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=
|
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
|
# 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
|
# TTY, which would fail, but if it is interactive, we do want to attach
|
||||||
# so that the user can send e.g. ^C through.
|
# so that the user can send e.g. ^C through.
|
||||||
|
@ -22,10 +26,10 @@ clean:
|
||||||
rm -rf bin
|
rm -rf bin
|
||||||
|
|
||||||
client: bin
|
client: bin
|
||||||
cd ctr && go build -o ../bin/ctr
|
cd ctr && go build -ldflags ${LDFLAGS} -o ../bin/ctr
|
||||||
|
|
||||||
daemon: bin
|
daemon: bin
|
||||||
cd containerd && go build -tags "$(BUILDTAGS)" -o ../bin/containerd
|
cd containerd && go build -ldflags ${LDFLAGS} -tags "$(BUILDTAGS)" -o ../bin/containerd
|
||||||
|
|
||||||
shim: bin
|
shim: bin
|
||||||
cd containerd-shim && go build -tags "$(BUILDTAGS)" -o ../bin/containerd-shim
|
cd containerd-shim && go build -tags "$(BUILDTAGS)" -o ../bin/containerd-shim
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"fmt"
|
||||||
"net"
|
"net"
|
||||||
"os"
|
"os"
|
||||||
"sync"
|
"sync"
|
||||||
|
@ -52,7 +53,11 @@ func main() {
|
||||||
appendPlatformFlags()
|
appendPlatformFlags()
|
||||||
app := cli.NewApp()
|
app := cli.NewApp()
|
||||||
app.Name = "containerd"
|
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.Usage = usage
|
||||||
app.Flags = daemonFlags
|
app.Flags = daemonFlags
|
||||||
setAppBefore(app)
|
setAppBefore(app)
|
||||||
|
|
|
@ -14,7 +14,11 @@ const usage = `High performance container daemon cli`
|
||||||
func main() {
|
func main() {
|
||||||
app := cli.NewApp()
|
app := cli.NewApp()
|
||||||
app.Name = "ctr"
|
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.Usage = usage
|
||||||
app.Flags = []cli.Flag{
|
app.Flags = []cli.Flag{
|
||||||
cli.BoolFlag{
|
cli.BoolFlag{
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
package containerd
|
package containerd
|
||||||
|
|
||||||
const Version = "0.0.5"
|
const Version = "0.0.5"
|
||||||
|
|
||||||
|
var GitCommit = ""
|
||||||
|
|
Loading…
Reference in a new issue