Skip to content

Commit 5d2b5a3

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 39986c9 commit 5d2b5a3

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
@@ -98,6 +98,34 @@ function patch_and_push_image() {
9898
skopeo copy --dest-authfile ${OPENSHIFT_PULL_SECRET_PATH} --all docker://registry-proxy.engineering.redhat.com/rh-osbs/openshift-crc-${image_name}:${version}-${release} docker://quay.io/crcont/openshift-crc-${image_name}:${openshift_version}
9999
}
100100

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

123151
patch_and_push_image cluster-kube-apiserver-operator
124152
patch_and_push_image cluster-kube-controller-manager-operator
153+
create_new_release_with_patched_images
125154

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

0 commit comments

Comments
 (0)