Skip to content

Commit b0148ba

Browse files
authored
Merge pull request #171 from Madhan-SWE/release-staging
Release staging image with alias tag
2 parents b102103 + a95f25b commit b0148ba

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed

Makefile

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,9 @@ REGISTRY?=gcr.io/k8s-staging-cloud-provider-ibm
1919
IMG?=ibm-powervs-block-csi-driver
2020
TAG?=$(GIT_COMMIT)
2121
LDFLAGS?="-X ${PKG}/pkg/driver.driverVersion=${TAG} -X ${PKG}/pkg/driver.gitCommit=${GIT_COMMIT} -X ${PKG}/pkg/driver.buildDate=${BUILD_DATE} -s -w"
22+
RELEASE_TAG ?= $(shell git describe --abbrev=0 2>/dev/null)
23+
PULL_BASE_REF ?= $(RELEASE_TAG) # PULL_BASE_REF will be provided by Prow
24+
RELEASE_ALIAS_TAG ?= $(PULL_BASE_REF)
2225

2326
GO111MODULE=on
2427
GOPROXY=direct
@@ -71,6 +74,17 @@ build-and-push-multi-arch: build-image-and-push-linux-amd64 build-image-and-push
7174
docker manifest create --amend $(REGISTRY)/$(IMG):$(TAG) $(REGISTRY)/$(IMG):$(TAG)_linux_amd64 $(REGISTRY)/$(IMG):$(TAG)_linux_ppc64le
7275
docker manifest push -p $(REGISTRY)/$(IMG):$(TAG)
7376

77+
.PHONY: release-alias-tag
78+
release-alias-tag: # Adds the tag to the last build tag.
79+
docker pull $(REGISTRY)/$(IMG):$(TAG)
80+
docker tag $(REGISTRY)/$(IMG):$(TAG) $(REGISTRY)/$(IMG):$(RELEASE_ALIAS_TAG)
81+
docker push $(REGISTRY)/$(IMG):$(RELEASE_ALIAS_TAG)
82+
83+
.PHONY: release-staging
84+
release-staging: ## Builds and push container images to the staging image registry.
85+
$(MAKE) build-and-push-multi-arch
86+
$(MAKE) release-alias-tag
87+
7488
.PHONY: clean
7589
clean:
7690
rm -rf bin/*

cloudbuild.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,4 @@ steps:
1515
- TAG=${_GIT_TAG}
1616
- HOME=/root
1717
args:
18-
- build-and-push-multi-arch
18+
- release-staging

0 commit comments

Comments
 (0)