Skip to content

Commit

Permalink
Allow to provide an operator custom tag in pin-bundle
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
viroel committed Jan 9, 2024
1 parent ca1faeb commit cb63213
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions hack/pin-bundle-images.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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"
Expand Down

0 comments on commit cb63213

Please sign in to comment.