Skip to content

Commit

Permalink
fix: correct release failure and incorrect CSV name generation (#1284)
Browse files Browse the repository at this point in the history
Signed-off-by: Michael Edgar <[email protected]>
  • Loading branch information
MikeEdgar authored Dec 6, 2024
1 parent 5926b79 commit 7251e42
Show file tree
Hide file tree
Showing 6 changed files with 27 additions and 12 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ jobs:
# ==================== Operator-Bundle ====================
- name: Modify Bundle CSV Metadata
run: ./operator/bin/modify-bundle-metadata.sh "SKIP_RANGE=>=0.0.1 <${{ env.PROJECT_VERSION }}"
run: ./operator/bin/modify-bundle-metadata.sh "VERSION=${{ env.PROJECT_VERSION }}" "SKIP_RANGE=>=0.0.1 <${{ env.PROJECT_VERSION }}"

- name: Build Operator Bundle Image
uses: docker/build-push-action@v6
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,8 @@ jobs:
# ==================== Operator-Bundle ====================
- name: Modify Bundle CSV Metadata
run: ./operator/bin/modify-bundle-metadata.sh
working-directory: target/checkout
run: ./operator/bin/modify-bundle-metadata.sh "VERSION=${{steps.metadata.outputs.current-version}}" "SKIP_RANGE=>=0.0.1 <${{steps.metadata.outputs.current-version}}"

- name: Build and Push Operator Bundle Image
uses: docker/build-push-action@v6
Expand All @@ -115,8 +116,7 @@ jobs:
chmod +x opm
sudo cp -v opm /usr/bin/
rm -vf opm
VERSION=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout | tr '[:upper:]' '[:lower:]')
operator/bin/generate-catalog.sh ${VERSION}
operator/bin/generate-catalog.sh ${{steps.metadata.outputs.current-version}}
- name: Build and Push Operator Catalog Image
uses: docker/build-push-action@v6
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/snapshot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ jobs:
# ==================== Operator-Bundle ====================
- name: Modify Bundle CSV Metadata
run: ./operator/bin/modify-bundle-metadata.sh "SKIP_RANGE=>=0.0.1 <${{ env.NEXT_VERSION }}"
run: ./operator/bin/modify-bundle-metadata.sh "VERSION=${{ env.NEXT_VERSION }}" "SKIP_RANGE=>=0.0.1 <${{ env.NEXT_VERSION }}"

- name: Build and Push Operator Bundle Image
uses: docker/build-push-action@v6
Expand Down
5 changes: 3 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ include *compose.env
IMAGE_REGISTRY ?= quay.io
IMAGE_GROUP ?= streamshub
VERSION ?= $(shell mvn help:evaluate -Dexpression=project.version -q -DforceStdout | tr '[:upper:]' '[:lower:]')
CSV_VERSION ?= $(VERSION)

CONSOLE_API_IMAGE ?= $(IMAGE_REGISTRY)/$(IMAGE_GROUP)/console-api:$(VERSION)
CONSOLE_UI_IMAGE ?= $(IMAGE_REGISTRY)/$(IMAGE_GROUP)/console-ui:$(VERSION)
Expand Down Expand Up @@ -34,8 +35,8 @@ container-image-api-push: container-image-api

container-image-operator:
mvn package -am -pl operator -Pcontainer-image -DskipTests -Dquarkus.container-image.image=$(CONSOLE_OPERATOR_IMAGE)
operator/bin/modify-bundle-metadata.sh SKOPEO_TRANSPORT=$(SKOPEO_TRANSPORT)
operator/bin/generate-catalog.sh $(VERSION)
operator/bin/modify-bundle-metadata.sh "VERSION=$(CSV_VERSION)" "SKIP_RANGE=$(SKIP_RANGE)" "SKOPEO_TRANSPORT=$(SKOPEO_TRANSPORT)"
operator/bin/generate-catalog.sh $(CSV_VERSION)
$(CONTAINER_RUNTIME) build --platform=$(ARCH) -t $(CONSOLE_OPERATOR_BUNDLE_IMAGE) -f operator/target/bundle/console-operator/bundle.Dockerfile
$(CONTAINER_RUNTIME) build --platform=$(ARCH) -t $(CONSOLE_OPERATOR_CATALOG_IMAGE) -f operator/target/catalog.Dockerfile

