OSDN Git Service

adds multiple SCM support.
[metasearch/grid-chef-repo.git] / roles / screwdriver-on-docker.rb
index 5688570..6891ddc 100644 (file)
@@ -17,6 +17,7 @@
 name 'screwdriver-on-docker'
 description 'Screwdriver on Docker'
 
+# Default ports
 #ui_port     = '9000'
 #api_port    = '9001'
 #store_port  = '9002'
@@ -28,22 +29,29 @@ run_list(
 
 override_attributes(
   'screwdriver' => {
-    'docker-compose' => {
-      # REQUIRED: SCM OAuth client ID and secret
+    'api' => {
+      'config' => {
+        'scms' => {
+          'github.com' => {  # id and display name
+            'plugin' => 'github',
+            'config' => {
+              # **REQUIRED**: SCM OAuth client ID, secret and webhook secret (GitHub only)
 =begin
-      'oauth_client_id_vault_item' => {
-        'vault' => 'screwdriver',
-        'name' => 'oauth_client_id',
-        'env_context' => false,
-        'key' => 'cid',  # real hash path: "/cid"
-      },
-      'oauth_client_secret_vault_item' => {
-        'vault' => 'screwdriver',
-        'name' => 'oauth_client_secret',
-        'env_context' => false,
-        'key' => 'secret',  # real hash path: "/secret"
-      },
+              # These 3 secrets should be set by the following `['screwdriver']['api']['scms_vault_items']` attribute.
+              'oauthClientId' => 'YOU-PROBABLY-WANT-SOMETHING-HERE',  # The client id used for OAuth with github. GitHub OAuth (https://developer.github.com/v3/oauth/)
+              'oauthClientSecret' => 'AGAIN-SOMETHING-HERE-IS-USEFUL',  # The client secret used for OAuth with github
+              'secret' => 'SUPER-SECRET-SIGNING-THING',  # Secret to add to GitHub webhooks so that we can validate them
+              #'gheHost' => 'github.screwdriver.cd',  # [Optional] GitHub enterprise host
+              'username' => 'sd-buildbot',  # [Optional] Username for code checkout
+              'email' => 'dev-null@screwdriver.cd',  # [Optional] Email for code checkout
+              'privateRepo' => false,  # [Optional] Set to true to support private repo; will need read and write access to public and private repos (https://developer.github.com/v3/oauth/#scopes)
 =end
+            },
+          },
+        },
+      },
+    },
+    'docker-compose' => {
       'config' => {
         'services' => {
           'api' => {
@@ -51,20 +59,8 @@ override_attributes(
               #"#{api_port}:80",
             ],
             'environment' => {
-              # REQUIRED: SCM settings
-              'SCM_PLUGIN' => 'github',  # 'gitlab' or 'github' or 'bitbucket'
-              # OAuth Callback URL: "http://#{node['fqdn']}:9001/v4/auth/login/web"
-              'SCM_USERNAME' => 'ci-tool',
-              'SCM_EMAIL' => 'citool@mail.example.com',
-              #'WEBHOOK_GITHUB_SECRET' => 'SUPER-SECRET-SIGNING-THING',
-              #'SCM_GITLAB_HOST' => 'gitlab.io.example.com',
-              #'SCM_GITLAB_PROTOCOL' => 'https',
               #'NODE_TLS_REJECT_UNAUTHORIZED' => '0',  # for self-signed cetificates
               # The following variables will be set by the screwdriver::docker-compose recipe automatically.
-              #'SECRET_OAUTH_CLIENT_ID' => '${SECRET_OAUTH_CLIENT_ID}',
-              #'SECRET_OAUTH_CLIENT_SECRET' => '${SECRET_OAUTH_CLIENT_SECRET}',
-              #'SECRET_JWT_PRIVATE_KEY' => '${SECRET_JWT_PRIVATE_KEY}',
-              #'SECRET_JWT_PUBLIC_KEY' => '${SECRET_JWT_PUBLIC_KEY}',
               #'ECOSYSTEM_UI' => "http://#{node['fqdn']}:#{ui_port}",
               #'ECOSYSTEM_STORE' => "http://#{node['fqdn']}:#{store_port}",
             },
@@ -84,9 +80,8 @@ override_attributes(
               #"#{store_port}:80",
             ],
             'environment' => {
-              # These variables will be set by the screwdriver::docker-compose recipe automatically.
+              # This variable will be set by the screwdriver::docker-compose recipe automatically.
               #'ECOSYSTEM_UI' => "http://#{node['fqdn']}:#{ui_port}",
-              #'SECRET_JWT_PUBLIC_KEY' => '${SECRET_JWT_PUBLIC_KEY}',
             },
           },
         },