Skip to content

Commit d0f120c

Browse files
committed
WIP Add bootc passthrough baremetal CI job
Add a bootc EDPM baremetal job variant that reuses the normal content provider while switching the deployment to PassThrough with the direct bootc image. Depends-On: openstack-k8s-operators/install_yamls#1149 Change-Id: Ib01002da16fea514103b6c251faa5cfcf9bbc3fc Signed-off-by: rabi <ramishra@redhat.com>
1 parent 0565bc4 commit d0f120c

3 files changed

Lines changed: 336 additions & 0 deletions

File tree

Lines changed: 309 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,309 @@
1+
---
2+
- name: Build and host bootc IPA artifacts
3+
hosts: "{{ cifmw_target_hook_host | default(cifmw_target_host | default('localhost')) }}"
4+
gather_facts: false
5+
vars:
6+
cifmw_bootc_ipa_artifact_dir: "{{ cifmw_basedir }}/artifacts/bootc-ipa"
7+
cifmw_bootc_ipa_build_dir: "{{ ansible_user_dir }}/bootc-ipa-build"
8+
cifmw_bootc_ipa_build_enabled: false
9+
cifmw_bootc_ipa_build_output_prefix: "ipa-centos9-stable-2025.2-podman"
10+
cifmw_bootc_ipa_release: "9-stream"
11+
cifmw_bootc_ipa_branch: "stable/2025.2"
12+
cifmw_bootc_ipa_flavor: "centos9"
13+
cifmw_bootc_ipa_distro: "centos"
14+
cifmw_bootc_ipa_server_namespace: "openstack"
15+
cifmw_bootc_ipa_server_name: "bootc-ipa-artifacts"
16+
cifmw_bootc_ipa_server_port: 8080
17+
cifmw_bootc_ipa_server_image: "quay.io/prometheus/busybox:latest"
18+
cifmw_bootc_ipa_published_basename: >-
19+
ipa-{{ cifmw_bootc_ipa_flavor }}-{{ cifmw_bootc_ipa_branch | replace('/', '-') }}
20+
cifmw_bootc_ipa_raw_kernel_file: >-
21+
{{ cifmw_bootc_ipa_artifact_dir }}/{{ cifmw_bootc_ipa_build_output_prefix }}.kernel
22+
cifmw_bootc_ipa_raw_initramfs_file: >-
23+
{{ cifmw_bootc_ipa_artifact_dir }}/{{ cifmw_bootc_ipa_build_output_prefix }}.initramfs
24+
cifmw_bootc_ipa_kernel_file: >-
25+
{{ cifmw_bootc_ipa_artifact_dir }}/{{ cifmw_bootc_ipa_published_basename }}.kernel
26+
cifmw_bootc_ipa_initramfs_file: >-
27+
{{ cifmw_bootc_ipa_artifact_dir }}/{{ cifmw_bootc_ipa_published_basename }}.initramfs
28+
cifmw_bootc_ipa_tarball: >-
29+
{{ cifmw_bootc_ipa_artifact_dir }}/{{ cifmw_bootc_ipa_published_basename }}.tar.gz
30+
cifmw_bootc_ipa_service_url: >-
31+
http://{{ cifmw_bootc_ipa_server_name }}.{{ cifmw_bootc_ipa_server_namespace }}.svc.cluster.local:{{ cifmw_bootc_ipa_server_port }}
32+
tasks:
33+
- name: Ensure IPA artifact directory exists
34+
ansible.builtin.file:
35+
path: "{{ cifmw_bootc_ipa_artifact_dir }}"
36+
state: directory
37+
mode: "0755"
38+
39+
- name: Ensure IPA build directory exists
40+
when: cifmw_bootc_ipa_build_enabled | bool
41+
ansible.builtin.file:
42+
path: "{{ cifmw_bootc_ipa_build_dir }}"
43+
state: directory
44+
mode: "0755"
45+
46+
- name: Write minimal container steps file
47+
when: cifmw_bootc_ipa_build_enabled | bool
48+
ansible.builtin.copy:
49+
dest: "{{ cifmw_bootc_ipa_build_dir }}/mysteps.yaml"
50+
content: |
51+
steps: []
52+
mode: "0644"
53+
54+
- name: Build podman-enabled IPA artifacts
55+
when: cifmw_bootc_ipa_build_enabled | bool
56+
args:
57+
chdir: "{{ cifmw_bootc_ipa_artifact_dir }}"
58+
creates: "{{ cifmw_bootc_ipa_raw_initramfs_file }}"
59+
executable: /bin/bash
60+
ansible.builtin.shell: |
61+
set -euo pipefail
62+
python3 -m venv "{{ cifmw_bootc_ipa_build_dir }}/.venv"
63+
. "{{ cifmw_bootc_ipa_build_dir }}/.venv/bin/activate"
64+
python -m pip install --upgrade pip setuptools wheel
65+
python -m pip install ironic-python-agent-builder
66+
export DIB_ALLOW_ARBITRARY_CONTAINERS=true
67+
export DIB_RUNNER=podman
68+
export DIB_STEPS_FILE_PATH="{{ cifmw_bootc_ipa_build_dir }}/mysteps.yaml"
69+
ironic-python-agent-builder \
70+
-o "{{ cifmw_bootc_ipa_build_output_prefix }}" \
71+
-r "{{ cifmw_bootc_ipa_release }}" \
72+
-b "{{ cifmw_bootc_ipa_branch }}" \
73+
-e ironic-python-agent-podman \
74+
-v "{{ cifmw_bootc_ipa_distro }}"
75+
76+
- name: Check for raw IPA artifacts
77+
ansible.builtin.stat:
78+
path: "{{ item }}"
79+
loop:
80+
- "{{ cifmw_bootc_ipa_raw_kernel_file }}"
81+
- "{{ cifmw_bootc_ipa_raw_initramfs_file }}"
82+
register: cifmw_bootc_ipa_raw_artifacts
83+
84+
- name: Assert raw IPA artifacts exist
85+
ansible.builtin.assert:
86+
that:
87+
- cifmw_bootc_ipa_raw_artifacts.results | map(attribute='stat.exists') | min
88+
fail_msg: >-
89+
Missing raw IPA artifacts. Expected
90+
{{ cifmw_bootc_ipa_raw_kernel_file }} and
91+
{{ cifmw_bootc_ipa_raw_initramfs_file }}.
92+
93+
- name: Copy kernel to published filename
94+
ansible.builtin.copy:
95+
src: "{{ cifmw_bootc_ipa_raw_kernel_file }}"
96+
dest: "{{ cifmw_bootc_ipa_kernel_file }}"
97+
mode: "0644"
98+
remote_src: true
99+
100+
- name: Copy initramfs to published filename
101+
ansible.builtin.copy:
102+
src: "{{ cifmw_bootc_ipa_raw_initramfs_file }}"
103+
dest: "{{ cifmw_bootc_ipa_initramfs_file }}"
104+
mode: "0644"
105+
remote_src: true
106+
107+
- name: Package IPA tarball with downloader-compatible filenames
108+
args:
109+
chdir: "{{ cifmw_bootc_ipa_artifact_dir }}"
110+
executable: /bin/bash
111+
ansible.builtin.shell: |
112+
set -euo pipefail
113+
tar -caf "{{ cifmw_bootc_ipa_tarball }}" \
114+
"{{ cifmw_bootc_ipa_published_basename }}.kernel" \
115+
"{{ cifmw_bootc_ipa_published_basename }}.initramfs"
116+
117+
- name: Ensure IPA hosting namespace exists
118+
kubernetes.core.k8s:
119+
kubeconfig: "{{ cifmw_openshift_kubeconfig }}"
120+
state: present
121+
definition:
122+
apiVersion: v1
123+
kind: Namespace
124+
metadata:
125+
name: "{{ cifmw_bootc_ipa_server_namespace }}"
126+
127+
- name: Create IPA hosting deployment
128+
kubernetes.core.k8s:
129+
kubeconfig: "{{ cifmw_openshift_kubeconfig }}"
130+
state: present
131+
definition:
132+
apiVersion: apps/v1
133+
kind: Deployment
134+
metadata:
135+
name: "{{ cifmw_bootc_ipa_server_name }}"
136+
namespace: "{{ cifmw_bootc_ipa_server_namespace }}"
137+
spec:
138+
replicas: 1
139+
selector:
140+
matchLabels:
141+
app: "{{ cifmw_bootc_ipa_server_name }}"
142+
template:
143+
metadata:
144+
labels:
145+
app: "{{ cifmw_bootc_ipa_server_name }}"
146+
spec:
147+
containers:
148+
- name: server
149+
image: "{{ cifmw_bootc_ipa_server_image }}"
150+
command:
151+
- sh
152+
- -c
153+
- >-
154+
mkdir -p /srv &&
155+
exec busybox httpd -f -p {{ cifmw_bootc_ipa_server_port }} -h /srv
156+
ports:
157+
- containerPort: "{{ cifmw_bootc_ipa_server_port }}"
158+
volumeMounts:
159+
- name: content
160+
mountPath: /srv
161+
volumes:
162+
- name: content
163+
emptyDir: {}
164+
165+
- name: Create IPA hosting service
166+
kubernetes.core.k8s:
167+
kubeconfig: "{{ cifmw_openshift_kubeconfig }}"
168+
state: present
169+
definition:
170+
apiVersion: v1
171+
kind: Service
172+
metadata:
173+
name: "{{ cifmw_bootc_ipa_server_name }}"
174+
namespace: "{{ cifmw_bootc_ipa_server_namespace }}"
175+
spec:
176+
selector:
177+
app: "{{ cifmw_bootc_ipa_server_name }}"
178+
ports:
179+
- name: http
180+
port: "{{ cifmw_bootc_ipa_server_port }}"
181+
targetPort: "{{ cifmw_bootc_ipa_server_port }}"
182+
183+
- name: Wait for IPA hosting pod to be ready
184+
environment:
185+
KUBECONFIG: "{{ cifmw_openshift_kubeconfig }}"
186+
PATH: "{{ cifmw_path }}"
187+
ansible.builtin.command:
188+
cmd: >-
189+
oc wait pod -n {{ cifmw_bootc_ipa_server_namespace }}
190+
-l app={{ cifmw_bootc_ipa_server_name }}
191+
--for=condition=Ready
192+
--timeout=300s
193+
194+
- name: Get IPA hosting pod name
195+
environment:
196+
KUBECONFIG: "{{ cifmw_openshift_kubeconfig }}"
197+
PATH: "{{ cifmw_path }}"
198+
ansible.builtin.command:
199+
cmd: >-
200+
oc get pod -n {{ cifmw_bootc_ipa_server_namespace }}
201+
-l app={{ cifmw_bootc_ipa_server_name }}
202+
-o jsonpath='{.items[0].metadata.name}'
203+
register: cifmw_bootc_ipa_server_pod
204+
changed_when: false
205+
206+
- name: Copy IPA tarball into hosting pod
207+
environment:
208+
KUBECONFIG: "{{ cifmw_openshift_kubeconfig }}"
209+
PATH: "{{ cifmw_path }}"
210+
ansible.builtin.command:
211+
cmd: >-
212+
oc cp
213+
"{{ cifmw_bootc_ipa_tarball }}"
214+
"{{ cifmw_bootc_ipa_server_namespace }}/{{ cifmw_bootc_ipa_server_pod.stdout }}:/srv/{{ cifmw_bootc_ipa_tarball | basename }}"
215+
216+
- name: Verify IPA tarball is served from hosting pod
217+
environment:
218+
KUBECONFIG: "{{ cifmw_openshift_kubeconfig }}"
219+
PATH: "{{ cifmw_path }}"
220+
ansible.builtin.command:
221+
cmd: >-
222+
oc exec -n {{ cifmw_bootc_ipa_server_namespace }}
223+
{{ cifmw_bootc_ipa_server_pod.stdout }} --
224+
sh -c "wget -qO /dev/null http://127.0.0.1:{{ cifmw_bootc_ipa_server_port }}/{{ cifmw_bootc_ipa_tarball | basename }}"
225+
226+
- name: Read the install-yamls parameters file
227+
ansible.builtin.slurp:
228+
path: "{{ cifmw_basedir }}/artifacts/parameters/install-yamls-params.yml"
229+
register: cifmw_bootc_ipa_install_yamls_params
230+
231+
- name: Update install-yamls parameters with bootc IPA source
232+
ansible.builtin.copy:
233+
dest: "{{ cifmw_basedir }}/artifacts/parameters/install-yamls-params.yml"
234+
mode: "0600"
235+
content: >-
236+
{{
237+
cifmw_bootc_ipa_install_yamls_params.content | b64decode | from_yaml |
238+
combine(
239+
{
240+
'cifmw_install_yamls_environment': {
241+
'BMO_IPA_BASEURI': cifmw_bootc_ipa_service_url,
242+
'BMO_IPA_BRANCH': cifmw_bootc_ipa_branch,
243+
'BMO_IPA_FLAVOR': cifmw_bootc_ipa_flavor
244+
},
245+
'cifmw_install_yamls_defaults': {
246+
'BMO_IPA_BASEURI': cifmw_bootc_ipa_service_url,
247+
'BMO_IPA_BRANCH': cifmw_bootc_ipa_branch,
248+
'BMO_IPA_FLAVOR': cifmw_bootc_ipa_flavor
249+
}
250+
},
251+
recursive=true
252+
) | to_nice_yaml
253+
}}
254+
255+
- name: Feed generated bootc IPA values back to main play
256+
ansible.builtin.copy:
257+
dest: "{{ cifmw_basedir }}/artifacts/{{ step }}_{{ hook_name }}.yml"
258+
mode: "0644"
259+
content: |
260+
cifmw_bootc_ipa_service_url: "{{ cifmw_bootc_ipa_service_url }}"
261+
262+
- name: Find ironic configmap namespace
263+
environment:
264+
KUBECONFIG: "{{ cifmw_openshift_kubeconfig }}"
265+
PATH: "{{ cifmw_path }}"
266+
ansible.builtin.command:
267+
cmd: >-
268+
oc get configmap ironic-bmo-configmap -A
269+
-o jsonpath='{.items[0].metadata.namespace}'
270+
register: cifmw_bootc_ipa_ironic_namespace
271+
changed_when: false
272+
failed_when: false
273+
274+
- name: Patch live ironic configmap with bootc IPA source
275+
when: cifmw_bootc_ipa_ironic_namespace.rc == 0 and cifmw_bootc_ipa_ironic_namespace.stdout | length > 0
276+
kubernetes.core.k8s:
277+
kubeconfig: "{{ cifmw_openshift_kubeconfig }}"
278+
state: patched
279+
definition:
280+
apiVersion: v1
281+
kind: ConfigMap
282+
metadata:
283+
name: ironic-bmo-configmap
284+
namespace: "{{ cifmw_bootc_ipa_ironic_namespace.stdout }}"
285+
data:
286+
IPA_BASEURI: "{{ cifmw_bootc_ipa_service_url }}"
287+
IPA_BRANCH: "{{ cifmw_bootc_ipa_branch }}"
288+
IPA_FLAVOR: "{{ cifmw_bootc_ipa_flavor }}"
289+
290+
- name: Restart ironic deployment to re-run IPA downloader
291+
when: cifmw_bootc_ipa_ironic_namespace.rc == 0 and cifmw_bootc_ipa_ironic_namespace.stdout | length > 0
292+
environment:
293+
KUBECONFIG: "{{ cifmw_openshift_kubeconfig }}"
294+
PATH: "{{ cifmw_path }}"
295+
ansible.builtin.command:
296+
cmd: >-
297+
oc rollout restart deployment/ironic
298+
-n {{ cifmw_bootc_ipa_ironic_namespace.stdout }}
299+
300+
- name: Wait for ironic rollout after configmap patch
301+
when: cifmw_bootc_ipa_ironic_namespace.rc == 0 and cifmw_bootc_ipa_ironic_namespace.stdout | length > 0
302+
environment:
303+
KUBECONFIG: "{{ cifmw_openshift_kubeconfig }}"
304+
PATH: "{{ cifmw_path }}"
305+
ansible.builtin.command:
306+
cmd: >-
307+
oc rollout status deployment/ironic
308+
-n {{ cifmw_bootc_ipa_ironic_namespace.stdout }}
309+
--timeout=10m

