Skip to content

Commit cdafc93

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 Signed-off-by: rabi <ramishra@redhat.com>
1 parent 0565bc4 commit cdafc93

3 files changed

Lines changed: 325 additions & 0 deletions

File tree

Lines changed: 298 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,298 @@
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_ip: ""
31+
cifmw_bootc_ipa_service_url: ""
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: Get IPA hosting service cluster IP
184+
kubernetes.core.k8s_info:
185+
kubeconfig: "{{ cifmw_openshift_kubeconfig }}"
186+
api_version: v1
187+
kind: Service
188+
name: "{{ cifmw_bootc_ipa_server_name }}"
189+
namespace: "{{ cifmw_bootc_ipa_server_namespace }}"
190+
register: cifmw_bootc_ipa_service
191+
192+
- name: Set IPA hosting service URL from cluster IP
193+
ansible.builtin.set_fact:
194+
cifmw_bootc_ipa_service_ip: "{{ cifmw_bootc_ipa_service.resources[0].spec.clusterIP }}"
195+
cifmw_bootc_ipa_service_url: "http://{{ cifmw_bootc_ipa_service.resources[0].spec.clusterIP }}:{{ cifmw_bootc_ipa_server_port }}"
196+
197+
- name: Wait for IPA hosting pod to be ready
198+
environment:
199+
KUBECONFIG: "{{ cifmw_openshift_kubeconfig }}"
200+
PATH: "{{ cifmw_path }}"
201+
ansible.builtin.command:
202+
cmd: >-
203+
oc wait pod -n {{ cifmw_bootc_ipa_server_namespace }}
204+
-l app={{ cifmw_bootc_ipa_server_name }}
205+
--for=condition=Ready
206+
--timeout=300s
207+
208+
- name: Get IPA hosting pod name
209+
environment:
210+
KUBECONFIG: "{{ cifmw_openshift_kubeconfig }}"
211+
PATH: "{{ cifmw_path }}"
212+
ansible.builtin.command:
213+
cmd: >-
214+
oc get pod -n {{ cifmw_bootc_ipa_server_namespace }}
215+
-l app={{ cifmw_bootc_ipa_server_name }}
216+
-o jsonpath='{.items[0].metadata.name}'
217+
register: cifmw_bootc_ipa_server_pod
218+
changed_when: false
219+
220+
- name: Copy IPA tarball into hosting pod
221+
environment:
222+
KUBECONFIG: "{{ cifmw_openshift_kubeconfig }}"
223+
PATH: "{{ cifmw_path }}"
224+
ansible.builtin.command:
225+
cmd: >-
226+
oc cp
227+
"{{ cifmw_bootc_ipa_tarball }}"
228+
"{{ cifmw_bootc_ipa_server_namespace }}/{{ cifmw_bootc_ipa_server_pod.stdout }}:/srv/{{ cifmw_bootc_ipa_tarball | basename }}"
229+
230+
- name: Verify IPA tarball is served from hosting pod
231+
environment:
232+
KUBECONFIG: "{{ cifmw_openshift_kubeconfig }}"
233+
PATH: "{{ cifmw_path }}"
234+
ansible.builtin.command:
235+
cmd: >-
236+
oc exec -n {{ cifmw_bootc_ipa_server_namespace }}
237+
{{ cifmw_bootc_ipa_server_pod.stdout }} --
238+
sh -c "wget -qO /dev/null http://127.0.0.1:{{ cifmw_bootc_ipa_server_port }}/{{ cifmw_bootc_ipa_tarball | basename }}"
239+
240+
- name: Feed generated bootc IPA values back to main play
241+
ansible.builtin.copy:
242+
dest: "{{ cifmw_basedir }}/artifacts/{{ step }}_{{ hook_name }}.yml"
243+
mode: "0644"
244+
content: |
245+
cifmw_bootc_ipa_service_url: "{{ cifmw_bootc_ipa_service_url }}"
246+
cifmw_edpm_prepare_extra_vars:
247+
BMO_IPA_BASEURI: "{{ cifmw_bootc_ipa_service_url }}"
248+
BMO_IPA_BRANCH: "{{ cifmw_bootc_ipa_branch }}"
249+
BMO_IPA_FLAVOR: "{{ cifmw_bootc_ipa_flavor }}"
250+
251+
- name: Find ironic configmap namespace
252+
environment:
253+
KUBECONFIG: "{{ cifmw_openshift_kubeconfig }}"
254+
PATH: "{{ cifmw_path }}"
255+
ansible.builtin.command:
256+
cmd: >-
257+
oc get configmap ironic-bmo-configmap -A
258+
-o jsonpath='{.items[0].metadata.namespace}'
259+
register: cifmw_bootc_ipa_ironic_namespace
260+
changed_when: false
261+
failed_when: false
262+
263+
- name: Patch live ironic configmap with bootc IPA source
264+
when: cifmw_bootc_ipa_ironic_namespace.rc == 0 and cifmw_bootc_ipa_ironic_namespace.stdout | length > 0
265+
kubernetes.core.k8s:
266+
kubeconfig: "{{ cifmw_openshift_kubeconfig }}"
267+
state: patched
268+
definition:
269+
apiVersion: v1
270+
kind: ConfigMap
271+
metadata:
272+
name: ironic-bmo-configmap
273+
namespace: "{{ cifmw_bootc_ipa_ironic_namespace.stdout }}"
274+
data:
275+
IPA_BASEURI: "{{ cifmw_bootc_ipa_service_url }}"
276+
IPA_BRANCH: "{{ cifmw_bootc_ipa_branch }}"
277+
IPA_FLAVOR: "{{ cifmw_bootc_ipa_flavor }}"
278+
279+
- name: Restart ironic deployment to re-run IPA downloader
280+
when: cifmw_bootc_ipa_ironic_namespace.rc == 0 and cifmw_bootc_ipa_ironic_namespace.stdout | length > 0
281+
environment:
282+
KUBECONFIG: "{{ cifmw_openshift_kubeconfig }}"
283+
PATH: "{{ cifmw_path }}"
284+
ansible.builtin.command:
285+
cmd: >-
286+
oc rollout restart deployment/ironic
287+
-n {{ cifmw_bootc_ipa_ironic_namespace.stdout }}
288+
289+
- name: Wait for ironic rollout after configmap patch
290+
when: cifmw_bootc_ipa_ironic_namespace.rc == 0 and cifmw_bootc_ipa_ironic_namespace.stdout | length > 0
291+
environment:
292+
KUBECONFIG: "{{ cifmw_openshift_kubeconfig }}"
293+
PATH: "{{ cifmw_path }}"
294+
ansible.builtin.command:
295+
cmd: >-
296+
oc rollout status deployment/ironic
297+
-n {{ cifmw_bootc_ipa_ironic_namespace.stdout }}
298+
--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)