Commit Graph

16 Commits (3710ce35613331c4e08d9245abb4b6a605e178b8)

Author SHA1 Message Date
Dr. Stefan Schimanski 52f6831576 genericapiserver: cut off kube pkg/version dependency 2017-01-17 12:34:05 +01:00
Kris 1740358573 Split the version metric out to its own package 2016-08-24 11:47:16 -07:00
David McMahon ef0c9f0c5b Remove "All rights reserved" from all the headers. 2016-06-29 17:47:36 -07:00
Jeff Grafton fb663f2cd5 Include Go version, platform, and other build info in version string
Additionally update MatchesServerVersion to only check GitVersion,
GitCommit, and GitTreeState.
2016-03-14 13:55:28 -07:00
Jimmi Dyson 9e6b3e4a9d Expose version as prometheus metric 2015-09-23 14:21:43 +01:00
Eric Paris 6b3a6e6b98 Make copyright ownership statement generic
Instead of saying "Google Inc." (which is not always correct) say "The
Kubernetes Authors", which is generic.
2015-05-01 17:49:56 -04:00
Sam Ghods 6399854240 Remove unused YAML tags and GetYAML/SetYAML methods
Unneeded after move to ghodss/yaml.
2014-12-02 16:25:28 -08:00
Brian Grant 7583e1a643 Automatic API generation by adopting go-restful 2014-11-14 16:49:19 +00:00
Daniel Smith dca7363459 Serve API version list, test with an integration test. 2014-10-28 17:35:56 -07:00
Filipe Brandenburger 8de322f196 Use just GitVersion for the -version output
It turns out that that's simply the most useful information about the version
that was built.

For a git tree, it includes information about the closest release, number of
commits since the release, enough of the SHA1 to find the exact commit and
whether the tree was clean or dirty at build time.

For a build from tarball, it will include information of which release was built
and, when using a tarball from a not released commit (e.g. downloading
"master.tar.gz" from GitHub, not recommended!) it will include the -dev prefix
to indicate that was not an official release. (That's as good as we can get with
it.)

If additional information is required, it can be found with -version=raw.

Tested:

- Built from the git tree:

    $ _output/go/bin/kubecfg -version
    Kubernetes v0.2-29-gd916051e9db865
    $ _output/go/bin/kubecfg -version=raw
    version.Info{Major:"0", Minor:"2+", GitVersion:"v0.2-29-gd916051e9db865", GitCommit:"d916051e9db8650899acb9415a4e285e3e3a1f87", GitTreeState:"clean"}

- Built it from a dirty git tree:

    $ { echo 'package version'; echo 'var X = 1'; } >pkg/version/sillyvar.go
    $ make
    $ _output/go/bin/kubecfg -version
    Kubernetes v0.2-29-gd916051e9db865-dirty
    $ _output/go/bin/kubecfg -version=raw
    version.Info{Major:"0", Minor:"2+", GitVersion:"v0.2-29-gd916051e9db865-dirty", GitCommit:"d916051e9db8650899acb9415a4e285e3e3a1f87", GitTreeState:"dirty"}

- Tag it v0.3 and build it:

    $ git tag -a v0.3 -m 'Release Kubernetes v0.3'
    $ make
    $ _output/go/bin/kubecfg -version
    Kubernetes v0.3
    $ _output/go/bin/kubecfg -version=raw
    version.Info{Major:"0", Minor:"3", GitVersion:"v0.3", GitCommit:"d916051e9db8650899acb9415a4e285e3e3a1f87", GitTreeState:"clean"}

- Built it from a tarball:

    $ wget -O kubernetes.tgz https://api.github.com/repos/filbranden/kubernetes/tarball/version_string1
    $ tar xvf kubernetes.tgz
    $ cd filbranden-kubernetes-*/
    $ make
    $ _output/go/bin/kubecfg -version
    Kubernetes v0.2-dev
    $ _output/go/bin/kubecfg -version=raw
    version.Info{Major:"0", Minor:"2+", GitVersion:"v0.2-dev", GitCommit:"", GitTreeState:"not a git tree"}

- Built it with `go get`:

    # I need to prefetch the tree to replace the official tree with mine:
    $ mkdir -p ${TMPDIR}/gopath/src/github.com/
    $ ln -sf filbranden ${TMPDIR}/gopath/src/github.com/GoogleCloudPlatform

    # Now run `go get` to build kubecfg:
    $ GOPATH=${TMPDIR}/gopath go get github.com/filbranden/kubernetes/cmd/kubecfg

    # Check the version:
    $ ${TMPDIR}/gopath/bin/kubecfg -version
    Kubernetes v0.2-dev
    $ ${TMPDIR}/gopath/bin/kubecfg -version=raw
    version.Info{Major:"0", Minor:"2+", GitVersion:"v0.2-dev", GitCommit:"", GitTreeState:"not a git tree"}

Signed-off-by: Filipe Brandenburger <filbranden@google.com>
2014-09-09 16:19:14 -07:00
Filipe Brandenburger b777eb19e2 Add additional ldflags constants for Kubernetes versioning
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>
2014-08-27 10:06:22 -07:00
Clayton Coleman 9336373857 Use -ldflags to set git commit version 2014-08-25 16:40:47 -04:00
Yuki Yugui Sonoda 331fd0d986 Extract "pkg/version".PrintAndExitIfRequested() to its own package
because it causes a runtime panic if a binary which has its own implementation
of "-version" flag tries to reuse a package library which indirectly depend on
"pkg/version".

e.g. If such an user-defined binary tires to link "pkg/api" or "pkg/client",
the binary fails with a runtime panic "flag redefined: version".
2014-08-01 15:05:27 +09:00
Filipe Brandenburger 7e56609139 Handle -version flag on all commands
Tested: Passed -version argument to kubelet (and all other binaries):
  $ output/go/bin/kubecfg -version
  Kubernetes version 0.1, build 6454a541fd56

Signed-off-by: Filipe Brandenburger <filbranden@google.com>
2014-07-30 18:48:56 -07:00
Daniel Smith 3b8488028d Add /version to server and check it in client.
Will help detect client/version skew and prevent e2e test from passing
while running a version other than the one you think it's running.
2014-07-28 15:45:25 -07:00
Daniel Smith 60f05c8d8d update version package when building. 2014-07-02 15:32:30 -07:00