|
| 1 | +--- |
| 2 | +# CI update variant for OpenStack version updates |
| 3 | +# This variant is used in CI jobs for testing minor version updates from one |
| 4 | +# release to another (e.g., FR3 -> FR4) using index images and install_yamls make targets. |
| 5 | + |
| 6 | +- name: Set cifmw_basedir if not defined |
| 7 | + ansible.builtin.set_fact: |
| 8 | + cifmw_basedir: "{{ cifmw_basedir | default(ansible_user_dir ~ '/ci-framework-data') }}" |
| 9 | + |
| 10 | +- name: Load all parameter files |
| 11 | + ansible.builtin.include_vars: |
| 12 | + dir: "{{ cifmw_basedir }}/artifacts/parameters" |
| 13 | + |
| 14 | +- name: Set update step to Running openstack cleanup |
| 15 | + ansible.builtin.command: |
| 16 | + cmd: > |
| 17 | + {{ cifmw_update_artifacts_basedir }}/update_event.sh |
| 18 | + Running openstack cleanup |
| 19 | +
|
| 20 | +- name: Run make openstack_cleanup |
| 21 | + vars: |
| 22 | + make_openstack_cleanup_env: "{{ cifmw_install_yamls_environment | combine({'PATH': cifmw_path }) }}" |
| 23 | + make_openstack_cleanup_dryrun: false |
| 24 | + ansible.builtin.include_role: |
| 25 | + name: 'install_yamls_makes' |
| 26 | + tasks_from: 'make_openstack_cleanup' |
| 27 | + |
| 28 | +- name: Set update step to Running openstack wait |
| 29 | + ansible.builtin.command: |
| 30 | + cmd: > |
| 31 | + {{ cifmw_update_artifacts_basedir }}/update_event.sh |
| 32 | + Running openstack wait |
| 33 | +
|
| 34 | +- name: Run make openstack_wait |
| 35 | + vars: |
| 36 | + make_openstack_wait_env: "{{ cifmw_install_yamls_environment | combine({'PATH': cifmw_path }) }}" |
| 37 | + make_openstack_wait_dryrun: false |
| 38 | + ansible.builtin.include_role: |
| 39 | + name: 'install_yamls_makes' |
| 40 | + tasks_from: 'make_openstack_wait' |
| 41 | + |
| 42 | +- name: Set update step to Running openstack init |
| 43 | + ansible.builtin.command: |
| 44 | + cmd: > |
| 45 | + {{ cifmw_update_artifacts_basedir }}/update_event.sh |
| 46 | + Running openstack init |
| 47 | +
|
| 48 | +- name: Run make openstack_init |
| 49 | + vars: |
| 50 | + make_openstack_init_env: "{{ cifmw_install_yamls_environment | combine({'PATH': cifmw_path }) }}" |
| 51 | + make_openstack_init_dryrun: false |
| 52 | + ansible.builtin.include_role: |
| 53 | + name: 'install_yamls_makes' |
| 54 | + tasks_from: 'make_openstack_init' |
| 55 | + |
| 56 | +- name: Set update step to Waiting for new version to be available |
| 57 | + ansible.builtin.command: |
| 58 | + cmd: > |
| 59 | + {{ cifmw_update_artifacts_basedir }}/update_event.sh |
| 60 | + Waiting for new version to be available |
| 61 | +
|
| 62 | +- name: Wait for availableVersion to be different from deployedVersion |
| 63 | + kubernetes.core.k8s_info: |
| 64 | + kubeconfig: "{{ cifmw_openshift_kubeconfig }}" |
| 65 | + api_key: "{{ cifmw_openshift_token | default(omit) }}" |
| 66 | + context: "{{ cifmw_openshift_context | default(omit) }}" |
| 67 | + api_version: core.openstack.org/v1beta1 |
| 68 | + kind: OpenStackVersion |
| 69 | + namespace: "{{ cifmw_update_namespace }}" |
| 70 | + register: openstackversion_wait_info |
| 71 | + retries: 10 |
| 72 | + delay: 60 |
| 73 | + until: > |
| 74 | + openstackversion_wait_info.resources is defined and |
| 75 | + openstackversion_wait_info.resources | length > 0 and |
| 76 | + openstackversion_wait_info.resources[0].status.availableVersion is defined and |
| 77 | + openstackversion_wait_info.resources[0].status.deployedVersion is defined and |
| 78 | + openstackversion_wait_info.resources[0].status.availableVersion != openstackversion_wait_info.resources[0].status.deployedVersion |
| 79 | +
|
| 80 | +- name: Get available version from OpenStackVersion CR |
| 81 | + ansible.builtin.set_fact: |
| 82 | + cifmw_update_next_available_version: "{{ openstackversion_wait_info.resources[0].status.availableVersion }}" |
| 83 | + |
| 84 | +- name: Set update step to Patching OpenStackVersion CR |
| 85 | + ansible.builtin.command: |
| 86 | + cmd: > |
| 87 | + {{ cifmw_update_artifacts_basedir }}/update_event.sh |
| 88 | + Patching OpenStackVersion CR with version {{ cifmw_update_next_available_version }} |
| 89 | +
|
| 90 | +- name: Patch OpenStackVersion CR availableVersion |
| 91 | + vars: |
| 92 | + make_openstack_patch_version_env: "{{ cifmw_install_yamls_environment | combine({'PATH': cifmw_path }) }}" |
| 93 | + make_openstack_patch_version_dryrun: false |
| 94 | + ansible.builtin.include_role: |
| 95 | + name: 'install_yamls_makes' |
| 96 | + tasks_from: 'make_openstack_patch_version' |
| 97 | + |
| 98 | +- name: Set vars related to update_containers content provider |
| 99 | + when: |
| 100 | + - content_provider_os_registry_url is defined |
| 101 | + - content_provider_os_registry_url != 'null' |
| 102 | + ansible.builtin.set_fact: |
| 103 | + cifmw_update_containers_registry: "{{ content_provider_os_registry_url | split('/') | first }}" |
| 104 | + cifmw_update_containers_org: "{{ content_provider_os_registry_url | split('/') | last }}" |
| 105 | + cifmw_update_containers_tag: "{{ content_provider_dlrn_md5_hash }}" |
| 106 | + cifmw_update_containers_openstack: true |
| 107 | + |
| 108 | +- name: Set update step to Updating container images |
| 109 | + when: >- |
| 110 | + (cifmw_update_containers_edpm_image_url is defined and |
| 111 | + cifmw_update_containers_openstack is defined and |
| 112 | + cifmw_update_containers_openstack | bool) or |
| 113 | + (cifmw_update_containers_ansibleee_image_url is defined) or |
| 114 | + (cifmw_update_containers_openstack is defined and |
| 115 | + cifmw_update_containers_openstack | bool) or |
| 116 | + (cifmw_update_containers_watcher is defined and |
| 117 | + cifmw_update_containers_watcher | bool) |
| 118 | + ansible.builtin.command: |
| 119 | + cmd: > |
| 120 | + {{ cifmw_update_artifacts_basedir }}/update_event.sh |
| 121 | + Updating container images |
| 122 | +
|
| 123 | +- name: Prepare and patch OpenStackVersion CR for update |
| 124 | + vars: |
| 125 | + cifmw_update_containers_metadata: "controlplane" |
| 126 | + cifmw_update_containers: true |
| 127 | + ansible.builtin.include_role: |
| 128 | + name: update_containers |
| 129 | + when: >- |
| 130 | + (cifmw_update_containers_edpm_image_url is defined and |
| 131 | + cifmw_update_containers_openstack is defined and |
| 132 | + cifmw_update_containers_openstack | bool) or |
| 133 | + (cifmw_update_containers_ansibleee_image_url is defined) or |
| 134 | + (cifmw_update_containers_openstack is defined and |
| 135 | + cifmw_update_containers_openstack | bool) or |
| 136 | + (cifmw_update_containers_watcher is defined and |
| 137 | + cifmw_update_containers_watcher | bool) |
| 138 | +
|
| 139 | +- name: Set update step to Starting the CI update sequence |
| 140 | + ansible.builtin.command: |
| 141 | + cmd: > |
| 142 | + {{ cifmw_update_artifacts_basedir }}/update_event.sh |
| 143 | + Starting the CI update sequence |
| 144 | +
|
| 145 | +- name: Run make openstack_update_run |
| 146 | + vars: |
| 147 | + make_openstack_update_run_env: "{{ cifmw_install_yamls_environment | combine({'PATH': cifmw_path }) }}" |
| 148 | + make_openstack_update_run_params: |
| 149 | + OPENSTACK_VERSION: "{{ cifmw_update_next_available_version }}" |
| 150 | + make_openstack_update_run_dryrun: false |
| 151 | + ansible.builtin.include_role: |
| 152 | + name: 'install_yamls_makes' |
| 153 | + tasks_from: 'make_openstack_update_run' |
| 154 | + |
| 155 | +- name: Set update step to Verifying update completion |
| 156 | + ansible.builtin.command: |
| 157 | + cmd: > |
| 158 | + {{ cifmw_update_artifacts_basedir }}/update_event.sh |
| 159 | + Verifying update completion |
| 160 | +
|
| 161 | +- name: Verify deployed version matches target version |
| 162 | + kubernetes.core.k8s_info: |
| 163 | + kubeconfig: "{{ cifmw_openshift_kubeconfig }}" |
| 164 | + api_key: "{{ cifmw_openshift_token | default(omit) }}" |
| 165 | + context: "{{ cifmw_openshift_context | default(omit) }}" |
| 166 | + api_version: core.openstack.org/v1beta1 |
| 167 | + kind: OpenStackVersion |
| 168 | + namespace: "{{ cifmw_update_namespace }}" |
| 169 | + register: openstackversion_verify_info |
| 170 | + until: > |
| 171 | + openstackversion_verify_info.resources is defined and |
| 172 | + openstackversion_verify_info.resources | length > 0 and |
| 173 | + openstackversion_verify_info.resources[0].status.deployedVersion is defined and |
| 174 | + openstackversion_verify_info.resources[0].status.deployedVersion == cifmw_update_next_available_version |
| 175 | + retries: 5 |
| 176 | + delay: 2 |
| 177 | + |
| 178 | +- name: Set update step to CI update sequence complete |
| 179 | + ansible.builtin.command: |
| 180 | + cmd: > |
| 181 | + {{ cifmw_update_artifacts_basedir }}/update_event.sh |
| 182 | + CI update verification successful - Target version {{ cifmw_update_next_available_version }} |
| 183 | + matches deployed version {{ openstackversion_verify_info.resources[0].status.deployedVersion }} |
0 commit comments