2 # Cookbook Name:: gitlab-grid
3 # Recipe:: runner-docker-compose
5 # Copyright 2017, whitestar
7 # Licensed under the Apache License, Version 2.0 (the "License");
8 # you may not use this file except in compliance with the License.
9 # You may obtain a copy of the License at
11 # http://www.apache.org/licenses/LICENSE-2.0
13 # Unless required by applicable law or agreed to in writing, software
14 # distributed under the License is distributed on an "AS IS" BASIS,
15 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 # See the License for the specific language governing permissions and
17 # limitations under the License.
20 doc_url = 'https://github.com/ayufan/gitlab-ci-multi-runner/blob/master/docs/install/docker.md'
22 include_recipe 'docker-grid::compose'
23 #include_recipe 'gitlab-grid::commons'
25 config = node['gitlab-grid']['runner-docker-compose']['config']
26 override_config = node.override['gitlab-grid']['runner-docker-compose']['config']
27 #force_override_config = node.force_override['gitlab-grid']['runner-docker-compose']['config']
28 app_dir = node['gitlab-grid']['runner-docker-compose']['app_dir']
29 etc_dir = node['gitlab-grid']['runner-docker-compose']['etc_dir']
30 certs_dir = "#{etc_dir}/certs"
33 vols = config['services']['runner']['volumes'].to_a
40 resources(directory: dir) rescue directory dir do
48 vols.push("#{etc_dir}:/etc/gitlab-runner")
50 if node['gitlab-grid']['with_ssl_cert_cookbook'] && node['gitlab-grid']['runner-docker-compose']['import_ca']
51 include_recipe 'ssl_cert::ca_certs'
52 ::Chef::Recipe.send(:include, SSLCert::Helper)
53 vols.push("#{ca_cert_path(node['gitlab-grid']['ssl_cert']['ca_name'])}:/etc/gitlab-runner/certs/ca.crt:ro")
56 override_config['services']['runner']['volumes'] = vols unless vols.empty?
61 template "#{app_dir}/#{conf_file}" do
62 source "opt/docker-compose/app/gitlab-runner/#{conf_file}"
70 Note: You must execute the following command manually.
74 $ docker-compose up -d
75 $ docker exec -it #{config['services']['runner']['container_name']} gitlab-runner register