Skip to content

Commit b2b46d7

Browse files
committed
pin-bundle-images: resolve fork tags from Quay under local registry CI
When LOCAL_REGISTRY=1 and the go.mod module path is not under openstack-k8s-operators, keep bundle pullspecs on IMAGEREGISTRY but query Quay for bundle tag digests. Upstream modules still use the local registry v2 tags/list path when mirrored. Signed-off-by: Amartya Sinha <amsinha@redhat.com>
1 parent e795160 commit b2b46d7

1 file changed

Lines changed: 19 additions & 9 deletions

File tree

hack/pin-bundle-images.sh

Lines changed: 19 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -46,24 +46,34 @@ for MOD_PATH in ${MOD_PATHS}; do
4646
if [[ "$GITHUB_USER" != "openstack-k8s-operators" || "$BASE" == "$IMAGEBASE" ]]; then
4747
if [[ "$IMAGENAMESPACE" != "openstack-k8s-operators" || "${IMAGEREGISTRY}" != "quay.io" ]]; then
4848
REPO_URL="${IMAGEREGISTRY}/${IMAGENAMESPACE}"
49-
CURL_REGISTRY="${IMAGEREGISTRY}"
50-
# Quay registry v2 api does not return all the tags that's why keeping v1 for quay and v2
51-
# for local registry
5249
if [[ ${LOCAL_REGISTRY} -eq 1 ]]; then
53-
REPO_CURL_URL="http://${CURL_REGISTRY}/v2/${IMAGENAMESPACE}"
54-
elif [[ "${CURL_REGISTRY}" == "docker.io" ]]; then
55-
# replace docker.io by hub.docker.com to read tags
56-
REPO_CURL_URL="https://hub.docker.com/v2/repositories/${IMAGENAMESPACE}"
50+
# Pullspecs use the local registry. Tag source: local v2 when upstream bundles are mirrored
51+
# locally; Quay v1 only for forks (module path not under openstack-k8s-operators), where tags
52+
# typically are not on the ephemeral registry.
53+
if [[ "$GITHUB_USER" != "openstack-k8s-operators" ]]; then
54+
CURL_REGISTRY="quay.io"
55+
REPO_CURL_URL="https://${CURL_REGISTRY}/api/v1/repository/${GITHUB_USER}"
56+
# Tags and images live on Quay under the fork; do not emit content-provider pullspecs for skopeo.
57+
REPO_URL="${CURL_REGISTRY}/${GITHUB_USER}"
58+
else
59+
CURL_REGISTRY="${IMAGEREGISTRY}"
60+
REPO_CURL_URL="http://${CURL_REGISTRY}/v2/${IMAGENAMESPACE}"
61+
fi
5762
else
58-
REPO_CURL_URL="https://${CURL_REGISTRY}/api/v1/repository/${IMAGENAMESPACE}"
63+
CURL_REGISTRY="${IMAGEREGISTRY}"
64+
if [[ "${CURL_REGISTRY}" == "docker.io" ]]; then
65+
REPO_CURL_URL="https://hub.docker.com/v2/repositories/${IMAGENAMESPACE}"
66+
else
67+
REPO_CURL_URL="https://${CURL_REGISTRY}/api/v1/repository/${IMAGENAMESPACE}"
68+
fi
5969
fi
6070
else
6171
REPO_CURL_URL="https://${CURL_REGISTRY}/api/v1/repository/${GITHUB_USER}"
6272
REPO_URL="${CURL_REGISTRY}/${GITHUB_USER}"
6373
fi
6474
fi
6575

66-
if [[ ${LOCAL_REGISTRY} -eq 1 && ( "$GITHUB_USER" != "openstack-k8s-operators" || "$BASE" == "$IMAGEBASE" ) ]]; then
76+
if [[ ${LOCAL_REGISTRY} -eq 1 && "${CURL_REGISTRY}" != "quay.io" && ( "$GITHUB_USER" != "openstack-k8s-operators" || "$BASE" == "$IMAGEBASE" ) ]]; then
6777
SHA=$(curl -s ${REPO_CURL_URL}/$BASE-operator-bundle/tags/list | jq -r '.tags // [] | .[]' | sort -u | { grep $REF || true; })
6878
elif [[ "${CURL_REGISTRY}" == "docker.io" ]]; then
6979
SHA=$(curl -s ${REPO_CURL_URL}/$BASE-operator-bundle/tags/?page_size=100 | jq -r '.results // [] | .[].name' | sort -u | { grep $REF || true; })

0 commit comments

Comments
 (0)