diff --git a/.github/actions/kamel-build-bundle/build-index-image.sh b/.github/actions/kamel-build-bundle/build-index-image.sh index feab906631..ee9c3ef1f7 100755 --- a/.github/actions/kamel-build-bundle/build-index-image.sh +++ b/.github/actions/kamel-build-bundle/build-index-image.sh @@ -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} @@ -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) @@ -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}/ { @@ -242,6 +248,7 @@ cat << EOF > ${sedtemp} p; EOF +echo "sed" sed -i -n -f ${sedtemp} ${CATALOG_DIR}/bundles.yaml rm -f ${sedtemp} @@ -249,13 +256,18 @@ 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}" diff --git a/script/Makefile b/script/Makefile index d6b1daaddc..1b99700d0a 100644 --- a/script/Makefile +++ b/script/Makefile @@ -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