Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
159 commits
Select commit Hold shift + click to select a range
f2bcbaf
chore(operator): wrapper for bundle helpers
porridge Jan 29, 2026
5e1b473
chore(operator): Go implemetation of fix-spec-descriptor-order
porridge Jan 29, 2026
61b39a4
fixes
porridge Jan 29, 2026
3fa1620
merge
porridge Feb 9, 2026
bfe4711
tidy
porridge Feb 9, 2026
5068886
move the tidy
porridge Feb 10, 2026
6766236
go mod tidy
porridge Feb 10, 2026
11d68b9
fix deps, checkout
porridge Feb 10, 2026
849d3c6
cleanup e2e
porridge Feb 10, 2026
e52c177
fix normalizer path
porridge Feb 10, 2026
e33466c
fix comparison
porridge Feb 10, 2026
10f6db8
improve comparison, fix summary
porridge Feb 10, 2026
4352773
keep linter happy
porridge Feb 10, 2026
c39b056
lint
porridge Feb 10, 2026
45788b4
lint
porridge Feb 10, 2026
36bb72c
try multiple modes
porridge Feb 10, 2026
0028766
pass related images mode
porridge Feb 10, 2026
3286a78
do not fail fast, set related image vars
porridge Feb 10, 2026
05d7951
matrix artifacts
porridge Feb 10, 2026
1a0e641
set -e and git diff at end
porridge Feb 10, 2026
abde0a2
branding
porridge Feb 10, 2026
92ce394
chore(operator): complete Go bundle helpers implementation
GrimmiMeloni Feb 10, 2026
4995d3f
docs(operator): add bundle helpers README
GrimmiMeloni Feb 10, 2026
5f58e1f
fix(operator): address Sourcery review comments on bundle helpers
GrimmiMeloni Feb 10, 2026
89c5123
fix(operator): use errors.New instead of fmt.Errorf without args
GrimmiMeloni Feb 10, 2026
acdb6e3
chore: Trigger Konflux pipeline re-run
GrimmiMeloni Feb 10, 2026
985c4fd
chore(ci): add gomod prefetch to operator bundle build
GrimmiMeloni Feb 11, 2026
570c1da
adjust konflux docker file for go build
GrimmiMeloni Feb 11, 2026
564c018
switch microdnf to dnf
GrimmiMeloni Feb 11, 2026
dd0ab37
switch default version of python3 in the builder to installed 3.12
GrimmiMeloni Feb 11, 2026
7ba2145
align python versions across docker build and test GHA
GrimmiMeloni Feb 12, 2026
68c8437
review changes
GrimmiMeloni Feb 12, 2026
3c8b871
refactor(operator): deduplicate skip version processing logic
GrimmiMeloni Feb 12, 2026
830f737
remove obsoletes
GrimmiMeloni Feb 13, 2026
3236639
simply skip version detection
GrimmiMeloni Feb 13, 2026
e1142d3
simplify more
GrimmiMeloni Feb 13, 2026
510b04f
more shared common logic
GrimmiMeloni Feb 13, 2026
3826c1f
simplify
GrimmiMeloni Feb 13, 2026
889296f
adjust behavior of echoReplaceVersion
GrimmiMeloni Feb 13, 2026
c6ab251
improve bundle helper comparison script isolation
GrimmiMeloni Feb 13, 2026
788ce75
add error handling for ENV vars
GrimmiMeloni Feb 13, 2026
09a2147
adjust comment
GrimmiMeloni Feb 13, 2026
af1c133
modernize sorter
GrimmiMeloni Feb 13, 2026
6ad98e9
further simplify sorter
GrimmiMeloni Feb 13, 2026
5a21f41
deduplicate code around yaml encoding
GrimmiMeloni Feb 16, 2026
fdb7a2d
address code review from sourcery.ai
GrimmiMeloni Feb 16, 2026
2ce59ea
adjust pyyaml version
GrimmiMeloni Feb 16, 2026
d256219
fix(operator): upgrade pip and setuptools for Python 3.12 compatibility
GrimmiMeloni Feb 16, 2026
4407c07
fix(operator): use two-stage pip upgrade for old CI environments
GrimmiMeloni Feb 16, 2026
7927523
fix style
GrimmiMeloni Feb 16, 2026
2f32121
fix(operator): simplify to single-stage upgrade with pip 21.3.1
GrimmiMeloni Feb 16, 2026
bfe8edb
fix(operator): rely on venv's default setuptools for compatibility
GrimmiMeloni Feb 16, 2026
d7ecc1a
fix(operator): remove pip upgrade to avoid Python 3.12 incompatibility
GrimmiMeloni Feb 16, 2026
fa05049
Update .github/workflows/test-bundle-helpers.yaml
GrimmiMeloni Feb 18, 2026
ee1a728
Update .github/workflows/test-bundle-helpers.yaml
GrimmiMeloni Feb 18, 2026
67d6db7
Update .github/workflows/test-bundle-helpers.yaml
GrimmiMeloni Feb 18, 2026
6a5687a
Update .github/workflows/test-bundle-helpers.yaml
GrimmiMeloni Feb 18, 2026
a11fa5e
Update .github/workflows/test-bundle-helpers.yaml
GrimmiMeloni Feb 18, 2026
2dc18bd
Update .github/workflows/test-bundle-helpers.yaml
GrimmiMeloni Feb 18, 2026
0dd3e02
Update .github/workflows/test-bundle-helpers.yaml
GrimmiMeloni Feb 18, 2026
dc76560
Update .github/workflows/test-bundle-helpers.yaml
GrimmiMeloni Feb 18, 2026
96ada65
incorporate review comments
GrimmiMeloni Feb 18, 2026
2c17dce
Update operator/bundle_helpers/yaml-normalizer.py
GrimmiMeloni Feb 18, 2026
c9e3687
Update operator/bundle_helpers/yaml-normalizer.py
GrimmiMeloni Feb 18, 2026
160fa22
Update operator/bundle_helpers/README.md
GrimmiMeloni Feb 18, 2026
b374852
Update operator/bundle_helpers/README.md
GrimmiMeloni Feb 18, 2026
1425c1b
Update operator/bundle_helpers/README.md
GrimmiMeloni Feb 18, 2026
a436939
address review comments
GrimmiMeloni Feb 18, 2026
1013d3a
address review comments
GrimmiMeloni Feb 18, 2026
4aa2253
Update operator/bundle_helpers/pkg/rewrite/rewriter_test.go
GrimmiMeloni Feb 18, 2026
6a07478
refactor replacedVersion from pointer to value type
GrimmiMeloni Feb 18, 2026
60d2d62
Update operator/bundle_helpers/pkg/rewrite/rewriter.go
GrimmiMeloni Feb 18, 2026
c7c062a
Update operator/bundle_helpers/pkg/rewrite/rewriter.go
GrimmiMeloni Feb 18, 2026
3a72beb
Update operator/bundle_helpers/pkg/descriptor/sorter.go
GrimmiMeloni Feb 18, 2026
e924bf1
Update operator/bundle_helpers/pkg/csv/version.go
GrimmiMeloni Feb 18, 2026
bd311eb
test: update TestCalculateReplacedVersion to expect nil for no replac…
GrimmiMeloni Feb 18, 2026
af6c1d1
refactor: change CalculateReplacedVersion to return *XyzVersion
GrimmiMeloni Feb 18, 2026
e87114d
refactor: update CalculateReplacedVersionForCSV to return *XyzVersion
GrimmiMeloni Feb 18, 2026
4246452
fix: only set spec["replaces"] when replacedVersion is not nil
GrimmiMeloni Feb 18, 2026
ed15741
fix: only print replacedVersion when not nil in echo mode
GrimmiMeloni Feb 18, 2026
de48ded
refactor: parse version strings early in CalculateReplacedVersion
GrimmiMeloni Feb 18, 2026
b1cbd6b
refactor: parse version strings early in CalculateReplacedVersionForCSV
GrimmiMeloni Feb 18, 2026
92e3f13
fix integration tests: export RELATED_IMAGE_* env vars
GrimmiMeloni Feb 18, 2026
578c6fe
test: add initial TestFixCSVDescriptorsMap cases
GrimmiMeloni Feb 24, 2026
75c2ed7
test: add remaining TestFixCSVDescriptorsMap cases
GrimmiMeloni Feb 24, 2026
710d772
test: add TestAllowRelativeFieldDependenciesMap
GrimmiMeloni Feb 24, 2026
eb39f8f
feat(bundle-helpers): add GetString helper for chartutil.Values
GrimmiMeloni Feb 24, 2026
b3869ff
chore(bundle-helpers): fix code style in values package
GrimmiMeloni Feb 24, 2026
d884111
feat(bundle-helpers): add GetMap helper
GrimmiMeloni Feb 24, 2026
aa4a8e4
fix(bundle-helpers): fix GetMap to use PathValue pattern
GrimmiMeloni Feb 24, 2026
9763cb2
feat(bundle-helpers): add GetArray helper
GrimmiMeloni Feb 24, 2026
d49040f
feat(bundle-helpers): add GetValue and PathExists helpers
GrimmiMeloni Feb 24, 2026
7465bea
feat(bundle-helpers): add SetValue helper
GrimmiMeloni Feb 25, 2026
a8fdac9
chore(bundle-helpers): fix code style in values package
GrimmiMeloni Feb 25, 2026
19d80db
refactor(bundle-helpers): use chartutil.ReadValues in patch_csv
GrimmiMeloni Feb 25, 2026
b29a618
fix(bundle-helpers): handle top-level paths and chartutil.Values in v…
GrimmiMeloni Feb 25, 2026
0dd6004
fix(bundle-helpers): handle chartutil.Values in rewrite.Strings
GrimmiMeloni Feb 25, 2026
2d4d1b7
refactor(bundle-helpers): use chartutil.Values and helpers in patcher
GrimmiMeloni Feb 25, 2026
e28b360
refactor(bundle-helpers): eliminate duplicated branch in injectRelate…
GrimmiMeloni Feb 25, 2026
5f67097
fix(bundle-helpers): fix GetMap and handle dotted annotation/label keys
GrimmiMeloni Feb 25, 2026
90f5688
refactor(bundle-helpers): use chartutil.Values in fix-spec-descriptor…
GrimmiMeloni Feb 25, 2026
5e97de1
refactor(bundle-helpers): remove dead chartutil.Values branches in ad…
GrimmiMeloni Feb 25, 2026
6f22895
refactor(bundle-helpers): simplify metadata.labels access in PatchCSV
GrimmiMeloni Feb 25, 2026
0534e09
fix(bundle-helpers): always ensure metadata.labels map exists in Patc…
GrimmiMeloni Feb 26, 2026
865cbee
refactor(bundle-helpers): remove pathValue wrapper, use PathValue dir…
GrimmiMeloni Feb 26, 2026
f977d42
refactor(bundle-helpers): remove dead code GetValue and PathExists
GrimmiMeloni Feb 26, 2026
e476b08
refactor(bundle-helpers): remove GetMap wrapper, use vals.Table directly
GrimmiMeloni Feb 26, 2026
fd8be01
refactor(bundle-helpers): simplify CRD owned lookup in addSecurityPol…
GrimmiMeloni Feb 26, 2026
cf6dc26
fix comment
GrimmiMeloni Feb 26, 2026
972bac3
fix(bundle-helpers): propagate strconv.Atoi errors in ParseXyzVersion
GrimmiMeloni Feb 26, 2026
62316e1
stronger typing, prefer XyzVersion over string
GrimmiMeloni Feb 26, 2026
b699bc5
rename symbol
GrimmiMeloni Feb 26, 2026
8da2d38
improve comment in advancePastSkips
GrimmiMeloni Feb 26, 2026
3fd7c68
add semantic comparison methods to XyzVersion
GrimmiMeloni Feb 26, 2026
67b657c
refactor(bundle-helpers): simplify test inputs with inline YAML
GrimmiMeloni Feb 26, 2026
0bdc43a
refactor(bundle-helpers): use t.Setenv instead of os.Setenv in tests
GrimmiMeloni Feb 26, 2026
bf9f935
refactor(bundle-helpers): move shared YAML output helpers to cmd/outp…
GrimmiMeloni Feb 26, 2026
1ee80f0
style fix
GrimmiMeloni Feb 26, 2026
e455b97
fix(bundle-helpers): restore RELATED_IMAGE_* cleanup in NoEnvVars test
GrimmiMeloni Feb 27, 2026
42698d9
fix(bundle-helpers): fix compare script cp destination for build-bundle
GrimmiMeloni Feb 27, 2026
60a0a8b
fix(bundle-helpers): restore direct map mutation in addSecurityPolicyCRD
GrimmiMeloni Feb 27, 2026
5b3e6f3
fix(bundle-helpers): delete sed backup files before diff in compare s…
GrimmiMeloni Feb 27, 2026
74402de
bump operator golang builder to 1.25.7
GrimmiMeloni Feb 27, 2026
3178b54
Update operator/bundle_helpers/cmd/patch_csv.go
GrimmiMeloni Mar 9, 2026
6e46d7a
Update operator/bundle_helpers/cmd/patch_csv.go
GrimmiMeloni Mar 9, 2026
63f44cf
Update operator/bundle_helpers/pkg/csv/patcher.go
GrimmiMeloni Mar 9, 2026
ed5d880
Update operator/bundle_helpers/compare-implementations.sh
GrimmiMeloni Mar 9, 2026
ce906e8
Update operator/bundle_helpers/compare-implementations.sh
GrimmiMeloni Mar 9, 2026
7637039
Update operator/bundle_helpers/compare-implementations.sh
GrimmiMeloni Mar 9, 2026
4def08d
Update operator/bundle_helpers/compare-implementations.sh
GrimmiMeloni Mar 9, 2026
994d4ae
Update operator/bundle_helpers/pkg/csv/patcher.go
GrimmiMeloni Mar 9, 2026
38c7b57
Update operator/bundle_helpers/pkg/csv/patcher.go
GrimmiMeloni Mar 9, 2026
d4f0ed1
Update operator/bundle_helpers/pkg/csv/patcher.go
GrimmiMeloni Mar 9, 2026
994f68e
Update operator/bundle_helpers/pkg/csv/patcher.go
GrimmiMeloni Mar 9, 2026
8379fd9
Update operator/bundle_helpers/pkg/csv/patcher.go
GrimmiMeloni Mar 9, 2026
8b87315
Update operator/bundle_helpers/pkg/csv/patcher_test.go
GrimmiMeloni Mar 9, 2026
801cc3a
Update operator/bundle_helpers/pkg/descriptor/sorter.go
GrimmiMeloni Mar 9, 2026
6676a85
Update operator/bundle_helpers/pkg/rewrite/rewriter.go
GrimmiMeloni Mar 9, 2026
7f7b13f
address review
GrimmiMeloni Mar 9, 2026
2cb85db
remove unnecessary closure
GrimmiMeloni Mar 9, 2026
89b389a
rename symbol
GrimmiMeloni Mar 9, 2026
fd27d76
rename symbol
GrimmiMeloni Mar 9, 2026
45479b2
split testcase
GrimmiMeloni Mar 9, 2026
333bd78
remove superflous test
GrimmiMeloni Mar 9, 2026
f43e662
add logging
GrimmiMeloni Mar 9, 2026
aedf211
use PathValue in sorter instead of map traversal
GrimmiMeloni Mar 9, 2026
7358bdd
rename and simplify
GrimmiMeloni Mar 9, 2026
0f3e97d
fix regression
GrimmiMeloni Mar 10, 2026
7d55d83
bugfix field dep path split
GrimmiMeloni Mar 10, 2026
35b1bf7
add missing type assertion check, missed the first time
GrimmiMeloni Mar 10, 2026
a66d9b4
downgrade PyYAML to 6.0.1 for Konflux compatibility
GrimmiMeloni Mar 10, 2026
47166bd
add support for FACT to test harness
GrimmiMeloni Mar 10, 2026
4c349bb
remove CGO from konflux bundle builds
GrimmiMeloni Mar 11, 2026
d9c63cf
rename as agreed in review
GrimmiMeloni Mar 23, 2026
692bef1
switch konflux bundle builder to rhel_9 for consistency
GrimmiMeloni Mar 25, 2026
18279ce
switch konflux bundle builder back to ubi9-minimal with golang
GrimmiMeloni Mar 25, 2026
e1df128
disable Go module caching in test-bundle-helpers workflow
GrimmiMeloni Mar 26, 2026
b25d966
use shared cache-go-dependencies action in test-bundle-helpers
GrimmiMeloni Mar 26, 2026
6b43bf6
switch konflux bundle builder back to openshift-golang-builder
GrimmiMeloni Mar 26, 2026
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
250 changes: 250 additions & 0 deletions .github/workflows/test-bundle-helpers.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,250 @@
# This workflow makes sure that the Go and Python outputs of operator bundle helpers are byte for byte equivalent.
# It will be removed together with the Python implementation in a follow-up PR.
name: Test Bundle Helpers

