diff --git a/.github/workflows/release_image.yaml b/.github/workflows/release_image.yaml index e335d25cd..41747aaa7 100644 --- a/.github/workflows/release_image.yaml +++ b/.github/workflows/release_image.yaml @@ -10,6 +10,7 @@ permissions: env: image_tag: quay.io/orc/openstack-resource-controller:${GITHUB_REF_NAME} + bundle_image_tag: quay.io/orc/openstack-resource-controller-bundle:${GITHUB_REF_NAME} jobs: push: @@ -24,7 +25,11 @@ jobs: fetch-tags: true - name: Set up Docker Buildx uses: docker/setup-buildx-action@v3 + - name: Install build dependencies + run: sudo apt-get install -y libgpgme-dev - run: | docker login -u="${{ secrets.QUAY_USERNAME }}" -p="${{ secrets.QUAY_TOKEN }}" quay.io make docker-buildx IMG=${{ env.image_tag }} + make build-bundle-image BUNDLE_IMG=${{ env.bundle_image_tag }} + make docker-push IMG=${{ env.bundle_image_tag }} diff --git a/Makefile b/Makefile index 4cfc0d564..c48c411c6 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,6 @@ # Image URL to use all building/pushing image targets IMG ?= controller:latest +BUNDLE_IMG ?= bundle:latest # ENVTEST_K8S_VERSION refers to the version of kubebuilder assets to be downloaded by envtest binary. ENVTEST_K8S_VERSION = 1.29.0 TRIVY_VERSION = 0.49.1 @@ -207,6 +208,11 @@ build-installer: manifests generate kustomize ## Generate a consolidated YAML wi $(MAKE) custom-deploy IMG=${IMG} $(KUSTOMIZE) build $(CUSTOMDEPLOY) > dist/install.yaml +.PHONY: build-bundle-image +build-bundle-image: kustomize operator-sdk + bash hack/bundle.sh + $(CONTAINER_TOOL) build -f bundle.Dockerfile -t ${BUNDLE_IMG} . + ##@ Deployment ifndef ignore-not-found @@ -299,6 +305,7 @@ GOLANGCI_KAL = $(LOCALBIN)/golangci-kube-api-linter MOCKGEN = $(LOCALBIN)/mockgen KUTTL = $(LOCALBIN)/kubectl-kuttl GOVULNCHECK = $(LOCALBIN)/govulncheck +OPERATOR_SDK = $(LOCALBIN)/operator-sdk ## Tool Versions KUSTOMIZE_VERSION ?= v5.6.0 @@ -309,6 +316,7 @@ KAL_VERSION ?= v0.0.0-20250531094218-f86bf7bd4b19 MOCKGEN_VERSION ?= v0.5.0 KUTTL_VERSION ?= v0.22.0 GOVULNCHECK_VERSION ?= v1.1.4 +OPERATOR_SDK_VERSION ?= v1.41.1 .PHONY: kustomize kustomize: $(KUSTOMIZE) ## Download kustomize locally if necessary. @@ -363,6 +371,11 @@ govulncheck: $(GOVULNCHECK) ## Download govulncheck locally if necessary. $(GOVULNCHECK): $(LOCALBIN) $(call go-install-tool,$(GOVULNCHECK),golang.org/x/vuln/cmd/govulncheck,$(GOVULNCHECK_VERSION)) +.PHONY: operator-sdk +operator-sdk: $(OPERATOR_SDK) ## Download operator-sdk locally if necessary. +$(OPERATOR_SDK): $(LOCALBIN) + $(call go-install-tool,$(OPERATOR_SDK),github.com/operator-framework/operator-sdk/cmd/operator-sdk,$(OPERATOR_SDK_VERSION)) + # go-install-tool will 'go install' any package with custom target and name of binary, if it doesn't exist # $1 - target path with name of binary # $2 - package url which can be installed diff --git a/hack/bundle.sh b/hack/bundle.sh index 9794385e9..7f189b410 100644 --- a/hack/bundle.sh +++ b/hack/bundle.sh @@ -2,7 +2,7 @@ REGISTRY=${REGISTRY:-quay.io/orc} IMAGE=${BASE_IMAGE:-openstack-resource-controller} -TAG=${BASE_IMAGE:-$(git describe --abbrev=0)} +TAG=${BASE_IMAGE:-$(git describe --abbrev=0 --tags)} IMG=${REGISTRY}/${IMAGE}:${TAG} # Update config/manifests/bases/orc.clusterserviceversion.yaml if needed @@ -14,6 +14,9 @@ mkdir "${TMP_OVERLAY}" pushd "${TMP_OVERLAY}" || exit kustomize create --resources ../manifests kustomize edit set image controller="${IMG}" + +kustomize edit add patch --kind ClusterServiceVersion --name "orc.*" --patch '[{"op": "replace", "path": "/spec/version", "value": "'$TAG'"}]' +kustomize edit add patch --kind ClusterServiceVersion --name "orc.*" --patch '[{"op": "replace", "path": "/metadata/name", "value": "orc.'$TAG'"}]' popd || exit # Generate bundle and bundle.Dockerfile