Skip to content

Commit dd83650

Browse files
cfergeaupraveenkumar
authored andcommitted
Create new release images in build-patched-kao-kcmo-images.sh
At the moment, build-patched-kao-kcmo-images.sh builds patched cluster-kube-apiserver-operator and cluster-kube-controller-manager-operator images, and then each time `snc.sh` is run, it will generate a new openshift release image using these patched operators. The openshift release image generation can be done only once at the same time the operators are built, and then reused in snc. This commit adds the generation to the build-patched-kao-kcmo-images.sh script, but snc.sh is not making use of it yet. The generated image is a multi-arch manifest as we need both x86_64 and aarch64 images. This is an improvement over what is currently done in snc.sh, where the release image is single arch, the arch depending on where snc.sh was run last (on an amd64 or aarch64 machine).
1 parent 9454ae0 commit dd83650

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed

build-patched-kao-kcmo-images.sh

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,34 @@ function patch_and_push_image() {
101101
skopeo copy --dest-authfile ${OPENSHIFT_PULL_SECRET_PATH} --all docker://${brew_image} docker://quay.io/crcont/openshift-crc-${image_name}:${openshift_version}
102102
}
103103

104+
function create_patched_release_image_for_arch() {
105+
local upstream_registry=$1
106+
local arch=$2
107+
local release_image="$(release_image_for_arch ${arch})"
108+
109+
# As of now, `oc adm release new` is not able to parse images which have
110+
# multiple arch manifest file so we first need to get the digest of the
111+
# image for ${yq_arch} and then use that digest with `oc adm release new`_
112+
kao_image_digest=$(${OC} image info -a ${OPENSHIFT_PULL_SECRET_PATH} ${upstream_registry}/openshift-crc-cluster-kube-apiserver-operator:${openshift_version} --filter-by-os=linux/${arch} -ojson | jq -r .digest)
113+
kcmo_image_digest=$(${OC} image info -a ${OPENSHIFT_PULL_SECRET_PATH} ${upstream_registry}/openshift-crc-cluster-kube-controller-manager-operator:${openshift_version} --filter-by-os=linux/${arch} -ojson | jq -r .digest)
114+
115+
${OC} adm release new -a ${OPENSHIFT_PULL_SECRET_PATH} --from-release=${release_image} \
116+
cluster-kube-apiserver-operator=${upstream_registry}/openshift-crc-cluster-kube-apiserver-operator@${kao_image_digest} \
117+
cluster-kube-controller-manager-operator=${upstream_registry}/openshift-crc-cluster-kube-controller-manager-operator@${kcmo_image_digest} \
118+
--to-image=${upstream_registry}/ocp-release:${openshift_version}-${arch}
119+
}
120+
121+
function create_new_release_with_patched_images() {
122+
local upstream_registry="quay.io/crcont"
123+
124+
podman manifest create ${upstream_registry}/ocp-release:${openshift_version}
125+
for arch in amd64 arm64; do \
126+
create_patched_release_image_for_arch ${upstream_registry} ${arch}
127+
podman manifest add ${upstream_registry}/ocp-release:${openshift_version} docker://${upstream_registry}/ocp-release:${openshift_version}-${arch}
128+
done
129+
podman manifest push --all ${upstream_registry}/ocp-release:${openshift_version} docker://${upstream_registry}/ocp-release:${openshift_version}
130+
}
131+
104132
function update_base_image() {
105133
local brew_repo=$1
106134
local base_image=$2
@@ -125,6 +153,7 @@ openshift_version=$(${OC} adm release info -a ${OPENSHIFT_PULL_SECRET_PATH} ${OP
125153

126154
patch_and_push_image cluster-kube-apiserver-operator
127155
patch_and_push_image cluster-kube-controller-manager-operator
156+
create_new_release_with_patched_images
128157

129158
base_image=$(grep "^FROM openshift/ose-base" crc-cluster-kube-apiserver-operator/Dockerfile | sed 's/^FROM //')
130159

0 commit comments

Comments
 (0)