on:
push:
tags:
- '*'
branches:
- master
- release-*
pull_request:
types:
- opened
- reopened
- synchronize

env:
ROX_PRODUCT_BRANDING: RHACS_BRANDING
RELATED_IMAGE_MAIN: foo
RELATED_IMAGE_SCANNER: foo
RELATED_IMAGE_SCANNER_SLIM: foo
RELATED_IMAGE_SCANNER_DB: foo
RELATED_IMAGE_SCANNER_DB_SLIM: foo
RELATED_IMAGE_COLLECTOR: foo
RELATED_IMAGE_FACT: foo
RELATED_IMAGE_ROXCTL: foo
RELATED_IMAGE_CENTRAL_DB: foo
RELATED_IMAGE_SCANNER_V4_DB: foo
RELATED_IMAGE_SCANNER_V4: foo

jobs:
test-python-implementation:
strategy:
matrix:
related_img_mode:
- konflux
- omit
- downstream
name: Test Python Implementation
runs-on: ubuntu-latest
defaults:
run:
working-directory: operator

steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
ref: ${{ github.event.pull_request.head.sha }}

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.12'

- name: Install Python dependencies
run: |
python -m pip install --upgrade pip
pip install -r bundle_helpers/requirements.txt

- name: Run Python unit tests
run: make test-bundle-helpers

