Skip to content

Commit

Permalink
snc: Use pre-build patched release images
Browse files Browse the repository at this point in the history
snc currently rebuilds the patched release image every time it needs
one. After recent commits, the patched release image is built by
build-patched-kao-kcmo-images.sh and pushed to
quay.io/crcont/ocp-release, so snc can reuse this image instead.
  • Loading branch information
cfergeau authored and praveenkumar committed Dec 22, 2022
1 parent 5d2b5a3 commit a3addda
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 18 deletions.
16 changes: 0 additions & 16 deletions snc-library.sh
Original file line number Diff line number Diff line change
Expand Up @@ -45,22 +45,6 @@ function download_oc() {
fi
}

function create_new_release_with_patched_images() {
upstream_registry=quay.io/crcont
openshift_version=$(${OC} adm release info -a ${OPENSHIFT_PULL_SECRET_PATH} ${OPENSHIFT_INSTALL_RELEASE_IMAGE_OVERRIDE} -ojsonpath='{.config.config.Labels.io\.openshift\.release}')
# As of now `oc adm release new` not able to parse images which have multiple arch manifest file so we first need to get the digest of the image for specific
# 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/${yq_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/${yq_ARCH} -ojson | jq -r .digest)

${OC} adm release new -a ${OPENSHIFT_PULL_SECRET_PATH} --from-release=${OPENSHIFT_INSTALL_RELEASE_IMAGE_OVERRIDE} \
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=quay.io/crcont/ocp-release:${openshift_version}
# Replace the release image override with crcont image
OPENSHIFT_INSTALL_RELEASE_IMAGE_OVERRIDE=quay.io/crcont/ocp-release:${openshift_version}
}

function run_preflight_checks() {
if [ -z "${OPENSHIFT_PULL_SECRET_PATH-}" ]; then
echo "OpenShift pull secret file path must be specified through the OPENSHIFT_PULL_SECRET_PATH environment variable"
Expand Down
4 changes: 2 additions & 2 deletions snc.sh
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,8 @@ fi

if [[ ${USE_PATCHED_RELEASE_IMAGE} == "enabled" ]]
then
echo "Creating a new image with patched KAO/KCMO images"
create_new_release_with_patched_images
echo "Using release image with patched KAO/KCMO images"
OPENSHIFT_INSTALL_RELEASE_IMAGE_OVERRIDE=quay.io/crcont/ocp-release:${OPENSHIFT_RELEASE_VERSION}-${yq_ARCH}
echo "OPENSHIFT_INSTALL_RELEASE_IMAGE_OVERRIDE set to ${OPENSHIFT_INSTALL_RELEASE_IMAGE_OVERRIDE}"
fi

Expand Down

0 comments on commit a3addda

Please sign in to comment.