Skip to content

Commit dbb3138

Browse files
committed
fix: Make sign-index-image backward compatible with index-image-bootstrap-pipeline
1 parent 2e9bde5 commit dbb3138

1 file changed

Lines changed: 16 additions & 8 deletions

File tree

ansible/roles/operator-pipeline/templates/openshift/tasks/sign-index-image.yml

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,9 @@ spec:
1212
- name: public_repository_mirror
1313
description: |
1414
The public repository mirror where the index image becomes available.
15+
Used by release pipeline to reference the public mirror in signatures.
1516
Example: registry.redhat.io/redhat/community-operator-index
17+
default: ""
1618

1719
# Signing configuration
1820
- name: requester
@@ -110,16 +112,22 @@ spec:
110112
MANIFEST_DIGESTS=""
111113
for i in $DIGEST_LIST
112114
do
113-
PENDING_INDEX_WITH_VERSION=$(echo $i | awk -F '+' '{print $1}')
114-
PENDING_INDEX=$(echo $PENDING_INDEX_WITH_VERSION | awk -F ':' '{print $1}')
115-
VERSION=$(echo $PENDING_INDEX_WITH_VERSION | awk -F ':' '{print $2}')
115+
INDEX_WITH_VERSION=$(echo $i | awk -F '+' '{print $1}')
116+
INDEX=$(echo $INDEX_WITH_VERSION | awk -F ':' '{print $1}')
117+
VERSION=$(echo $INDEX_WITH_VERSION | awk -F ':' '{print $2}')
116118
DIGEST_SHA=$(echo $i | awk -F '@' '{print $2}')
117119
118-
REFERENCE="$(params.public_repository_mirror):${VERSION}"
119-
120-
PENDING_INDEX_WITH_DIGEST_SHA="${PENDING_INDEX}@${DIGEST_SHA}"
121-
122-
MANIFEST_LIST=$(skopeo inspect --retry-times 5 $SKOPEO_EXTRA_ARGS --raw docker://$PENDING_INDEX_WITH_DIGEST_SHA)
120+
if [[ -n "$(params.public_repository_mirror)" ]]; then
121+
# release pipeline
122+
INSPECT_TARGET="${INDEX}@${DIGEST_SHA}" # pending repository
123+
REFERENCE="$(params.public_repository_mirror):${VERSION}"
124+
else
125+
# index image bootstrap signing pipeline
126+
INSPECT_TARGET="${INDEX_WITH_VERSION}" # public repository mirror
127+
REFERENCE="${INDEX_WITH_VERSION}"
128+
fi
129+
130+
MANIFEST_LIST=$(skopeo inspect --retry-times 5 $SKOPEO_EXTRA_ARGS --raw docker://$INSPECT_TARGET)
123131
MANIFEST_LIST=$(echo $MANIFEST_LIST | jq -r '.manifests[].digest')
124132
125133
# create comma separated index images that match each digest

0 commit comments

Comments
 (0)