- name: Generate bundle with Python
env:
USE_GO_BUNDLE_HELPER: false
RELATED_IMAGES_MODE: ${{ matrix.related_img_mode }}
run: |
set -euo pipefail
go mod tidy
make bundle bundle-post-process
mkdir -p /tmp/artifacts
cp -r bundle /tmp/artifacts/bundle-python
cp -r build/bundle /tmp/artifacts/build-bundle-python
# Make sure the build is clean.
git diff --exit-code HEAD

- name: Upload Python bundle artifacts
uses: actions/upload-artifact@v4
with:
name: bundle-python-${{ matrix.related_img_mode }}
path: /tmp/artifacts/
retention-days: 1

test-go-implementation:
strategy:
fail-fast: false
matrix:
related_img_mode:
- konflux
- omit
- downstream
name: Test Go Implementation
runs-on: ubuntu-latest
defaults:
run:
working-directory: operator

steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
ref: ${{ github.event.pull_request.head.sha }}

- name: Set up Go
uses: actions/setup-go@v5
with:
go-version-file: go.mod
cache: false

- name: Cache Go dependencies
uses: ./.github/actions/cache-go-dependencies

- name: Run Go unit tests
run: |
cd bundle_helpers
go test ./...

# Needed since the Go implementation uses yaml-normalizer.py
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.12'

