2023-01-09 14:55:00 +00:00
|
|
|
GITREF=$(shell git describe --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
|
2023-01-09 14:55:00 +00:00
|
|
|
VERSION_GO="// Code generated by \"make version\". DO NOT EDIT.\n\
|
|
|
|
package teleport\n\n\
|
|
|
|
const Version = \"$(VERSION)\"\n\n\
|
|
|
|
// Gitref is set to the output of \"git describe\" 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
|
|
|
|
2021-06-18 18:52:55 +00:00
|
|
|
# $(API_VERSION_GO) will be written to api/version.go
|
2023-01-09 14:55:00 +00:00
|
|
|
API_VERSION_GO="// Code generated by \"make version\". DO NOT EDIT.\n\
|
|
|
|
package api\n\n\
|
|
|
|
const Version = \"$(VERSION)\"\n\n\
|
|
|
|
// Gitref is set to the output of \"git describe\" during the build process.\n\
|
2021-06-18 18:52:55 +00:00
|
|
|
var Gitref string\n"
|
|
|
|
|
2023-03-07 04:49:01 +00:00
|
|
|
# $(UPDATER_VERSION_GO) will be written to api/version.go
|
|
|
|
UPDATER_VERSION_GO="// Code generated by \"make version\". DO NOT EDIT.\n\
|
|
|
|
package kubeversionupdater\n\n\
|
|
|
|
const Version = \"$(VERSION)\"\n\n\
|
|
|
|
// Gitref is set to the output of \"git describe\" during the build process.\n\
|
|
|
|
var Gitref string\n"
|
|
|
|
|
2023-01-09 14:55:00 +00:00
|
|
|
# $(GITREF_GO) will be written to gitref.go
|
|
|
|
GITREF_GO="// Code generated by \"make version\". DO NOT EDIT.\n\
|
|
|
|
package teleport\n\n\
|
|
|
|
func init() { Gitref = \"$(GITREF)\" }\n"
|
2016-06-14 23:52:32 +00:00
|
|
|
|
|
|
|
#
|
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
|
2023-08-16 01:20:21 +00:00
|
|
|
setver: validate-semver helm-version tsh-version
|
2016-06-30 02:12:19 +00:00
|
|
|
@printf $(VERSION_GO) | gofmt > version.go
|
2021-06-18 18:52:55 +00:00
|
|
|
@printf $(API_VERSION_GO) | gofmt > ./api/version.go
|
2023-03-07 04:49:01 +00:00
|
|
|
@printf $(UPDATER_VERSION_GO) | gofmt > ./integrations/kube-agent-updater/version.go
|
2016-06-30 02:12:19 +00:00
|
|
|
@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.
|
2021-05-17 19:01:16 +00:00
|
|
|
# The weird -i usage is to make the sed commands work the same on both Linux and Mac. Test on both platforms if you change it.
|
2021-05-17 14:35:11 +00:00
|
|
|
.PHONY:helm-version
|
|
|
|
helm-version:
|
2022-06-09 09:16:52 +00:00
|
|
|
for CHART in teleport-cluster teleport-kube-agent teleport-cluster/charts/teleport-operator; do \
|
|
|
|
sed -i'.bak' -e "s_^\\.version:\ .*_.version: \\&version \"$${VERSION}\"_g" examples/chart/$${CHART}/Chart.yaml || exit 1; \
|
2021-05-17 19:01:16 +00:00
|
|
|
rm -f examples/chart/$${CHART}/Chart.yaml.bak; \
|
2021-06-28 19:06:47 +00:00
|
|
|
done
|
2023-05-15 22:42:54 +00:00
|
|
|
|
|
|
|
TSH_APP_PLISTS := $(wildcard build.assets/macos/*/tsh.app/Contents/Info.plist)
|
|
|
|
PLIST_FILES := $(abspath $(TSH_APP_PLISTS))
|
|
|
|
|
|
|
|
# tsh-version sets CFBundleVersion and CFBundleShortVersionString in the tsh{,dev} Info.plist
|
|
|
|
.PHONY:tsh-version
|
|
|
|
tsh-version:
|
|
|
|
cd build.assets/tooling && go run ./cmd/update-plist-version $(VERSION) $(PLIST_FILES)
|
2023-08-16 01:20:21 +00:00
|
|
|
|
|
|
|
.PHONY:validate-semver
|
|
|
|
validate-semver:
|
2023-08-16 23:26:41 +00:00
|
|
|
cd build.assets/tooling && CGO_ENABLED=0 go run ./cmd/check -check valid -tag v$(VERSION)
|