Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

API version generated file #7157

Merged
merged 9 commits into from
Jun 18, 2021
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ ifeq ("$(OS)","windows")
BINARIES=$(BUILDDIR)/tsh
endif

VERSRC = version.go gitref.go
VERSRC = version.go gitref.go api/version.go
Joerger marked this conversation as resolved.
Show resolved Hide resolved

KUBECONFIG ?=
TEST_KUBE ?=
Expand Down
11 changes: 11 additions & 0 deletions api/version.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
/* DO NOT EDIT THIS FILE. IT IS GENERATED BY 'make api/version.go'*/

package api

const (
Version = "7.0.0-dev"
)

// Gitref variable is automatically set to the output of git-describe
// during the build process
var Gitref string
2 changes: 1 addition & 1 deletion version.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* DO NOT EDIT THIS FILE. IT IS GENERATED BY 'make setver'*/
/* DO NOT EDIT THIS FILE. IT IS GENERATED BY 'make version.go'*/

package teleport

Expand Down
13 changes: 11 additions & 2 deletions version.mk
Original file line number Diff line number Diff line change
@@ -1,15 +1,23 @@
GITREF=`git describe --dirty --long --tags`

# $(VERSION_GO) will be written to version.go
VERSION_GO="/* DO NOT EDIT THIS FILE. IT IS GENERATED BY 'make setver'*/\n\n\
VERSION_GO="/* DO NOT EDIT THIS FILE. IT IS GENERATED BY 'make version.go'*/\n\n\
package teleport\n\
const( Version = \"$(VERSION)\" )\n\
// Gitref variable is automatically set to the output of "git-describe" \n\
// during the build process\n\
var Gitref string\n"

# $(API_VERSION_GO) will be written to api/version.go
API_VERSION_GO="/* DO NOT EDIT THIS FILE. IT IS GENERATED BY 'make api/version.go'*/\n\n\
package api\n\
const( Version = \"$(VERSION)\" )\n\
// Gitref variable is automatically set to the output of "git-describe" \n\
// during the build process\n\
var Gitref string\n"

# $(GIT_GO) will be written to gitref.go
GITREF_GO="/* DO NOT EDIT THIS FILE. IT IS GENERATED BY make */ \n\n\
GITREF_GO="/* DO NOT EDIT THIS FILE. IT IS GENERATED BY `make gitref.go` */ \n\n\
package teleport\n\
func init() { Gitref = \"$(GITREF)\"} "

Expand All @@ -19,6 +27,7 @@ func init() { Gitref = \"$(GITREF)\"} "
.PHONY:setver
setver: helm-version
@printf $(VERSION_GO) | gofmt > version.go
@printf $(API_VERSION_GO) | gofmt > ./api/version.go
@printf $(GITREF_GO) | gofmt > gitref.go

# helm-version automatically updates the versions of Helm charts to match the version set in the Makefile,
Expand Down