# Needed since the Go implementation uses yaml-normalizer.py
- name: Install Python dependencies
run: |
python -m pip install --upgrade pip
pip install -r bundle_helpers/requirements.txt

- name: Generate bundle with Go
env:
USE_GO_BUNDLE_HELPER: true
RELATED_IMAGES_MODE: ${{ matrix.related_img_mode }}
run: |
set -euo pipefail
go mod tidy
make bundle bundle-post-process
mkdir -p /tmp/artifacts
cp -r bundle /tmp/artifacts/bundle-go
cp -r build/bundle /tmp/artifacts/build-bundle-go
# Make sure the build is clean.
git diff --exit-code HEAD

- name: Upload Go bundle artifacts
uses: actions/upload-artifact@v4
with:
name: bundle-go-${{ matrix.related_img_mode }}
path: /tmp/artifacts/
retention-days: 1

compare-implementations:
strategy:
fail-fast: false
matrix:
related_img_mode:
- konflux
- omit
- downstream
name: Compare Python and Go Outputs
runs-on: ubuntu-latest
needs: [test-python-implementation, test-go-implementation]

steps:
- name: Download Python bundle
uses: actions/download-artifact@v4
with:
name: bundle-python-${{ matrix.related_img_mode }}
path: /tmp/python

- name: Download Go bundle
uses: actions/download-artifact@v4
with:
name: bundle-go-${{ matrix.related_img_mode }}
path: /tmp/go

