Skip to content

Commit 45d8815

Browse files
rabiclaude
andcommitted
[multiple] Add new job to run minor update with baremetal deployment
Adds a new baremetal job to test minor update with upstream github content. This will currently test from fr3->main(with PR). The job uses a new 'ci' variant in the update role for better integration with the existing framework: - Phase 1: Deploy with FR3 index image using deploy-edpm.yml - Phase 2: Update to target version using update role's ci variant The ci variant (roles/update/tasks/update_variant_ci.yml): - Runs openstack cleanup, wait, and init - Waits for new version availability - Patches OpenStackVersion CR - Updates container images via update_containers role - Executes update and verifies deployed version Signed-off-by: rabi <[email protected]> Co-Authored-By: Claude <[email protected]> Signed-off-by: rabi <[email protected]>
1 parent 84c46b6 commit 45d8815

File tree

5 files changed

+351
-3
lines changed

5 files changed

+351
-3
lines changed
Lines changed: 148 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,148 @@
1+
---
2+
- name: "Run ci/playbooks/edpm_baremetal_update/run.yml"
3+
hosts: "{{ cifmw_zuul_target_host | default('all') }}"
4+
gather_facts: true
5+
tasks:
6+
- name: Filter out host if needed
7+
when:
8+
- cifmw_zuul_target_host is defined
9+
- cifmw_zuul_target_host != 'all'
10+
- inventory_hostname != cifmw_zuul_target_host
11+
ansible.builtin.meta: end_host
12+
13+
- name: Check for edpm-ansible.yml file
14+
ansible.builtin.stat:
15+
path: "{{ ansible_user_dir }}/ci-framework-data/artifacts/edpm-ansible.yml"
16+
register: edpm_file
17+
18+
- name: Check if new ssh keypair exists
19+
ansible.builtin.include_role:
20+
name: recognize_ssh_keypair
21+
22+
- name: Add crc node in local inventory
23+
ansible.builtin.add_host:
24+
name: crc
25+
ansible_ssh_private_key_file: "{{ ansible_user_dir }}/.crc/machines/crc/{{ crc_ssh_keypair }}"
26+
ansible_ssh_user: core
27+
ansible_host: api.crc.testing
28+
29+
- name: Ensure we know ssh hosts
30+
ansible.builtin.shell:
31+
cmd: "ssh-keyscan {{ hostvars[item].ansible_host }} >> ~/.ssh/known_hosts"
32+
loop: "{{ hostvars.keys() | reject('equalto', 'localhost') }}"
33+
34+
- name: Inject CRC in zuul_inventory
35+
block:
36+
- name: Load zuul_inventory
37+
register: _inventory
38+
ansible.builtin.slurp:
39+
path: "{{ ansible_user_dir }}/ci-framework-data/artifacts/zuul_inventory.yml"
40+
41+
- name: Inject CRC in zuul_inventory.yml
42+
vars:
43+
_crc:
44+
all:
45+
hosts:
46+
crc: "{{ dict(hostvars.crc) }}"
47+
_updated: >-
48+
{{
49+
_inventory.content | b64decode | from_yaml | combine(_crc, recursive=true)
50+
}}
51+
ansible.builtin.copy:
52+
dest: "{{ ansible_user_dir }}/ci-framework-data/artifacts/zuul_inventory.yml"
53+
content: "{{ _updated | to_nice_yaml }}"
54+
mode: "0644"
55+
56+
- name: Set default pre-update tag if not provided
57+
ansible.builtin.set_fact:
58+
cifmw_minor_update_pre_update_tag: "{{ cifmw_minor_update_pre_update_tag | default('18.0-fr3-latest') }}"
59+
60+
- name: Get pre-update index image digest from tag
61+
ansible.builtin.shell: >-
62+
skopeo inspect
63+
docker://quay.io/openstack-k8s-operators/openstack-operator-index:{{ cifmw_minor_update_pre_update_tag }}
64+
| jq -r '.Digest'
65+
register: pre_update_digest_result
66+
changed_when: false
67+
failed_when: pre_update_digest_result.rc != 0
68+
69+
- name: Set pre-update index image using digest from tag
70+
ansible.builtin.set_fact:
71+
cifmw_minor_update_pre_update_index_image: >-
72+
quay.io/openstack-k8s-operators/openstack-operator-index@{{ pre_update_digest_result.stdout | trim }}
73+
74+
- name: Get minor update index image from content provider or use default
75+
ansible.builtin.set_fact:
76+
cifmw_minor_update_index_image: >-
77+
{{
78+
cifmw_operator_build_output.operators['openstack-operator'].image_catalog
79+
if (cifmw_operator_build_output is defined and
80+
cifmw_operator_build_output.operators is defined and
81+
'openstack-operator' in cifmw_operator_build_output.operators)
82+
else cifmw_minor_update_pre_update_index_image
83+
}}
84+
85+
- name: Override operator build output with pre-update index image for Phase 1
86+
ansible.builtin.set_fact:
87+
cifmw_operator_build_output_pre_update: >-
88+
{{
89+
{
90+
'cifmw_operator_build_output': {
91+
'operators': {
92+
'openstack-operator': {
93+
'image_catalog': cifmw_minor_update_pre_update_index_image
94+
}
95+
}
96+
}
97+
}
98+
}}
99+
100+
- name: Phase 1 - Deploy with pre-update index image using deploy-edpm.yml
101+
block:
102+
- name: Write pre-update operator build output to temporary file
103+
ansible.builtin.copy:
104+
dest: "{{ ansible_user_dir }}/ci-framework-data/artifacts/operator_build_output_pre_update.yml"
105+
content: "{{ cifmw_operator_build_output_pre_update | to_nice_yaml }}"
106+
mode: "0644"
107+
108+
- name: Perform Podified and EDPM deployment on compute nodes with virtual baremetal (pre-update version)
109+
ansible.builtin.command:
110+
chdir: "{{ ansible_user_dir }}/src/github.com/openstack-k8s-operators/ci-framework"
111+
cmd: >-
112+
ansible-playbook deploy-edpm.yml
113+
-i "{{ ansible_user_dir }}/ci-framework-data/artifacts/zuul_inventory.yml"
114+
-e @group_vars/all.yml
115+
-e @scenarios/centos-9/base.yml
116+
-e @scenarios/centos-9/edpm_baremetal_deployment_ci.yml
117+
{%- if edpm_file.stat.exists %}
118+
-e @{{ ansible_user_dir }}/ci-framework-data/artifacts/edpm-ansible.yml
119+
{%- endif %}
120+
{%- if cifmw_extras is defined %}
121+
{%- for extra_var in cifmw_extras %}
122+
-e "{{ extra_var }}"
123+
{%- endfor %}
124+
{%- endif %}
125+
-e "@{{ ansible_user_dir }}/ci-framework-data/artifacts/parameters/zuul-params.yml"
126+
-e "@{{ ansible_user_dir }}/ci-framework-data/artifacts/operator_build_output_pre_update.yml"
127+
-e "cifmw_prepare_openstackversion=false"
128+
129+
- name: Update install_yamls environment for minor update phase
130+
ansible.builtin.set_fact:
131+
cifmw_install_yamls_environment: >-
132+
{{
133+
(cifmw_install_yamls_environment | default({})) |
134+
combine({'PATH': cifmw_path | default(ansible_user_dir ~ '/.crc/bin:' ~ ansible_user_dir ~ '/.crc/bin/oc:' ~ ansible_user_dir ~ '/bin:' ~ ansible_env.PATH)}) |
135+
combine({'OPENSTACK_IMG': cifmw_minor_update_index_image}) |
136+
combine({'BMO_CLEANUP': false})
137+
}}
138+
139+
# Phase 2: Run update role with ci variant
140+
# This uses install_yamls_makes role that was generated during Phase 1 bootstrap
141+
# Parameters files will be loaded by update_variant_ci.yml on the target host
142+
- name: Phase 2 - Run CI update workflow (cleanup, init, update, and verify)
143+
vars:
144+
cifmw_update_variant: "ci"
145+
cifmw_update_run_dryrun: false
146+
cifmw_update_artifacts_basedir: "{{ ansible_user_dir }}/ci-framework-data/tests/update"
147+
ansible.builtin.include_role:
148+
name: update

