Skip to content
Closed
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
6 changes: 3 additions & 3 deletions operator/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -457,10 +457,10 @@ 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).
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 @@ -472,7 +472,7 @@ bundle-post-process: test-bundle-helpers operator-sdk ## Post-process CSV file t
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 Down
32 changes: 32 additions & 0 deletions operator/bundle_helpers/dispatch.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#!/usr/bin/env bash
#
# Wrapper script for bundle helper tools.
#
# Provides an abstraction layer that allows switching between Python and Go
# implementations of bundle helper scripts without changing Makefile or Dockerfiles.
# The implementation is selected via the USE_GO_BUNDLE_HELPER environment variable.
#
# Usage: dispatch.sh <script-base-name> [args...]

set -euo pipefail

if [[ $# -lt 1 ]]; then
echo "Usage: $0 <script-base-name> [args...]" >&2
echo "Available scripts: fix-spec-descriptor-order, patch-csv" >&2
exit 1
fi

script_name="$1"
shift

script_dir="$(dirname "$0")"

case "$script_name" in
fix-spec-descriptor-order|patch-csv)
if [[ "${USE_GO_BUNDLE_HELPER:-false}" == "true" ]]; then
echo "No Go implementation of $script_name available yet." >&2
exit 1
fi
exec "${script_dir}/${script_name}.py" "$@"
;;
esac
2 changes: 1 addition & 1 deletion operator/bundle_helpers/prepare-bundle-manifests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@ mkdir -p build/
rm -rf build/bundle
cp -a bundle build/

"$(dirname "$0")/patch-csv.py" "$@" \
"$(dirname "$0")/dispatch.sh" patch-csv "$@" \
< bundle/manifests/rhacs-operator.clusterserviceversion.yaml \
> build/bundle/manifests/rhacs-operator.clusterserviceversion.yaml
Loading