- name: Install comparison tools
run: |
sudo apt-get update
sudo apt-get install -y diffutils

- name: Compare bundle outputs
run: |
echo "=== Comparing Python and Go bundle outputs ==="

if diff -ruN /tmp/python/bundle-python /tmp/go/bundle-go; then
echo "✓ SUCCESS: Bundle outputs are identical"
else
echo "✗ FAILURE: Bundle outputs differ"
exit 1
fi
echo ""
echo "=== Pruning createdAt lines..."
sed -i '/^ createdAt:/d' /tmp/*/build-bundle-*/manifests/rhacs-operator.clusterserviceversion.yaml

echo ""
echo "=== Comparing build/bundle outputs ==="
if diff -ruN /tmp/python/build-bundle-python /tmp/go/build-bundle-go; then
echo "✓ SUCCESS: Build bundle outputs are identical"
else
echo "✗ FAILURE: Build bundle outputs differ"
exit 1
fi
echo ""
echo "=== Listing contents"
find /tmp/python /tmp/go -ls
find /tmp/python /tmp/go -type f -print0 | xargs -0 md5sum | sort

status-check:
strategy:
matrix:
related_img_mode:
- konflux
- omit
- downstream
name: Bundle Helper Tests Status
runs-on: ubuntu-latest
needs: [test-python-implementation, test-go-implementation, compare-implementations]
if: always()

