From a52bc44f5a7c874810161dc919ece64cf605158a Mon Sep 17 00:00:00 2001 From: Matthew Mosesohn Date: Wed, 25 Oct 2017 11:45:54 +0100 Subject: [PATCH] Fix broken CI jobs (#1854) * Fix broken CI jobs Adjust image and image_family scenarios for debian. Checkout CI file for upgrades * add debugging to file download * Fix download for alternate playbooks * Update ansible ssh args to force ssh user * Update sync_container.yml --- .gitlab-ci.yml | 2 ++ ansible.cfg | 4 ++-- extra_playbooks/upgrade-only-k8s.yml | 1 + roles/download/tasks/download_file.yml | 6 ++++++ roles/download/tasks/sync_container.yml | 4 ++-- tests/ansible.cfg | 2 +- tests/cloud_playbooks/create-gce.yml | 3 ++- tests/files/centos-weave-kubeadm.yml | 4 ++-- tests/files/centos7-calico-ha.yml | 6 +++--- tests/files/centos7-flannel-addons.yml | 2 +- tests/files/coreos-alpha-weave-ha.yml | 2 +- tests/files/coreos-calico-aio.yml | 2 +- tests/files/coreos-canal.yml | 2 +- .../{debian8-calico.yml => debian8-calico-upgrade.yml} | 0 tests/files/rhel7-canal-sep.yml | 2 +- tests/files/rhel7-weave.yml | 2 +- tests/files/ubuntu-canal-ha.yml | 2 +- tests/files/ubuntu-canal-kubeadm.yml | 4 ++-- tests/files/{ubuntu-flannel.yml => ubuntu-flannel-sep.yml} | 2 +- tests/files/ubuntu-rkt-sep.yml | 4 +++- tests/files/ubuntu-vault-sep.yml | 2 +- tests/files/ubuntu-weave-sep.yml | 2 +- upgrade-cluster.yml | 1 + 23 files changed, 37 insertions(+), 24 deletions(-) rename tests/files/{debian8-calico.yml => debian8-calico-upgrade.yml} (100%) rename tests/files/{ubuntu-flannel.yml => ubuntu-flannel-sep.yml} (85%) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 08b7f0383..0971e6ba9 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -96,6 +96,8 @@ before_script: # Uncomment when gitlab kargo repo has tags #- test "${UPGRADE_TEST}" != "false" && git fetch --all && git checkout $(git describe --tags $(git rev-list --tags --max-count=1)) - test "${UPGRADE_TEST}" != "false" && git checkout 72ae7638bcc94c66afa8620dfa4ad9a9249327ea + # Checkout the CI vars file so it is available + - test "${UPGRADE_TEST}" != "false" && git checkout "${CI_BUILD_REF}" tests/files/${CI_JOB_NAME}.yml # Create cluster diff --git a/ansible.cfg b/ansible.cfg index 20534b1f2..181262cc6 100644 --- a/ansible.cfg +++ b/ansible.cfg @@ -1,7 +1,7 @@ [ssh_connection] pipelining=True -ssh_args = -o ControlMaster=auto -o ControlPersist=30m -o ConnectionAttempts=100 -#ssh_args = -F ./ssh-bastion.conf -o ControlMaster=auto -o ControlPersist=30m -o ConnectionAttempts=100 +ansible_ssh_common_args = -o ControlMaster=auto -o ControlPersist=30m -o ConnectionAttempts=100 +#ansible_ssh_common_args = -F {{ inventory_dir|quote }}/ssh-bastion.conf -o ControlMaster=auto -o ControlPersist=30m -o ConnectionAttempts=100 #control_path = ~/.ssh/ansible-%%r@%%h:%%p [defaults] host_key_checking=False diff --git a/extra_playbooks/upgrade-only-k8s.yml b/extra_playbooks/upgrade-only-k8s.yml index c2af6a301..90ee84ec9 100644 --- a/extra_playbooks/upgrade-only-k8s.yml +++ b/extra_playbooks/upgrade-only-k8s.yml @@ -3,6 +3,7 @@ ### * Will not upgrade etcd ### * Will not upgrade network plugins ### * Will not upgrade Docker +### * Will not pre-download containers or kubeadm ### * Currently does not support Vault deployment. ### ### In most cases, you probably want to use upgrade-cluster.yml playbook and diff --git a/roles/download/tasks/download_file.yml b/roles/download/tasks/download_file.yml index dfbfc348d..e0497962a 100644 --- a/roles/download/tasks/download_file.yml +++ b/roles/download/tasks/download_file.yml @@ -1,4 +1,10 @@ --- +- name: file_download | Downloading... + debug: + msg: + - "URL: {{ download.url }}" + - "Dest: {{ download.dest }}" + - name: file_download | Create dest directory file: path: "{{local_release_dir}}/{{download.dest|dirname}}" diff --git a/roles/download/tasks/sync_container.yml b/roles/download/tasks/sync_container.yml index 146706543..2a03b014c 100644 --- a/roles/download/tasks/sync_container.yml +++ b/roles/download/tasks/sync_container.yml @@ -62,7 +62,7 @@ synchronize: src: "{{ fname }}" dest: "{{ fname }}" - use_ssh_args: yes + use_ssh_args: "{{ has_bastion | default(false) }}" mode: pull delegate_to: localhost delegate_facts: no @@ -81,7 +81,7 @@ synchronize: src: "{{ fname }}" dest: "{{ fname }}" - use_ssh_args: yes + use_ssh_args: "{{ has_bastion | default(false) }}" mode: push delegate_to: localhost delegate_facts: no diff --git a/tests/ansible.cfg b/tests/ansible.cfg index a7d2e0183..780e1524b 100644 --- a/tests/ansible.cfg +++ b/tests/ansible.cfg @@ -1,6 +1,6 @@ [ssh_connection] pipelining=True -ssh_args = -o ControlMaster=auto -o ControlPersist=30m -o ConnectionAttempts=100 +ansible_ssh_common_args = -o ControlMaster=auto -o ControlPersist=30m -o ConnectionAttempts=100 [defaults] forks = 20 host_key_checking=False diff --git a/tests/cloud_playbooks/create-gce.yml b/tests/cloud_playbooks/create-gce.yml index 088479de8..fdb20e375 100644 --- a/tests/cloud_playbooks/create-gce.yml +++ b/tests/cloud_playbooks/create-gce.yml @@ -29,7 +29,8 @@ gce: instance_names: "{{instance_names}}" machine_type: "{{ cloud_machine_type }}" - image_family: "{{ cloud_image }}" + image: "{{ cloud_image | default(omit) }}" + image_family: "{{ cloud_image_family | default(omit) }}" preemptible: "{{ preemptible }}" service_account_email: "{{ gce_service_account_email }}" pem_file: "{{ gce_pem_file | default(omit)}}" diff --git a/tests/files/centos-weave-kubeadm.yml b/tests/files/centos-weave-kubeadm.yml index de7d064e2..b4cd8e17c 100644 --- a/tests/files/centos-weave-kubeadm.yml +++ b/tests/files/centos-weave-kubeadm.yml @@ -1,5 +1,5 @@ # Instance settings -cloud_image: centos-7 +cloud_image_family: centos-7 cloud_machine_type: "n1-standard-1" cloud_region: us-central1-b mode: ha @@ -9,7 +9,7 @@ startup_script: "" kube_network_plugin: weave weave_cpu_limit: "100m" weave_cpu_requests: "100m" -kubeadm_enabled: "true" +kubeadm_enabled: true deploy_netchecker: true kubedns_min_replicas: 1 cloud_provider: gce diff --git a/tests/files/centos7-calico-ha.yml b/tests/files/centos7-calico-ha.yml index 32a633ff9..a34ab2dfb 100644 --- a/tests/files/centos7-calico-ha.yml +++ b/tests/files/centos7-calico-ha.yml @@ -1,12 +1,12 @@ # Instance settings -cloud_image: centos-7 +cloud_image_family: centos-7 cloud_region: europe-west1-b mode: ha-scale # Deployment settings kube_network_plugin: calico -download_localhost: "true" -download_run_once: "true" +download_localhost: true +download_run_once: true deploy_netchecker: true kubedns_min_replicas: 1 cloud_provider: gce diff --git a/tests/files/centos7-flannel-addons.yml b/tests/files/centos7-flannel-addons.yml index 6022cc489..70da8d13e 100644 --- a/tests/files/centos7-flannel-addons.yml +++ b/tests/files/centos7-flannel-addons.yml @@ -1,5 +1,5 @@ # Instance settings -cloud_image: centos-7 +cloud_image_family: centos-7 cloud_region: us-west1-a cloud_machine_type: "n1-standard-1" mode: default diff --git a/tests/files/coreos-alpha-weave-ha.yml b/tests/files/coreos-alpha-weave-ha.yml index df00cd31c..d8087c621 100644 --- a/tests/files/coreos-alpha-weave-ha.yml +++ b/tests/files/coreos-alpha-weave-ha.yml @@ -1,5 +1,5 @@ # Instance settings -cloud_image: coreos-alpha +cloud_image_family: coreos-alpha cloud_region: us-west1-a mode: ha-scale startup_script: 'systemctl disable locksmithd && systemctl stop locksmithd' diff --git a/tests/files/coreos-calico-aio.yml b/tests/files/coreos-calico-aio.yml index 030eb74be..37ff7ac8f 100644 --- a/tests/files/coreos-calico-aio.yml +++ b/tests/files/coreos-calico-aio.yml @@ -1,5 +1,5 @@ # Instance settings -cloud_image: coreos-stable +cloud_image_family: coreos-stable cloud_region: us-west1-b cloud_machine_type: "n1-standard-2" mode: aio diff --git a/tests/files/coreos-canal.yml b/tests/files/coreos-canal.yml index e5bc5eba0..afbedc30c 100644 --- a/tests/files/coreos-canal.yml +++ b/tests/files/coreos-canal.yml @@ -1,5 +1,5 @@ # Instance settings -cloud_image: coreos-stable +cloud_image_family: coreos-stable cloud_region: us-east1-b mode: default startup_script: 'systemctl disable locksmithd && systemctl stop locksmithd' diff --git a/tests/files/debian8-calico.yml b/tests/files/debian8-calico-upgrade.yml similarity index 100% rename from tests/files/debian8-calico.yml rename to tests/files/debian8-calico-upgrade.yml diff --git a/tests/files/rhel7-canal-sep.yml b/tests/files/rhel7-canal-sep.yml index 3742c8025..2fc39cbb1 100644 --- a/tests/files/rhel7-canal-sep.yml +++ b/tests/files/rhel7-canal-sep.yml @@ -1,5 +1,5 @@ # Instance settings -cloud_image: rhel-7 +cloud_image_family: rhel-7 cloud_region: us-east1-b mode: separate diff --git a/tests/files/rhel7-weave.yml b/tests/files/rhel7-weave.yml index 41b2fc981..66804df5c 100644 --- a/tests/files/rhel7-weave.yml +++ b/tests/files/rhel7-weave.yml @@ -1,5 +1,5 @@ # Instance settings -cloud_image: rhel-7 +cloud_image_family: rhel-7 cloud_region: europe-west1-b mode: default diff --git a/tests/files/ubuntu-canal-ha.yml b/tests/files/ubuntu-canal-ha.yml index c86a5f8b8..7900c055b 100644 --- a/tests/files/ubuntu-canal-ha.yml +++ b/tests/files/ubuntu-canal-ha.yml @@ -1,5 +1,5 @@ # Instance settings -cloud_image: ubuntu-1604-lts +cloud_image_family: ubuntu-1604-lts cloud_region: europe-west1-b mode: ha diff --git a/tests/files/ubuntu-canal-kubeadm.yml b/tests/files/ubuntu-canal-kubeadm.yml index ede3b9ef5..93574118f 100644 --- a/tests/files/ubuntu-canal-kubeadm.yml +++ b/tests/files/ubuntu-canal-kubeadm.yml @@ -1,5 +1,5 @@ # Instance settings -cloud_image: ubuntu-1604-lts +cloud_image_family: ubuntu-1604-lts cloud_machine_type: "n1-standard-1" cloud_region: europe-west1-b mode: ha @@ -7,7 +7,7 @@ mode: ha # Deployment settings bootstrap_os: ubuntu kube_network_plugin: canal -kubeadm_enabled: "true" +kubeadm_enabled: true deploy_netchecker: true kubedns_min_replicas: 1 cloud_provider: gce diff --git a/tests/files/ubuntu-flannel.yml b/tests/files/ubuntu-flannel-sep.yml similarity index 85% rename from tests/files/ubuntu-flannel.yml rename to tests/files/ubuntu-flannel-sep.yml index 815d6ff9c..6292926c8 100644 --- a/tests/files/ubuntu-flannel.yml +++ b/tests/files/ubuntu-flannel-sep.yml @@ -1,5 +1,5 @@ # Instance settings -cloud_image: ubuntu-1604-lts +cloud_image_family: ubuntu-1604-lts cloud_region: europe-west1-b mode: separate diff --git a/tests/files/ubuntu-rkt-sep.yml b/tests/files/ubuntu-rkt-sep.yml index 8cc71534d..297ce5be0 100644 --- a/tests/files/ubuntu-rkt-sep.yml +++ b/tests/files/ubuntu-rkt-sep.yml @@ -1,5 +1,5 @@ # Instance settings -cloud_image: ubuntu-1604-lts +cloud_image_family: ubuntu-1604-lts cloud_region: us-central1-b mode: separate @@ -8,6 +8,8 @@ bootstrap_os: ubuntu kube_network_plugin: flannel etcd_deployment: rkt kubelet_deployment: rkt +download_localhost: true +download_run_once: true deploy_netchecker: true kubedns_min_replicas: 1 cloud_provider: gce diff --git a/tests/files/ubuntu-vault-sep.yml b/tests/files/ubuntu-vault-sep.yml index 58a519c9a..2e4926f21 100644 --- a/tests/files/ubuntu-vault-sep.yml +++ b/tests/files/ubuntu-vault-sep.yml @@ -1,6 +1,6 @@ # Instance settings cloud_machine_type: "n1-standard-1" -cloud_image: ubuntu-1604-lts +cloud_image_family: ubuntu-1604-lts cloud_region: us-central1-b mode: separate diff --git a/tests/files/ubuntu-weave-sep.yml b/tests/files/ubuntu-weave-sep.yml index 34a39af3c..9ab13c278 100644 --- a/tests/files/ubuntu-weave-sep.yml +++ b/tests/files/ubuntu-weave-sep.yml @@ -1,5 +1,5 @@ # Instance settings -cloud_image: ubuntu-1604-lts +cloud_image_family: ubuntu-1604-lts cloud_region: us-central1-b mode: separate diff --git a/upgrade-cluster.yml b/upgrade-cluster.yml index a377a625a..747ed6023 100644 --- a/upgrade-cluster.yml +++ b/upgrade-cluster.yml @@ -32,6 +32,7 @@ - role: rkt tags: rkt when: "'rkt' in [etcd_deployment_type, kubelet_deployment_type, vault_deployment_type]" + - { role: download, tags: download, skip_downloads: false } - hosts: etcd:k8s-cluster:vault any_errors_fatal: "{{ any_errors_fatal | default(true) }}"