According to the plan listed in docs/releasing.md.
The gitMinor will keep using a "+" suffix instead for now.
Added a //TODO to deprecate gitMajor and gitMinor in a follow up.
Tested:
- Built it from the git tree:
$ make
$ _output/go/bin/kubecfg -version
Kubernetes version 0.2+, build 8d31eb03c11d4db64ae26809eef7f73070efd811
$ _output/go/bin/kubecfg -version=raw
version.Info{Major:"0", Minor:"2+", GitVersion:"v0.2-29-g8d31eb03c11d4d", GitCommit:"8d31eb03c11d4db64ae26809eef7f73070efd811", GitTreeState:"clean"}
- Built it with a direct `go install` (same as tarball):
$ GOPATH=${PWD}/_output/go:${PWD}/Godeps/_workspace go install $KUBE_GO_PACKAGE/cmd/kubecfg
$ _output/go/bin/kubecfg -version=raw
version.Info{Major:"0", Minor:"2+", GitVersion:"v0.2-dev", GitCommit:"", GitTreeState:"not a git tree"}
$ _output/go/bin/kubecfg -version
Kubernetes version 0.2+, build (unknown)
A follow up commit will address the output of the -version (without "raw") command to use gitVersion instead of Major + Minor.
Signed-off-by: Filipe Brandenburger <filbranden@google.com>
This commit will be tagged with a v0.2 annotated git tag.
Tested:
- Created a git tag for it, built it and checked output of -version:
$ git tag -a -m 'Release Kubernetes v0.2' v0.2
$ make
hack/build-go.sh
Building local go components
$ _output/go/bin/kubecfg -version
Kubernetes version 0.2, build b47f9af5c9ea770973be1b001adaffbdfcb08618
$ _output/go/bin/kubecfg -version=raw
version.Info{Major:"0", Minor:"2", GitVersion:"v0.2", GitCommit:"b47f9af5c9ea770973be1b001adaffbdfcb08618", GitTreeState:"clean"}
- Made sure hack/test-go.sh and hack/test-cmd.sh still pass.
Fixes: Issue #1018
Signed-off-by: Filipe Brandenburger <filbranden@google.com>
Now it is possible to push these variables through ldflags:
- gitMajor
- gitMinor
- gitVersion (from latest annotated tag, output of git describe)
- gitCommit (renamed commitFromGit, intended to have the full sha1)
- gitTreeState (either "clean" or "dirty")
These are spawned into its separate source file, since they are meant to
be updated separately when a new version is released.
Also use the notation vX.Y+ for when git information is not present.
(This is consistent with the kernel build, e.g. Linux 3.15+ means its
version is >= 3.15 and < 3.16.)
v2: Added comments to the individual fields in pkg/version/base.go
Tested:
- Built it and checked the -version output:
$ hack/build-go.sh
$ output/go/bin/kubelet -version
Kubernetes version 0.1+, build c328679ef8aa
Signed-off-by: Filipe Brandenburger <filbranden@google.com>