steps:
- name: Check test results
run: |
python_result="${{ needs.test-python-implementation.result }}"
go_result="${{ needs.test-go-implementation.result }}"
compare_result="${{ needs.compare-implementations.result }}"

echo "Python tests: $python_result"
echo "Go tests: $go_result"
echo "Comparison: $compare_result"

if [ "$python_result" != "success" ]; then
echo "✗ Python tests failed"
exit 1
fi

if [ "$go_result" != "success" ]; then
echo "✗ Go tests failed"
exit 1
fi

if [ "$compare_result" != "success" ]; then
echo "✗ Go/Python comparison failed"
exit 1
fi

echo "✓ All required tests passed"
3 changes: 2 additions & 1 deletion .tekton/operator-bundle-build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,8 @@ spec:
- name: prefetch-input
value: |
[
{ "type": "rpm", "path": "." }
{ "type": "rpm", "path": "." },
{ "type": "gomod", "path": "." }
]
- name: build-source-image
value: 'true'
Expand Down
38 changes: 27 additions & 11 deletions operator/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ CSV_VERSION ?= v$(VERSION)
# Set to empty string to echo some command lines which are hidden by default.
SILENT ?= @

# Python binary to use for bundle helpers. Can be overridden to use a specific version (e.g., python3.9).
# The Konflux build uses Python 3.9, so using python3.9 locally ensures compatibility.
# Python binary to use for bundle helpers. Can be overridden to use a specific version (e.g., python3.12).
# The Konflux build uses Python 3.12, so using python3.12 locally ensures compatibility.
PYTHON ?= python3

# This can be adjusted if deploying into non-standard namespaces. For example, as in
Expand Down Expand Up @@ -83,6 +83,14 @@ INDEX_IMG ?= $(INDEX_IMG_BASE):$(INDEX_IMG_TAG)
# Image URL to use all building/pushing image targets
IMG ?= $(IMAGE_TAG_BASE):$(VERSION)

# RELATED_IMAGES_MODE controls how container image references are handled in the operator bundle CSV.
# Valid values:
# omit (default) - No related images in CSV (upstream builds)
# downstream - Inject RELATED_IMAGE_* env vars for Red Hat builds (no spec.relatedImages)
# konflux - Add explicit spec.relatedImages section for Konflux builds
# Used by bundle-post-process target to support image mirroring and disconnected environments.
RELATED_IMAGES_MODE ?= omit

