-
Notifications
You must be signed in to change notification settings - Fork 1
Make bump-version.sh hermetic and manually update bundle files #207
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -73,4 +73,4 @@ formatters: | |
| - builtin$ | ||
| - examples$ | ||
| run: | ||
| timeout: 5m | ||
| timeout: 10m | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2,50 +2,109 @@ | |
|
|
||
| set -e | ||
|
|
||
| # Accept version as first argument, fall back to VERSION env var, or show usage | ||
| # Generate or accept version | ||
| # Priority: 1) command line arg, 2) OPERATOR_VERSION env var, 3) generate from Makefile + commit | ||
| if [ -n "$1" ]; then | ||
| VERSION="$1" | ||
| elif [ -z "$VERSION" ]; then | ||
| echo "Usage: $0 <version>" | ||
| echo " or set VERSION environment variable" | ||
| echo "Example: $0 1.2.1" | ||
| exit 1 | ||
| echo "Using version from argument: $VERSION" | ||
| elif [ -n "$OPERATOR_VERSION" ]; then | ||
| VERSION="$OPERATOR_VERSION" | ||
| echo "Using version from OPERATOR_VERSION environment: $VERSION" | ||
| else | ||
| # Generate version from Makefile + commit SHA | ||
| echo "Generating version dynamically..." | ||
|
|
||
| # Read base version from Makefile | ||
| if [ -f Makefile ]; then | ||
| BASE_VERSION=$(grep -E "^VERSION \?=" Makefile | awk '{print $3}') | ||
|
Comment on lines
+17
to
+19
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Keep
Proposed fix- BASE_VERSION=$(grep -E "^VERSION \?=" Makefile | awk '{print $3}')
+ BASE_VERSION=$(grep -E "^VERSION \?=" Makefile | awk '{print $3}' | sed -E 's/-[0-9a-f]{7}$//')Also applies to: 87-88 🤖 Prompt for AI Agents
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is not actually modifying the code it is just modifying the code in the pipeline There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧩 Analysis chain
🏁 Script executed: Length of output: 244 🏁 Script executed: Length of output: 508 🏁 Script executed: Length of output: 56 🏁 Script executed: Length of output: 43 🏁 Script executed: Length of output: 43
|
||
| else | ||
| echo "❌ ERROR: Makefile not found and VERSION not provided" | ||
| echo "Usage: $0 <version>" | ||
| echo " or set OPERATOR_VERSION environment variable" | ||
| exit 1 | ||
| fi | ||
|
|
||
| if [ -z "$BASE_VERSION" ]; then | ||
| echo "❌ ERROR: Could not read VERSION from Makefile" | ||
| exit 1 | ||
| fi | ||
|
|
||
| # Get commit SHA from environment variable (set by pipeline) or git | ||
| COMMIT_SHA_VALUE="${COMMIT_SHA:-}" | ||
| if [ -z "$COMMIT_SHA_VALUE" ] && command -v git &> /dev/null && [ -d .git ]; then | ||
| COMMIT_SHA_VALUE=$(git rev-parse HEAD 2>/dev/null || echo "") | ||
| fi | ||
|
|
||
| # If we have a commit SHA, append it to the version | ||
| if [ -n "$COMMIT_SHA_VALUE" ]; then | ||
| COMMIT_SHORT="${COMMIT_SHA_VALUE:0:7}" | ||
| VERSION="${BASE_VERSION}-${COMMIT_SHORT}" | ||
| echo "Generated version: $VERSION (from Makefile: $BASE_VERSION + commit: $COMMIT_SHORT)" | ||
| else | ||
| VERSION="$BASE_VERSION" | ||
| echo "Using base version from Makefile: $VERSION (no commit SHA available)" | ||
| fi | ||
| fi | ||
|
|
||
| echo "Bumping version to: $VERSION" | ||
|
|
||
| # Extract major.minor version for CPE label (e.g., 1.3.4 -> 1.3) | ||
| # Extract major.minor version for CPE label (e.g., 1.3.4 -> 1.3, 1.3.0-abc1234 -> 1.3) | ||
| MAJOR_MINOR=$(echo "$VERSION" | sed -E 's/^([0-9]+\.[0-9]+).*/\1/') | ||
| echo "CPE version (major.minor): $MAJOR_MINOR" | ||
|
|
||
| yq -i ".spec.version=\"${VERSION}\"" config/manifests/bases/multiarch-tuning-operator.clusterserviceversion.yaml | ||
| yq -i ".metadata.name=\"multiarch-tuning-operator.v${VERSION}\"" config/manifests/bases/multiarch-tuning-operator.clusterserviceversion.yaml | ||
| yq -i ".spec.startingCSV=\"multiarch-tuning-operator.v${VERSION}\"" deploy/base/operators.coreos.com/subscriptions/openshift-multiarch-tuning-operator/subscription.yaml | ||
| yq eval-all -i "(select(.schema==\"olm.channel\").entries[0].name)=\"multiarch-tuning-operator.v${VERSION}\"" index.base.yaml | ||
|
|
||
|
|
||
| if [[ "$(uname)" == "Darwin" ]]; then | ||
| # macOS BSD sed | ||
| sed -i '' "s/^LABEL release=.*/LABEL release=\"${VERSION}\"/" Dockerfile | ||
| sed -i '' "s/^LABEL version=.*/LABEL version=\"${VERSION}\"/" Dockerfile | ||
| sed -i '' "s/^LABEL cpe=.*/LABEL cpe=\"cpe:\/a:redhat:multiarch_tuning_operator:${MAJOR_MINOR}::el9\"/" Dockerfile | ||
| sed -i '' "s/^LABEL release=.*/LABEL release=\"${VERSION}\"/" konflux.Dockerfile | ||
| sed -i '' "s/^LABEL version=.*/LABEL version=\"${VERSION}\"/" konflux.Dockerfile | ||
| sed -i '' "s/^LABEL cpe=.*/LABEL cpe=\"cpe:\/a:redhat:multiarch_tuning_operator:${MAJOR_MINOR}::el9\"/" konflux.Dockerfile | ||
| sed -i '' "s/^LABEL cpe=.*/LABEL cpe=\"cpe:\/a:redhat:multiarch_tuning_operator:${MAJOR_MINOR}::el9\"/" bundle.Dockerfile | ||
| sed -i '' "s/^LABEL cpe=.*/LABEL cpe=\"cpe:\/a:redhat:multiarch_tuning_operator:${MAJOR_MINOR}::el9\"/" bundle.konflux.Dockerfile | ||
| sed -i '' "s/^VERSION ?= .*/VERSION ?= ${VERSION}/" Makefile | ||
| # Escape version for use in sed (handles dots and dashes) | ||
| VERSION_ESCAPED=$(echo "$VERSION" | sed 's/[.]/\\./g') | ||
|
|
||
| echo "Updating version references..." | ||
|
|
||
| # Update config/manifests/bases/multiarch-tuning-operator.clusterserviceversion.yaml | ||
| sed -i "s/^ version: .*/ version: ${VERSION}/" config/manifests/bases/multiarch-tuning-operator.clusterserviceversion.yaml | ||
| sed -i "s/^ name: multiarch-tuning-operator\.v.*/ name: multiarch-tuning-operator.v${VERSION}/" config/manifests/bases/multiarch-tuning-operator.clusterserviceversion.yaml | ||
|
|
||
| # Update deploy/base/operators.coreos.com/subscriptions/openshift-multiarch-tuning-operator/subscription.yaml | ||
| sed -i "s/^ startingCSV: multiarch-tuning-operator\.v.*/ startingCSV: multiarch-tuning-operator.v${VERSION}/" deploy/base/operators.coreos.com/subscriptions/openshift-multiarch-tuning-operator/subscription.yaml | ||
|
|
||
| # Update index.base.yaml (channel entry name) | ||
| sed -i "s/^ name: multiarch-tuning-operator\.v.*/ name: multiarch-tuning-operator.v${VERSION}/" index.base.yaml | ||
|
|
||
| # Update Dockerfiles | ||
| sed -i "s/^LABEL release=.*/LABEL release=\"${VERSION}\"/" Dockerfile | ||
| sed -i "s/^LABEL version=.*/LABEL version=\"${VERSION}\"/" Dockerfile | ||
| sed -i "s/^LABEL cpe=.*/LABEL cpe=\"cpe:\/a:redhat:multiarch_tuning_operator:${MAJOR_MINOR}::el9\"/" Dockerfile | ||
|
|
||
| sed -i "s/^LABEL release=.*/LABEL release=\"${VERSION}\"/" konflux.Dockerfile | ||
| sed -i "s/^LABEL version=.*/LABEL version=\"${VERSION}\"/" konflux.Dockerfile | ||
| sed -i "s/^LABEL cpe=.*/LABEL cpe=\"cpe:\/a:redhat:multiarch_tuning_operator:${MAJOR_MINOR}::el9\"/" konflux.Dockerfile | ||
|
|
||
| sed -i "s/^LABEL release=.*/LABEL release=\"${VERSION}\"/" bundle.Dockerfile | ||
| sed -i "s/^LABEL version=.*/LABEL version=\"${VERSION}\"/" bundle.Dockerfile | ||
| sed -i "s/^LABEL cpe=.*/LABEL cpe=\"cpe:\/a:redhat:multiarch_tuning_operator:${MAJOR_MINOR}::el9\"/" bundle.Dockerfile | ||
|
|
||
| sed -i "s/^LABEL release=.*/LABEL release=\"${VERSION}\"/" bundle.konflux.Dockerfile | ||
| sed -i "s/^LABEL version=.*/LABEL version=\"${VERSION}\"/" bundle.konflux.Dockerfile | ||
| sed -i "s/^LABEL cpe=.*/LABEL cpe=\"cpe:\/a:redhat:multiarch_tuning_operator:${MAJOR_MINOR}::el9\"/" bundle.konflux.Dockerfile | ||
|
|
||
| # Update Makefile | ||
| sed -i "s/^VERSION ?= .*/VERSION ?= ${VERSION}/" Makefile | ||
|
|
||
| # Update bundle files directly (instead of running make bundle) | ||
| echo "Updating bundle files..." | ||
|
|
||
| # Update bundle/manifests/multiarch-tuning-operator.clusterserviceversion.yaml | ||
| if [ -f bundle/manifests/multiarch-tuning-operator.clusterserviceversion.yaml ]; then | ||
| sed -i "s/^ version: .*/ version: ${VERSION}/" bundle/manifests/multiarch-tuning-operator.clusterserviceversion.yaml | ||
| sed -i "s/^ name: multiarch-tuning-operator\.v.*/ name: multiarch-tuning-operator.v${VERSION}/" bundle/manifests/multiarch-tuning-operator.clusterserviceversion.yaml | ||
| else | ||
| # Linux GNU sed | ||
| sed -i "s/^LABEL release=.*/LABEL release=\"${VERSION}\"/" Dockerfile | ||
| sed -i "s/^LABEL version=.*/LABEL version=\"${VERSION}\"/" Dockerfile | ||
| sed -i "s/^LABEL cpe=.*/LABEL cpe=\"cpe:\/a:redhat:multiarch_tuning_operator:${MAJOR_MINOR}::el9\"/" Dockerfile | ||
| sed -i "s/^LABEL release=.*/LABEL release=\"${VERSION}\"/" konflux.Dockerfile | ||
| sed -i "s/^LABEL version=.*/LABEL version=\"${VERSION}\"/" konflux.Dockerfile | ||
| sed -i "s/^LABEL cpe=.*/LABEL cpe=\"cpe:\/a:redhat:multiarch_tuning_operator:${MAJOR_MINOR}::el9\"/" konflux.Dockerfile | ||
| sed -i "s/^LABEL cpe=.*/LABEL cpe=\"cpe:\/a:redhat:multiarch_tuning_operator:${MAJOR_MINOR}::el9\"/" bundle.Dockerfile | ||
| sed -i "s/^LABEL cpe=.*/LABEL cpe=\"cpe:\/a:redhat:multiarch_tuning_operator:${MAJOR_MINOR}::el9\"/" bundle.konflux.Dockerfile | ||
| sed -i "s/^VERSION ?= .*/VERSION ?= ${VERSION}/" Makefile | ||
| echo "⚠️ Warning: bundle/manifests/multiarch-tuning-operator.clusterserviceversion.yaml not found, skipping" | ||
| fi | ||
| echo "make bundle" | ||
| make bundle | ||
|
|
||
| # Update bundle/metadata/annotations.yaml | ||
| if [ -f bundle/metadata/annotations.yaml ]; then | ||
| # The annotations.yaml has version in several places, update all | ||
| sed -i "s/operators\.operatorframework\.io\.bundle\.channels\.v1: .*/operators.operatorframework.io.bundle.channels.v1: stable/" bundle/metadata/annotations.yaml | ||
| else | ||
| echo "⚠️ Warning: bundle/metadata/annotations.yaml not found, skipping" | ||
| fi | ||
|
|
||
| echo "✅ Version bumped to: $VERSION" | ||
| echo "✅ All version references updated" | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧩 Analysis chain
🏁 Script executed:
Repository: openshift/multiarch-tuning-operator
Length of output: 881
🏁 Script executed:
Repository: openshift/multiarch-tuning-operator
Length of output: 61
🏁 Script executed:
Repository: openshift/multiarch-tuning-operator
Length of output: 556
🏁 Script executed:
Repository: openshift/multiarch-tuning-operator
Length of output: 529
🏁 Script executed:
Repository: openshift/multiarch-tuning-operator
Length of output: 61
🏁 Script executed:
Repository: openshift/multiarch-tuning-operator
Length of output: 12349
🏁 Script executed:
Repository: openshift/multiarch-tuning-operator
Length of output: 668
🏁 Script executed:
Repository: openshift/multiarch-tuning-operator
Length of output: 10040
🏁 Script executed:
Repository: openshift/multiarch-tuning-operator
Length of output: 2982
🏁 Script executed:
Repository: openshift/multiarch-tuning-operator
Length of output: 1683
🏁 Script executed:
Repository: openshift/multiarch-tuning-operator
Length of output: 61
🏁 Script executed:
Repository: openshift/multiarch-tuning-operator
Length of output: 151
🏁 Script executed:
Repository: openshift/multiarch-tuning-operator
Length of output: 969
🏁 Script executed:
Repository: openshift/multiarch-tuning-operator
Length of output: 791
🏁 Script executed:
Repository: openshift/multiarch-tuning-operator
Length of output: 264
🏁 Script executed:
# Check if UBI 9 go-toolset:1.25 specifically is documented or if there's a known digest web_search UBI 9 go-toolset 1.25 registry.access.redhat.com image digestRepository: openshift/multiarch-tuning-operator
Length of output: 172
🌐 Web query:
UBI 9 go-toolset 1.25 registry.access.redhat.com image digest sha256💡 Result:
The registry.access.redhat.com/ubi9/go-toolset container image is a frequently updated, rolling-release image provided by Red Hat [1][2]. Because it is updated regularly to include the latest security patches and Go toolchain versions, there is no single, static SHA256 digest for the image [3][4][5]. To obtain the current, specific SHA256 digest for the ubi9/go-toolset image, you should query the Red Hat Container Registry directly using a tool like skopeo or podman. You can retrieve the digest for the latest version by running the following command: podman inspect registry.access.redhat.com/ubi9/go-toolset --format '{{.Digest}}' Alternatively, if you have skopeo installed, you can inspect the remote image without pulling it: skopeo inspect docker://registry.access.redhat.com/ubi9/go-toolset | grep Digest These commands will return the current, immutable digest for the image tag currently available in the registry [6]. For production environments, it is recommended to use this specific digest in your Dockerfiles or container manifests to ensure build reproducibility [3][4]. You can find further information and documentation on using these images in the Red Hat Ecosystem Catalog [1][7].
Citations:
Pin
SCRIPT_RUNNER_IMAGEby digest.The
registry.access.redhat.com/ubi9/go-toolset:1.25tag is mutable and receives rolling updates, so therun-scripttask can execute different code across builds despiteHERMETIC=true. While the resolved reference is recorded inADDITIONAL_BASE_IMAGESfor tracking, this does not prevent the image from being re-pulled with different content. Pinning by digest is required to achieve true hermetic behavior and is consistent with the recent commit's goal of fixing hermetic compliance violations.Proposed fix
Obtain the digest using:
podman inspect registry.access.redhat.com/ubi9/go-toolset:1.25 --format '{{.Digest}}'🤖 Prompt for AI Agents