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

fix(olm): set metadata package name to camel-k-operator #5692

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft
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
14 changes: 13 additions & 1 deletion .github/actions/kamel-build-bundle/build-index-image.sh
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,7 @@ echo "Constructing index image ..."
# Removes catalog directory if already exists.
# Stops opm from aborting due to existing directory.
#
echo "Removes catalog directory if already exists..."
CATALOG_DIR=catalog
if [ -d ${CATALOG_DIR} ]; then
rm -rf ${CATALOG_DIR}
Expand All @@ -203,17 +204,21 @@ if [ -f ${CATALOG_DIR}.Dockerfile ]; then
rm -f ${CATALOG_DIR}.Dockerfile
fi

echo "Create catalog directory if already exists..."
mkdir ${CATALOG_DIR}
echo "opm render quay.io/operatorhubio/catalog:latest"
opm render quay.io/operatorhubio/catalog:latest -o yaml > ${CATALOG_DIR}/bundles.yaml
echo "opm render --use-http"
opm render --use-http -o yaml ${BUNDLE_IMAGE} > ${CATALOG_DIR}/camel-k.yaml

#
# Add the dedicated stable-dev branch (needed for upgrade tests)
#
echo "camel-k.yaml"
cat << EOF >> ${CATALOG_DIR}/camel-k.yaml
---
schema: olm.channel
package: camel-k
package: camel-k-operator
name: stable-dev-$(make get-version | grep -Po "\d+\.\d+")
entries:
- name: $(make get-csv-name)
Expand All @@ -223,6 +228,7 @@ EOF
#
# Update the existing stable channel (needed for preflight and tests on OCP)
#
echo "replaces"
sedtemp=$(mktemp sed-template-XXX.sed)
cat << EOF > ${sedtemp}
/- name: ${IMAGE_LAST_NAME}.v${IMAGE_LAST_VERSION}/ {
Expand All @@ -242,20 +248,26 @@ cat << EOF > ${sedtemp}
p;
EOF

echo "sed"
sed -i -n -f ${sedtemp} ${CATALOG_DIR}/bundles.yaml

rm -f ${sedtemp}

#
# Validate the modified catalog
#
cat ${CATALOG_DIR}/bundles.yaml
echo "validate"
opm validate ${CATALOG_DIR}
echo "generate"
opm generate dockerfile ${CATALOG_DIR}
if [ ! -f catalog.Dockerfile ]; then
echo "Error: Failed to create catalog dockerfile"
exit 1
fi
echo "docker build"
docker build . -f catalog.Dockerfile -t ${LOCAL_IIB}
echo "docker push"
docker push ${LOCAL_IIB}
BUILD_BUNDLE_LOCAL_IMAGE_BUNDLE_INDEX="${REGISTRY_PULL_HOST}/${IMAGE_NAMESPACE}/camel-k-iib:${IMAGE_VERSION}"
echo "Setting build-bundle-image-bundle-index to ${BUILD_BUNDLE_LOCAL_IMAGE_BUNDLE_INDEX}"
Expand Down
3 changes: 3 additions & 0 deletions script/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -678,6 +678,9 @@ bundle: set-version kustomize operator-sdk pre-bundle $(BUNDLE_CAMEL_APIS)
# Rename the CSV name to conform with the existing released operator versions
# This cannot happen in pre-bundle as the operator-sdk generation expects a CSV name the same as PACKAGE
@sed -i "s/^ name: $(CSV_NAME)/ name: $(CSV_PRODUCTION_NAME)/" $(CSV_PRODUCTION_PATH)
# operator-sdk requires the name of the package to be the same as the operator name
@sed -i "s/^ operators.operatorframework.io.bundle.package.v1: $(PACKAGE)/ operators.operatorframework.io.bundle.package.v1: $(LAST_RELEASED_IMAGE_NAME)/" ./bundle/metadata/annotations.yaml
@sed -i "s/^LABEL operators.operatorframework.io.bundle.package.v1=$(PACKAGE)/LABEL operators.operatorframework.io.bundle.package.v1=$(LAST_RELEASED_IMAGE_NAME)/" ./bundle/Dockerfile
@echo " com.redhat.openshift.versions: $(BUNDLE_METADATA_OPENSHIFT_VERSION)" >> ./bundle/metadata/annotations.yaml
$(OPERATOR_SDK) bundle validate ./bundle

Expand Down
Loading