blob: 3cc1bd30b2fffe3750d268865ee3f05233615ec0 [file] [log] [blame] [view]
Benjamin Copelanda445cf02020-08-11 16:32:21 +01001Yet Another Docker Plugin config builder
2=======
3
4Yet Another Docker Plugin (YADP) is extremely hard to manage, when running multiple slaves with multiple images. Due to the way Jenkins displays the configuration page. YADP provides a [groovy script](https://github.com/KostyaSha/yet-another-docker-plugin/blob/master/docs/script-console-scripts/configure-yadocker-cloud.groovy) which builds a JSON array to populate the configuration in Jenkins.
5
6This script uses YAML and Jinja2 to generate a java JSONARRAY to build the configuration, using a !include constructor in the YAML file, allowing the ability to template up docker_images, since many of our slaves run the same image, it lessens repetition.
7
8Features
9=======
10
111. Ability to !include inside YAML to lessen duplication
122. Ability to include multiple YAML files with !include [file1.yml, file2.yml]
133. Ability to include SSH settings via using launch_method:" along with ssh: or jnlp:
14
15
16Usage
17=======
18
19####hosts
20
21```
22- host1:
23 cloud_name: host1.example.org
24 docker-url: tcp://0.0.0.0:2375
25 docker_templates: !include external_template_file.yml
26
27- host2:
28 cloud_name: host2.example.org
29 docker-url: tcp://0.0.0.1:2375
30 docker_templates:
31 - xenial-amd64:
32 docker_image_name: 'ubuntu:latest'
33 max_instances: '1'
34 labels: 'docker-ubuntu'
35 launch_method: ssh
36 ssh:
37 launch_ssh_credentials_id: 'random-id'
38 launch_ssh_port: '22'
39
40- host3
41 cloud_name: host3.example.org
42 docker-url: tcp://0.0.0.0:2375
43 docker_templates:
44 !include [external_template_file.yml, external_template_file_2.yml]
45```
46
47Limitations
48=======
49
50Due to the nature of YAML and populating the Java JSONARRAY, its important that YAML is phased correctly.
51
52Most of the limitations surround docker_templates.
53
54A list of limitations and pending improvements.
55
561. Do not mix !include and templates under docker_templates.
57
58Example of broken approach:
59
60- host1:
61 cloud_name: host1.example.org
62 docker-url: tcp://0.0.0.0:2375
63 docker_templates:
64 !include external_template_file.yml
65 - xenial-amd64:
66 docker_image_name: 'ubuntu:latest'
67 max_instances: '1'
68 labels: 'docker-ubuntu'
69
702. Do not add spaces under the image cloud_name, the must fall inline with the image name
71
72Example of broken approach:
73- xenial-amd64:
74 docker_image_name: 'ubuntu:latest'
75 max_instances: '1'
76 labels: 'docker-ubuntu'
77
783. Docker labels could be "host" specific. If you are including a template file, the template has no link to the host, so its not possible to do "host based labels". Instead just create another template file with custom settings and include that file.