Merge pull request #139 from mlaventure/git-commit
Add the git commit to the output version
This commit is contained in:
commit
577f9d7696
4 changed files with 19 additions and 4 deletions
8
Makefile
8
Makefile
|
@ -1,5 +1,9 @@
|
|||
BUILDTAGS=
|
||||
|
||||
GIT_COMMIT := $(shell git rev-parse HEAD 2> /dev/null || true)
|
||||
|
||||
LDFLAGS := "-X github.com/docker/containerd.GitCommit=${GIT_COMMIT} ${LDFLAGS}"
|
||||
|
||||
# if this session isn't interactive, then we don't want to allocate a
|
||||
# TTY, which would fail, but if it is interactive, we do want to attach
|
||||
# so that the user can send e.g. ^C through.
|
||||
|
@ -22,10 +26,10 @@ clean:
|
|||
rm -rf bin
|
||||
|
||||
client: bin
|
||||
cd ctr && go build -o ../bin/ctr
|
||||
cd ctr && go build -ldflags ${LDFLAGS} -o ../bin/ctr
|
||||
|
||||
daemon: bin
|
||||
cd containerd && go build -tags "$(BUILDTAGS)" -o ../bin/containerd
|
||||
cd containerd && go build -ldflags ${LDFLAGS} -tags "$(BUILDTAGS)" -o ../bin/containerd
|
||||
|
||||
shim: bin
|
||||
cd containerd-shim && go build -tags "$(BUILDTAGS)" -o ../bin/containerd-shim
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"net"
|
||||
"os"
|
||||
"sync"
|
||||
|
@ -52,7 +53,11 @@ func main() {
|
|||
appendPlatformFlags()
|
||||
app := cli.NewApp()
|
||||
app.Name = "containerd"
|
||||
app.Version = containerd.Version
|
||||
if containerd.GitCommit != "" {
|
||||
app.Version = fmt.Sprintf("%s commit: %s", containerd.Version, containerd.GitCommit)
|
||||
} else {
|
||||
app.Version = containerd.Version
|
||||
}
|
||||
app.Usage = usage
|
||||
app.Flags = daemonFlags
|
||||
setAppBefore(app)
|
||||
|
|
|
@ -14,7 +14,11 @@ const usage = `High performance container daemon cli`
|
|||
func main() {
|
||||
app := cli.NewApp()
|
||||
app.Name = "ctr"
|
||||
app.Version = containerd.Version
|
||||
if containerd.GitCommit != "" {
|
||||
app.Version = fmt.Sprintf("%s commit: %s", containerd.Version, containerd.GitCommit)
|
||||
} else {
|
||||
app.Version = containerd.Version
|
||||
}
|
||||
app.Usage = usage
|
||||
app.Flags = []cli.Flag{
|
||||
cli.BoolFlag{
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
package containerd
|
||||
|
||||
const Version = "0.0.5"
|
||||
|
||||
var GitCommit = ""
|
||||
|
|
Loading…
Reference in a new issue