diff options
author | Benjamin Copeland <ben.copeland@linaro.org> | 2018-07-04 20:33:08 +0000 |
---|---|---|
committer | Linaro Code Review <review@review.linaro.org> | 2018-07-04 20:33:08 +0000 |
commit | fb3b2666beaf12e5c9f4fd185b25cdf1d6f9c5ee (patch) | |
tree | 5baa6dcf06abea15b846b8ba15419ce7a298d244 | |
parent | ac289d56a68d88e2cff84676ed1fca391ec3ed6e (diff) | |
parent | 8e8da02b6264a3c71e1f612b1256d9234f9db11f (diff) |
Merge "Template: Add x86_64 hosts and have the ability to !include ssh settings"
-rw-r--r-- | README.md | 20 | ||||
-rw-r--r-- | docker_ssh_buildslave.yml | 8 | ||||
-rw-r--r-- | docker_templates_amd64.yml | 41 | ||||
-rw-r--r-- | docker_templates_amd64_rp.yml | 7 | ||||
-rw-r--r-- | docker_vol_x86_64.yml | 10 | ||||
-rw-r--r-- | hosts.yml | 53 | ||||
-rw-r--r-- | hosts_template.yml | 38 | ||||
-rw-r--r-- | templates/configure-yadocker-cloud.groovy.j2 | 30 |
8 files changed, 143 insertions, 64 deletions
@@ -3,13 +3,21 @@ Yet Another Docker Plugin config builder Yet 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. -This 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. +This 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. + +Features +======= + +1. Ability to !include inside YAML to lessen duplication +2. Ability to include multiple YAML files with !include [file1.yml, file2.yml] +3. Ability to include SSH settings via using launch_method:" along with ssh: or jnlp: + Usage ======= ####hosts.yml -List your jenkin_slaves here + ``` - host1: cloud_name: host1.example.org @@ -17,13 +25,17 @@ List your jenkin_slaves here docker_templates: !include external_template_file.yml - host2: - cloud_name: host2 + cloud_name: host2.example.org docker-url: tcp://0.0.0.1:2375 docker_templates: - xenial-amd64: docker_image_name: 'ubuntu:latest' max_instances: '1' labels: 'docker-ubuntu' + launch_method: ssh + ssh: + launch_ssh_credentials_id: 'random-id' + launch_ssh_port: '22' - host3 cloud_name: host3.example.org @@ -35,7 +47,7 @@ List your jenkin_slaves here Limitations ======= -Due to the nature of YAML and populating the Java JSONARRAY, its important that yaml is phased correctly. +Due to the nature of YAML and populating the Java JSONARRAY, its important that YAML is phased correctly. Most of the limitations surround docker_templates. diff --git a/docker_ssh_buildslave.yml b/docker_ssh_buildslave.yml new file mode 100644 index 0000000..baeb3aa --- /dev/null +++ b/docker_ssh_buildslave.yml @@ -0,0 +1,8 @@ +--- +# Name: buildslave (buildslave for generic docker slaves) +# https://ci.linaro.org/credentials/store/system/domain/_/credential/88434794-118e-40e4-9cd9-be1ae5d70eec/ +launch_ssh_credentials_id: '88434794-118e-40e4-9cd9-be1ae5d70eec' +launch_ssh_port: '22' +launch_ssh_connection_timeout: '60' +launch_ssh_max_num_retries: '1000' +launch_ssh_time_wait_between_retries: '60' diff --git a/docker_templates_amd64.yml b/docker_templates_amd64.yml index 2094805..33fcbde 100644 --- a/docker_templates_amd64.yml +++ b/docker_templates_amd64.yml @@ -1,23 +1,32 @@ -# Test +--- - xenial-amd64: - docker_image_name: 'linaro/xenial' - max_instances: '1' - stop_container_timeout: 10 - #valid values: pull_latest, pull_always, pull_once, pull_never - pull_strategy: 'pull_never' + docker_image_name: 'linaro/xenial-amd64' remote_fs_root: '/home/buildslave' - labels: 'docker-xenial docker-xenial-amd64 docker-xenial-amd64-08' - dns: '8.8.8.8' - #valid values: launch_ssh or launch_jnlp + labels: 'docker-xenial docker-xenial-amd64' launch_method: 'launch_ssh' - launch_ssh_credentials_id: '88434794-118e-40e4-9cd9-be1ae5d70eec' - launch_ssh_port: '22' - launch_ssh_connection_timeout: '60' - launch_ssh_max_num_retries: '1000' - launch_ssh_time_wait_between_retries: '60' + ssh: !include docker_ssh_buildslave.yml volumes: !include docker_vol_x86_64.yml + - utopic-amd64: - docker_image_name: 'linaro/utopic' + docker_image_name: 'linaro/utopic-amd64' max_instances: '10' - labels: 'docker-utopic docker-utopic-amd64 docker-utopic-amd64-08' + labels: 'docker-utopic docker-utopic-amd64' volumes: !include docker_vol_x86_64.yml + launch_method: 'launch_ssh' + ssh: !include docker_ssh_buildslave.yml + +- jessie-amd64: + docker_image_name: 'linaro/jessie-amd64' + max_instances: '10' + labels: 'docker-jessie docker-jessie-amd64' + volumes: !include docker_vol_x86_64.yml + launch_method: 'launch_ssh' + ssh: !include docker_ssh_buildslave.yml + +- docker-stretch: + docker_image_name: 'linaro/ci-amd64-debian:stretch' + max_instances: '10' + labels: 'docker-stretch docker-stretch-amd64' + volumes: !include docker_vol_x86_64.yml + launch_method: 'launch_ssh' + ssh: !include docker_ssh_buildslave.yml diff --git a/docker_templates_amd64_rp.yml b/docker_templates_amd64_rp.yml new file mode 100644 index 0000000..6e611cf --- /dev/null +++ b/docker_templates_amd64_rp.yml @@ -0,0 +1,7 @@ +--- +- jessie-amd64-rp: + docker_image_name: 'linaro/jessie-amd64' + labels: 'docker-jessie-rp' + launch_method: 'launch_ssh' + ssh: !include docker_ssh_buildslave.yml + volumes: !include docker_vol_x86_64.yml diff --git a/docker_vol_x86_64.yml b/docker_vol_x86_64.yml index 8b3cb73..e88efc1 100644 --- a/docker_vol_x86_64.yml +++ b/docker_vol_x86_64.yml @@ -1,4 +1,6 @@ -'/home/buildslave/srv:/home/buildslave/srv -\n/srv/docker/ssh/buildslave.config:/home/buildslave/.ssh/config -\n/srv/docker/ssh/buildslave.known_hosts:/home/buildslave/.ssh/known_hosts -\n/srv/docker/ssh/id_rsa_buildslave.pub:/home/buildslave/.ssh/authorized_keys:ro' +'/home/buildslave/srv:/home/buildslave/srv:rw +\n/home/buildslave/.jenkins:/home/buildslave/.jenkins:rw +\n/srv/docker/ssh/buildslave.config:/home/buildslave/.ssh/config:rw +\n/srv/docker/ssh/buildslave.known_hosts:/home/buildslave/.ssh/known_hosts:rw +\n/srv/docker/ssh/id_rsa_buildslave.pub:/home/buildslave/.ssh/authorized_keys:ro +\n/var/lib/libvirt:/var/lib/libvirt:rw' @@ -1,17 +1,54 @@ +--- # List of YADP Hosts - x86_64-07: cloud_name: x86_64-07 - docker_url: tcp://0.0.0.0:2375 - max_containers: 1 + docker_url: tcp://188.40.92.79:2375 docker_templates: !include docker_templates_amd64.yml -- lhg01: - cloud_name: lhg-01 - docker-url: tcp://lhg-01:2375 +- x86_64-08: + cloud_name: x86_64-08 + docker_url: tcp://188.40.49.144:2375 + docker_templates: !include docker_templates_amd64.yml + +- x86_64-09: + cloud_name: x86_64-09 + docker_url: tcp://148.251.184.94:2375 + docker_templates: !include docker_templates_amd64.yml + +- x86_64-10: + cloud_name: x86_64-10 + docker_url: tcp://138.201.52.83:2375 + docker_templates: !include docker_templates_amd64.yml + +- x86_64-11: + cloud_name: x86_64-11 + docker_url: tcp://88.99.28.12:2375 + docker_templates: + !include [docker_templates_amd64.yml, docker_templates_amd64_rp.yml] + +- x86_64-12: + cloud_name: x86_64-12 + docker_url: tcp://88.99.28.38:2375 + docker_templates: + !include [docker_templates_amd64.yml, docker_templates_amd64_rp.yml] + +# Not using docker_templates_amd64.yml due to using custom number of +# max_containers/max_instances +- x86_64-13: + cloud_name: x86_64-13 + docker_url: tcp://88.99.59.232:2375 + max_containers: 6 docker_templates: - xenial-amd64: - docker_image_name: 'linaro/xenial' - max_instances: '1' - labels: 'docker-xenial-lhg' + docker_image_name: 'linaro/xenial-amd64' + labels: 'docker-xenial-amd64-13' + launch_method: 'launch_ssh' + ssh: !include docker_ssh_buildslave.yml + max_instances: '10' + volumes: !include docker_vol_x86_64.yml +- x86_64-14: + cloud_name: x86_64-14 + docker_url: tcp://88.99.149.141:2375 + docker_templates: !include docker_templates_amd64.yml diff --git a/hosts_template.yml b/hosts_template.yml index 3d68ab9..7b07537 100644 --- a/hosts_template.yml +++ b/hosts_template.yml @@ -1,3 +1,4 @@ +--- # TEMPLATE FILE # # This is a template file, of all options available @@ -68,25 +69,28 @@ availability_idle_timeout: 10 executors: 1 #LAUNCH METHOD - #valid values: launch_ssh or launch_jnlp - launch_method: 'launch_jnlp' + #valid values: launch_ssh *OR* launch_jnlp + launch_method: 'launch_ssh' #settings specific to launch_ssh (you only need one or the other) - launch_ssh_credentials_id: '' - launch_ssh_port: 22 - launch_ssh_java_path: '' - launch_ssh_jvm_options: '' - launch_ssh_prefix_start_slave_command: '' - launch_ssh_suffix_start_slave_command: '' - launch_ssh_connection_timeout: 120 - launch_ssh_max_num_retries: 10 - launch_ssh_time_wait_between_retries: 10 + ssh: + launch_ssh_credentials_id: '' + launch_ssh_port: 22 + launch_ssh_java_path: '' + launch_ssh_jvm_options: '' + launch_ssh_prefix_start_slave_command: '' + launch_ssh_suffix_start_slave_command: '' + launch_ssh_connection_timeout: 120 + launch_ssh_max_num_retries: 10 + launch_ssh_time_wait_between_retries: 10 #settings specific to launch_jnlp - launch_jnlp_linux_user: 'jenkins' - launch_jnlp_lauch_timeout: 120 - launch_jnlp_slave_jar_options: '' - launch_jnlp_slave_jvm_options: '' - launch_jnlp_different_jenkins_master_url: '' - launch_jnlp_ignore_certificate_check: false + launch_method: 'launch_jnlp' + jnlp: + launch_jnlp_linux_user: 'jenkins' + launch_jnlp_lauch_timeout: 120 + launch_jnlp_slave_jar_options: '' + launch_jnlp_slave_jvm_options: '' + launch_jnlp_different_jenkins_master_url: '' + launch_jnlp_ignore_certificate_check: false #NODE PROPERTIES #environment_variables is a HashMap of key/value pairs environment_variables: '[:]' diff --git a/templates/configure-yadocker-cloud.groovy.j2 b/templates/configure-yadocker-cloud.groovy.j2 index c6a3a35..14be6de 100644 --- a/templates/configure-yadocker-cloud.groovy.j2 +++ b/templates/configure-yadocker-cloud.groovy.j2 @@ -109,24 +109,24 @@ JSONArray clouds_yadocker = [ {% for host in hosts %} {%if docker.launch_method == 'launch_ssh' %} launch_method: 'launch_ssh', //settings specific to launch_ssh (you only need one or the other) - launch_ssh_credentials_id: '{{docker.launch_ssh_credentials_id}}', - launch_ssh_port: '{{docker.launch_ssh_port|default('22')}}', - launch_ssh_java_path: '{{docker.launch_ssh_java_path}}', - launch_ssh_jvm_options: '{{docker.launch_ssh_jvm_options}}', - launch_ssh_prefix_start_slave_command: '{{docker.launch_ssh_prefix_start_slave_command}}', - launch_ssh_suffix_start_slave_command: '{{docker.launch_ssh_suffix_start_slave_command}}', - launch_ssh_connection_timeout: '{{docker.launch_ssh_connection_timeout}}', - launch_ssh_max_num_retries: '{{docker.launch_ssh_max_num_retries}}', - launch_ssh_time_wait_between_retries: '{{docker.launch_ssh_time_wait_between_retries}}', + launch_ssh_credentials_id: '{{docker.ssh.launch_ssh_credentials_id}}', + launch_ssh_port: '{{docker.ssh.launch_ssh_port|default('22')}}', + launch_ssh_java_path: '{{docker.ssh.launch_ssh_java_path}}', + launch_ssh_jvm_options: '{{docker.ssh.launch_ssh_jvm_options}}', + launch_ssh_prefix_start_slave_command: '{{docker.ssh.launch_ssh_prefix_start_slave_command}}', + launch_ssh_suffix_start_slave_command: '{{docker.ssh.launch_ssh_suffix_start_slave_command}}', + launch_ssh_connection_timeout: '{{docker.ssh.launch_ssh_connection_timeout}}', + launch_ssh_max_num_retries: '{{docker.ssh.launch_ssh_max_num_retries}}', + launch_ssh_time_wait_between_retries: '{{docker.ssh.launch_ssh_time_wait_between_retries}}', {%elif docker.launch_method == 'launch_jnlp' %} launch_method: 'launch_jnlp', //settings specific to launch_jnlp - launch_jnlp_linux_user: '{{docker.launch_jnlp_linux_user}}', - launch_jnlp_lauch_timeout: '{{docker.launch_jnlp_lauch_timeout}}', - launch_jnlp_slave_jar_options: '{{docker.launch_jnlp_slave_jar_options}}', - launch_jnlp_slave_jvm_options: '{{docker.launch_jnlp_slave_jvm_options}}', - launch_jnlp_different_jenkins_master_url: '{{docker.launch_jnlp_different_jenkins_master_url}}', - launch_jnlp_ignore_certificate_check: '{{docker.launch_jnlp_ignore_certificate_check}}', + launch_jnlp_linux_user: '{{docker.jnlp.launch_jnlp_linux_user}}', + launch_jnlp_lauch_timeout: '{{docker.jnlp.launch_jnlp_lauch_timeout}}', + launch_jnlp_slave_jar_options: '{{docker.jnlp.launch_jnlp_slave_jar_options}}', + launch_jnlp_slave_jvm_options: '{{docker.jnlp.launch_jnlp_slave_jvm_options}}', + launch_jnlp_different_jenkins_master_url: '{{docker.jnlp.launch_jnlp_different_jenkins_master_url}}', + launch_jnlp_ignore_certificate_check: '{{docker.jnlp.launch_jnlp_ignore_certificate_check}}', {%endif%} //NODE PROPERTIES //environment_variables is a HashMap of key/value pairs |