Skip to content

Commit

Permalink
fix: Reference to a bundle image digest instead of tag (#1724)
Browse files Browse the repository at this point in the history
Signed-off-by: Anatolii Bazko <[email protected]>
  • Loading branch information
tolusha authored Jul 7, 2023
1 parent f8de2ca commit 99127ae
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 9 deletions.
24 changes: 17 additions & 7 deletions build/scripts/olm/release-catalog.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,20 +25,20 @@ init() {
case $1 in
'--channel'|'-c') CHANNEL="$2"; shift 1;;
'--catalog-image'|'-i') CATALOG_IMAGE="$2"; shift 1;;
'--bundle-image'|'-n') BUNDLE_IMAGE="$2"; shift 1;;
'--bundle-image'|'-b') BUNDLE_IMAGE="$2"; shift 1;;
'--image-tool'|'-t') IMAGE_TOOL="$2"; shift 1;;
'--help'|'-h') usage; exit;;
esac
shift 1
done

[[ ! ${IMAGE_TOOL} ]] && IMAGE_TOOL="docker"
if [[ ! ${CHANNEL} ]] || [[ ! ${CATALOG_IMAGE} ]]; then usage; exit 1; fi
if [[ ! ${CHANNEL} ]]; then usage; exit 1; fi

BUNDLE_NAME=$(make bundle-name CHANNEL="${CHANNEL}")
BUNDLE_VERSION=$(make bundle-version CHANNEL="${CHANNEL}")
REGISTRY="$(echo "${CATALOG_IMAGE}" | rev | cut -d '/' -f2- | rev)"
BUNDLE_IMAGE="${BUNDLE_IMAGE:=${REGISTRY}/eclipse-che-olm-bundle:${BUNDLE_VERSION}}"
BUNDLE_IMAGE="${BUNDLE_IMAGE:=quay.io/eclipse/eclipse-che-olm-bundle:${BUNDLE_VERSION}}"
CATALOG_IMAGE=${CATALOG_IMAGE:=quay.io/eclipse/eclipse-che-olm-catalog:${CHANNEL}}

echo "[INFO] Bundle name : ${BUNDLE_NAME}"
echo "[INFO] Bundle version: ${BUNDLE_VERSION}"
Expand All @@ -54,12 +54,13 @@ usage () {
echo
echo "Options:"
echo -e "\t-i,--catalog-image Catalog image to build"
echo -e "\t-i,--bundle-image Bundle image to build"
echo -e "\t-c,--channel=next|stable Olm channel to build bundle from"
echo -e "\t-t,--image-tool [default: docker] Image tool"
echo
echo "Example:"
echo -e "\t$0 -i quay.io/eclipse/eclipse-che-olm-catalog:next -c next"
echo -e "\t$0 -i quay.io/eclipse/eclipse-che-olm-catalog:stable -c stable"
echo -e "\t$0 -c next"
echo -e "\t$0 -c stable"
}

build () {
Expand All @@ -73,8 +74,17 @@ build () {
make bundle-build bundle-push CHANNEL="${CHANNEL}" BUNDLE_IMG="${BUNDLE_IMAGE}" IMAGE_TOOL="${IMAGE_TOOL}"

echo "[INFO] Add bundle to the catalog"

BUNDLE_IMAGE_INSPECT=$(skopeo inspect docker://${BUNDLE_IMAGE})
BUNDLE_IMAGE_WITH_DIGESTS=$(echo "${BUNDLE_IMAGE_INSPECT}" | jq -r '.Name')@$(echo "${BUNDLE_IMAGE_INSPECT}" | jq -r '.Digest')

echo "[INFO] Build image with digest: ${BUNDLE_IMAGE_WITH_DIGESTS}"

# Reference to the bundle image with digest instead of tag
# to deploy Eclipse Che in disconnected cluster
make bundle-render CHANNEL="${CHANNEL}" BUNDLE_NAME="${BUNDLE_NAME}" BUNDLE_IMG="${BUNDLE_IMAGE_WITH_DIGESTS}"

LAST_BUNDLE_NAME=$(yq -r '.entries | .[length - 1].name' "${CHANNEL_PATH}")
make bundle-render CHANNEL="${CHANNEL}" BUNDLE_NAME="${BUNDLE_NAME}" BUNDLE_IMG="${BUNDLE_IMAGE}"
if [[ ${CHANNEL} == "stable" ]]; then
yq -riY '(.entries) += [{"name": "'${BUNDLE_NAME}'", "replaces": "'${LAST_BUNDLE_NAME}'"}]' "${CHANNEL_PATH}"
else
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ metadata:
operators.operatorframework.io/project_layout: go.kubebuilder.io/v3
repository: https://github.com/eclipse-che/che-operator
support: Eclipse Foundation
name: eclipse-che.v7.71.0-799.next
name: eclipse-che.v7.71.0-801.next
namespace: placeholder
spec:
apiservicedefinitions: {}
Expand Down Expand Up @@ -1231,7 +1231,7 @@ spec:
minKubeVersion: 1.19.0
provider:
name: Eclipse Foundation
version: 7.71.0-799.next
version: 7.71.0-801.next
webhookdefinitions:
- admissionReviewVersions:
- v1
Expand Down

0 comments on commit 99127ae

Please sign in to comment.