2016-12-31 08:13:41 +00:00
|
|
|
GITREF=`git describe --dirty --long --tags`
|
2016-06-13 18:27:19 +00:00
|
|
|
|
2016-06-14 23:52:32 +00:00
|
|
|
# $(VERSION_GO) will be written to version.go
|
2017-01-04 06:54:53 +00:00
|
|
|
VERSION_GO="/* DO NOT EDIT THIS FILE. IT IS GENERATED BY 'make setver'*/\n\n\
|
2016-06-14 23:52:32 +00:00
|
|
|
package teleport\n\
|
2016-06-15 17:50:45 +00:00
|
|
|
const( Version = \"$(VERSION)\" )\n\
|
2017-01-04 06:54:53 +00:00
|
|
|
// Gitref variable is automatically set to the output of "git-describe" \n\
|
|
|
|
// during the build process\n\
|
2016-06-14 23:52:32 +00:00
|
|
|
var Gitref string\n"
|
2016-06-13 18:27:19 +00:00
|
|
|
|
2016-06-14 23:52:32 +00:00
|
|
|
# $(GIT_GO) will be written to gitref.go
|
|
|
|
GITREF_GO="/* DO NOT EDIT THIS FILE. IT IS GENERATED BY make */ \n\n\
|
|
|
|
package teleport\n\
|
|
|
|
func init() { Gitref = \"$(GITREF)\"} "
|
|
|
|
|
|
|
|
#
|
2016-06-15 17:50:45 +00:00
|
|
|
# setver updates version.go and gitref.go with VERSION and GITREF vars
|
2016-06-14 23:52:32 +00:00
|
|
|
#
|
|
|
|
.PHONY:setver
|
2021-05-17 14:35:11 +00:00
|
|
|
setver: helm-version
|
2016-06-30 02:12:19 +00:00
|
|
|
@printf $(VERSION_GO) | gofmt > version.go
|
|
|
|
@printf $(GITREF_GO) | gofmt > gitref.go
|
2021-05-17 14:35:11 +00:00
|
|
|
|
|
|
|
# helm-version automatically updates the versions of Helm charts to match the version set in the Makefile,
|
|
|
|
# so that chart versions are also kept in sync when the Teleport version is updated for a release.
|
|
|
|
# If the version contains '-dev' (as it does on the master branch, or for development builds) then we get the latest
|
|
|
|
# published major version number by parsing a sorted list of git tags instead, to make deploying the chart from master
|
|
|
|
# work as expected. Version numbers are quoted as a string because Helm otherwise treats dotted decimals as floats.
|
|
|
|
.PHONY:helm-version
|
|
|
|
helm-version:
|
|
|
|
@if ! echo "$${VERSION}" | grep -q "\-dev"; then \
|
|
|
|
export CHART_VERSION=$${VERSION}; \
|
|
|
|
else \
|
|
|
|
export CHART_VERSION=$$(git ls-remote --tags https://github.com/gravitational/teleport | cut -d'/' -f3 | grep -Ev '(alpha|beta|dev|rc)' | sort -rV | head -n1 | cut -d. -f1 | tr -d '^v'); \
|
|
|
|
fi; \
|
|
|
|
for CHART in teleport-cluster teleport-kube-agent; do \
|
|
|
|
sed -i "s_^version:\ .*_version: \"$${CHART_VERSION}\"_g" examples/chart/$${CHART}/Chart.yaml || exit 1; \
|
|
|
|
sed -i "s_^appVersion:\ .*_appVersion: \"$${CHART_VERSION}\"_g" examples/chart/$${CHART}/Chart.yaml || exit 1; \
|
|
|
|
done
|