From 442d211ee3987494bc144d47f01b7ee4bd907d60 Mon Sep 17 00:00:00 2001 From: Antoine Legrand Date: Mon, 20 Feb 2017 16:51:48 +0100 Subject: [PATCH 01/10] Add DigitalOcean playbook to create VM --- tests/cloud_playbooks/create-do.yml | 48 +++++++++++++++++++++++++++++ tests/templates/inventory-do.j2 | 48 +++++++++++++++++++++++++++++ 2 files changed, 96 insertions(+) create mode 100644 tests/cloud_playbooks/create-do.yml create mode 100644 tests/templates/inventory-do.j2 diff --git a/tests/cloud_playbooks/create-do.yml b/tests/cloud_playbooks/create-do.yml new file mode 100644 index 000000000..1e6423ef4 --- /dev/null +++ b/tests/cloud_playbooks/create-do.yml @@ -0,0 +1,48 @@ +--- +- hosts: localhost + become: false + gather_facts: no + vars: + cloud_machine_type: g1-small + mode: default + + tasks: + - name: replace_test_id + set_fact: + test_name: "{{test_id |regex_replace('\\.', '-')}}" + + - set_fact: + instance_names: >- + {%- if mode in ['separate', 'ha'] -%} + ["k8s-{{test_name}}-1", "k8s-{{test_name}}-2", "k8s-{{test_name}}-3"] + {%- else -%} + ["k8s-{{test_name}}-1", "k8s-{{test_name}}-2"] + {%- endif -%} + + - name: Create DO instances + digital_ocean: + unique_name: yes + api_token: "{{ lookup('env','DO_API_TOKEN') }}" + command: "droplet" + image_id: "{{ cloud_image }}" + name: "{{ item }}" + private_networking: no + region_id: "{{cloud_region}}" + size_id: 2gb + ssh_key_ids: "6536865" + state: present + wait: yes + register: droplets + with_items: "{{instance_names}}" + + - debug: + msg: "{{droplets}}, {{inventory_path}}" + + - name: Template the inventory + template: + src: ../templates/inventory-do.j2 + dest: "{{ inventory_path }}/inventory-do.cfg" + + - name: Wait for SSH to come up + wait_for: host={{item.droplet.ip_address}} port=22 delay=10 timeout=180 state=started + with_items: "{{droplets.results}}" diff --git a/tests/templates/inventory-do.j2 b/tests/templates/inventory-do.j2 new file mode 100644 index 000000000..37ec3211c --- /dev/null +++ b/tests/templates/inventory-do.j2 @@ -0,0 +1,48 @@ +{% for instance in droplets.results %} +node{{loop.index}} ansible_ssh_host={{instance.droplet.ip_address}} +{% endfor %} + +{% if mode is defined and mode == "separate" %} +[kube-master] +node1 + +[kube-node] +node2 + +[etcd] +node3 + +[vault] +node3 +{% elif mode is defined and mode == "ha" %} +[kube-master] +node1 +node2 + +[kube-node] +node3 + +[etcd] +node2 +node3 + +[vault] +node2 +node3 +{% else %} +[kube-master] +node1 + +[kube-node] +node2 + +[etcd] +node1 + +[vault] +node1 +{% endif %} + +[k8s-cluster:children] +kube-node +kube-master From 3ef7c25a1622be127106f2f1da382ca39bacb0e0 Mon Sep 17 00:00:00 2001 From: Antoine Legrand Date: Wed, 22 Feb 2017 14:27:30 +0100 Subject: [PATCH 02/10] Add digitalocean test case --- .gitlab-ci.yml | 186 ++++++++++++++++++++++++++++ tests/cloud_playbooks/create-do.yml | 58 ++++++++- tests/templates/inventory-do.j2 | 32 ++--- 3 files changed, 254 insertions(+), 22 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 5da1a9723..2177dc4f6 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,4 +1,5 @@ stages: + - deploy-do-part1 - moderator - unit-tests - deploy-gce-part1 @@ -235,6 +236,178 @@ before_script: -e gce_credentials_file=${HOME}/.ssh/gce.json -e inventory_path=${PWD}/inventory/sample/hosts.ini +.do: &do + <<: *job + <<: *gce + cache: + key: "$CI_BUILD_REF_NAME" + paths: + - downloads/ + - $HOME/.cache + before_script: + - docker info + - pip install ansible==2.2.1.0 + - pip install netaddr + - pip install apache-libcloud==0.20.1 + - pip install boto==2.9.0 + - pip install dopy==0.3.5 + - ansible-playbook --version + - export PYPATH=$([ $BOOTSTRAP_OS = none ] && echo /usr/bin/python || echo /opt/bin/python) + script: + - pwd + - ls + - echo ${PWD} + - > + ansible-playbook tests/cloud_playbooks/create-do.yml -i tests/local_inventory/hosts.cfg -c local + ${LOG_LEVEL} + -e cloud_image=${CLOUD_IMAGE} + -e cloud_region=${CLOUD_REGION} + -e inventory_path=${PWD}/inventory/inventory.ini + -e kube_network_plugin=${KUBE_NETWORK_PLUGIN} + -e mode=${CLUSTER_MODE} + -e test_id=${TEST_ID} + + # Check out latest tag if testing upgrade + # Uncomment when gitlab kargo repo has tags + #- test "${UPGRADE_TEST}" = "true" && git fetch --all && git checkout $(git describe --tags $(git rev-list --tags --max-count=1)) + - test "${UPGRADE_TEST}" = "true" && git checkout 031cf565ec3ccd3ebbe80eeef3454c3780e5c598 && pip install ansible==2.2.0 + + + # Create cluster + - > + ansible-playbook -i inventory/inventory.ini -b --become-user=root --private-key=${HOME}/.ssh/id_rsa -u $SSH_USER + ${SSH_ARGS} + ${LOG_LEVEL} + -e state=present + -e ansible_python_interpreter=${PYPATH} + -e ansible_ssh_user=${SSH_USER} + -e bootstrap_os=${BOOTSTRAP_OS} + -e cert_management=${CERT_MGMT:-script} + -e cloud_provider=gce + -e deploy_netchecker=true + -e download_localhost=true + -e download_run_once=true + -e etcd_deployment_type=${ETCD_DEPLOYMENT} + -e kube_network_plugin=${KUBE_NETWORK_PLUGIN} + -e kubelet_deployment_type=${KUBELET_DEPLOYMENT} + -e local_release_dir=${PWD}/downloads + -e resolvconf_mode=${RESOLVCONF_MODE} + -e vault_deployment_type=${VAULT_DEPLOYMENT} + cluster.yml + + # Repeat deployment if testing upgrade + #FIXME(mattymo): repeat "Create cluster" above without duplicating code + - > + if [ "${UPGRADE_TEST}" = "true" ]; then + pip install ansible==2.2.1.0; + git checkout "${CI_BUILD_REF}"; + ansible-playbook -i inventory/inventory.ini -b --become-user=root --private-key=${HOME}/.ssh/id_rsa -u $SSH_USER + ${SSH_ARGS} + ${LOG_LEVEL} + -e ansible_python_interpreter=${PYPATH} + -e ansible_ssh_user=${SSH_USER} + -e bootstrap_os=${BOOTSTRAP_OS} + -e cloud_provider=gce + -e deploy_netchecker=true + -e download_localhost=true + -e download_run_once=true + -e etcd_deployment_type=${ETCD_DEPLOYMENT} + -e kube_network_plugin=${KUBE_NETWORK_PLUGIN} + -e kubelet_deployment_type=${KUBELET_DEPLOYMENT} + -e local_release_dir=${PWD}/downloads + -e resolvconf_mode=${RESOLVCONF_MODE} + -e weave_cpu_requests=${WEAVE_CPU_LIMIT} + -e weave_cpu_limit=${WEAVE_CPU_LIMIT} + cluster.yml; + fi + + # Tests Cases + ## Test Master API + - ansible-playbook -i inventory/inventory.ini -e ansible_python_interpreter=${PYPATH} -u $SSH_USER -e ansible_ssh_user=$SSH_USER $SSH_ARGS -b --become-user=root tests/testcases/010_check-apiserver.yml $LOG_LEVEL + + ## Ping the between 2 pod + - ansible-playbook -i inventory/inventory.ini -e ansible_python_interpreter=${PYPATH} -u $SSH_USER -e ansible_ssh_user=$SSH_USER $SSH_ARGS -b --become-user=root tests/testcases/030_check-network.yml $LOG_LEVEL + + ## Advanced DNS checks + - ansible-playbook -i inventory/inventory.ini -e ansible_python_interpreter=${PYPATH} -u $SSH_USER -e ansible_ssh_user=$SSH_USER $SSH_ARGS -b --become-user=root tests/testcases/040_check-network-adv.yml $LOG_LEVEL + + ## Idempotency checks 1/5 (repeat deployment) + - > + if [ "${IDEMPOT_CHECK}" = "true" ]; then + ansible-playbook -i inventory/inventory.ini -u $SSH_USER -e ansible_ssh_user=$SSH_USER $SSH_ARGS + -b --become-user=root -e cloud_provider=gce $LOG_LEVEL -e kube_network_plugin=${KUBE_NETWORK_PLUGIN} + --private-key=${HOME}/.ssh/id_rsa + -e bootstrap_os=${BOOTSTRAP_OS} + -e ansible_python_interpreter=${PYPATH} + -e download_run_once=true + -e download_localhost=true + -e deploy_netchecker=true + -e resolvconf_mode=${RESOLVCONF_MODE} + -e local_release_dir=${PWD}/downloads + -e etcd_deployment_type=${ETCD_DEPLOYMENT} + -e kubelet_deployment_type=${KUBELET_DEPLOYMENT} + cluster.yml; + fi + + ## Idempotency checks 2/5 (Advanced DNS checks) + - > + if [ "${IDEMPOT_CHECK}" = "true" ]; then + ansible-playbook -i inventory/inventory.ini -e ansible_python_interpreter=${PYPATH} + -u $SSH_USER -e ansible_ssh_user=$SSH_USER $SSH_ARGS -b --become-user=root + tests/testcases/040_check-network-adv.yml $LOG_LEVEL; + fi + + ## Idempotency checks 3/5 (reset deployment) + - > + if [ "${IDEMPOT_CHECK}" = "true" ]; then + ansible-playbook -i inventory/inventory.ini -u $SSH_USER -e ansible_ssh_user=$SSH_USER $SSH_ARGS + -b --become-user=root -e cloud_provider=gce $LOG_LEVEL -e kube_network_plugin=${KUBE_NETWORK_PLUGIN} + --private-key=${HOME}/.ssh/id_rsa + -e bootstrap_os=${BOOTSTRAP_OS} + -e ansible_python_interpreter=${PYPATH} + reset.yml; + fi + + ## Idempotency checks 4/5 (redeploy after reset) + - > + if [ "${IDEMPOT_CHECK}" = "true" ]; then + ansible-playbook -i inventory/inventory.ini -u $SSH_USER -e ansible_ssh_user=$SSH_USER $SSH_ARGS + -b --become-user=root -e cloud_provider=gce $LOG_LEVEL -e kube_network_plugin=${KUBE_NETWORK_PLUGIN} + --private-key=${HOME}/.ssh/id_rsa + -e bootstrap_os=${BOOTSTRAP_OS} + -e ansible_python_interpreter=${PYPATH} + -e download_run_once=true + -e download_localhost=true + -e deploy_netchecker=true + -e resolvconf_mode=${RESOLVCONF_MODE} + -e local_release_dir=${PWD}/downloads + -e etcd_deployment_type=${ETCD_DEPLOYMENT} + -e kubelet_deployment_type=${KUBELET_DEPLOYMENT} + cluster.yml; + fi + + ## Idempotency checks 5/5 (Advanced DNS checks) + - > + if [ "${IDEMPOT_CHECK}" = "true" ]; then + ansible-playbook -i inventory/inventory.ini -e ansible_python_interpreter=${PYPATH} + -u $SSH_USER -e ansible_ssh_user=$SSH_USER $SSH_ARGS -b --become-user=root + tests/testcases/040_check-network-adv.yml $LOG_LEVEL; + fi + + after_script: + - > + ansible-playbook -i inventory/inventory.ini tests/cloud_playbooks/create-do.yml -c local $LOG_LEVEL + -e state=absent + -e mode=${CLUSTER_MODE} + -e test_id=${TEST_ID} + -e kube_network_plugin=${KUBE_NETWORK_PLUGIN} + -e gce_project_id=${GCE_PROJECT_ID} + -e gce_service_account_email=${GCE_ACCOUNT} + -e gce_credentials_file=${HOME}/.ssh/gce.json + -e cloud_image=${CLOUD_IMAGE} + -e inventory_path=${PWD}/inventory/inventory.ini + -e cloud_region=${CLOUD_REGION} + # Test matrix. Leave the comments for markup scripts. .coreos_calico_aio_variables: &coreos_calico_aio_variables # stage: deploy-gce-part1 @@ -312,6 +485,19 @@ coreos-calico-aio: except: ['triggers'] only: [/^pr-.*$/] +coreos-calico-sep-do: + stage: deploy-do-part1 + <<: *job + <<: *do + variables: + <<: *gce_variables + <<: *coreos_calico_sep_variables + CLOUD_IMAGE: coreos-stable + CLOUD_REGION: NYC3 + when: on_success + except: ['triggers'] + only: [/^pr-.*$/] + coreos-calico-sep-triggers: stage: deploy-gce-part1 <<: *job diff --git a/tests/cloud_playbooks/create-do.yml b/tests/cloud_playbooks/create-do.yml index 1e6423ef4..33a9f935a 100644 --- a/tests/cloud_playbooks/create-do.yml +++ b/tests/cloud_playbooks/create-do.yml @@ -3,7 +3,50 @@ become: false gather_facts: no vars: - cloud_machine_type: g1-small + state: "present" + ssh_key_id: "6536865" + cloud_machine_type: 2gb + regions: + - nyc1 + - sfo1 + - nyc2 + - ams2 + - sgp1 + - lon1 + - nyc3 + - ams3 + - fra1 + - tor1 + - sfo2 + - blr1 + cloud_images: + - coreos-beta + - fedora-24-x64 + - centos-5-x64 + - centos-5-x32 + - fedora-25-x64 + - debian-7-x64 + - debian-7-x32 + - debian-8-x64 + - debian-8-x32 + - centos-6-x32 + - centos-6-x64 + - coreos-stable + - ubuntu-16-10-x32 + - ubuntu-16-10-x64 + - freebsd-11-0-x64-zfs + - freebsd-10-3-x64-zfs + - coreos-alpha + - ubuntu-12-04-x32 + - ubuntu-12-04-x64 + - ubuntu-16-04-x64 + - ubuntu-16-04-x32 + - ubuntu-14-04-x64 + - ubuntu-14-04-x32 + - centos-7-x64 + - freebsd-11-0-x64 + - freebsd-10-3-x64 + - centos-7-3-1611-x64 mode: default tasks: @@ -19,7 +62,7 @@ ["k8s-{{test_name}}-1", "k8s-{{test_name}}-2"] {%- endif -%} - - name: Create DO instances + - name: Manage DO instances | {{state}} digital_ocean: unique_name: yes api_token: "{{ lookup('env','DO_API_TOKEN') }}" @@ -28,21 +71,24 @@ name: "{{ item }}" private_networking: no region_id: "{{cloud_region}}" - size_id: 2gb - ssh_key_ids: "6536865" - state: present + size_id: "{{cloud_machine_type}}" + ssh_key_ids: "{{ssh_key_id}}" + state: "{{state}}" wait: yes register: droplets with_items: "{{instance_names}}" - debug: msg: "{{droplets}}, {{inventory_path}}" + when: "{{ state == 'present' }}" - name: Template the inventory template: src: ../templates/inventory-do.j2 - dest: "{{ inventory_path }}/inventory-do.cfg" + dest: "{{ inventory_path }}" + when: "{{ state == 'present' }}" - name: Wait for SSH to come up wait_for: host={{item.droplet.ip_address}} port=22 delay=10 timeout=180 state=started with_items: "{{droplets.results}}" + when: "{{ state == 'present' }}" diff --git a/tests/templates/inventory-do.j2 b/tests/templates/inventory-do.j2 index 37ec3211c..95b6f3027 100644 --- a/tests/templates/inventory-do.j2 +++ b/tests/templates/inventory-do.j2 @@ -1,46 +1,46 @@ {% for instance in droplets.results %} -node{{loop.index}} ansible_ssh_host={{instance.droplet.ip_address}} +{{instance.droplet.name}} ansible_ssh_host={{instance.droplet.ip_address}} {% endfor %} {% if mode is defined and mode == "separate" %} [kube-master] -node1 +{{droplets.results[0].droplet.name}} [kube-node] -node2 +{{droplets.results[1].droplet.name}} [etcd] -node3 +{{droplets.results[2].droplet.name}} [vault] -node3 +{{droplets.results[2].droplet.name}} {% elif mode is defined and mode == "ha" %} [kube-master] -node1 -node2 +{{droplets.results[0].droplet.name}} +{{droplets.results[1].droplet.name}} [kube-node] -node3 +{{droplets.results[2].droplet.name}} [etcd] -node2 -node3 +{{droplets.results[1].droplet.name}} +{{droplets.results[2].droplet.name}} [vault] -node2 -node3 +{{droplets.results[1].droplet.name}} +{{droplets.results[2].droplet.name}} {% else %} [kube-master] -node1 +{{droplets.results[0].droplet.name}} [kube-node] -node2 +{{droplets.results[1].droplet.name}} [etcd] -node1 +{{droplets.results[0].droplet.name}} [vault] -node1 +{{droplets.results[0].droplet.name}} {% endif %} [k8s-cluster:children] From c403b61383caedc96d99225c6170e0d5794bd978 Mon Sep 17 00:00:00 2001 From: Antoine Legrand Date: Wed, 22 Feb 2017 17:58:08 +0100 Subject: [PATCH 03/10] Update private key --- .gitlab-ci.yml | 47 +++++++++++++++++++++++++++++++---------------- 1 file changed, 31 insertions(+), 16 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 2177dc4f6..8c6d28019 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -251,8 +251,14 @@ before_script: - pip install apache-libcloud==0.20.1 - pip install boto==2.9.0 - pip install dopy==0.3.5 + - mkdir -p /.ssh + - mkdir -p $HOME/.ssh + - echo $DO_PRIVATE_KEY | base64 -d > $HOME/.ssh/id_rsa + - chmod 400 $HOME/.ssh/id_rsa + - md5sum ~/.ssh/id_rsa - ansible-playbook --version - - export PYPATH=$([ $BOOTSTRAP_OS = none ] && echo /usr/bin/python || echo /opt/bin/python) + - export PYPATH=$([ $BOOTSTRAP_OS = coreos ] && echo /opt/bin/python || echo /usr/bin/python ) + - echo $PYPATH script: - pwd - ls @@ -275,12 +281,12 @@ before_script: # Create cluster - > - ansible-playbook -i inventory/inventory.ini -b --become-user=root --private-key=${HOME}/.ssh/id_rsa -u $SSH_USER + ansible-playbook -i inventory/inventory.ini -b --become-user=root --private-key=${HOME}/.ssh/id_rsa -u root ${SSH_ARGS} ${LOG_LEVEL} -e state=present -e ansible_python_interpreter=${PYPATH} - -e ansible_ssh_user=${SSH_USER} + -e ansible_ssh_user=root -e bootstrap_os=${BOOTSTRAP_OS} -e cert_management=${CERT_MGMT:-script} -e cloud_provider=gce @@ -301,11 +307,11 @@ before_script: if [ "${UPGRADE_TEST}" = "true" ]; then pip install ansible==2.2.1.0; git checkout "${CI_BUILD_REF}"; - ansible-playbook -i inventory/inventory.ini -b --become-user=root --private-key=${HOME}/.ssh/id_rsa -u $SSH_USER + ansible-playbook -i inventory/inventory.ini -b --become-user=root --private-key=${HOME}/.ssh/id_rsa -u root ${SSH_ARGS} ${LOG_LEVEL} -e ansible_python_interpreter=${PYPATH} - -e ansible_ssh_user=${SSH_USER} + -e ansible_ssh_user=root -e bootstrap_os=${BOOTSTRAP_OS} -e cloud_provider=gce -e deploy_netchecker=true @@ -323,18 +329,18 @@ before_script: # Tests Cases ## Test Master API - - ansible-playbook -i inventory/inventory.ini -e ansible_python_interpreter=${PYPATH} -u $SSH_USER -e ansible_ssh_user=$SSH_USER $SSH_ARGS -b --become-user=root tests/testcases/010_check-apiserver.yml $LOG_LEVEL + - ansible-playbook -i inventory/inventory.ini -e ansible_python_interpreter=${PYPATH} -u root -e ansible_ssh_user=root $SSH_ARGS -b --become-user=root tests/testcases/010_check-apiserver.yml $LOG_LEVEL ## Ping the between 2 pod - - ansible-playbook -i inventory/inventory.ini -e ansible_python_interpreter=${PYPATH} -u $SSH_USER -e ansible_ssh_user=$SSH_USER $SSH_ARGS -b --become-user=root tests/testcases/030_check-network.yml $LOG_LEVEL + - ansible-playbook -i inventory/inventory.ini -e ansible_python_interpreter=${PYPATH} -u root -e ansible_ssh_user=root $SSH_ARGS -b --become-user=root tests/testcases/030_check-network.yml $LOG_LEVEL ## Advanced DNS checks - - ansible-playbook -i inventory/inventory.ini -e ansible_python_interpreter=${PYPATH} -u $SSH_USER -e ansible_ssh_user=$SSH_USER $SSH_ARGS -b --become-user=root tests/testcases/040_check-network-adv.yml $LOG_LEVEL + - ansible-playbook -i inventory/inventory.ini -e ansible_python_interpreter=${PYPATH} -u root -e ansible_ssh_user=root $SSH_ARGS -b --become-user=root tests/testcases/040_check-network-adv.yml $LOG_LEVEL ## Idempotency checks 1/5 (repeat deployment) - > if [ "${IDEMPOT_CHECK}" = "true" ]; then - ansible-playbook -i inventory/inventory.ini -u $SSH_USER -e ansible_ssh_user=$SSH_USER $SSH_ARGS + ansible-playbook -i inventory/inventory.ini -u root -e ansible_ssh_user=root $SSH_ARGS -b --become-user=root -e cloud_provider=gce $LOG_LEVEL -e kube_network_plugin=${KUBE_NETWORK_PLUGIN} --private-key=${HOME}/.ssh/id_rsa -e bootstrap_os=${BOOTSTRAP_OS} @@ -353,14 +359,14 @@ before_script: - > if [ "${IDEMPOT_CHECK}" = "true" ]; then ansible-playbook -i inventory/inventory.ini -e ansible_python_interpreter=${PYPATH} - -u $SSH_USER -e ansible_ssh_user=$SSH_USER $SSH_ARGS -b --become-user=root + -u root -e ansible_ssh_user=root $SSH_ARGS -b --become-user=root tests/testcases/040_check-network-adv.yml $LOG_LEVEL; fi ## Idempotency checks 3/5 (reset deployment) - > if [ "${IDEMPOT_CHECK}" = "true" ]; then - ansible-playbook -i inventory/inventory.ini -u $SSH_USER -e ansible_ssh_user=$SSH_USER $SSH_ARGS + ansible-playbook -i inventory/inventory.ini -u root -e ansible_ssh_user=root $SSH_ARGS -b --become-user=root -e cloud_provider=gce $LOG_LEVEL -e kube_network_plugin=${KUBE_NETWORK_PLUGIN} --private-key=${HOME}/.ssh/id_rsa -e bootstrap_os=${BOOTSTRAP_OS} @@ -371,7 +377,7 @@ before_script: ## Idempotency checks 4/5 (redeploy after reset) - > if [ "${IDEMPOT_CHECK}" = "true" ]; then - ansible-playbook -i inventory/inventory.ini -u $SSH_USER -e ansible_ssh_user=$SSH_USER $SSH_ARGS + ansible-playbook -i inventory/inventory.ini -u root -e ansible_ssh_user=root $SSH_ARGS -b --become-user=root -e cloud_provider=gce $LOG_LEVEL -e kube_network_plugin=${KUBE_NETWORK_PLUGIN} --private-key=${HOME}/.ssh/id_rsa -e bootstrap_os=${BOOTSTRAP_OS} @@ -390,7 +396,7 @@ before_script: - > if [ "${IDEMPOT_CHECK}" = "true" ]; then ansible-playbook -i inventory/inventory.ini -e ansible_python_interpreter=${PYPATH} - -u $SSH_USER -e ansible_ssh_user=$SSH_USER $SSH_ARGS -b --become-user=root + -u root -e ansible_ssh_user=root $SSH_ARGS -b --become-user=root tests/testcases/040_check-network-adv.yml $LOG_LEVEL; fi @@ -453,6 +459,15 @@ before_script: # stage: deploy-gce-special MOVED_TO_GROUP_VARS: "true" +.ubuntu_calico_variables: &ubuntu_calico_variables +# stage: deploy-gce-special + KUBE_NETWORK_PLUGIN: calico + CLOUD_IMAGE: ubuntu-1604-xenial + CLOUD_REGION: us-central1-b + CLUSTER_MODE: separate + IDEMPOT_CHECK: "false" + BOOTSTRAP_OS: ubuntu + .centos7_calico_ha_variables: ¢os7_calico_ha_variables # stage: deploy-gce-special MOVED_TO_GROUP_VARS: "true" @@ -485,14 +500,14 @@ coreos-calico-aio: except: ['triggers'] only: [/^pr-.*$/] -coreos-calico-sep-do: +ubuntu-calico-sep-do: stage: deploy-do-part1 <<: *job <<: *do variables: <<: *gce_variables - <<: *coreos_calico_sep_variables - CLOUD_IMAGE: coreos-stable + <<: *ubuntu_calico_variables + CLOUD_IMAGE: ubuntu-16-04-x64 CLOUD_REGION: NYC3 when: on_success except: ['triggers'] From ce25fa43022188307414f76a6486e6eaf521b202 Mon Sep 17 00:00:00 2001 From: Antoine Legrand <2t.antoine@gmail.com> Date: Mon, 12 Feb 2018 11:35:37 +0100 Subject: [PATCH 04/10] Enable multiple CI platform / Add DigitalOcean --- .gitlab-ci.yml | 1075 ++++++++++++++-------------- tests/Makefile | 50 ++ tests/files/ubuntu-canal-ha-do.yml | 10 + 3 files changed, 591 insertions(+), 544 deletions(-) create mode 100644 tests/Makefile create mode 100644 tests/files/ubuntu-canal-ha-do.yml diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 8c6d28019..b8981ffbc 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,5 +1,5 @@ stages: - - deploy-do-part1 + - deploy-do - moderator - unit-tests - deploy-gce-part1 @@ -10,6 +10,21 @@ variables: FAILFASTCI_NAMESPACE: 'kargo-ci' # DOCKER_HOST: tcp://localhost:2375 ANSIBLE_FORCE_COLOR: "true" + MAGIC: "ci check this" + TEST_ID: "$CI_PIPELINE_ID-$CI_BUILD_ID" + CI_TEST_VARS: "./tests/files/${CI_JOB_NAME}.yml" + GS_ACCESS_KEY_ID: $GS_KEY + GS_SECRET_ACCESS_KEY: $GS_SECRET + CONTAINER_ENGINE: docker + SSH_USER: $GCE_USER + GCE_PREEMPTIBLE: "false" + ANSIBLE_KEEP_REMOTE_FILES: "1" + ANSIBLE_CONFIG: ./tests/ansible.cfg + IDEMPOT_CHECK: "false" + RESET_CHECK: "false" + UPGRADE_TEST: "false" + KUBEADM_ENABLED: "false" + LOG_LEVEL: "-vv" # asia-east1-a # asia-northeast1-a @@ -39,24 +54,16 @@ before_script: .gce_variables: &gce_variables GCE_USER: travis SSH_USER: $GCE_USER - TEST_ID: "$CI_PIPELINE_ID-$CI_BUILD_ID" - CI_TEST_VARS: "./tests/files/${CI_JOB_NAME}.yml" - CONTAINER_ENGINE: docker - PRIVATE_KEY: $GCE_PRIVATE_KEY - GS_ACCESS_KEY_ID: $GS_KEY - GS_SECRET_ACCESS_KEY: $GS_SECRET CLOUD_MACHINE_TYPE: "g1-small" - GCE_PREEMPTIBLE: "false" - ANSIBLE_KEEP_REMOTE_FILES: "1" - ANSIBLE_CONFIG: ./tests/ansible.cfg - IDEMPOT_CHECK: "false" - RESET_CHECK: "false" - UPGRADE_TEST: "false" - KUBEADM_ENABLED: "false" - LOG_LEVEL: "-vv" - MAGIC: "ci check this" + CI_PLATFORM: "gce" + PRIVATE_KEY: $GCE_PRIVATE_KEY -.gce: &gce +.do_variableS: &do_variables + PRIVATE_KEY: $DO_PRIVATE_KEY + CI_PLATFORM: "do" + + +.testcases: &testcases <<: *job <<: *docker_service cache: @@ -69,10 +76,6 @@ before_script: - pip install -r tests/requirements.txt - mkdir -p /.ssh - mkdir -p $HOME/.ssh - - echo $PRIVATE_KEY | base64 -d > $HOME/.ssh/id_rsa - - echo $GCE_PEM_FILE | base64 -d > $HOME/.ssh/gce - - echo $GCE_CREDENTIALS > $HOME/.ssh/gce.json - - chmod 400 $HOME/.ssh/id_rsa - ansible-playbook --version - export PYPATH=$([[ ! "$CI_JOB_NAME" =~ "coreos" ]] && echo /usr/bin/python || echo /opt/bin/python) - echo "CI_JOB_NAME is $CI_JOB_NAME" @@ -82,15 +85,7 @@ before_script: - ls - echo ${PWD} - echo "${STARTUP_SCRIPT}" - - > - ansible-playbook tests/cloud_playbooks/create-gce.yml -i tests/local_inventory/hosts.cfg -c local - ${LOG_LEVEL} - -e gce_credentials_file=${HOME}/.ssh/gce.json - -e gce_project_id=${GCE_PROJECT_ID} - -e gce_service_account_email=${GCE_ACCOUNT} - -e inventory_path=${PWD}/inventory/sample/hosts.ini - -e test_id=${TEST_ID} - -e preemptible=$GCE_PREEMPTIBLE + - cd tests && make create-${CI_PLATFORM} -s ; cd - # Check out latest tag if testing upgrade # Uncomment when gitlab kargo repo has tags @@ -227,192 +222,195 @@ before_script: fi after_script: - - > - ansible-playbook -i inventory/sample/hosts.ini tests/cloud_playbooks/delete-gce.yml -c local $LOG_LEVEL - -e @${CI_TEST_VARS} - -e test_id=${TEST_ID} - -e gce_project_id=${GCE_PROJECT_ID} - -e gce_service_account_email=${GCE_ACCOUNT} - -e gce_credentials_file=${HOME}/.ssh/gce.json - -e inventory_path=${PWD}/inventory/sample/hosts.ini + - cd tests && make delete-${CI_PLATFORM} -s ; cd - -.do: &do - <<: *job - <<: *gce - cache: - key: "$CI_BUILD_REF_NAME" - paths: - - downloads/ - - $HOME/.cache - before_script: - - docker info - - pip install ansible==2.2.1.0 - - pip install netaddr - - pip install apache-libcloud==0.20.1 - - pip install boto==2.9.0 - - pip install dopy==0.3.5 - - mkdir -p /.ssh - - mkdir -p $HOME/.ssh - - echo $DO_PRIVATE_KEY | base64 -d > $HOME/.ssh/id_rsa - - chmod 400 $HOME/.ssh/id_rsa - - md5sum ~/.ssh/id_rsa - - ansible-playbook --version - - export PYPATH=$([ $BOOTSTRAP_OS = coreos ] && echo /opt/bin/python || echo /usr/bin/python ) - - echo $PYPATH - script: - - pwd - - ls - - echo ${PWD} - - > - ansible-playbook tests/cloud_playbooks/create-do.yml -i tests/local_inventory/hosts.cfg -c local - ${LOG_LEVEL} - -e cloud_image=${CLOUD_IMAGE} - -e cloud_region=${CLOUD_REGION} - -e inventory_path=${PWD}/inventory/inventory.ini - -e kube_network_plugin=${KUBE_NETWORK_PLUGIN} - -e mode=${CLUSTER_MODE} - -e test_id=${TEST_ID} - - # Check out latest tag if testing upgrade - # Uncomment when gitlab kargo repo has tags - #- test "${UPGRADE_TEST}" = "true" && git fetch --all && git checkout $(git describe --tags $(git rev-list --tags --max-count=1)) - - test "${UPGRADE_TEST}" = "true" && git checkout 031cf565ec3ccd3ebbe80eeef3454c3780e5c598 && pip install ansible==2.2.0 - - - # Create cluster - - > - ansible-playbook -i inventory/inventory.ini -b --become-user=root --private-key=${HOME}/.ssh/id_rsa -u root - ${SSH_ARGS} - ${LOG_LEVEL} - -e state=present - -e ansible_python_interpreter=${PYPATH} - -e ansible_ssh_user=root - -e bootstrap_os=${BOOTSTRAP_OS} - -e cert_management=${CERT_MGMT:-script} - -e cloud_provider=gce - -e deploy_netchecker=true - -e download_localhost=true - -e download_run_once=true - -e etcd_deployment_type=${ETCD_DEPLOYMENT} - -e kube_network_plugin=${KUBE_NETWORK_PLUGIN} - -e kubelet_deployment_type=${KUBELET_DEPLOYMENT} - -e local_release_dir=${PWD}/downloads - -e resolvconf_mode=${RESOLVCONF_MODE} - -e vault_deployment_type=${VAULT_DEPLOYMENT} - cluster.yml - - # Repeat deployment if testing upgrade - #FIXME(mattymo): repeat "Create cluster" above without duplicating code - - > - if [ "${UPGRADE_TEST}" = "true" ]; then - pip install ansible==2.2.1.0; - git checkout "${CI_BUILD_REF}"; - ansible-playbook -i inventory/inventory.ini -b --become-user=root --private-key=${HOME}/.ssh/id_rsa -u root - ${SSH_ARGS} - ${LOG_LEVEL} - -e ansible_python_interpreter=${PYPATH} - -e ansible_ssh_user=root - -e bootstrap_os=${BOOTSTRAP_OS} - -e cloud_provider=gce - -e deploy_netchecker=true - -e download_localhost=true - -e download_run_once=true - -e etcd_deployment_type=${ETCD_DEPLOYMENT} - -e kube_network_plugin=${KUBE_NETWORK_PLUGIN} - -e kubelet_deployment_type=${KUBELET_DEPLOYMENT} - -e local_release_dir=${PWD}/downloads - -e resolvconf_mode=${RESOLVCONF_MODE} - -e weave_cpu_requests=${WEAVE_CPU_LIMIT} - -e weave_cpu_limit=${WEAVE_CPU_LIMIT} - cluster.yml; - fi - - # Tests Cases - ## Test Master API - - ansible-playbook -i inventory/inventory.ini -e ansible_python_interpreter=${PYPATH} -u root -e ansible_ssh_user=root $SSH_ARGS -b --become-user=root tests/testcases/010_check-apiserver.yml $LOG_LEVEL - - ## Ping the between 2 pod - - ansible-playbook -i inventory/inventory.ini -e ansible_python_interpreter=${PYPATH} -u root -e ansible_ssh_user=root $SSH_ARGS -b --become-user=root tests/testcases/030_check-network.yml $LOG_LEVEL - - ## Advanced DNS checks - - ansible-playbook -i inventory/inventory.ini -e ansible_python_interpreter=${PYPATH} -u root -e ansible_ssh_user=root $SSH_ARGS -b --become-user=root tests/testcases/040_check-network-adv.yml $LOG_LEVEL - - ## Idempotency checks 1/5 (repeat deployment) - - > - if [ "${IDEMPOT_CHECK}" = "true" ]; then - ansible-playbook -i inventory/inventory.ini -u root -e ansible_ssh_user=root $SSH_ARGS - -b --become-user=root -e cloud_provider=gce $LOG_LEVEL -e kube_network_plugin=${KUBE_NETWORK_PLUGIN} - --private-key=${HOME}/.ssh/id_rsa - -e bootstrap_os=${BOOTSTRAP_OS} - -e ansible_python_interpreter=${PYPATH} - -e download_run_once=true - -e download_localhost=true - -e deploy_netchecker=true - -e resolvconf_mode=${RESOLVCONF_MODE} - -e local_release_dir=${PWD}/downloads - -e etcd_deployment_type=${ETCD_DEPLOYMENT} - -e kubelet_deployment_type=${KUBELET_DEPLOYMENT} - cluster.yml; - fi - - ## Idempotency checks 2/5 (Advanced DNS checks) - - > - if [ "${IDEMPOT_CHECK}" = "true" ]; then - ansible-playbook -i inventory/inventory.ini -e ansible_python_interpreter=${PYPATH} - -u root -e ansible_ssh_user=root $SSH_ARGS -b --become-user=root - tests/testcases/040_check-network-adv.yml $LOG_LEVEL; - fi - - ## Idempotency checks 3/5 (reset deployment) - - > - if [ "${IDEMPOT_CHECK}" = "true" ]; then - ansible-playbook -i inventory/inventory.ini -u root -e ansible_ssh_user=root $SSH_ARGS - -b --become-user=root -e cloud_provider=gce $LOG_LEVEL -e kube_network_plugin=${KUBE_NETWORK_PLUGIN} - --private-key=${HOME}/.ssh/id_rsa - -e bootstrap_os=${BOOTSTRAP_OS} - -e ansible_python_interpreter=${PYPATH} - reset.yml; - fi - - ## Idempotency checks 4/5 (redeploy after reset) - - > - if [ "${IDEMPOT_CHECK}" = "true" ]; then - ansible-playbook -i inventory/inventory.ini -u root -e ansible_ssh_user=root $SSH_ARGS - -b --become-user=root -e cloud_provider=gce $LOG_LEVEL -e kube_network_plugin=${KUBE_NETWORK_PLUGIN} - --private-key=${HOME}/.ssh/id_rsa - -e bootstrap_os=${BOOTSTRAP_OS} - -e ansible_python_interpreter=${PYPATH} - -e download_run_once=true - -e download_localhost=true - -e deploy_netchecker=true - -e resolvconf_mode=${RESOLVCONF_MODE} - -e local_release_dir=${PWD}/downloads - -e etcd_deployment_type=${ETCD_DEPLOYMENT} - -e kubelet_deployment_type=${KUBELET_DEPLOYMENT} - cluster.yml; - fi - - ## Idempotency checks 5/5 (Advanced DNS checks) - - > - if [ "${IDEMPOT_CHECK}" = "true" ]; then - ansible-playbook -i inventory/inventory.ini -e ansible_python_interpreter=${PYPATH} - -u root -e ansible_ssh_user=root $SSH_ARGS -b --become-user=root - tests/testcases/040_check-network-adv.yml $LOG_LEVEL; - fi +.gce: &gce + <<: *testcases + variables: + <<: *gce_variables - after_script: - - > - ansible-playbook -i inventory/inventory.ini tests/cloud_playbooks/create-do.yml -c local $LOG_LEVEL - -e state=absent - -e mode=${CLUSTER_MODE} - -e test_id=${TEST_ID} - -e kube_network_plugin=${KUBE_NETWORK_PLUGIN} - -e gce_project_id=${GCE_PROJECT_ID} - -e gce_service_account_email=${GCE_ACCOUNT} - -e gce_credentials_file=${HOME}/.ssh/gce.json - -e cloud_image=${CLOUD_IMAGE} - -e inventory_path=${PWD}/inventory/inventory.ini - -e cloud_region=${CLOUD_REGION} +.do: &do + variables: + <<: *do_variables + <<: *testcases + +# .do: &do +# <<: *job +# <<: *gce +# cache: +# key: "$CI_BUILD_REF_NAME" +# paths: +# - downloads/ +# - $HOME/.cache +# before_script: +# - docker info +# - pip install ansible==2.2.1.0 +# - pip install netaddr +# - pip install apache-libcloud==0.20.1 +# - pip install boto==2.9.0 +# - pip install dopy==0.3.5 +# - mkdir -p /.ssh +# - mkdir -p $HOME/.ssh +# - echo $DO_PRIVATE_KEY | base64 -d > $HOME/.ssh/id_rsa +# - chmod 400 $HOME/.ssh/id_rsa +# - md5sum ~/.ssh/id_rsa +# - ansible-playbook --version +# - export PYPATH=$([ $BOOTSTRAP_OS = coreos ] && echo /opt/bin/python || echo /usr/bin/python ) +# - echo $PYPATH +# script: +# - pwd +# - ls +# - echo ${PWD} +# - > +# ansible-playbook tests/cloud_playbooks/create-do.yml -i tests/local_inventory/hosts.cfg -c local +# ${LOG_LEVEL} +# -e cloud_image=${CLOUD_IMAGE} +# -e cloud_region=${CLOUD_REGION} +# -e inventory_path=${PWD}/inventory/inventory.ini +# -e kube_network_plugin=${KUBE_NETWORK_PLUGIN} +# -e mode=${CLUSTER_MODE} +# -e test_id=${TEST_ID} + +# # Check out latest tag if testing upgrade +# # Uncomment when gitlab kargo repo has tags +# #- test "${UPGRADE_TEST}" = "true" && git fetch --all && git checkout $(git describe --tags $(git rev-list --tags --max-count=1)) +# - test "${UPGRADE_TEST}" = "true" && git checkout 031cf565ec3ccd3ebbe80eeef3454c3780e5c598 && pip install ansible==2.2.0 + + +# # Create cluster +# - > +# ansible-playbook -i inventory/inventory.ini -b --become-user=root --private-key=${HOME}/.ssh/id_rsa -u root +# ${SSH_ARGS} +# ${LOG_LEVEL} +# -e state=present +# -e ansible_python_interpreter=${PYPATH} +# -e ansible_ssh_user=root +# -e bootstrap_os=${BOOTSTRAP_OS} +# -e cert_management=${CERT_MGMT:-script} +# -e cloud_provider=gce +# -e deploy_netchecker=true +# -e download_localhost=true +# -e download_run_once=true +# -e etcd_deployment_type=${ETCD_DEPLOYMENT} +# -e kube_network_plugin=${KUBE_NETWORK_PLUGIN} +# -e kubelet_deployment_type=${KUBELET_DEPLOYMENT} +# -e local_release_dir=${PWD}/downloads +# -e resolvconf_mode=${RESOLVCONF_MODE} +# -e vault_deployment_type=${VAULT_DEPLOYMENT} +# cluster.yml + +# # Repeat deployment if testing upgrade +# #FIXME(mattymo): repeat "Create cluster" above without duplicating code +# - > +# if [ "${UPGRADE_TEST}" = "true" ]; then +# pip install ansible==2.2.1.0; +# git checkout "${CI_BUILD_REF}"; +# ansible-playbook -i inventory/inventory.ini -b --become-user=root --private-key=${HOME}/.ssh/id_rsa -u root +# ${SSH_ARGS} +# ${LOG_LEVEL} +# -e ansible_python_interpreter=${PYPATH} +# -e ansible_ssh_user=root +# -e bootstrap_os=${BOOTSTRAP_OS} +# -e cloud_provider=gce +# -e deploy_netchecker=true +# -e download_localhost=true +# -e download_run_once=true +# -e etcd_deployment_type=${ETCD_DEPLOYMENT} +# -e kube_network_plugin=${KUBE_NETWORK_PLUGIN} +# -e kubelet_deployment_type=${KUBELET_DEPLOYMENT} +# -e local_release_dir=${PWD}/downloads +# -e resolvconf_mode=${RESOLVCONF_MODE} +# -e weave_cpu_requests=${WEAVE_CPU_LIMIT} +# -e weave_cpu_limit=${WEAVE_CPU_LIMIT} +# cluster.yml; +# fi + +# # Tests Cases +# ## Test Master API +# - ansible-playbook -i inventory/inventory.ini -e ansible_python_interpreter=${PYPATH} -u root -e ansible_ssh_user=root $SSH_ARGS -b --become-user=root tests/testcases/010_check-apiserver.yml $LOG_LEVEL + +# ## Ping the between 2 pod +# - ansible-playbook -i inventory/inventory.ini -e ansible_python_interpreter=${PYPATH} -u root -e ansible_ssh_user=root $SSH_ARGS -b --become-user=root tests/testcases/030_check-network.yml $LOG_LEVEL + +# ## Advanced DNS checks +# - ansible-playbook -i inventory/inventory.ini -e ansible_python_interpreter=${PYPATH} -u root -e ansible_ssh_user=root $SSH_ARGS -b --become-user=root tests/testcases/040_check-network-adv.yml $LOG_LEVEL + +# ## Idempotency checks 1/5 (repeat deployment) +# - > +# if [ "${IDEMPOT_CHECK}" = "true" ]; then +# ansible-playbook -i inventory/inventory.ini -u root -e ansible_ssh_user=root $SSH_ARGS +# -b --become-user=root -e cloud_provider=gce $LOG_LEVEL -e kube_network_plugin=${KUBE_NETWORK_PLUGIN} +# --private-key=${HOME}/.ssh/id_rsa +# -e bootstrap_os=${BOOTSTRAP_OS} +# -e ansible_python_interpreter=${PYPATH} +# -e download_run_once=true +# -e download_localhost=true +# -e deploy_netchecker=true +# -e resolvconf_mode=${RESOLVCONF_MODE} +# -e local_release_dir=${PWD}/downloads +# -e etcd_deployment_type=${ETCD_DEPLOYMENT} +# -e kubelet_deployment_type=${KUBELET_DEPLOYMENT} +# cluster.yml; +# fi + +# ## Idempotency checks 2/5 (Advanced DNS checks) +# - > +# if [ "${IDEMPOT_CHECK}" = "true" ]; then +# ansible-playbook -i inventory/inventory.ini -e ansible_python_interpreter=${PYPATH} +# -u root -e ansible_ssh_user=root $SSH_ARGS -b --become-user=root +# tests/testcases/040_check-network-adv.yml $LOG_LEVEL; +# fi + +# ## Idempotency checks 3/5 (reset deployment) +# - > +# if [ "${IDEMPOT_CHECK}" = "true" ]; then +# ansible-playbook -i inventory/inventory.ini -u root -e ansible_ssh_user=root $SSH_ARGS +# -b --become-user=root -e cloud_provider=gce $LOG_LEVEL -e kube_network_plugin=${KUBE_NETWORK_PLUGIN} +# --private-key=${HOME}/.ssh/id_rsa +# -e bootstrap_os=${BOOTSTRAP_OS} +# -e ansible_python_interpreter=${PYPATH} +# reset.yml; +# fi + +# ## Idempotency checks 4/5 (redeploy after reset) +# - > +# if [ "${IDEMPOT_CHECK}" = "true" ]; then +# ansible-playbook -i inventory/inventory.ini -u root -e ansible_ssh_user=root $SSH_ARGS +# -b --become-user=root -e cloud_provider=gce $LOG_LEVEL -e kube_network_plugin=${KUBE_NETWORK_PLUGIN} +# --private-key=${HOME}/.ssh/id_rsa +# -e bootstrap_os=${BOOTSTRAP_OS} +# -e ansible_python_interpreter=${PYPATH} +# -e download_run_once=true +# -e download_localhost=true +# -e deploy_netchecker=true +# -e resolvconf_mode=${RESOLVCONF_MODE} +# -e local_release_dir=${PWD}/downloads +# -e etcd_deployment_type=${ETCD_DEPLOYMENT} +# -e kubelet_deployment_type=${KUBELET_DEPLOYMENT} +# cluster.yml; +# fi + +# ## Idempotency checks 5/5 (Advanced DNS checks) +# - > +# if [ "${IDEMPOT_CHECK}" = "true" ]; then +# ansible-playbook -i inventory/inventory.ini -e ansible_python_interpreter=${PYPATH} +# -u root -e ansible_ssh_user=root $SSH_ARGS -b --become-user=root +# tests/testcases/040_check-network-adv.yml $LOG_LEVEL; +# fi + +# after_script: +# - > +# ansible-playbook -i inventory/inventory.ini tests/cloud_playbooks/create-do.yml -c local $LOG_LEVEL +# -e state=absent +# -e mode=${CLUSTER_MODE} +# -e test_id=${TEST_ID} +# -e kube_network_plugin=${KUBE_NETWORK_PLUGIN} +# -e gce_project_id=${GCE_PROJECT_ID} +# -e gce_service_account_email=${GCE_ACCOUNT} +# -e gce_credentials_file=${HOME}/.ssh/gce.json +# -e cloud_image=${CLOUD_IMAGE} +# -e inventory_path=${PWD}/inventory/inventory.ini +# -e cloud_region=${CLOUD_REGION} # Test matrix. Leave the comments for markup scripts. .coreos_calico_aio_variables: &coreos_calico_aio_variables @@ -459,15 +457,6 @@ before_script: # stage: deploy-gce-special MOVED_TO_GROUP_VARS: "true" -.ubuntu_calico_variables: &ubuntu_calico_variables -# stage: deploy-gce-special - KUBE_NETWORK_PLUGIN: calico - CLOUD_IMAGE: ubuntu-1604-xenial - CLOUD_REGION: us-central1-b - CLUSTER_MODE: separate - IDEMPOT_CHECK: "false" - BOOTSTRAP_OS: ubuntu - .centos7_calico_ha_variables: ¢os7_calico_ha_variables # stage: deploy-gce-special MOVED_TO_GROUP_VARS: "true" @@ -490,7 +479,8 @@ before_script: # Builds for PRs only (premoderated by unit-tests step) and triggers (auto) coreos-calico-aio: - stage: deploy-gce-part1 + stage: deploy-do + # stage: deploy-gce-part1 <<: *job <<: *gce variables: @@ -498,330 +488,327 @@ coreos-calico-aio: <<: *coreos_calico_aio_variables when: on_success except: ['triggers'] - only: [/^pr-.*$/] + # only: [/^pr-.*$/] -ubuntu-calico-sep-do: - stage: deploy-do-part1 +ubuntu-canal-ha-do: + stage: deploy-do <<: *job <<: *do variables: <<: *gce_variables - <<: *ubuntu_calico_variables - CLOUD_IMAGE: ubuntu-16-04-x64 - CLOUD_REGION: NYC3 - when: on_success - except: ['triggers'] - only: [/^pr-.*$/] - -coreos-calico-sep-triggers: - stage: deploy-gce-part1 - <<: *job - <<: *gce - variables: - <<: *gce_variables - <<: *coreos_calico_aio_variables - when: on_success - only: ['triggers'] - -centos7-flannel-addons: - stage: deploy-gce-part2 - <<: *job - <<: *gce - variables: - <<: *gce_variables - <<: *centos7_flannel_addons_variables - when: on_success - except: ['triggers'] - only: [/^pr-.*$/] - -centos7-flannel-addons-triggers: - stage: deploy-gce-part1 - <<: *job - <<: *gce - variables: - <<: *gce_variables - <<: *centos7_flannel_addons_variables - when: on_success - only: ['triggers'] - -ubuntu-weave-sep: - stage: deploy-gce-special - <<: *job - <<: *gce - variables: - <<: *gce_variables - <<: *ubuntu_weave_sep_variables - when: on_success - except: ['triggers'] - only: [/^pr-.*$/] - -ubuntu-weave-sep-triggers: - stage: deploy-gce-part1 - <<: *job - <<: *gce - variables: - <<: *gce_variables - <<: *ubuntu_weave_sep_variables when: on_success - only: ['triggers'] - -# More builds for PRs/merges (manual) and triggers (auto) -ubuntu-canal-ha: - stage: deploy-gce-part1 - <<: *job - <<: *gce - variables: - <<: *gce_variables - <<: *ubuntu_canal_ha_variables - when: manual except: ['triggers'] - only: ['master', /^pr-.*$/] - -ubuntu-canal-ha-triggers: - stage: deploy-gce-part1 - <<: *job - <<: *gce - variables: - <<: *gce_variables - <<: *ubuntu_canal_ha_variables - when: on_success - only: ['triggers'] - -ubuntu-canal-kubeadm: - stage: deploy-gce-part1 - <<: *job - <<: *gce - variables: - <<: *gce_variables - <<: *ubuntu_canal_kubeadm_variables - when: manual - except: ['triggers'] - only: ['master', /^pr-.*$/] - -ubuntu-canal-kubeadm-triggers: - stage: deploy-gce-part1 - <<: *job - <<: *gce - variables: - <<: *gce_variables - <<: *ubuntu_canal_kubeadm_variables - when: on_success - only: ['triggers'] - -centos-weave-kubeadm: - stage: deploy-gce-part1 - <<: *job - <<: *gce - variables: - <<: *gce_variables - <<: *centos_weave_kubeadm_variables - when: manual - except: ['triggers'] - only: ['master', /^pr-.*$/] - -centos-weave-kubeadm-triggers: - stage: deploy-gce-part1 - <<: *job - <<: *gce - variables: - <<: *gce_variables - <<: *centos_weave_kubeadm_variables - when: on_success - only: ['triggers'] - -ubuntu-contiv-sep: - stage: deploy-gce-special - <<: *job - <<: *gce - variables: - <<: *gce_variables - <<: *ubuntu_contiv_sep_variables - when: manual - except: ['triggers'] - only: ['master', /^pr-.*$/] - -rhel7-weave: - stage: deploy-gce-part1 - <<: *job - <<: *gce - variables: - <<: *gce_variables - <<: *rhel7_weave_variables - when: manual - except: ['triggers'] - only: ['master', /^pr-.*$/] - -rhel7-weave-triggers: - stage: deploy-gce-part1 - <<: *job - <<: *gce - variables: - <<: *gce_variables - <<: *rhel7_weave_variables - when: on_success - only: ['triggers'] - -debian8-calico-upgrade: - stage: deploy-gce-part2 - <<: *job - <<: *gce - variables: - <<: *gce_variables - <<: *debian8_calico_variables - when: manual - except: ['triggers'] - only: ['master', /^pr-.*$/] - -debian8-calico-triggers: - stage: deploy-gce-part1 - <<: *job - <<: *gce - variables: - <<: *gce_variables - <<: *debian8_calico_variables - when: on_success - only: ['triggers'] - -coreos-canal: - stage: deploy-gce-part2 - <<: *job - <<: *gce - variables: - <<: *gce_variables - <<: *coreos_canal_variables - when: manual - except: ['triggers'] - only: ['master', /^pr-.*$/] - -coreos-canal-triggers: - stage: deploy-gce-part1 - <<: *job - <<: *gce - variables: - <<: *gce_variables - <<: *coreos_canal_variables - when: on_success - only: ['triggers'] - -rhel7-canal-sep: - stage: deploy-gce-special - <<: *job - <<: *gce - variables: - <<: *gce_variables - <<: *rhel7_canal_sep_variables - when: manual - except: ['triggers'] - only: ['master', /^pr-.*$/,] - -rhel7-canal-sep-triggers: - stage: deploy-gce-part1 - <<: *job - <<: *gce - variables: - <<: *gce_variables - <<: *rhel7_canal_sep_variables - when: on_success - only: ['triggers'] - -centos7-calico-ha: - stage: deploy-gce-special - <<: *job - <<: *gce - variables: - <<: *gce_variables - <<: *centos7_calico_ha_variables - when: manual - except: ['triggers'] - only: ['master', /^pr-.*$/] - -centos7-calico-ha-triggers: - stage: deploy-gce-part1 - <<: *job - <<: *gce - variables: - <<: *gce_variables - <<: *centos7_calico_ha_variables - when: on_success - only: ['triggers'] - -# no triggers yet https://github.com/kubernetes-incubator/kargo/issues/613 -coreos-alpha-weave-ha: - stage: deploy-gce-special - <<: *job - <<: *gce - variables: - <<: *gce_variables - <<: *coreos_alpha_weave_ha_variables - when: manual - except: ['triggers'] - only: ['master', /^pr-.*$/] - -ubuntu-rkt-sep: - stage: deploy-gce-part1 - <<: *job - <<: *gce - variables: - <<: *gce_variables - <<: *ubuntu_rkt_sep_variables - when: manual - except: ['triggers'] - only: ['master', /^pr-.*$/] - -ubuntu-vault-sep: - stage: deploy-gce-part1 - <<: *job - <<: *gce - variables: - <<: *gce_variables - <<: *ubuntu_vault_sep_variables - when: manual - except: ['triggers'] - only: ['master', /^pr-.*$/] - -ubuntu-flannel-sep: - stage: deploy-gce-special - <<: *job - <<: *gce - variables: - <<: *gce_variables - <<: *ubuntu_flannel_variables - when: manual - except: ['triggers'] - only: ['master', /^pr-.*$/] - -# Premoderated with manual actions -ci-authorized: - <<: *job - stage: moderator - before_script: - - apt-get -y install jq - script: - - /bin/sh scripts/premoderator.sh - except: ['triggers', 'master'] - -syntax-check: - <<: *job - stage: unit-tests - script: - - ansible-playbook -i inventory/local-tests.cfg -u root -e ansible_ssh_user=root -b --become-user=root cluster.yml -vvv --syntax-check - - ansible-playbook -i inventory/local-tests.cfg -u root -e ansible_ssh_user=root -b --become-user=root upgrade-cluster.yml -vvv --syntax-check - - ansible-playbook -i inventory/local-tests.cfg -u root -e ansible_ssh_user=root -b --become-user=root reset.yml -vvv --syntax-check - - ansible-playbook -i inventory/local-tests.cfg -u root -e ansible_ssh_user=root -b --become-user=root extra_playbooks/upgrade-only-k8s.yml -vvv --syntax-check - except: ['triggers', 'master'] - -yamllint: - <<: *job - stage: unit-tests - script: - - yamllint roles - except: ['triggers', 'master'] - -tox-inventory-builder: - stage: unit-tests - <<: *job - script: - - pip install tox - - cd contrib/inventory_builder && tox - when: manual - except: ['triggers', 'master'] + # only: [/^pr-.*$/] + +# coreos-calico-sep-triggers: +# stage: deploy-gce-part1 +# <<: *job +# <<: *gce +# variables: +# <<: *gce_variables +# <<: *coreos_calico_aio_variables +# when: on_success +# only: ['triggers'] + +# centos7-flannel-addons: +# stage: deploy-gce-part2 +# <<: *job +# <<: *gce +# variables: +# <<: *gce_variables +# <<: *centos7_flannel_addons_variables +# when: on_success +# except: ['triggers'] +# only: [/^pr-.*$/] + +# centos7-flannel-addons-triggers: +# stage: deploy-gce-part1 +# <<: *job +# <<: *gce +# variables: +# <<: *gce_variables +# <<: *centos7_flannel_addons_variables +# when: on_success +# only: ['triggers'] + +# ubuntu-weave-sep: +# stage: deploy-gce-special +# <<: *job +# <<: *gce +# variables: +# <<: *gce_variables +# <<: *ubuntu_weave_sep_variables +# when: on_success +# except: ['triggers'] +# only: [/^pr-.*$/] + +# ubuntu-weave-sep-triggers: +# stage: deploy-gce-part1 +# <<: *job +# <<: *gce +# variables: +# <<: *gce_variables +# <<: *ubuntu_weave_sep_variables +# when: on_success +# only: ['triggers'] + +# # More builds for PRs/merges (manual) and triggers (auto) +# ubuntu-canal-ha: +# stage: deploy-gce-part1 +# <<: *job +# <<: *gce +# variables: +# <<: *gce_variables +# <<: *ubuntu_canal_ha_variables +# when: manual +# except: ['triggers'] +# only: ['master', /^pr-.*$/] + +# ubuntu-canal-ha-triggers: +# stage: deploy-gce-part1 +# <<: *job +# <<: *gce +# variables: +# <<: *gce_variables +# <<: *ubuntu_canal_ha_variables +# when: on_success +# only: ['triggers'] + +# ubuntu-canal-kubeadm: +# stage: deploy-gce-part1 +# <<: *job +# <<: *gce +# variables: +# <<: *gce_variables +# <<: *ubuntu_canal_kubeadm_variables +# when: manual +# except: ['triggers'] +# only: ['master', /^pr-.*$/] + +# ubuntu-canal-kubeadm-triggers: +# stage: deploy-gce-part1 +# <<: *job +# <<: *gce +# variables: +# <<: *gce_variables +# <<: *ubuntu_canal_kubeadm_variables +# when: on_success +# only: ['triggers'] + +# centos-weave-kubeadm: +# stage: deploy-gce-part1 +# <<: *job +# <<: *gce +# variables: +# <<: *gce_variables +# <<: *centos_weave_kubeadm_variables +# when: manual +# except: ['triggers'] +# only: ['master', /^pr-.*$/] + +# centos-weave-kubeadm-triggers: +# stage: deploy-gce-part1 +# <<: *job +# <<: *gce +# variables: +# <<: *gce_variables +# <<: *centos_weave_kubeadm_variables +# when: on_success +# only: ['triggers'] + +# ubuntu-contiv-sep: +# stage: deploy-gce-special +# <<: *job +# <<: *gce +# variables: +# <<: *gce_variables +# <<: *ubuntu_contiv_sep_variables +# when: manual +# except: ['triggers'] +# only: ['master', /^pr-.*$/] + +# rhel7-weave: +# stage: deploy-gce-part1 +# <<: *job +# <<: *gce +# variables: +# <<: *gce_variables +# <<: *rhel7_weave_variables +# when: manual +# except: ['triggers'] +# only: ['master', /^pr-.*$/] + +# rhel7-weave-triggers: +# stage: deploy-gce-part1 +# <<: *job +# <<: *gce +# variables: +# <<: *gce_variables +# <<: *rhel7_weave_variables +# when: on_success +# only: ['triggers'] + +# debian8-calico-upgrade: +# stage: deploy-gce-part2 +# <<: *job +# <<: *gce +# variables: +# <<: *gce_variables +# <<: *debian8_calico_variables +# when: manual +# except: ['triggers'] +# only: ['master', /^pr-.*$/] + +# debian8-calico-triggers: +# stage: deploy-gce-part1 +# <<: *job +# <<: *gce +# variables: +# <<: *gce_variables +# <<: *debian8_calico_variables +# when: on_success +# only: ['triggers'] + +# coreos-canal: +# stage: deploy-gce-part2 +# <<: *job +# <<: *gce +# variables: +# <<: *gce_variables +# <<: *coreos_canal_variables +# when: manual +# except: ['triggers'] +# only: ['master', /^pr-.*$/] + +# coreos-canal-triggers: +# stage: deploy-gce-part1 +# <<: *job +# <<: *gce +# variables: +# <<: *gce_variables +# <<: *coreos_canal_variables +# when: on_success +# only: ['triggers'] + +# rhel7-canal-sep: +# stage: deploy-gce-special +# <<: *job +# <<: *gce +# variables: +# <<: *gce_variables +# <<: *rhel7_canal_sep_variables +# when: manual +# except: ['triggers'] +# only: ['master', /^pr-.*$/,] + +# rhel7-canal-sep-triggers: +# stage: deploy-gce-part1 +# <<: *job +# <<: *gce +# variables: +# <<: *gce_variables +# <<: *rhel7_canal_sep_variables +# when: on_success +# only: ['triggers'] + +# centos7-calico-ha: +# stage: deploy-gce-special +# <<: *job +# <<: *gce +# variables: +# <<: *gce_variables +# <<: *centos7_calico_ha_variables +# when: manual +# except: ['triggers'] +# only: ['master', /^pr-.*$/] + +# centos7-calico-ha-triggers: +# stage: deploy-gce-part1 +# <<: *job +# <<: *gce +# variables: +# <<: *gce_variables +# <<: *centos7_calico_ha_variables +# when: on_success +# only: ['triggers'] + +# # no triggers yet https://github.com/kubernetes-incubator/kargo/issues/613 +# coreos-alpha-weave-ha: +# stage: deploy-gce-special +# <<: *job +# <<: *gce +# variables: +# <<: *gce_variables +# <<: *coreos_alpha_weave_ha_variables +# when: manual +# except: ['triggers'] +# only: ['master', /^pr-.*$/] + +# ubuntu-rkt-sep: +# stage: deploy-gce-part1 +# <<: *job +# <<: *gce +# variables: +# <<: *gce_variables +# <<: *ubuntu_rkt_sep_variables +# when: manual +# except: ['triggers'] +# only: ['master', /^pr-.*$/] + +# ubuntu-vault-sep: +# stage: deploy-gce-part1 +# <<: *job +# <<: *gce +# variables: +# <<: *gce_variables +# <<: *ubuntu_vault_sep_variables +# when: manual +# except: ['triggers'] +# only: ['master', /^pr-.*$/] + +# ubuntu-flannel-sep: +# stage: deploy-gce-special +# <<: *job +# <<: *gce +# variables: +# <<: *gce_variables +# <<: *ubuntu_flannel_variables +# when: manual +# except: ['triggers'] +# only: ['master', /^pr-.*$/] + +# # Premoderated with manual actions +# ci-authorized: +# <<: *job +# stage: moderator +# before_script: +# - apt-get -y install jq +# script: +# - /bin/sh scripts/premoderator.sh +# except: ['triggers', 'master'] + +# syntax-check: +# <<: *job +# stage: unit-tests +# script: +# - ansible-playbook -i inventory/local-tests.cfg -u root -e ansible_ssh_user=root -b --become-user=root cluster.yml -vvv --syntax-check +# - ansible-playbook -i inventory/local-tests.cfg -u root -e ansible_ssh_user=root -b --become-user=root upgrade-cluster.yml -vvv --syntax-check +# - ansible-playbook -i inventory/local-tests.cfg -u root -e ansible_ssh_user=root -b --become-user=root reset.yml -vvv --syntax-check +# - ansible-playbook -i inventory/local-tests.cfg -u root -e ansible_ssh_user=root -b --become-user=root extra_playbooks/upgrade-only-k8s.yml -vvv --syntax-check +# except: ['triggers', 'master'] + +# yamllint: +# <<: *job +# stage: unit-tests +# script: +# - yamllint roles +# except: ['triggers', 'master'] + +# tox-inventory-builder: +# stage: unit-tests +# <<: *job +# script: +# - pip install tox +# - cd contrib/inventory_builder && tox +# when: manual +# except: ['triggers', 'master'] diff --git a/tests/Makefile b/tests/Makefile new file mode 100644 index 000000000..e42aaf9bc --- /dev/null +++ b/tests/Makefile @@ -0,0 +1,50 @@ +$(HOME)/.ssh/id_rsa: + mkdir -p $(HOME)/.ssh + echo $(PRIVATE_KEY) | base64 -d > $(HOME)/.ssh/id_rsa + chmod 400 $(HOME)/.ssh/id_rsa + +init-gce: $(HOME)/.ssh/id_rsa + # echo $(GCE_PEM_FILE) | base64 -d > $(HOME)/.ssh/gce + echo "$(GCE_CREDENTIALS)" > $(HOME)/.ssh/gce.json + + +init-do: $(HOME)/.ssh/id_rsa + pip install dopy + echo $(DO_PRIVATE_KEY) | base64 -d > $(HOME)/.ssh/id_rsa + +create-gce: init-gce + ansible-playbook cloud_playbooks/create-gce.yml -i local_inventory/hosts.cfg -c local \ + $(LOG_LEVEL) \ + -e @$(CI_TEST_VARS) \ + -e gce_credentials_file=$(HOME)/.ssh/gce.json \ + -e gce_project_id=$(GCE_PROJECT_ID) \ + -e gce_service_account_email=$(GCE_ACCOUNT) \ + -e inventory_path=$(PWD)/../inventory/sample/hosts.ini \ + -e test_id=$(TEST_ID) \ + -e preemptible=$(GCE_PREEMPTIBLE) + + +delete-gce: + ansible-playbook -i ../inventory/sample/hosts.ini cloud_playbooks/delete-gce.yml -c local \ + $(LOG_LEVEL) \ + -e @$(CI_TEST_VARS) \ + -e test_id=$(TEST_ID) \ + -e gce_project_id=$(GCE_PROJECT_ID) \ + -e gce_service_account_email=$(GCE_ACCOUNT) \ + -e gce_credentials_file=$(HOME)/.ssh/gce.json \ + -e inventory_path=$(PWD)/inventory/sample/hosts.ini + +create-do: init-do + ansible-playbook cloud_playbooks/create-do.yml -i tests/local_inventory/hosts.cfg -c local \ + ${LOG_LEVEL} \ + -e @$(CI_TEST_VARS) \ + -e inventory_path=${PWD}/../inventory/hosts.ini \ + -e test_id=${TEST_ID} + + +delete-do: + ansible-playbook -i ../inventory/sample/hosts.ini tests/cloud_playbooks/create-do.yml -c local \ + $LOG_LEVEL \ + -e state=absent \ + -e test_id=${TEST_ID} \ + -e inventory_path=${PWD}/../inventory/inventory.ini \ diff --git a/tests/files/ubuntu-canal-ha-do.yml b/tests/files/ubuntu-canal-ha-do.yml new file mode 100644 index 000000000..6fec2bc28 --- /dev/null +++ b/tests/files/ubuntu-canal-ha-do.yml @@ -0,0 +1,10 @@ +cloud_image: ubuntu-16-04-x64 +cloud_region: NYC3 +mode: ha + +# Deployment settings +bootstrap_os: ubuntu +kube_network_plugin: canal +deploy_netchecker: true +kubedns_min_replicas: 1 +cloud_provider: 'do' From 51e695066a87eb74e709e0ff6baf728a34a79b4e Mon Sep 17 00:00:00 2001 From: Antoine Legrand <2t.antoine@gmail.com> Date: Mon, 12 Feb 2018 13:39:41 +0100 Subject: [PATCH 05/10] Add dockerfile for the ci --- Dockerfile | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 Dockerfile diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 000000000..f7703e5f2 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,17 @@ +FROM python:2.7.14-stretch + +RUN mkdir /kubespray +WORKDIR /kubespray +RUN apt update -y && \ + apt install -y \ + libssl-dev python-dev sshpass apt-transport-https \ + ca-certificates curl gnupg2 software-properties-common +RUN curl -fsSL https://download.docker.com/linux/$(. /etc/os-release; echo "$ID")/gpg | apt-key add - && \ + add-apt-repository \ + "deb [arch=amd64] https://download.docker.com/linux/$(. /etc/os-release; echo "$ID") \ + $(lsb_release -cs) \ + stable" \ + && apt update -y && apt-get install docker-ce -y + +COPY . . +RUN pip install -r tests/requirements.txt && pip install -r requirements.txt From e1d139db2e2a4f6e7f1df942692ad4e7dd0f60dd Mon Sep 17 00:00:00 2001 From: Antoine Legrand <2t.antoine@gmail.com> Date: Mon, 12 Feb 2018 13:46:44 +0100 Subject: [PATCH 06/10] Use new CI image --- .gitlab-ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index b8981ffbc..1ab5b5acf 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -41,7 +41,7 @@ before_script: tags: - kubernetes - docker - image: quay.io/ant31/kargo:master + image: quay.io/kubespray/kubespray:master .docker_service: &docker_service services: From cb202a76df6d83bbb249ef88f24641c3e9d19043 Mon Sep 17 00:00:00 2001 From: Antoine Legrand <2t.antoine@gmail.com> Date: Mon, 12 Feb 2018 14:28:59 +0100 Subject: [PATCH 07/10] Fix tests --- .gitlab-ci.yml | 6 +++--- tests/Makefile | 16 ++++++++-------- tests/cloud_playbooks/create-do.yml | 3 +++ tests/files/ubuntu-canal-ha-do.yml | 2 +- 4 files changed, 15 insertions(+), 12 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 1ab5b5acf..8406ee4e2 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -24,7 +24,7 @@ variables: RESET_CHECK: "false" UPGRADE_TEST: "false" KUBEADM_ENABLED: "false" - LOG_LEVEL: "-vv" + LOG_LEVEL: "-vvv" # asia-east1-a # asia-northeast1-a @@ -484,8 +484,8 @@ coreos-calico-aio: <<: *job <<: *gce variables: - <<: *gce_variables <<: *coreos_calico_aio_variables + <<: *gce_variables when: on_success except: ['triggers'] # only: [/^pr-.*$/] @@ -495,7 +495,7 @@ ubuntu-canal-ha-do: <<: *job <<: *do variables: - <<: *gce_variables + <<: *do_variables when: on_success except: ['triggers'] # only: [/^pr-.*$/] diff --git a/tests/Makefile b/tests/Makefile index e42aaf9bc..8c4639b29 100644 --- a/tests/Makefile +++ b/tests/Makefile @@ -5,17 +5,16 @@ $(HOME)/.ssh/id_rsa: init-gce: $(HOME)/.ssh/id_rsa # echo $(GCE_PEM_FILE) | base64 -d > $(HOME)/.ssh/gce - echo "$(GCE_CREDENTIALS)" > $(HOME)/.ssh/gce.json - + echo "$(GCE_CREDENTIALS_B64)" > $(HOME)/.ssh/gce.json init-do: $(HOME)/.ssh/id_rsa - pip install dopy + pip install dopy==0.3.5 echo $(DO_PRIVATE_KEY) | base64 -d > $(HOME)/.ssh/id_rsa create-gce: init-gce ansible-playbook cloud_playbooks/create-gce.yml -i local_inventory/hosts.cfg -c local \ $(LOG_LEVEL) \ - -e @$(CI_TEST_VARS) \ + -e @"files/${CI_JOB_NAME}.yml" \ -e gce_credentials_file=$(HOME)/.ssh/gce.json \ -e gce_project_id=$(GCE_PROJECT_ID) \ -e gce_service_account_email=$(GCE_ACCOUNT) \ @@ -27,7 +26,7 @@ create-gce: init-gce delete-gce: ansible-playbook -i ../inventory/sample/hosts.ini cloud_playbooks/delete-gce.yml -c local \ $(LOG_LEVEL) \ - -e @$(CI_TEST_VARS) \ + -e @"files/${CI_JOB_NAME}.yml" \ -e test_id=$(TEST_ID) \ -e gce_project_id=$(GCE_PROJECT_ID) \ -e gce_service_account_email=$(GCE_ACCOUNT) \ @@ -35,16 +34,17 @@ delete-gce: -e inventory_path=$(PWD)/inventory/sample/hosts.ini create-do: init-do - ansible-playbook cloud_playbooks/create-do.yml -i tests/local_inventory/hosts.cfg -c local \ + ansible-playbook cloud_playbooks/create-do.yml -i local_inventory/hosts.cfg -c local \ ${LOG_LEVEL} \ - -e @$(CI_TEST_VARS) \ + -e @"files/${CI_JOB_NAME}.yml" \ -e inventory_path=${PWD}/../inventory/hosts.ini \ -e test_id=${TEST_ID} delete-do: - ansible-playbook -i ../inventory/sample/hosts.ini tests/cloud_playbooks/create-do.yml -c local \ + ansible-playbook -i ../inventory/sample/hosts.ini cloud_playbooks/create-do.yml -c local \ $LOG_LEVEL \ + -e @"files/${CI_JOB_NAME}.yml" \ -e state=absent \ -e test_id=${TEST_ID} \ -e inventory_path=${PWD}/../inventory/inventory.ini \ diff --git a/tests/cloud_playbooks/create-do.yml b/tests/cloud_playbooks/create-do.yml index 33a9f935a..18756d294 100644 --- a/tests/cloud_playbooks/create-do.yml +++ b/tests/cloud_playbooks/create-do.yml @@ -54,6 +54,9 @@ set_fact: test_name: "{{test_id |regex_replace('\\.', '-')}}" + - name: show vars + debug: msg="{{cloud_region}}, {{cloud_image}}" + - set_fact: instance_names: >- {%- if mode in ['separate', 'ha'] -%} diff --git a/tests/files/ubuntu-canal-ha-do.yml b/tests/files/ubuntu-canal-ha-do.yml index 6fec2bc28..94a4af67a 100644 --- a/tests/files/ubuntu-canal-ha-do.yml +++ b/tests/files/ubuntu-canal-ha-do.yml @@ -1,5 +1,5 @@ cloud_image: ubuntu-16-04-x64 -cloud_region: NYC3 +cloud_region: nyc3 mode: ha # Deployment settings From c187ae22e5ae9c68160e86025b79c0957e764142 Mon Sep 17 00:00:00 2001 From: Antoine Legrand <2t.antoine@gmail.com> Date: Mon, 12 Feb 2018 15:32:40 +0100 Subject: [PATCH 08/10] Force to /usr/bin/python in CI --- .gitlab-ci.yml | 10 ++++++---- Dockerfile | 19 +++++++++---------- tests/Makefile | 5 ++--- tests/requirements.txt | 1 + 4 files changed, 18 insertions(+), 17 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 8406ee4e2..2aab53a5b 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -16,7 +16,7 @@ variables: GS_ACCESS_KEY_ID: $GS_KEY GS_SECRET_ACCESS_KEY: $GS_SECRET CONTAINER_ENGINE: docker - SSH_USER: $GCE_USER + SSH_USER: root GCE_PREEMPTIBLE: "false" ANSIBLE_KEEP_REMOTE_FILES: "1" ANSIBLE_CONFIG: ./tests/ansible.cfg @@ -34,14 +34,14 @@ variables: # us-west1-a before_script: - - pip install -r tests/requirements.txt + - /usr/bin/python -m pip install -r tests/requirements.txt - mkdir -p /.ssh .job: &job tags: - kubernetes - docker - image: quay.io/kubespray/kubespray:master + image: quay.io/kubespray/kubespray:latest .docker_service: &docker_service services: @@ -61,6 +61,7 @@ before_script: .do_variableS: &do_variables PRIVATE_KEY: $DO_PRIVATE_KEY CI_PLATFORM: "do" + SSH_USER: root .testcases: &testcases @@ -73,7 +74,8 @@ before_script: - $HOME/.cache before_script: - docker info - - pip install -r tests/requirements.txt + - /usr/bin/python -m pip install -r requirements.txt + - /usr/bin/python -m pip install -r tests/requirements.txt - mkdir -p /.ssh - mkdir -p $HOME/.ssh - ansible-playbook --version diff --git a/Dockerfile b/Dockerfile index f7703e5f2..d2cfa16c2 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,17 +1,16 @@ -FROM python:2.7.14-stretch +FROM ubuntu:16.04 RUN mkdir /kubespray WORKDIR /kubespray RUN apt update -y && \ apt install -y \ libssl-dev python-dev sshpass apt-transport-https \ - ca-certificates curl gnupg2 software-properties-common -RUN curl -fsSL https://download.docker.com/linux/$(. /etc/os-release; echo "$ID")/gpg | apt-key add - && \ - add-apt-repository \ - "deb [arch=amd64] https://download.docker.com/linux/$(. /etc/os-release; echo "$ID") \ - $(lsb_release -cs) \ - stable" \ - && apt update -y && apt-get install docker-ce -y - + ca-certificates curl gnupg2 software-properties-common python-pip +RUN curl -fsSL https://download.docker.com/linux/ubuntu/gpg | apt-key add - && \ + add-apt-repository \ + "deb [arch=amd64] https://download.docker.com/linux/ubuntu \ + $(lsb_release -cs) \ + stable" \ + && apt update -y && apt-get install docker-ce -y COPY . . -RUN pip install -r tests/requirements.txt && pip install -r requirements.txt +RUN /usr/bin/python -m pip install pip -U && /usr/bin/python -m pip install -r tests/requirements.txt && python -m pip install -r requirements.txt diff --git a/tests/Makefile b/tests/Makefile index 8c4639b29..638a299f5 100644 --- a/tests/Makefile +++ b/tests/Makefile @@ -5,10 +5,9 @@ $(HOME)/.ssh/id_rsa: init-gce: $(HOME)/.ssh/id_rsa # echo $(GCE_PEM_FILE) | base64 -d > $(HOME)/.ssh/gce - echo "$(GCE_CREDENTIALS_B64)" > $(HOME)/.ssh/gce.json + echo "$(GCE_CREDENTIALS_B64)" | base64 -d > $(HOME)/.ssh/gce.json init-do: $(HOME)/.ssh/id_rsa - pip install dopy==0.3.5 echo $(DO_PRIVATE_KEY) | base64 -d > $(HOME)/.ssh/id_rsa create-gce: init-gce @@ -43,7 +42,7 @@ create-do: init-do delete-do: ansible-playbook -i ../inventory/sample/hosts.ini cloud_playbooks/create-do.yml -c local \ - $LOG_LEVEL \ + $(LOG_LEVEL) \ -e @"files/${CI_JOB_NAME}.yml" \ -e state=absent \ -e test_id=${TEST_ID} \ diff --git a/tests/requirements.txt b/tests/requirements.txt index 01ef7b5ac..0b6163a5d 100644 --- a/tests/requirements.txt +++ b/tests/requirements.txt @@ -3,3 +3,4 @@ yamllint apache-libcloud==2.2.1 boto==2.9.0 tox +dopy From 7a20d698093c254b552480340598f86d5dbcb980 Mon Sep 17 00:00:00 2001 From: Antoine Legrand <2t.antoine@gmail.com> Date: Mon, 12 Feb 2018 16:04:26 +0100 Subject: [PATCH 09/10] fix inventory paths --- .gitlab-ci.yml | 862 +++++++----------- tests/Makefile | 14 +- ...canal-ha-do.yml => do_ubuntu-canal-ha.yml} | 2 +- ...beadm.yml => gce_centos-weave-kubeadm.yml} | 0 ...alico-ha.yml => gce_centos7-calico-ha.yml} | 0 ...ons.yml => gce_centos7-flannel-addons.yml} | 0 ...e-ha.yml => gce_coreos-alpha-weave-ha.yml} | 0 ...lico-aio.yml => gce_coreos-calico-aio.yml} | 0 ...{coreos-canal.yml => gce_coreos-canal.yml} | 0 ...ade.yml => gce_debian8-calico-upgrade.yml} | 0 ...-canal-sep.yml => gce_rhel7-canal-sep.yml} | 0 .../{rhel7-weave.yml => gce_rhel7-weave.yml} | 0 ...u-canal-ha.yml => gce_ubuntu-canal-ha.yml} | 0 ...beadm.yml => gce_ubuntu-canal-kubeadm.yml} | 0 ...ntiv-sep.yml => gce_ubuntu-contiv-sep.yml} | 0 ...nel-sep.yml => gce_ubuntu-flannel-sep.yml} | 0 ...ntu-rkt-sep.yml => gce_ubuntu-rkt-sep.yml} | 0 ...vault-sep.yml => gce_ubuntu-vault-sep.yml} | 0 ...weave-sep.yml => gce_ubuntu-weave-sep.yml} | 0 tests/requirements.txt | 1 + 20 files changed, 351 insertions(+), 528 deletions(-) rename tests/files/{ubuntu-canal-ha-do.yml => do_ubuntu-canal-ha.yml} (88%) rename tests/files/{centos-weave-kubeadm.yml => gce_centos-weave-kubeadm.yml} (100%) rename tests/files/{centos7-calico-ha.yml => gce_centos7-calico-ha.yml} (100%) rename tests/files/{centos7-flannel-addons.yml => gce_centos7-flannel-addons.yml} (100%) rename tests/files/{coreos-alpha-weave-ha.yml => gce_coreos-alpha-weave-ha.yml} (100%) rename tests/files/{coreos-calico-aio.yml => gce_coreos-calico-aio.yml} (100%) rename tests/files/{coreos-canal.yml => gce_coreos-canal.yml} (100%) rename tests/files/{debian8-calico-upgrade.yml => gce_debian8-calico-upgrade.yml} (100%) rename tests/files/{rhel7-canal-sep.yml => gce_rhel7-canal-sep.yml} (100%) rename tests/files/{rhel7-weave.yml => gce_rhel7-weave.yml} (100%) rename tests/files/{ubuntu-canal-ha.yml => gce_ubuntu-canal-ha.yml} (100%) rename tests/files/{ubuntu-canal-kubeadm.yml => gce_ubuntu-canal-kubeadm.yml} (100%) rename tests/files/{ubuntu-contiv-sep.yml => gce_ubuntu-contiv-sep.yml} (100%) rename tests/files/{ubuntu-flannel-sep.yml => gce_ubuntu-flannel-sep.yml} (100%) rename tests/files/{ubuntu-rkt-sep.yml => gce_ubuntu-rkt-sep.yml} (100%) rename tests/files/{ubuntu-vault-sep.yml => gce_ubuntu-vault-sep.yml} (100%) rename tests/files/{ubuntu-weave-sep.yml => gce_ubuntu-weave-sep.yml} (100%) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 2aab53a5b..1b5e8a6a7 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,10 +1,9 @@ stages: - - deploy-do - - moderator - unit-tests - - deploy-gce-part1 - - deploy-gce-part2 - - deploy-gce-special + - moderator + - deploy-part1 + - deploy-part2 + - deploy-special variables: FAILFASTCI_NAMESPACE: 'kargo-ci' @@ -24,7 +23,7 @@ variables: RESET_CHECK: "false" UPGRADE_TEST: "false" KUBEADM_ENABLED: "false" - LOG_LEVEL: "-vvv" + LOG_LEVEL: "-vv" # asia-east1-a # asia-northeast1-a @@ -58,7 +57,7 @@ before_script: CI_PLATFORM: "gce" PRIVATE_KEY: $GCE_PRIVATE_KEY -.do_variableS: &do_variables +.do_variables: &do_variables PRIVATE_KEY: $DO_PRIVATE_KEY CI_PLATFORM: "do" SSH_USER: root @@ -236,253 +235,74 @@ before_script: <<: *do_variables <<: *testcases -# .do: &do -# <<: *job -# <<: *gce -# cache: -# key: "$CI_BUILD_REF_NAME" -# paths: -# - downloads/ -# - $HOME/.cache -# before_script: -# - docker info -# - pip install ansible==2.2.1.0 -# - pip install netaddr -# - pip install apache-libcloud==0.20.1 -# - pip install boto==2.9.0 -# - pip install dopy==0.3.5 -# - mkdir -p /.ssh -# - mkdir -p $HOME/.ssh -# - echo $DO_PRIVATE_KEY | base64 -d > $HOME/.ssh/id_rsa -# - chmod 400 $HOME/.ssh/id_rsa -# - md5sum ~/.ssh/id_rsa -# - ansible-playbook --version -# - export PYPATH=$([ $BOOTSTRAP_OS = coreos ] && echo /opt/bin/python || echo /usr/bin/python ) -# - echo $PYPATH -# script: -# - pwd -# - ls -# - echo ${PWD} -# - > -# ansible-playbook tests/cloud_playbooks/create-do.yml -i tests/local_inventory/hosts.cfg -c local -# ${LOG_LEVEL} -# -e cloud_image=${CLOUD_IMAGE} -# -e cloud_region=${CLOUD_REGION} -# -e inventory_path=${PWD}/inventory/inventory.ini -# -e kube_network_plugin=${KUBE_NETWORK_PLUGIN} -# -e mode=${CLUSTER_MODE} -# -e test_id=${TEST_ID} - -# # Check out latest tag if testing upgrade -# # Uncomment when gitlab kargo repo has tags -# #- test "${UPGRADE_TEST}" = "true" && git fetch --all && git checkout $(git describe --tags $(git rev-list --tags --max-count=1)) -# - test "${UPGRADE_TEST}" = "true" && git checkout 031cf565ec3ccd3ebbe80eeef3454c3780e5c598 && pip install ansible==2.2.0 - - -# # Create cluster -# - > -# ansible-playbook -i inventory/inventory.ini -b --become-user=root --private-key=${HOME}/.ssh/id_rsa -u root -# ${SSH_ARGS} -# ${LOG_LEVEL} -# -e state=present -# -e ansible_python_interpreter=${PYPATH} -# -e ansible_ssh_user=root -# -e bootstrap_os=${BOOTSTRAP_OS} -# -e cert_management=${CERT_MGMT:-script} -# -e cloud_provider=gce -# -e deploy_netchecker=true -# -e download_localhost=true -# -e download_run_once=true -# -e etcd_deployment_type=${ETCD_DEPLOYMENT} -# -e kube_network_plugin=${KUBE_NETWORK_PLUGIN} -# -e kubelet_deployment_type=${KUBELET_DEPLOYMENT} -# -e local_release_dir=${PWD}/downloads -# -e resolvconf_mode=${RESOLVCONF_MODE} -# -e vault_deployment_type=${VAULT_DEPLOYMENT} -# cluster.yml - -# # Repeat deployment if testing upgrade -# #FIXME(mattymo): repeat "Create cluster" above without duplicating code -# - > -# if [ "${UPGRADE_TEST}" = "true" ]; then -# pip install ansible==2.2.1.0; -# git checkout "${CI_BUILD_REF}"; -# ansible-playbook -i inventory/inventory.ini -b --become-user=root --private-key=${HOME}/.ssh/id_rsa -u root -# ${SSH_ARGS} -# ${LOG_LEVEL} -# -e ansible_python_interpreter=${PYPATH} -# -e ansible_ssh_user=root -# -e bootstrap_os=${BOOTSTRAP_OS} -# -e cloud_provider=gce -# -e deploy_netchecker=true -# -e download_localhost=true -# -e download_run_once=true -# -e etcd_deployment_type=${ETCD_DEPLOYMENT} -# -e kube_network_plugin=${KUBE_NETWORK_PLUGIN} -# -e kubelet_deployment_type=${KUBELET_DEPLOYMENT} -# -e local_release_dir=${PWD}/downloads -# -e resolvconf_mode=${RESOLVCONF_MODE} -# -e weave_cpu_requests=${WEAVE_CPU_LIMIT} -# -e weave_cpu_limit=${WEAVE_CPU_LIMIT} -# cluster.yml; -# fi - -# # Tests Cases -# ## Test Master API -# - ansible-playbook -i inventory/inventory.ini -e ansible_python_interpreter=${PYPATH} -u root -e ansible_ssh_user=root $SSH_ARGS -b --become-user=root tests/testcases/010_check-apiserver.yml $LOG_LEVEL - -# ## Ping the between 2 pod -# - ansible-playbook -i inventory/inventory.ini -e ansible_python_interpreter=${PYPATH} -u root -e ansible_ssh_user=root $SSH_ARGS -b --become-user=root tests/testcases/030_check-network.yml $LOG_LEVEL - -# ## Advanced DNS checks -# - ansible-playbook -i inventory/inventory.ini -e ansible_python_interpreter=${PYPATH} -u root -e ansible_ssh_user=root $SSH_ARGS -b --become-user=root tests/testcases/040_check-network-adv.yml $LOG_LEVEL - -# ## Idempotency checks 1/5 (repeat deployment) -# - > -# if [ "${IDEMPOT_CHECK}" = "true" ]; then -# ansible-playbook -i inventory/inventory.ini -u root -e ansible_ssh_user=root $SSH_ARGS -# -b --become-user=root -e cloud_provider=gce $LOG_LEVEL -e kube_network_plugin=${KUBE_NETWORK_PLUGIN} -# --private-key=${HOME}/.ssh/id_rsa -# -e bootstrap_os=${BOOTSTRAP_OS} -# -e ansible_python_interpreter=${PYPATH} -# -e download_run_once=true -# -e download_localhost=true -# -e deploy_netchecker=true -# -e resolvconf_mode=${RESOLVCONF_MODE} -# -e local_release_dir=${PWD}/downloads -# -e etcd_deployment_type=${ETCD_DEPLOYMENT} -# -e kubelet_deployment_type=${KUBELET_DEPLOYMENT} -# cluster.yml; -# fi - -# ## Idempotency checks 2/5 (Advanced DNS checks) -# - > -# if [ "${IDEMPOT_CHECK}" = "true" ]; then -# ansible-playbook -i inventory/inventory.ini -e ansible_python_interpreter=${PYPATH} -# -u root -e ansible_ssh_user=root $SSH_ARGS -b --become-user=root -# tests/testcases/040_check-network-adv.yml $LOG_LEVEL; -# fi - -# ## Idempotency checks 3/5 (reset deployment) -# - > -# if [ "${IDEMPOT_CHECK}" = "true" ]; then -# ansible-playbook -i inventory/inventory.ini -u root -e ansible_ssh_user=root $SSH_ARGS -# -b --become-user=root -e cloud_provider=gce $LOG_LEVEL -e kube_network_plugin=${KUBE_NETWORK_PLUGIN} -# --private-key=${HOME}/.ssh/id_rsa -# -e bootstrap_os=${BOOTSTRAP_OS} -# -e ansible_python_interpreter=${PYPATH} -# reset.yml; -# fi - -# ## Idempotency checks 4/5 (redeploy after reset) -# - > -# if [ "${IDEMPOT_CHECK}" = "true" ]; then -# ansible-playbook -i inventory/inventory.ini -u root -e ansible_ssh_user=root $SSH_ARGS -# -b --become-user=root -e cloud_provider=gce $LOG_LEVEL -e kube_network_plugin=${KUBE_NETWORK_PLUGIN} -# --private-key=${HOME}/.ssh/id_rsa -# -e bootstrap_os=${BOOTSTRAP_OS} -# -e ansible_python_interpreter=${PYPATH} -# -e download_run_once=true -# -e download_localhost=true -# -e deploy_netchecker=true -# -e resolvconf_mode=${RESOLVCONF_MODE} -# -e local_release_dir=${PWD}/downloads -# -e etcd_deployment_type=${ETCD_DEPLOYMENT} -# -e kubelet_deployment_type=${KUBELET_DEPLOYMENT} -# cluster.yml; -# fi - -# ## Idempotency checks 5/5 (Advanced DNS checks) -# - > -# if [ "${IDEMPOT_CHECK}" = "true" ]; then -# ansible-playbook -i inventory/inventory.ini -e ansible_python_interpreter=${PYPATH} -# -u root -e ansible_ssh_user=root $SSH_ARGS -b --become-user=root -# tests/testcases/040_check-network-adv.yml $LOG_LEVEL; -# fi - -# after_script: -# - > -# ansible-playbook -i inventory/inventory.ini tests/cloud_playbooks/create-do.yml -c local $LOG_LEVEL -# -e state=absent -# -e mode=${CLUSTER_MODE} -# -e test_id=${TEST_ID} -# -e kube_network_plugin=${KUBE_NETWORK_PLUGIN} -# -e gce_project_id=${GCE_PROJECT_ID} -# -e gce_service_account_email=${GCE_ACCOUNT} -# -e gce_credentials_file=${HOME}/.ssh/gce.json -# -e cloud_image=${CLOUD_IMAGE} -# -e inventory_path=${PWD}/inventory/inventory.ini -# -e cloud_region=${CLOUD_REGION} - # Test matrix. Leave the comments for markup scripts. .coreos_calico_aio_variables: &coreos_calico_aio_variables -# stage: deploy-gce-part1 +# stage: deploy-part1 MOVED_TO_GROUP_VARS: "true" .ubuntu_canal_ha_variables: &ubuntu_canal_ha_variables -# stage: deploy-gce-part1 +# stage: deploy-part1 UPGRADE_TEST: "graceful" .centos_weave_kubeadm_variables: ¢os_weave_kubeadm_variables -# stage: deploy-gce-part1 +# stage: deploy-part1 UPGRADE_TEST: "graceful" .ubuntu_canal_kubeadm_variables: &ubuntu_canal_kubeadm_variables -# stage: deploy-gce-part1 +# stage: deploy-part1 MOVED_TO_GROUP_VARS: "true" .ubuntu_contiv_sep_variables: &ubuntu_contiv_sep_variables -# stage: deploy-gce-special +# stage: deploy-special MOVED_TO_GROUP_VARS: "true" .rhel7_weave_variables: &rhel7_weave_variables -# stage: deploy-gce-part1 +# stage: deploy-part1 MOVED_TO_GROUP_VARS: "true" .centos7_flannel_addons_variables: ¢os7_flannel_addons_variables -# stage: deploy-gce-part2 +# stage: deploy-part2 MOVED_TO_GROUP_VARS: "true" .debian8_calico_variables: &debian8_calico_variables -# stage: deploy-gce-part2 +# stage: deploy-part2 MOVED_TO_GROUP_VARS: "true" .coreos_canal_variables: &coreos_canal_variables -# stage: deploy-gce-part2 +# stage: deploy-part2 MOVED_TO_GROUP_VARS: "true" .rhel7_canal_sep_variables: &rhel7_canal_sep_variables -# stage: deploy-gce-special +# stage: deploy-special MOVED_TO_GROUP_VARS: "true" .ubuntu_weave_sep_variables: &ubuntu_weave_sep_variables -# stage: deploy-gce-special +# stage: deploy-special MOVED_TO_GROUP_VARS: "true" .centos7_calico_ha_variables: ¢os7_calico_ha_variables -# stage: deploy-gce-special +# stage: deploy-special MOVED_TO_GROUP_VARS: "true" .coreos_alpha_weave_ha_variables: &coreos_alpha_weave_ha_variables -# stage: deploy-gce-special +# stage: deploy-special MOVED_TO_GROUP_VARS: "true" .ubuntu_rkt_sep_variables: &ubuntu_rkt_sep_variables -# stage: deploy-gce-part1 +# stage: deploy-part1 MOVED_TO_GROUP_VARS: "true" .ubuntu_vault_sep_variables: &ubuntu_vault_sep_variables -# stage: deploy-gce-part1 +# stage: deploy-part1 MOVED_TO_GROUP_VARS: "true" .ubuntu_flannel_variables: &ubuntu_flannel_variables -# stage: deploy-gce-special +# stage: deploy-special MOVED_TO_GROUP_VARS: "true" # Builds for PRs only (premoderated by unit-tests step) and triggers (auto) -coreos-calico-aio: - stage: deploy-do - # stage: deploy-gce-part1 +gce_coreos-calico-aio: + stage: deploy-part1 <<: *job <<: *gce variables: @@ -490,327 +310,327 @@ coreos-calico-aio: <<: *gce_variables when: on_success except: ['triggers'] - # only: [/^pr-.*$/] + only: [/^pr-.*$/] -ubuntu-canal-ha-do: - stage: deploy-do +do_ubuntu-canal-ha: + stage: deploy-part1 <<: *job <<: *do variables: <<: *do_variables when: on_success except: ['triggers'] - # only: [/^pr-.*$/] - -# coreos-calico-sep-triggers: -# stage: deploy-gce-part1 -# <<: *job -# <<: *gce -# variables: -# <<: *gce_variables -# <<: *coreos_calico_aio_variables -# when: on_success -# only: ['triggers'] - -# centos7-flannel-addons: -# stage: deploy-gce-part2 -# <<: *job -# <<: *gce -# variables: -# <<: *gce_variables -# <<: *centos7_flannel_addons_variables -# when: on_success -# except: ['triggers'] -# only: [/^pr-.*$/] - -# centos7-flannel-addons-triggers: -# stage: deploy-gce-part1 -# <<: *job -# <<: *gce -# variables: -# <<: *gce_variables -# <<: *centos7_flannel_addons_variables -# when: on_success -# only: ['triggers'] - -# ubuntu-weave-sep: -# stage: deploy-gce-special -# <<: *job -# <<: *gce -# variables: -# <<: *gce_variables -# <<: *ubuntu_weave_sep_variables -# when: on_success -# except: ['triggers'] -# only: [/^pr-.*$/] - -# ubuntu-weave-sep-triggers: -# stage: deploy-gce-part1 -# <<: *job -# <<: *gce -# variables: -# <<: *gce_variables -# <<: *ubuntu_weave_sep_variables -# when: on_success -# only: ['triggers'] - -# # More builds for PRs/merges (manual) and triggers (auto) -# ubuntu-canal-ha: -# stage: deploy-gce-part1 -# <<: *job -# <<: *gce -# variables: -# <<: *gce_variables -# <<: *ubuntu_canal_ha_variables -# when: manual -# except: ['triggers'] -# only: ['master', /^pr-.*$/] - -# ubuntu-canal-ha-triggers: -# stage: deploy-gce-part1 -# <<: *job -# <<: *gce -# variables: -# <<: *gce_variables -# <<: *ubuntu_canal_ha_variables -# when: on_success -# only: ['triggers'] - -# ubuntu-canal-kubeadm: -# stage: deploy-gce-part1 -# <<: *job -# <<: *gce -# variables: -# <<: *gce_variables -# <<: *ubuntu_canal_kubeadm_variables -# when: manual -# except: ['triggers'] -# only: ['master', /^pr-.*$/] - -# ubuntu-canal-kubeadm-triggers: -# stage: deploy-gce-part1 -# <<: *job -# <<: *gce -# variables: -# <<: *gce_variables -# <<: *ubuntu_canal_kubeadm_variables -# when: on_success -# only: ['triggers'] - -# centos-weave-kubeadm: -# stage: deploy-gce-part1 -# <<: *job -# <<: *gce -# variables: -# <<: *gce_variables -# <<: *centos_weave_kubeadm_variables -# when: manual -# except: ['triggers'] -# only: ['master', /^pr-.*$/] - -# centos-weave-kubeadm-triggers: -# stage: deploy-gce-part1 -# <<: *job -# <<: *gce -# variables: -# <<: *gce_variables -# <<: *centos_weave_kubeadm_variables -# when: on_success -# only: ['triggers'] - -# ubuntu-contiv-sep: -# stage: deploy-gce-special -# <<: *job -# <<: *gce -# variables: -# <<: *gce_variables -# <<: *ubuntu_contiv_sep_variables -# when: manual -# except: ['triggers'] -# only: ['master', /^pr-.*$/] - -# rhel7-weave: -# stage: deploy-gce-part1 -# <<: *job -# <<: *gce -# variables: -# <<: *gce_variables -# <<: *rhel7_weave_variables -# when: manual -# except: ['triggers'] -# only: ['master', /^pr-.*$/] - -# rhel7-weave-triggers: -# stage: deploy-gce-part1 -# <<: *job -# <<: *gce -# variables: -# <<: *gce_variables -# <<: *rhel7_weave_variables -# when: on_success -# only: ['triggers'] - -# debian8-calico-upgrade: -# stage: deploy-gce-part2 -# <<: *job -# <<: *gce -# variables: -# <<: *gce_variables -# <<: *debian8_calico_variables -# when: manual -# except: ['triggers'] -# only: ['master', /^pr-.*$/] - -# debian8-calico-triggers: -# stage: deploy-gce-part1 -# <<: *job -# <<: *gce -# variables: -# <<: *gce_variables -# <<: *debian8_calico_variables -# when: on_success -# only: ['triggers'] - -# coreos-canal: -# stage: deploy-gce-part2 -# <<: *job -# <<: *gce -# variables: -# <<: *gce_variables -# <<: *coreos_canal_variables -# when: manual -# except: ['triggers'] -# only: ['master', /^pr-.*$/] - -# coreos-canal-triggers: -# stage: deploy-gce-part1 -# <<: *job -# <<: *gce -# variables: -# <<: *gce_variables -# <<: *coreos_canal_variables -# when: on_success -# only: ['triggers'] - -# rhel7-canal-sep: -# stage: deploy-gce-special -# <<: *job -# <<: *gce -# variables: -# <<: *gce_variables -# <<: *rhel7_canal_sep_variables -# when: manual -# except: ['triggers'] -# only: ['master', /^pr-.*$/,] - -# rhel7-canal-sep-triggers: -# stage: deploy-gce-part1 -# <<: *job -# <<: *gce -# variables: -# <<: *gce_variables -# <<: *rhel7_canal_sep_variables -# when: on_success -# only: ['triggers'] - -# centos7-calico-ha: -# stage: deploy-gce-special -# <<: *job -# <<: *gce -# variables: -# <<: *gce_variables -# <<: *centos7_calico_ha_variables -# when: manual -# except: ['triggers'] -# only: ['master', /^pr-.*$/] - -# centos7-calico-ha-triggers: -# stage: deploy-gce-part1 -# <<: *job -# <<: *gce -# variables: -# <<: *gce_variables -# <<: *centos7_calico_ha_variables -# when: on_success -# only: ['triggers'] - -# # no triggers yet https://github.com/kubernetes-incubator/kargo/issues/613 -# coreos-alpha-weave-ha: -# stage: deploy-gce-special -# <<: *job -# <<: *gce -# variables: -# <<: *gce_variables -# <<: *coreos_alpha_weave_ha_variables -# when: manual -# except: ['triggers'] -# only: ['master', /^pr-.*$/] - -# ubuntu-rkt-sep: -# stage: deploy-gce-part1 -# <<: *job -# <<: *gce -# variables: -# <<: *gce_variables -# <<: *ubuntu_rkt_sep_variables -# when: manual -# except: ['triggers'] -# only: ['master', /^pr-.*$/] - -# ubuntu-vault-sep: -# stage: deploy-gce-part1 -# <<: *job -# <<: *gce -# variables: -# <<: *gce_variables -# <<: *ubuntu_vault_sep_variables -# when: manual -# except: ['triggers'] -# only: ['master', /^pr-.*$/] - -# ubuntu-flannel-sep: -# stage: deploy-gce-special -# <<: *job -# <<: *gce -# variables: -# <<: *gce_variables -# <<: *ubuntu_flannel_variables -# when: manual -# except: ['triggers'] -# only: ['master', /^pr-.*$/] - -# # Premoderated with manual actions -# ci-authorized: -# <<: *job -# stage: moderator -# before_script: -# - apt-get -y install jq -# script: -# - /bin/sh scripts/premoderator.sh -# except: ['triggers', 'master'] - -# syntax-check: -# <<: *job -# stage: unit-tests -# script: -# - ansible-playbook -i inventory/local-tests.cfg -u root -e ansible_ssh_user=root -b --become-user=root cluster.yml -vvv --syntax-check -# - ansible-playbook -i inventory/local-tests.cfg -u root -e ansible_ssh_user=root -b --become-user=root upgrade-cluster.yml -vvv --syntax-check -# - ansible-playbook -i inventory/local-tests.cfg -u root -e ansible_ssh_user=root -b --become-user=root reset.yml -vvv --syntax-check -# - ansible-playbook -i inventory/local-tests.cfg -u root -e ansible_ssh_user=root -b --become-user=root extra_playbooks/upgrade-only-k8s.yml -vvv --syntax-check -# except: ['triggers', 'master'] - -# yamllint: -# <<: *job -# stage: unit-tests -# script: -# - yamllint roles -# except: ['triggers', 'master'] - -# tox-inventory-builder: -# stage: unit-tests -# <<: *job -# script: -# - pip install tox -# - cd contrib/inventory_builder && tox -# when: manual -# except: ['triggers', 'master'] + only: [/^pr-.*$/] + +gce_coreos-calico-sep-triggers: + stage: deploy-part1 + <<: *job + <<: *gce + variables: + <<: *gce_variables + <<: *coreos_calico_aio_variables + when: on_success + only: ['triggers'] + +gce_centos7-flannel-addons: + stage: deploy-part2 + <<: *job + <<: *gce + variables: + <<: *gce_variables + <<: *centos7_flannel_addons_variables + when: on_success + except: ['triggers'] + only: [/^pr-.*$/] + +gce_centos7-flannel-addons-triggers: + stage: deploy-part1 + <<: *job + <<: *gce + variables: + <<: *gce_variables + <<: *centos7_flannel_addons_variables + when: on_success + only: ['triggers'] + +gce_ubuntu-weave-sep: + stage: deploy-special + <<: *job + <<: *gce + variables: + <<: *gce_variables + <<: *ubuntu_weave_sep_variables + when: on_success + except: ['triggers'] + only: [/^pr-.*$/] + +gce_ubuntu-weave-sep-triggers: + stage: deploy-part1 + <<: *job + <<: *gce + variables: + <<: *gce_variables + <<: *ubuntu_weave_sep_variables + when: on_success + only: ['triggers'] + +# More builds for PRs/merges (manual) and triggers (auto) +gce_ubuntu-canal-ha: + stage: deploy-part1 + <<: *job + <<: *gce + variables: + <<: *gce_variables + <<: *ubuntu_canal_ha_variables + when: manual + except: ['triggers'] + only: ['master', /^pr-.*$/] + +gce_ubuntu-canal-ha-triggers: + stage: deploy-part1 + <<: *job + <<: *gce + variables: + <<: *gce_variables + <<: *ubuntu_canal_ha_variables + when: on_success + only: ['triggers'] + +gce_ubuntu-canal-kubeadm: + stage: deploy-part1 + <<: *job + <<: *gce + variables: + <<: *gce_variables + <<: *ubuntu_canal_kubeadm_variables + when: manual + except: ['triggers'] + only: ['master', /^pr-.*$/] + +gce_ubuntu-canal-kubeadm-triggers: + stage: deploy-part1 + <<: *job + <<: *gce + variables: + <<: *gce_variables + <<: *ubuntu_canal_kubeadm_variables + when: on_success + only: ['triggers'] + +gce_centos-weave-kubeadm: + stage: deploy-part1 + <<: *job + <<: *gce + variables: + <<: *gce_variables + <<: *centos_weave_kubeadm_variables + when: manual + except: ['triggers'] + only: ['master', /^pr-.*$/] + +gce_centos-weave-kubeadm-triggers: + stage: deploy-part1 + <<: *job + <<: *gce + variables: + <<: *gce_variables + <<: *centos_weave_kubeadm_variables + when: on_success + only: ['triggers'] + +gce_ubuntu-contiv-sep: + stage: deploy-special + <<: *job + <<: *gce + variables: + <<: *gce_variables + <<: *ubuntu_contiv_sep_variables + when: manual + except: ['triggers'] + only: ['master', /^pr-.*$/] + +gce_rhel7-weave: + stage: deploy-part1 + <<: *job + <<: *gce + variables: + <<: *gce_variables + <<: *rhel7_weave_variables + when: manual + except: ['triggers'] + only: ['master', /^pr-.*$/] + +gce_rhel7-weave-triggers: + stage: deploy-part1 + <<: *job + <<: *gce + variables: + <<: *gce_variables + <<: *rhel7_weave_variables + when: on_success + only: ['triggers'] + +gce_debian8-calico-upgrade: + stage: deploy-part2 + <<: *job + <<: *gce + variables: + <<: *gce_variables + <<: *debian8_calico_variables + when: manual + except: ['triggers'] + only: ['master', /^pr-.*$/] + +gce_debian8-calico-triggers: + stage: deploy-part1 + <<: *job + <<: *gce + variables: + <<: *gce_variables + <<: *debian8_calico_variables + when: on_success + only: ['triggers'] + +gce_coreos-canal: + stage: deploy-part2 + <<: *job + <<: *gce + variables: + <<: *gce_variables + <<: *coreos_canal_variables + when: manual + except: ['triggers'] + only: ['master', /^pr-.*$/] + +gce_coreos-canal-triggers: + stage: deploy-part1 + <<: *job + <<: *gce + variables: + <<: *gce_variables + <<: *coreos_canal_variables + when: on_success + only: ['triggers'] + +gce_rhel7-canal-sep: + stage: deploy-special + <<: *job + <<: *gce + variables: + <<: *gce_variables + <<: *rhel7_canal_sep_variables + when: manual + except: ['triggers'] + only: ['master', /^pr-.*$/,] + +gce_rhel7-canal-sep-triggers: + stage: deploy-part1 + <<: *job + <<: *gce + variables: + <<: *gce_variables + <<: *rhel7_canal_sep_variables + when: on_success + only: ['triggers'] + +gce_centos7-calico-ha: + stage: deploy-special + <<: *job + <<: *gce + variables: + <<: *gce_variables + <<: *centos7_calico_ha_variables + when: manual + except: ['triggers'] + only: ['master', /^pr-.*$/] + +gce_centos7-calico-ha-triggers: + stage: deploy-part1 + <<: *job + <<: *gce + variables: + <<: *gce_variables + <<: *centos7_calico_ha_variables + when: on_success + only: ['triggers'] + +# no triggers yet https://github.com/kubernetes-incubator/kargo/issues/613 +gce_coreos-alpha-weave-ha: + stage: deploy-special + <<: *job + <<: *gce + variables: + <<: *gce_variables + <<: *coreos_alpha_weave_ha_variables + when: manual + except: ['triggers'] + only: ['master', /^pr-.*$/] + +gce_ubuntu-rkt-sep: + stage: deploy-part1 + <<: *job + <<: *gce + variables: + <<: *gce_variables + <<: *ubuntu_rkt_sep_variables + when: manual + except: ['triggers'] + only: ['master', /^pr-.*$/] + +gce_ubuntu-vault-sep: + stage: deploy-part1 + <<: *job + <<: *gce + variables: + <<: *gce_variables + <<: *ubuntu_vault_sep_variables + when: manual + except: ['triggers'] + only: ['master', /^pr-.*$/] + +gce_ubuntu-flannel-sep: + stage: deploy-special + <<: *job + <<: *gce + variables: + <<: *gce_variables + <<: *ubuntu_flannel_variables + when: manual + except: ['triggers'] + only: ['master', /^pr-.*$/] + +# Premoderated with manual actions +ci-authorized: + <<: *job + stage: moderator + before_script: + - apt-get -y install jq + script: + - /bin/sh scripts/premoderator.sh + except: ['triggers', 'master'] + +syntax-check: + <<: *job + stage: unit-tests + script: + - ansible-playbook -i inventory/local-tests.cfg -u root -e ansible_ssh_user=root -b --become-user=root cluster.yml -vvv --syntax-check + - ansible-playbook -i inventory/local-tests.cfg -u root -e ansible_ssh_user=root -b --become-user=root upgrade-cluster.yml -vvv --syntax-check + - ansible-playbook -i inventory/local-tests.cfg -u root -e ansible_ssh_user=root -b --become-user=root reset.yml -vvv --syntax-check + - ansible-playbook -i inventory/local-tests.cfg -u root -e ansible_ssh_user=root -b --become-user=root extra_playbooks/upgrade-only-k8s.yml -vvv --syntax-check + except: ['triggers', 'master'] + +yamllint: + <<: *job + stage: unit-tests + script: + - yamllint roles + except: ['triggers', 'master'] + +tox-inventory-builder: + stage: unit-tests + <<: *job + script: + - pip install tox + - cd contrib/inventory_builder && tox + when: manual + except: ['triggers', 'master'] diff --git a/tests/Makefile b/tests/Makefile index 638a299f5..8d17e243c 100644 --- a/tests/Makefile +++ b/tests/Makefile @@ -1,3 +1,5 @@ +INVENTORY=$(PWD)/../inventory/sample/hosts.ini + $(HOME)/.ssh/id_rsa: mkdir -p $(HOME)/.ssh echo $(PRIVATE_KEY) | base64 -d > $(HOME)/.ssh/id_rsa @@ -17,33 +19,33 @@ create-gce: init-gce -e gce_credentials_file=$(HOME)/.ssh/gce.json \ -e gce_project_id=$(GCE_PROJECT_ID) \ -e gce_service_account_email=$(GCE_ACCOUNT) \ - -e inventory_path=$(PWD)/../inventory/sample/hosts.ini \ + -e inventory_path=$(INVENTORY) \ -e test_id=$(TEST_ID) \ -e preemptible=$(GCE_PREEMPTIBLE) delete-gce: - ansible-playbook -i ../inventory/sample/hosts.ini cloud_playbooks/delete-gce.yml -c local \ + ansible-playbook -i $(INVENTORY) cloud_playbooks/delete-gce.yml -c local \ $(LOG_LEVEL) \ -e @"files/${CI_JOB_NAME}.yml" \ -e test_id=$(TEST_ID) \ -e gce_project_id=$(GCE_PROJECT_ID) \ -e gce_service_account_email=$(GCE_ACCOUNT) \ -e gce_credentials_file=$(HOME)/.ssh/gce.json \ - -e inventory_path=$(PWD)/inventory/sample/hosts.ini + -e inventory_path=$(INVENTORY) create-do: init-do ansible-playbook cloud_playbooks/create-do.yml -i local_inventory/hosts.cfg -c local \ ${LOG_LEVEL} \ -e @"files/${CI_JOB_NAME}.yml" \ - -e inventory_path=${PWD}/../inventory/hosts.ini \ + -e inventory_path=$(INVENTORY) \ -e test_id=${TEST_ID} delete-do: - ansible-playbook -i ../inventory/sample/hosts.ini cloud_playbooks/create-do.yml -c local \ + ansible-playbook -i $(INVENTORY) cloud_playbooks/create-do.yml -c local \ $(LOG_LEVEL) \ -e @"files/${CI_JOB_NAME}.yml" \ -e state=absent \ -e test_id=${TEST_ID} \ - -e inventory_path=${PWD}/../inventory/inventory.ini \ + -e inventory_path=$(INVENTORY) diff --git a/tests/files/ubuntu-canal-ha-do.yml b/tests/files/do_ubuntu-canal-ha.yml similarity index 88% rename from tests/files/ubuntu-canal-ha-do.yml rename to tests/files/do_ubuntu-canal-ha.yml index 94a4af67a..e91dfd7c1 100644 --- a/tests/files/ubuntu-canal-ha-do.yml +++ b/tests/files/do_ubuntu-canal-ha.yml @@ -7,4 +7,4 @@ bootstrap_os: ubuntu kube_network_plugin: canal deploy_netchecker: true kubedns_min_replicas: 1 -cloud_provider: 'do' +# cloud_provider: 'do' diff --git a/tests/files/centos-weave-kubeadm.yml b/tests/files/gce_centos-weave-kubeadm.yml similarity index 100% rename from tests/files/centos-weave-kubeadm.yml rename to tests/files/gce_centos-weave-kubeadm.yml diff --git a/tests/files/centos7-calico-ha.yml b/tests/files/gce_centos7-calico-ha.yml similarity index 100% rename from tests/files/centos7-calico-ha.yml rename to tests/files/gce_centos7-calico-ha.yml diff --git a/tests/files/centos7-flannel-addons.yml b/tests/files/gce_centos7-flannel-addons.yml similarity index 100% rename from tests/files/centos7-flannel-addons.yml rename to tests/files/gce_centos7-flannel-addons.yml diff --git a/tests/files/coreos-alpha-weave-ha.yml b/tests/files/gce_coreos-alpha-weave-ha.yml similarity index 100% rename from tests/files/coreos-alpha-weave-ha.yml rename to tests/files/gce_coreos-alpha-weave-ha.yml diff --git a/tests/files/coreos-calico-aio.yml b/tests/files/gce_coreos-calico-aio.yml similarity index 100% rename from tests/files/coreos-calico-aio.yml rename to tests/files/gce_coreos-calico-aio.yml diff --git a/tests/files/coreos-canal.yml b/tests/files/gce_coreos-canal.yml similarity index 100% rename from tests/files/coreos-canal.yml rename to tests/files/gce_coreos-canal.yml diff --git a/tests/files/debian8-calico-upgrade.yml b/tests/files/gce_debian8-calico-upgrade.yml similarity index 100% rename from tests/files/debian8-calico-upgrade.yml rename to tests/files/gce_debian8-calico-upgrade.yml diff --git a/tests/files/rhel7-canal-sep.yml b/tests/files/gce_rhel7-canal-sep.yml similarity index 100% rename from tests/files/rhel7-canal-sep.yml rename to tests/files/gce_rhel7-canal-sep.yml diff --git a/tests/files/rhel7-weave.yml b/tests/files/gce_rhel7-weave.yml similarity index 100% rename from tests/files/rhel7-weave.yml rename to tests/files/gce_rhel7-weave.yml diff --git a/tests/files/ubuntu-canal-ha.yml b/tests/files/gce_ubuntu-canal-ha.yml similarity index 100% rename from tests/files/ubuntu-canal-ha.yml rename to tests/files/gce_ubuntu-canal-ha.yml diff --git a/tests/files/ubuntu-canal-kubeadm.yml b/tests/files/gce_ubuntu-canal-kubeadm.yml similarity index 100% rename from tests/files/ubuntu-canal-kubeadm.yml rename to tests/files/gce_ubuntu-canal-kubeadm.yml diff --git a/tests/files/ubuntu-contiv-sep.yml b/tests/files/gce_ubuntu-contiv-sep.yml similarity index 100% rename from tests/files/ubuntu-contiv-sep.yml rename to tests/files/gce_ubuntu-contiv-sep.yml diff --git a/tests/files/ubuntu-flannel-sep.yml b/tests/files/gce_ubuntu-flannel-sep.yml similarity index 100% rename from tests/files/ubuntu-flannel-sep.yml rename to tests/files/gce_ubuntu-flannel-sep.yml diff --git a/tests/files/ubuntu-rkt-sep.yml b/tests/files/gce_ubuntu-rkt-sep.yml similarity index 100% rename from tests/files/ubuntu-rkt-sep.yml rename to tests/files/gce_ubuntu-rkt-sep.yml diff --git a/tests/files/ubuntu-vault-sep.yml b/tests/files/gce_ubuntu-vault-sep.yml similarity index 100% rename from tests/files/ubuntu-vault-sep.yml rename to tests/files/gce_ubuntu-vault-sep.yml diff --git a/tests/files/ubuntu-weave-sep.yml b/tests/files/gce_ubuntu-weave-sep.yml similarity index 100% rename from tests/files/ubuntu-weave-sep.yml rename to tests/files/gce_ubuntu-weave-sep.yml diff --git a/tests/requirements.txt b/tests/requirements.txt index 0b6163a5d..37067448d 100644 --- a/tests/requirements.txt +++ b/tests/requirements.txt @@ -4,3 +4,4 @@ apache-libcloud==2.2.1 boto==2.9.0 tox dopy +PyCrypto From e5a450349bf0ba6011dffabd711e116178896b46 Mon Sep 17 00:00:00 2001 From: Antoine Legrand <2t.antoine@gmail.com> Date: Tue, 13 Feb 2018 12:30:14 +0100 Subject: [PATCH 10/10] Single step CI --- .gitlab-ci.yml | 81 +++++++++++++++++++++++++++----------------------- 1 file changed, 43 insertions(+), 38 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 1b5e8a6a7..9241e0bb9 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -300,7 +300,9 @@ before_script: # stage: deploy-special MOVED_TO_GROUP_VARS: "true" + # Builds for PRs only (premoderated by unit-tests step) and triggers (auto) +### PR JOBS gce_coreos-calico-aio: stage: deploy-part1 <<: *job @@ -322,50 +324,63 @@ do_ubuntu-canal-ha: except: ['triggers'] only: [/^pr-.*$/] -gce_coreos-calico-sep-triggers: +gce_centos7-flannel-addons: stage: deploy-part1 <<: *job <<: *gce variables: <<: *gce_variables - <<: *coreos_calico_aio_variables + <<: *centos7_flannel_addons_variables when: on_success - only: ['triggers'] + except: ['triggers'] + only: [/^pr-.*$/] -gce_centos7-flannel-addons: - stage: deploy-part2 +gce_ubuntu-weave-sep: + stage: deploy-part1 <<: *job <<: *gce variables: <<: *gce_variables - <<: *centos7_flannel_addons_variables + <<: *ubuntu_weave_sep_variables when: on_success except: ['triggers'] only: [/^pr-.*$/] -gce_centos7-flannel-addons-triggers: - stage: deploy-part1 +### MANUAL JOBS +gce_coreos-calico-sep-triggers: + stage: deploy-part2 <<: *job <<: *gce variables: <<: *gce_variables - <<: *centos7_flannel_addons_variables + <<: *coreos_calico_aio_variables when: on_success only: ['triggers'] -gce_ubuntu-weave-sep: - stage: deploy-special + +gce_ubuntu-canal-ha-triggers: + stage: deploy-part2 <<: *job <<: *gce variables: <<: *gce_variables - <<: *ubuntu_weave_sep_variables + <<: *ubuntu_canal_ha_variables when: on_success - except: ['triggers'] - only: [/^pr-.*$/] + only: ['triggers'] + +gce_centos7-flannel-addons-triggers: + stage: deploy-part2 + <<: *job + <<: *gce + variables: + <<: *gce_variables + <<: *centos7_flannel_addons_variables + when: on_success + only: ['triggers'] + gce_ubuntu-weave-sep-triggers: - stage: deploy-part1 + stage: deploy-part2 <<: *job <<: *gce variables: @@ -376,7 +391,7 @@ gce_ubuntu-weave-sep-triggers: # More builds for PRs/merges (manual) and triggers (auto) gce_ubuntu-canal-ha: - stage: deploy-part1 + stage: deploy-part2 <<: *job <<: *gce variables: @@ -386,18 +401,8 @@ gce_ubuntu-canal-ha: except: ['triggers'] only: ['master', /^pr-.*$/] -gce_ubuntu-canal-ha-triggers: - stage: deploy-part1 - <<: *job - <<: *gce - variables: - <<: *gce_variables - <<: *ubuntu_canal_ha_variables - when: on_success - only: ['triggers'] - gce_ubuntu-canal-kubeadm: - stage: deploy-part1 + stage: deploy-part2 <<: *job <<: *gce variables: @@ -408,7 +413,7 @@ gce_ubuntu-canal-kubeadm: only: ['master', /^pr-.*$/] gce_ubuntu-canal-kubeadm-triggers: - stage: deploy-part1 + stage: deploy-part2 <<: *job <<: *gce variables: @@ -418,7 +423,7 @@ gce_ubuntu-canal-kubeadm-triggers: only: ['triggers'] gce_centos-weave-kubeadm: - stage: deploy-part1 + stage: deploy-part2 <<: *job <<: *gce variables: @@ -429,7 +434,7 @@ gce_centos-weave-kubeadm: only: ['master', /^pr-.*$/] gce_centos-weave-kubeadm-triggers: - stage: deploy-part1 + stage: deploy-part2 <<: *job <<: *gce variables: @@ -450,7 +455,7 @@ gce_ubuntu-contiv-sep: only: ['master', /^pr-.*$/] gce_rhel7-weave: - stage: deploy-part1 + stage: deploy-part2 <<: *job <<: *gce variables: @@ -461,7 +466,7 @@ gce_rhel7-weave: only: ['master', /^pr-.*$/] gce_rhel7-weave-triggers: - stage: deploy-part1 + stage: deploy-part2 <<: *job <<: *gce variables: @@ -482,7 +487,7 @@ gce_debian8-calico-upgrade: only: ['master', /^pr-.*$/] gce_debian8-calico-triggers: - stage: deploy-part1 + stage: deploy-part2 <<: *job <<: *gce variables: @@ -503,7 +508,7 @@ gce_coreos-canal: only: ['master', /^pr-.*$/] gce_coreos-canal-triggers: - stage: deploy-part1 + stage: deploy-part2 <<: *job <<: *gce variables: @@ -524,7 +529,7 @@ gce_rhel7-canal-sep: only: ['master', /^pr-.*$/,] gce_rhel7-canal-sep-triggers: - stage: deploy-part1 + stage: deploy-part2 <<: *job <<: *gce variables: @@ -545,7 +550,7 @@ gce_centos7-calico-ha: only: ['master', /^pr-.*$/] gce_centos7-calico-ha-triggers: - stage: deploy-part1 + stage: deploy-part2 <<: *job <<: *gce variables: @@ -567,7 +572,7 @@ gce_coreos-alpha-weave-ha: only: ['master', /^pr-.*$/] gce_ubuntu-rkt-sep: - stage: deploy-part1 + stage: deploy-part2 <<: *job <<: *gce variables: @@ -578,7 +583,7 @@ gce_ubuntu-rkt-sep: only: ['master', /^pr-.*$/] gce_ubuntu-vault-sep: - stage: deploy-part1 + stage: deploy-part2 <<: *job <<: *gce variables: