From 687307e5920c51668b0f3d7b2948b02ff378c8e0 Mon Sep 17 00:00:00 2001 From: "David J. M. Karlsen" Date: Tue, 14 Nov 2023 23:13:03 +0100 Subject: [PATCH] rfactor --- .github/workflows/build.yaml | 6 ++---- Makefile | 18 +++++++++++++----- 2 files changed, 15 insertions(+), 9 deletions(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 680e22e..18cc5c3 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -69,13 +69,11 @@ jobs: - name: catalog if: startsWith(github.ref, 'refs/tags/v') run: | - make catalog-build catalog-push VERSION=${{ env.VERSION }} + make update-catalog-template catalog-build catalog-push VERSION=${{ env.VERSION }} # re-tag as alpha, so that we can stick to a single channel echo re-tagging - export CATALOG_BASE_IMG=ghcr.io/davidkarlsen/flyway-operator-catalog:alpha - docker tag ghcr.io/davidkarlsen/flyway-operator-catalog:${{ env.GIT_VERSION }} ${CATALOG_BASE_IMG} - docker push ${CATALOG_BASE_IMG} + make catalog-retag VERSION=${{ env.VERSION }} - name: createRelease if: startsWith(github.ref, 'refs/tags/v') diff --git a/Makefile b/Makefile index c5ace41..6208909 100644 --- a/Makefile +++ b/Makefile @@ -256,24 +256,32 @@ OPM = $(shell which opm) endif endif + +update-catalog-template: + yq -e '.Stable.Bundles += {"Image": "$(BUNDLE_IMG)" }' -i ./catalog-template.yaml + git commit -m"Bump catalog material" catalog-template.yaml + git push origin HEAD:main + # The image tag given to the resulting catalog image (e.g. make catalog-build CATALOG_IMG=example.com/operator-catalog:v0.2.0). CATALOG_IMG ?= $(IMAGE_TAG_BASE)-catalog:v$(VERSION) +CATALOG_VERSIONLESS = ghcr.io/davidkarlsen/flyway-operator-catalog:alpha # Build a catalog image by adding bundle images to an empty catalog using the operator package manager tool, 'opm'. # This recipe invokes 'opm' in 'semver' bundle add mode. For more information on add modes, see: # https://github.com/operator-framework/community-operators/blob/7f1438c/docs/packaging-operator.md#updating-your-existing-operator .PHONY: catalog-build catalog-build: opm - yq -e '.Stable.Bundles += {"Image": "$(BUNDLE_IMG)" }' -i ./catalog-template.yaml - git commit -m"Bump catalog material" catalog-template.yaml - git push origin HEAD:main rm -rf catalog mkdir catalog - opm alpha render-template semver -o yaml < catalog-template.yaml > catalog/catalog.yaml - opm validate catalog + $(OPM) alpha render-template semver -o yaml < catalog-template.yaml > catalog/catalog.yaml + $(OPM) validate catalog docker build --platform=linux/amd64 -f Dockerfile.catalog -t $(CATALOG_IMG) . # Push the catalog image. .PHONY: catalog-push catalog-push: ## Push a catalog image. $(MAKE) docker-push IMG=$(CATALOG_IMG) + +catalog-retag: + docker tag $(CATALOG_IMG) $(CATALOG_VERSIONLESS) + docker push $(CATALOG_VERSIONLESS)