Skip to content

Commit 81d5bc1

Browse files
committed
upgrade catalog: use digest
This PR does 2 things: -converts image URLS into digest versions. This should pin the references to when they got built -adds a sha/digest tag to the catalog index. This should fix persistence issues and make it possible to use a catalog from a specific sha/digest without it getting deleted on quay.io
1 parent 3307ee4 commit 81d5bc1

File tree

2 files changed

+33
-2
lines changed

2 files changed

+33
-2
lines changed

.github/workflows/catalog-openstack-operator-upgrades.yaml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,3 +87,25 @@ jobs:
8787
registry: ${{ env.imageregistry }}/${{ env.imagenamespace }}
8888
username: ${{ secrets.QUAY_USERNAME }}
8989
password: ${{ secrets.QUAY_PASSWORD }}
90+
digestfile: digest.txt
91+
92+
# tag the quay.io image with the digest so it is preserved
93+
- name: Set OPERATOR_INDEX_IMAGE_DIGEST for Operator and tag
94+
shell: bash
95+
run: |
96+
DIGEST=$(cat digest.txt | sed -e 's|sha256:||')
97+
echo "OPERATOR_INDEX_IMAGE_DIGEST=$DIGEST" >> $GITHUB_ENV
98+
podman tag "${REGISTRY}/${IMAGE}:${GITHUB_SHA}" "${REGISTRY}/${IMAGE}:${DIGEST}"
99+
env:
100+
REGISTRY: ${{ env.imageregistry }}/${{ env.imagenamespace }}
101+
IMAGE: openstack-operator-index-upgrade
102+
GITHUB_SHA: ${{ github.sha }}
103+
104+
- name: Push tag with digest ${{ env.OPERATOR_INDEX_IMAGE_DIGEST }}
105+
uses: redhat-actions/push-to-registry@v2
106+
with:
107+
image: openstack-operator-index-upgrade
108+
tags: ${{ env.OPERATOR_INDEX_IMAGE_DIGEST }}
109+
registry: ${{ env.imageregistry }}/${{ env.imagenamespace }}
110+
username: ${{ secrets.QUAY_USERNAME }}
111+
password: ${{ secrets.QUAY_PASSWORD }}

hack/catalog-build-olm-upgrade.sh

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,14 @@
22
#NOTE: this script is used by the catalog-openstack-operator-upgrades.yaml
33
set -ex
44

5+
function toDigestURL {
6+
local URL=$1
7+
8+
DIGEST=$(skopeo inspect --format '{{.Digest}}' docker://$URL)
9+
echo $URL | sed -e "s|:.*|@$DIGEST|"
10+
11+
}
12+
513
MAIN_VERSION=${MAIN_VERSION:-"0.4.0"}
614
FEATURE_RELEASE_VERSION=${FEATURE_RELEASE_VERSION:-"0.3.0"}
715
FEATURE_RELEASE_BRANCH=${FEATURE_RELEASE_BRANCH:-"18.0-fr3"}
@@ -14,9 +22,10 @@ mkdir catalog
1422
opm generate dockerfile ./catalog -i registry.redhat.io/openshift4/ose-operator-registry-rhel9:v4.18
1523
opm init openstack-operator --default-channel=stable-v1.0 --output yaml > catalog/index.yaml
1624

17-
opm render ${BUNDLE} --output yaml >> catalog/index.yaml
25+
#opm render ${BUNDLE} --output yaml >> catalog/index.yaml
26+
opm render $(toDigestURL $BUNDLE) --output yaml >> catalog/index.yaml
1827
# always default to use the FR release from openstack-k8s-operators
19-
opm render quay.io/openstack-k8s-operators/openstack-operator-bundle:${FEATURE_RELEASE_BRANCH}-latest --output yaml >> catalog/index.yaml
28+
opm render $(toDigestURL quay.io/openstack-k8s-operators/openstack-operator-bundle:${FEATURE_RELEASE_BRANCH}-latest) --output yaml >> catalog/index.yaml
2029

2130
cat >> catalog/index.yaml << EOF_CAT
2231
---

0 commit comments

Comments
 (0)