Skip to content

Commit 04b6b7f

Browse files
committed
test,CI: pass experimental options to systemd unit when deploying
In the deploy script, after installing all the test RPMs, add an override to the unit file that sets the IMAGE_BUILDER_EXPERIMENTAL environment variable for the osbuild-composer service with any values from the global runner environment. If image-builder-manifest-generation is enabled, install image-builder from the repos. Add a single API test job (api.sh) to the gitlab CI config that uses the new experimental job type. In the api.sh script, when image-builder-manifest-generation is enabled in the test, verify it was actually used by searching for the warning that's logged when the job is enqueued.
1 parent 7628a10 commit 04b6b7f

File tree

3 files changed

+38
-0
lines changed

3 files changed

+38
-0
lines changed

.gitlab-ci.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -605,6 +605,13 @@ API:
605605
- aws/rhel-10.0-ga-aarch64
606606
INTERNAL_NETWORK: ["true"]
607607

608+
# single test config for experimental feature
609+
- IMAGE_TYPE: ["aws"]
610+
RUNNER:
611+
- aws/rhel-10.1-nightly-x86_64
612+
IMAGE_BUILDER_EXPERIMENTAL: "image-builder-manifest-generation=1"
613+
INTERNAL_NETWORK: ["true"]
614+
608615
API-module-hotfixes:
609616
stage: test
610617
extends: .terraform

schutzbot/deploy.sh

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,28 @@ retry sudo dnf -y install osbuild-tools
136136
# Save osbuild-composer NVR to a file to be used as CI artifact
137137
rpm -q osbuild-composer > COMPOSER_NVR
138138

139+
IMAGE_BUILDER_EXPERIMENTAL="${IMAGE_BUILDER_EXPERIMENTAL:-}"
140+
if [[ "${IMAGE_BUILDER_EXPERIMENTAL}" != "" ]]; then
141+
greenprint "Adding experimental options to osbuild-composer.service"
142+
# Pass any experimental options into the systemd unit
143+
cat > experimental-override.conf << EOF
144+
[Service]
145+
Environment=IMAGE_BUILDER_EXPERIMENTAL="${IMAGE_BUILDER_EXPERIMENTAL}"
146+
EOF
147+
148+
cat experimental-override.conf | sudo systemctl edit --stdin osbuild-composer.service
149+
sudo systemctl daemon-reload
150+
sudo systemctl cat osbuild-composer.service
151+
152+
if echo "${IMAGE_BUILDER_EXPERIMENTAL}" | grep -q "image-builder-manifest-generation=1"; then
153+
# TODO: configure dependency pinning for image-builder like we do for osbuild
154+
# https://issues.redhat.com/browse/HMS-9647
155+
greenprint "Installing image-builder for experimental manifest generation"
156+
sudo dnf -y install image-builder
157+
fi
158+
fi
159+
160+
139161
if [ "${NIGHTLY:=false}" == "true" ]; then
140162
# check if we've installed the osbuild-composer RPM from the nightly tree
141163
# under test or happen to install a newer version from one of the S3 repositories

test/cases/api.sh

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -903,5 +903,14 @@ TOKEN="$(curl --request POST \
903903
sudo systemctl restart osbuild-remote-worker@localhost:8700.service
904904
sudo systemctl is-active --quiet osbuild-remote-worker@localhost:8700.service
905905

906+
IMAGE_BUILDER_EXPERIMENTAL="${IMAGE_BUILDER_EXPERIMENTAL:-}"
907+
if [[ "${IMAGE_BUILDER_EXPERIMENTAL}" != "" ]]; then
908+
if echo "${IMAGE_BUILDER_EXPERIMENTAL}" | grep -q "image-builder-manifest-generation=1"; then
909+
greenprint "Verifying usage of experimental job type"
910+
# verify using log message
911+
journalctl -g "using experimental job type: image-builder-manifest"
912+
fi
913+
fi
914+
906915
greenprint "DONE"
907916
exit 0

0 commit comments

Comments
 (0)