Expand Down
4 changes: 3 additions & 1 deletion operator/bin/generate-catalog.sh
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
#!/bin/bash

SCRIPT_PATH="$(cd -- "$(dirname "$0")" >/dev/null 2>&1 ; pwd -P)"
source ${SCRIPT_PATH}/common.sh

export VERSION="${1}"

source ${SCRIPT_PATH}/common.sh

echo "[INFO] Generate catalog"

rm -rvf ${CATALOG_PATH} ${CATALOG_PATH}.Dockerfile
Expand Down
20 changes: 16 additions & 4 deletions operator/bin/modify-bundle-metadata.sh
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#!/bin/bash

SCRIPT_PATH="$(cd -- "$(dirname "$0")" >/dev/null 2>&1 ; pwd -P)"
source ${SCRIPT_PATH}/common.sh

VERSION=""
SKIP_RANGE=""
SKOPEO_TRANSPORT="docker://"

Expand All @@ -12,19 +12,27 @@ do
VALUE=$(echo "$ARGUMENT" | sed 's/^[^=]*=//')

case "$KEY" in
SKIP_RANGE) SKIP_RANGE=${VALUE};;
ORIGINAL_OPERATOR_NAME) ORIGINAL_OPERATOR_NAME=${VALUE};;
SKOPEO_TRANSPORT) SKOPEO_TRANSPORT=${VALUE};;
VERSION) VERSION=${VALUE};;
SKIP_RANGE) SKIP_RANGE=${VALUE};;
ORIGINAL_OPERATOR_NAME) ORIGINAL_OPERATOR_NAME=${VALUE};;
SKOPEO_TRANSPORT) SKOPEO_TRANSPORT=${VALUE};;
*)
esac
done

source ${SCRIPT_PATH}/common.sh

api_name="console-api"
ui_name="console-ui"
operator_name="console-operator"

echo "[INFO] Modify values and replace placeholders in ${CSV_FILE_PATH}"

if [[ -n "$VERSION" ]]; then
echo "[DEBUG] Setting version = \"${VERSION}\""
${YQ} eval -o yaml -i ".spec.version = \"${VERSION}\"" "${CSV_FILE_PATH}"
fi

# Delete any namespaces set on the CSV deployment(s), possibly added by `quarkus.kubernetes.namespace`
${YQ} eval -o yaml -i 'del(.spec.install.spec.deployments[0].spec.template.metadata.namespace)' "${CSV_FILE_PATH}"

Expand Down Expand Up @@ -69,6 +77,10 @@ ${YQ} eval -o yaml -i ".spec.install.spec.deployments[0].spec.template.spec.cont
${YQ} eval -o yaml -i ".spec.install.spec.deployments[0].spec.template.spec.serviceAccountName = \"${OPERATOR_NAME}\"" "${CSV_FILE_PATH}"
${YQ} eval -o yaml -i ".spec.install.spec.clusterPermissions.[].serviceAccountName = \"${OPERATOR_NAME}\"" "${CSV_FILE_PATH}"

echo "[DEBUG] Updating package name annotation and image label to ${OPERATOR_NAME}"
${YQ} eval -o yaml -i ".annotations.[\"operators.operatorframework.io.bundle.package.v1\"] = \"${OPERATOR_NAME}\"" "${BUNDLE_PATH}/metadata/annotations.yaml"
sed -i 's/'${ORIGINAL_OPERATOR_NAME}'/'${OPERATOR_NAME}'/' "${BUNDLE_PATH}/bundle.Dockerfile"

# Add Env for operator deployment that references API and UI images with digest instead of tag
echo "[DEBUG] Add UI and API images to CSV"

Expand Down

0 comments on commit 7251e42

Please sign in to comment.