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

Use just GitVersion for the -version output #1251

Merged
merged 1 commit into from
Sep 9, 2014
Merged

Use just GitVersion for the -version output #1251

merged 1 commit into from
Sep 9, 2014

Conversation

filbranden
Copy link
Contributor

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.

I tested most use cases, I didn't test tarball with official version since that requires additional commits, at the time we release v0.3 I'll have a chance to experiment with that in my fork before we push the tag upstream.

Cheers,
Filipe

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>
@filbranden
Copy link
Contributor Author

Fixes #1018

jbeda added a commit that referenced this pull request Sep 9, 2014
Use just GitVersion for the -version output
@jbeda jbeda merged commit 9ffe6c0 into kubernetes:master Sep 9, 2014
@filbranden filbranden deleted the version_string1 branch September 9, 2014 23:35
tkashem pushed a commit to tkashem/kubernetes that referenced this pull request May 5, 2022
…-loglevel

Bug 2062459: Identify if there are multiple schedulers running
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants