Skip to content

Commit ecaf039

Browse files
authored
Merge pull request #491 from shiftstack/publish-bundle-image
Publish bundle image on git tag
2 parents 1419293 + 40a7a91 commit ecaf039

3 files changed

Lines changed: 22 additions & 1 deletion

File tree

.github/workflows/release_image.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ permissions:
1010

1111
env:
1212
image_tag: quay.io/orc/openstack-resource-controller:${GITHUB_REF_NAME}
13+
bundle_image_tag: quay.io/orc/openstack-resource-controller-bundle:${GITHUB_REF_NAME}
1314

1415
jobs:
1516
push:
@@ -24,7 +25,11 @@ jobs:
2425
fetch-tags: true
2526
- name: Set up Docker Buildx
2627
uses: docker/setup-buildx-action@v3
28+
- name: Install build dependencies
29+
run: sudo apt-get install -y libgpgme-dev
2730

2831
- run: |
2932
docker login -u="${{ secrets.QUAY_USERNAME }}" -p="${{ secrets.QUAY_TOKEN }}" quay.io
3033
make docker-buildx IMG=${{ env.image_tag }}
34+
make build-bundle-image BUNDLE_IMG=${{ env.bundle_image_tag }}
35+
make docker-push IMG=${{ env.bundle_image_tag }}

Makefile

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
# Image URL to use all building/pushing image targets
22
IMG ?= controller:latest
3+
BUNDLE_IMG ?= bundle:latest
34
# ENVTEST_K8S_VERSION refers to the version of kubebuilder assets to be downloaded by envtest binary.
45
ENVTEST_K8S_VERSION = 1.29.0
56
TRIVY_VERSION = 0.49.1
@@ -207,6 +208,11 @@ build-installer: manifests generate kustomize ## Generate a consolidated YAML wi
207208
$(MAKE) custom-deploy IMG=${IMG}
208209
$(KUSTOMIZE) build $(CUSTOMDEPLOY) > dist/install.yaml
209210

211+
.PHONY: build-bundle-image
212+
build-bundle-image: kustomize operator-sdk
213+
bash hack/bundle.sh
214+
$(CONTAINER_TOOL) build -f bundle.Dockerfile -t ${BUNDLE_IMG} .
215+
210216
##@ Deployment
211217

212218
ifndef ignore-not-found
@@ -299,6 +305,7 @@ GOLANGCI_KAL = $(LOCALBIN)/golangci-kube-api-linter
299305
MOCKGEN = $(LOCALBIN)/mockgen
300306
KUTTL = $(LOCALBIN)/kubectl-kuttl
301307
GOVULNCHECK = $(LOCALBIN)/govulncheck
308+
OPERATOR_SDK = $(LOCALBIN)/operator-sdk
302309

303310
## Tool Versions
304311
KUSTOMIZE_VERSION ?= v5.6.0
@@ -309,6 +316,7 @@ KAL_VERSION ?= v0.0.0-20250531094218-f86bf7bd4b19
309316
MOCKGEN_VERSION ?= v0.5.0
310317
KUTTL_VERSION ?= v0.22.0
311318
GOVULNCHECK_VERSION ?= v1.1.4
319+
OPERATOR_SDK_VERSION ?= v1.41.1
312320

313321
.PHONY: kustomize
314322
kustomize: $(KUSTOMIZE) ## Download kustomize locally if necessary.
@@ -363,6 +371,11 @@ govulncheck: $(GOVULNCHECK) ## Download govulncheck locally if necessary.
363371
$(GOVULNCHECK): $(LOCALBIN)
364372
$(call go-install-tool,$(GOVULNCHECK),golang.org/x/vuln/cmd/govulncheck,$(GOVULNCHECK_VERSION))
365373

374+
.PHONY: operator-sdk
375+
operator-sdk: $(OPERATOR_SDK) ## Download operator-sdk locally if necessary.
376+
$(OPERATOR_SDK): $(LOCALBIN)
377+
$(call go-install-tool,$(OPERATOR_SDK),github.com/operator-framework/operator-sdk/cmd/operator-sdk,$(OPERATOR_SDK_VERSION))
378+
366379
# go-install-tool will 'go install' any package with custom target and name of binary, if it doesn't exist
367380
# $1 - target path with name of binary
368381
# $2 - package url which can be installed

hack/bundle.sh

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
REGISTRY=${REGISTRY:-quay.io/orc}
44
IMAGE=${BASE_IMAGE:-openstack-resource-controller}
5-
TAG=${BASE_IMAGE:-$(git describe --abbrev=0)}
5+
TAG=${BASE_IMAGE:-$(git describe --abbrev=0 --tags)}
66
IMG=${REGISTRY}/${IMAGE}:${TAG}
77

88
# Update config/manifests/bases/orc.clusterserviceversion.yaml if needed
@@ -14,6 +14,9 @@ mkdir "${TMP_OVERLAY}"
1414
pushd "${TMP_OVERLAY}" || exit
1515
kustomize create --resources ../manifests
1616
kustomize edit set image controller="${IMG}"
17+
18+
kustomize edit add patch --kind ClusterServiceVersion --name "orc.*" --patch '[{"op": "replace", "path": "/spec/version", "value": "'$TAG'"}]'
19+
kustomize edit add patch --kind ClusterServiceVersion --name "orc.*" --patch '[{"op": "replace", "path": "/metadata/name", "value": "orc.'$TAG'"}]'
1720
popd || exit
1821

1922
# Generate bundle and bundle.Dockerfile

0 commit comments

Comments
 (0)