Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use OLM bundle image digest file to pin image used by index #874

Merged
merged 1 commit into from
Mar 2, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions bundle/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,9 @@
<argument>--bundle-image</argument>
<argument>${kas.bundle.image}</argument>
<!-- -->
<argument>--bundle-image-digest-file</argument>
<argument>${project.build.directory}/bundle/jib-image.digest</argument>
<!-- -->
<argument>--index-registry</argument>
<argument>${kas.index.image-registry}</argument>
<!-- -->
Expand Down
11 changes: 11 additions & 0 deletions bundle/src/main/sh/build-push-index.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#!/bin/sh

BUNDLE_IMAGE=
BUNDLE_IMAGE_DIGEST_FILE=''
INDEX_REGISTRY=
INDEX_GROUP=
INDEX_IMAGE=
Expand All @@ -14,6 +15,11 @@ while [[ ${#} -gt 0 ]]; do
shift
shift
;;
"--bundle-image-digest-file" )
BUNDLE_IMAGE_DIGEST_FILE="${2:?${key} requires a valid bundle image digest file reference}"
shift
shift
;;
"--index-registry" )
INDEX_REGISTRY="${2:?${key} requires an index registry value}"
shift
Expand Down Expand Up @@ -46,6 +52,11 @@ while [[ ${#} -gt 0 ]]; do
esac
done

if [ -f "${BUNDLE_IMAGE_DIGEST_FILE}" ] ; then
BUNDLE_IMAGE_BASE=$(echo "${BUNDLE_IMAGE}" | cut -d ':' -f 1)
BUNDLE_IMAGE="${BUNDLE_IMAGE_BASE}@$(cat "${BUNDLE_IMAGE_DIGEST_FILE}")"
fi

opm index add --bundles "${BUNDLE_IMAGE}" --generate -d $(pwd)/index.Dockerfile

# set docker env variable to force it build images for linux/amd64 platform
Expand Down