OSDN Git Service

add .envrc
[metasearch/grid-chef-repo.git] / roles / jenkins-on-docker.rb
1 #
2 # Copyright 2017, whitestar
3 #
4 # Licensed under the Apache License, Version 2.0 (the "License");
5 # you may not use this file except in compliance with the License.
6 # You may obtain a copy of the License at
7 #
8 #     http://www.apache.org/licenses/LICENSE-2.0
9 #
10 # Unless required by applicable law or agreed to in writing, software
11 # distributed under the License is distributed on an "AS IS" BASIS,
12 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 # See the License for the specific language governing permissions and
14 # limitations under the License.
15 #
16
17 name 'jenkins-on-docker'
18 description 'Jenkins on Docker'
19
20 #jenkins_cn = 'jenkins.io.example.com'
21
22 run_list(
23   #'recipe[ssl_cert::server_key_pairs]',
24   'role[docker]',
25   'recipe[jenkins-grid::docker-compose]',
26 )
27
28 #env_run_lists()
29
30 #default_attributes()
31
32 override_attributes(
33   'ssl_cert' => {
34     # 'common_names' => [
35     #   jenkins_cn,
36     # ],
37   },
38   'docker-grid' => {
39     'engine' => {
40       'skip_setup' => false,
41     },
42     'compose' => {
43       'skip_setup' => false,
44     },
45   },
46   'jenkins-grid' => {
47     #'with_ssl_cert_cookbook' => true,
48     'ssl_cert' => {
49       #'common_name' => jenkins_cn,
50     },
51     'docker-compose' => {
52       'config' => {
53         # Version 2 docker-compose format
54         'version' => '2',
55         'services' => {
56           'jenkins' => {
57             'restart' => 'always',
58             'image' => 'jenkins:latest',
59             #'expose' => [
60             #  '8083',  # for https
61             #],
62             #'ports' => [
63             #],
64             'environment' => {
65               'JENKINS_OPTS' => [
66                 #'--httpPort=-1 --httpsPort=8083',
67                 # These options will be set by the jenkins-grid::docker-compose recipe automatically.
68                 #'--httpsCertificate=/var/lib/jenkins/server.crt',
69                 #'--httpsPrivateKey=/var/lib/jenkins/server.key',
70               ].join(' '),
71             },
72             # These volumes will be set by the jenkins-grid::docker-compose recipe automatically.
73             #'volumes' => [
74             #  "#{node['jenkins-grid']['docker-compose']['jenkins_home']['path']}:/var/jenkins_home",
75             #  "#{server_cert_path(node['jenkins-grid']['ssl_cert']['common_name'])}:/var/lib/jenkins/server.crt:ro",
76             #  "#{node['jenkins-grid']['docker-compose']['app_dir']}/certs/server.key:/var/lib/jenkins/server.key:ro",
77             #],
78           },
79         },
80       },
81     },
82   },
83 )