zuul.d/jobs.yaml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,30 @@
1212
- job:
1313
name: openstack-baremetal-operator-crc-podified-edpm-baremetal
1414
parent: cifmw-crc-podified-edpm-baremetal
15+
16+
- job:
17+
name: openstack-baremetal-operator-crc-podified-edpm-baremetal-bootc
18+
parent: cifmw-crc-podified-edpm-baremetal-bootc
19+
vars:
20+
cifmw_update_containers: true
21+
cifmw_update_containers_openstack: true
22+
cifmw_update_containers_edpm_image_url: oci://quay.io/rabi/edpm-bootc:oci-test
23+
pre_deploy:
24+
- name: 61 Bootc IPA artifacts
25+
type: playbook
26+
source: "{{ ansible_user_dir }}/src/github.com/openstack-k8s-operators/openstack-baremetal-operator/ci/playbooks/bootc-ipa-pre-deploy.yml"
27+
extra_vars:
28+
cifmw_bootc_ipa_build_enabled: true
29+
post_ctlplane_deploy:
30+
- name: 61 Bootc IPA reconfigure ironic
31+
type: playbook
32+
source: "{{ ansible_user_dir }}/src/github.com/openstack-k8s-operators/openstack-baremetal-operator/ci/playbooks/bootc-ipa-pre-deploy.yml"
33+
extra_vars:
34+
cifmw_bootc_ipa_build_enabled: false
35+
cifmw_install_yamls_vars:
36+
BAREMETAL_OS_IMG_TYPE: PassThrough
37+
BMO_DEFAULT_DEPLOY_INTERFACE: bootc
38+
1539
- job:
1640
name: openstack-baremetal-operator-edpm-baremetal-minor-update
1741
parent: cifmw-crc-podified-edpm-baremetal-minor-update

zuul.d/projects.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@
99
- openstack-baremetal-operator-crc-podified-edpm-baremetal:
1010
dependencies:
1111
- openstack-baremetal-operator-content-provider
12+
- openstack-baremetal-operator-crc-podified-edpm-baremetal-bootc:
13+
dependencies:
14+
- openstack-baremetal-operator-content-provider
1215
- openstack-baremetal-operator-edpm-baremetal-minor-update:
1316
dependencies:
1417
- openstack-baremetal-operator-content-provider

0 commit comments

Comments
 (0)