roles/edpm_prepare/tasks/kustomize_and_deploy.yml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,18 +26,19 @@
2626
cifmw_update_containers_registry: "{{ content_provider_os_registry_url | split('/') | first }}"
2727
cifmw_update_containers_org: "{{ content_provider_os_registry_url | split('/') | last }}"
2828
cifmw_update_containers_tag: "{{ content_provider_dlrn_md5_hash }}"
29-
cifmw_update_containers_openstack: true
29+
cifmw_update_containers_openstack: "{{ cifmw_edpm_prepare_update_containers | default(true) }}"
3030

3131
- name: Prepare OpenStackVersion CR
3232
when: >-
33-
(cifmw_update_containers_edpm_image_url is defined and
33+
(cifmw_prepare_openstackversion | default(true) | bool) and
34+
((cifmw_update_containers_edpm_image_url is defined and
3435
cifmw_update_containers_openstack is defined and
3536
cifmw_update_containers_openstack | bool) or
3637
(cifmw_update_containers_ansibleee_image_url is defined) or
3738
(cifmw_update_containers_openstack is defined and
3839
cifmw_update_containers_openstack | bool) or
3940
(cifmw_update_containers_watcher is defined and
40-
cifmw_update_containers_watcher | bool)
41+
cifmw_update_containers_watcher | bool))
4142
vars:
4243
cifmw_update_containers_metadata: "{{ _ctlplane_name }}"
4344
ansible.builtin.include_role:
Lines changed: 183 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,183 @@
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 }}

zuul.d/edpm.yaml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,21 @@
3939
cifmw_edpm_deploy_baremetal_bootc: true
4040
cifmw_update_containers: true
4141

42+
# Virtual Baremetal job with CRC for minor update testing.
43+
# First deploys with FR4 index image, then updates with PR index image.
44+
- job:
45+
name: cifmw-crc-podified-edpm-baremetal-minor-update
46+
nodeset: centos-9-crc-2-48-0-6xlarge
47+
parent: cifmw-base-crc-openstack
48+
run: ci/playbooks/edpm_baremetal_update/run.yml
49+
dependencies:
50+
- openstack-k8s-operators-content-provider
51+
vars:
52+
crc_parameters: "--memory 32000 --disk-size 240 --cpus 12"
53+
cifmw_manage_secrets_pullsecret_content: '{}'
54+
cifmw_rhol_crc_binary_folder: "/usr/local/bin"
55+
cifmw_minor_update_pre_update_tag: "18.0-fr3-latest"
56+
4257
# Podified galera job
4358
- job:
4459
name: cifmw-crc-podified-galera-deployment

zuul.d/project-templates.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@
5959
- cifmw-molecule
6060
- podified-multinode-edpm-deployment-crc: *content_provider
6161
- cifmw-crc-podified-edpm-baremetal: *content_provider
62+
- cifmw-crc-podified-edpm-baremetal-minor-update: *content_provider
6263
- podified-multinode-hci-deployment-crc: *content_provider
6364
- cifmw-multinode-tempest: *content_provider
6465
- cifmw-pod-zuul-files

0 commit comments

Comments
 (0)