From cb632135cd3bd38d17b7158ea772905e81f638b6 Mon Sep 17 00:00:00 2001 From: Douglas Viroel Date: Mon, 8 Jan 2024 17:44:26 -0300 Subject: [PATCH] Allow to provide an operator custom tag in pin-bundle This patch allow us to provide a custom tag to service operator, defined by IMAGEBASE, while pinning all bundles using 'pin-bundle-images' script. This will enable us to build bundles with custom tags in Prow, avoiding conflicts with concurrent jobs. --- hack/pin-bundle-images.sh | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/hack/pin-bundle-images.sh b/hack/pin-bundle-images.sh index 2d75ebe5f..08cc79cc8 100755 --- a/hack/pin-bundle-images.sh +++ b/hack/pin-bundle-images.sh @@ -8,6 +8,7 @@ DOCKERFILE=${DOCKERFILE:-""} IMAGENAMESPACE=${IMAGENAMESPACE:-"openstack-k8s-operators"} IMAGEREGISTRY=${IMAGEREGISTRY:-"quay.io"} IMAGEBASE=${IMAGEBASE:-} +IMAGECUSTOMTAG=${IMAGECUSTOMTAG:-} LOCAL_REGISTRY=${LOCAL_REGISTRY:-0} if [ -n "$DOCKERFILE" ]; then @@ -26,10 +27,17 @@ for MOD_PATH in $(go list -mod=readonly -m -json all | jq -r '. | select(.Path | GIT_REPO=${MOD_PATH%"/apis"} GIT_REPO=${GIT_REPO%"/api"} - REF=$(echo $MOD_VERSION | sed -e 's|v[0-9]*.[0-9]*.[0-9]*-.*[0-9]*-\(.*\)$|\1|') - if [[ "$REF" == v* ]]; then - REF=$(git ls-remote https://${GIT_REPO} | grep ${REF} | awk 'NR==1{print $1}') + + # Check if there is a custom tag for IMAGEBASE operator + if [[ -n "$IMAGECUSTOMTAG" && "$BASE" == "$IMAGEBASE" ]]; then + REF=${IMAGECUSTOMTAG} + else + REF=$(echo $MOD_VERSION | sed -e 's|v[0-9]*.[0-9]*.[0-9]*-.*[0-9]*-\(.*\)$|\1|') + if [[ "$REF" == v* ]]; then + REF=$(git ls-remote https://${GIT_REPO} | grep ${REF} | awk 'NR==1{print $1}') + fi fi + GITHUB_USER=$(echo $MOD_PATH | sed -e 's|github.com/\(.*\)/.*-operator/.*$|\1|') CURL_REGISTRY="quay.io" REPO_CURL_URL="https://${CURL_REGISTRY}/api/v1/repository/openstack-k8s-operators"