@@ -107,6 +107,68 @@ function create_agent_iso_no_registry() {
107107
108108 rm -rf " ${asset_dir} " /src
109109 popd
110+
111+ inject_iri_manifest_into_ove_iso
112+ }
113+
114+ function inject_iri_manifest_into_ove_iso() {
115+ local agent_iso_no_registry
116+ agent_iso_no_registry=$( get_agent_iso_no_registry)
117+
118+ local release_version
119+ release_version=$( oc adm release info --registry-config " $PULL_SECRET_FILE " " $OPENSHIFT_RELEASE_IMAGE " -o json | jq -r ' .metadata.version' )
120+
121+ local version_for_tag=" ${release_version} "
122+ if [[ " ${OPENSHIFT_RELEASE_TYPE} " != " ci" ]] && [[ " ${OPENSHIFT_RELEASE_TYPE} " != " nightly" ]]; then
123+ version_for_tag=" ${release_version} -x86_64"
124+ fi
125+
126+ local ocp_bundle_str=" ocp-release-bundle-${version_for_tag} "
127+ if [[ ${# ocp_bundle_str} -gt 64 ]]; then
128+ ocp_bundle_str=" ${ocp_bundle_str: 0: 64} "
129+ fi
130+
131+ local manifest_content
132+ manifest_content=$( cat << EOF
133+ apiVersion: machineconfiguration.openshift.io/v1
134+ kind: InternalReleaseImage
135+ metadata:
136+ name: cluster
137+ spec:
138+ releases:
139+ - name: ${ocp_bundle_str}
140+ EOF
141+ )
142+
143+ local manifest_b64
144+ manifest_b64=$( echo " ${manifest_content} " | base64 -w 0)
145+
146+ local ign_temp_path
147+ ign_temp_path=" $( mktemp --directory) "
148+
149+ echo " Extracting OVE ISO ignition to inject IRI manifest..."
150+ podman run --pull=newer --privileged --rm \
151+ -v /run/udev:/run/udev \
152+ -v " ${agent_iso_no_registry} :/data/agent.iso" \
153+ -w /data \
154+ quay.io/coreos/coreos-installer:release iso ignition show agent.iso \
155+ > " ${ign_temp_path} /iso.ign"
156+
157+ jq --arg path " /etc/assisted/extra-manifests/internalreleaseimage.yaml" \
158+ --arg source " data:text/plain;charset=utf-8;base64,${manifest_b64} " \
159+ ' .storage.files = [.storage.files[] | select(.path != $path)] + [{"path": $path, "mode": 420, "overwrite": true, "contents": {"source": $source}}]' \
160+ < " ${ign_temp_path} /iso.ign" > " ${ign_temp_path} /modified.ign"
161+
162+ echo " Embedding modified ignition with IRI manifest..."
163+ podman run --privileged --rm \
164+ -v /run/udev:/run/udev \
165+ -v " ${agent_iso_no_registry} :/data/agent.iso" \
166+ -v " ${ign_temp_path} /modified.ign:/data/modified.ign" \
167+ -w /data \
168+ quay.io/coreos/coreos-installer:release iso ignition embed -f -i modified.ign agent.iso
169+
170+ rm -rf " ${ign_temp_path} "
171+ echo " IRI manifest injected into OVE ISO"
110172}
111173
112174# Deletes all files and directories under asset_dir
0 commit comments