Skip to content

Commit 687698a

Browse files
committed
chore(image): replace release script with extra tagging in makefile
1 parent 3b59f76 commit 687698a

2 files changed

Lines changed: 9 additions & 15 deletions

File tree

Makefile

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,13 @@ endif
4949
# Set the Operator SDK version to use. By default, what is installed on the system is used.
5050
# This is useful for CI or a project to utilize a specific version of the operator-sdk toolkit.
5151
OPERATOR_SDK_VERSION ?= v1.42.2
52+
53+
# Get git commit hash for tagging
54+
GIT_COMMIT ?= $(shell git rev-parse --short=7 HEAD)
55+
5256
# Image URL to use all building/pushing image targets
5357
IMG ?= $(IMAGE_TAG_BASE):$(VERSION)
58+
IMG_COMMIT ?= $(IMAGE_TAG_BASE):$(GIT_COMMIT)
5459

5560
# Get the currently used golang install path (in GOPATH/bin, unless GOBIN is set)
5661
ifeq (,$(shell go env GOBIN))
@@ -138,12 +143,13 @@ run: manifests generate fmt vet ## Run a controller from your host.
138143
# (i.e. docker build --platform linux/arm64). However, you must enable docker buildKit for it.
139144
# More info: https://docs.docker.com/develop/develop-images/build_enhancements/
140145
.PHONY: docker-build
141-
docker-build: ## Build docker image with the manager.
142-
$(CONTAINER_TOOL) build -t ${IMG} .
146+
docker-build: ## Build docker image with the manager, tagged with both VERSION and commit hash.
147+
$(CONTAINER_TOOL) build -t ${IMG} -t ${IMG_COMMIT} .
143148

144149
.PHONY: docker-push
145-
docker-push: ## Push docker image with the manager.
150+
docker-push: ## Push docker image with the manager (both VERSION and commit hash tags).
146151
$(CONTAINER_TOOL) push ${IMG}
152+
$(CONTAINER_TOOL) push ${IMG_COMMIT}
147153

148154
# PLATFORMS defines the target platforms for the manager image be built to provide support to multiple
149155
# architectures. (i.e. make docker-buildx IMG=myregistry/mypoperator:0.0.1). To use this option you need to:

release.sh

Lines changed: 0 additions & 12 deletions
This file was deleted.

0 commit comments

Comments
 (0)