Skip to content

Commit

Permalink
Update catalog file to point to downstream bundle (#758)
Browse files Browse the repository at this point in the history
  • Loading branch information
OlivierCazade authored Sep 8, 2024
1 parent 8b029a2 commit 27434da
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 0 deletions.
31 changes: 31 additions & 0 deletions hack/patch_catalog.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import os
from sys import exit as sys_exit
from datetime import datetime
from ruamel.yaml import YAML
yaml = YAML()
yaml.explicit_start = True

version = os.getenv('VERSION')
bundle_image = 'registry.redhat.io/network-observability/network-observability-operator-bundle@v{}'.format(version)

def load_index(pathn):
if not pathn.endswith(".yaml"):
return None
try:
with open(pathn, "r") as f:
return list(yaml.load_all(f))
except FileNotFoundError:
print("File can not found")
exit(6)

def dump_index(pathn, index):
with open(pathn, "w") as f:
for o in index:
yaml.dump(o, f)
return

index = load_index(os.getenv('TARGET_INDEX_FILE'))

index[1]["image"] = bundle_image

dump_index(os.getenv('TARGET_INDEX_FILE'), index)
2 changes: 2 additions & 0 deletions hack/update-build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ crd_name="flows.netobserv.io_flowcollectors.yaml"
crd_file="${manifests_dir}/${crd_name}"
csv_name="netobserv-operator.clusterserviceversion.yaml"
csv_file="${manifests_dir}/${csv_name}"
index_file="./catalog/index.yaml"

cat <<EOF >>"${CONTAINER_FILE}"
LABEL com.redhat.component="network-observability-operator-container"
Expand Down Expand Up @@ -69,6 +70,7 @@ export EPOC_TIMESTAMP=$(date +%s)
export IN_CSV_DESC="./config/descriptions/ocp.md"

REPLACES="${REPLACE_VERSION}" VERSION="${TARGET_VERSION}" TARGET_CSV_FILE="${csv_file}" python3 ./hack/patch_csv.py
REPLACES="${REPLACE_VERSION}" VERSION="${TARGET_VERSION}" TARGET_INDEX_FILE="${index_file}" python3 ./hack/patch_catalog.py

sed -i 's/operators.operatorframework.io.bundle.channels.v1: latest,community/operators.operatorframework.io.bundle.channels.v1: stable/g' ./bundle/metadata/annotations.yaml
sed -i 's/operators.operatorframework.io.bundle.channel.default.v1: community/operators.operatorframework.io.bundle.channel.default.v1: stable/g' ./bundle/metadata/annotations.yaml

0 comments on commit 27434da

Please sign in to comment.