Skip to content

Commit 4dbf1a7

Browse files
authored
Merge pull request #8392 from k8s-infra-cherrypick-robot/cherry-pick-8388-to-cluster-autoscaler-release-1.31
[cluster-autoscaler-release-1.31] CA: add release automation validation
2 parents 0f59059 + e74b45c commit 4dbf1a7

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

cluster-autoscaler/Makefile

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,20 @@ build-in-docker-arch-%: clean-arch-% docker-builder
109109
docker run ${RM_FLAG} -v `pwd`:/gopath/src/k8s.io/autoscaler/cluster-autoscaler/:Z autoscaling-builder:latest \
110110
bash -c 'cd /gopath/src/k8s.io/autoscaler/cluster-autoscaler && BUILD_TAGS=${BUILD_TAGS} LDFLAGS="${LDFLAGS}" make build-arch-$*'
111111

112-
release: $(addprefix build-in-docker-arch-,$(ALL_ARCH)) execute-release
112+
release-extract-version = $(shell cat version/version.go | grep "Version =" | cut -d '"' -f 2)
113+
114+
release-validate:
115+
@if [ -z $(shell git tag --points-at HEAD | grep -e ^cluster-autoscaler-1.[1-9][0-9]*.[0-9][0-9]*$) ]; then \
116+
echo "Can't release from this commit, there is no compatible git tag"; \
117+
exit 1; \
118+
fi
119+
@if [ -z $(shell git tag --points-at HEAD | grep -e $(call release-extract-version)) ]; then \
120+
echo "Can't release from this commit, git tag does not match version/version.go"; \
121+
exit 1; \
122+
fi
123+
124+
release: TAG=v$(call release-extract-version)
125+
release: release-validate $(addprefix build-in-docker-arch-,$(ALL_ARCH)) execute-release
113126
@echo "Full in-docker release ${TAG}${FOR_PROVIDER} completed"
114127

115128
container: container-arch-$(GOARCH)

0 commit comments

Comments
 (0)