Skip to content

Commit

Permalink
Create new release images in build-patched-kao-kcmo-images.sh
Browse files Browse the repository at this point in the history
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).
  • Loading branch information
cfergeau authored and praveenkumar committed Dec 22, 2022
1 parent 39986c9 commit 5d2b5a3
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions build-patched-kao-kcmo-images.sh
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,34 @@ function patch_and_push_image() {
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}
}

function create_patched_release_image_for_arch() {
local upstream_registry=$1
local arch=$2
local release_image="$(release_image_for_arch ${arch})"

# As of now, `oc adm release new` is not able to parse images which have
# multiple arch manifest file so we first need to get the digest of the
# image for ${yq_arch} and then use that digest with `oc adm release new`_
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)
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)

${OC} adm release new -a ${OPENSHIFT_PULL_SECRET_PATH} --from-release=${release_image} \
cluster-kube-apiserver-operator=${upstream_registry}/openshift-crc-cluster-kube-apiserver-operator@${kao_image_digest} \
cluster-kube-controller-manager-operator=${upstream_registry}/openshift-crc-cluster-kube-controller-manager-operator@${kcmo_image_digest} \
--to-image=${upstream_registry}/ocp-release:${openshift_version}-${arch}
}

function create_new_release_with_patched_images() {
local upstream_registry="quay.io/crcont"

podman manifest create ${upstream_registry}/ocp-release:${openshift_version}
for arch in amd64 arm64; do \
create_patched_release_image_for_arch ${upstream_registry} ${arch}
podman manifest add ${upstream_registry}/ocp-release:${openshift_version} docker://${upstream_registry}/ocp-release:${openshift_version}-${arch}
done
podman manifest push --all ${upstream_registry}/ocp-release:${openshift_version} docker://${upstream_registry}/ocp-release:${openshift_version}
}

function update_base_image() {
local brew_repo=$1
local base_image=$2
Expand All @@ -122,6 +150,7 @@ openshift_version=$(${OC} adm release info -a ${OPENSHIFT_PULL_SECRET_PATH} ${OP

patch_and_push_image cluster-kube-apiserver-operator
patch_and_push_image cluster-kube-controller-manager-operator
create_new_release_with_patched_images

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

Expand Down

0 comments on commit 5d2b5a3

Please sign in to comment.