# Set up the so-called "storage image" for executing scorecard test suite.
# By default a busybox image is pulled from docker.io. In order to rule out timing issues related to rate limiting
# we use our own copy of a busybox image from quay.io.
Expand Down Expand Up @@ -287,8 +295,12 @@ test-upgrade: kuttl bundle-post-process ## Run OLM-based operator upgrade tests.
.PHONY: test-bundle-helpers
test-bundle-helpers: ## Run Python unit tests against helper scripts.
set -euo pipefail ;\
$(ACTIVATE_PYTHON) ;\
pytest -v bundle_helpers
if [ "$${USE_GO_BUNDLE_HELPER:-true}" != "true" ]; then \
$(ACTIVATE_PYTHON) ;\
pytest -v bundle_helpers ;\
else \
echo "Skipping Python tests (USE_GO_BUNDLE_HELPER=true)" ;\
fi

.PHONY: stackrox-image-pull-secret
stackrox-image-pull-secret: ## Create default image pull secret for StackRox images on Quay.io. Used by Helm chart.
Expand Down Expand Up @@ -443,11 +455,13 @@ upgrade-dirty-tag-via-olm: kuttl
##@ Bundle and Index build

# Commands to enter local Python virtual environment and get needed dependencies there.
# pip 21.3.1 and setuptools 59.6.0 use pkgutil.ImpImporter, removed in Python 3.12.
# The required Python version is tracked in bundle_helpers/.python-version.
# We rely on the venv's default pip and setuptools, which are automatically compatible
# with the Python version used to create the venv:
# - Python 3.12 venvs come with pip/setuptools that handle Python 3.12 correctly
# - Older Python venvs come with pip/setuptools appropriate for those versions
# This avoids compatibility issues when trying to upgrade to specific pip versions.
ACTIVATE_PYTHON = $(PYTHON) -m venv bundle_helpers/.venv ;\
. bundle_helpers/.venv/bin/activate ;\
pip3 install --upgrade pip==21.3.1 setuptools==59.6.0 ;\
pip3 install -r bundle_helpers/requirements.txt

.PHONY: bundle
Expand Down Expand Up @@ -476,10 +490,11 @@ bundle: yq manifests kustomize operator-sdk ## Generate bundle manifests and met
# Yet we want most of the contents autogenerated from the Makefile variables as a single source of truth.
# Therefore we append ".extra" file to the end of bundle's dockerfile.
cat bundle.Dockerfile.extra >> bundle.Dockerfile
# Run a python script to fix the orders in the specDescriptors (children must not appear before their parents).
# Fix the orders in the specDescriptors (children must not appear before their parents).
# Note: Python venv is always needed because the Go implementation uses yaml-normalizer.py
set -euo pipefail ;\
$(ACTIVATE_PYTHON) ;\
bundle_helpers/fix-spec-descriptor-order.py \
./bundle_helpers/dispatch.sh fix-spec-descriptor-order \
<bundle/manifests/rhacs-operator.clusterserviceversion.yaml \
>bundle/manifests/rhacs-operator.clusterserviceversion.yaml.fixed
mv bundle/manifests/rhacs-operator.clusterserviceversion.yaml.fixed \
Expand All @@ -488,10 +503,11 @@ bundle: yq manifests kustomize operator-sdk ## Generate bundle manifests and met

.PHONY: bundle-post-process
bundle-post-process: test-bundle-helpers operator-sdk ## Post-process CSV file to include correct operator versions, etc.
# Note: Python venv is always needed because dispatch.sh may use yaml-normalizer.py
set -euo pipefail ;\
$(ACTIVATE_PYTHON) ;\
first_version=3.62.0 `# 3.62.0 is the first operator version ever released` ;\
candidate_version=$$(./bundle_helpers/patch-csv.py \
candidate_version=$$(./bundle_helpers/dispatch.sh patch-csv \
--use-version $(VERSION) \
--first-version $${first_version} \
--operator-image $(IMG) \
Expand All @@ -509,7 +525,7 @@ bundle-post-process: test-bundle-helpers operator-sdk ## Post-process CSV file t
--use-version=$(VERSION) \
--first-version=$${first_version} \
--operator-image=$(IMG) \
--related-images-mode=omit \
--related-images-mode=$(RELATED_IMAGES_MODE) \
$${unreleased_opt:-}
# Check that the resulting bundle still passes validations.
$(OPERATOR_SDK) bundle validate ./build/bundle --select-optional suite=operatorframework
Expand Down
Loading
Loading