Skip to content

Commit 72bf359

Browse files
authored
Merge pull request #8388 from jackfrancis/ca-validate-make-release
CA: add release automation validation
2 parents ff6e93b + 26d6b38 commit 72bf359

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
@@ -107,7 +107,20 @@ build-in-docker-arch-%: clean-arch-% docker-builder
107107
docker run ${RM_FLAG} -v `pwd`:/gopath/src/k8s.io/autoscaler/cluster-autoscaler/:Z autoscaling-builder:latest \
108108
bash -c 'cd /gopath/src/k8s.io/autoscaler/cluster-autoscaler && BUILD_TAGS=${BUILD_TAGS} LDFLAGS="${LDFLAGS}" make build-arch-$*'
109109

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

113126
container: container-arch-$(GOARCH)

0 commit comments

Comments
 (0)