Use current GIT commit ID and built info (time and machine) for versioning purpose
This commit is contained in:
Junjie Qian 2017-06-21 13:54:43 -07:00 коммит произвёл Junjie Qian
Родитель 1096040f83
Коммит 63723f39b9
3 изменённых файлов: 22 добавлений и 1 удалений

Просмотреть файл

@ -3,10 +3,14 @@
export GOPATH=$(PWD)/_gopath
GITCOMMIT=`git rev-parse --short HEAD`
BUILDTIME=`date +%FT%T%z`
HOSTNAME=`hostname`
all: hdfs-mount
hdfs-mount: *.go $(GOPATH)/src/bazil.org/fuse $(GOPATH)/src/github.com/colinmarc/hdfs $(GOPATH)/src/golang.org/x/net/context $(GOPATH)/src/github.com/golang/protobuf/proto
go build -o hdfs-mount
go build -ldflags="-w -X main.GITCOMMIT=${GITCOMMIT} -X main.BUILDTIME=${BUILDTIME} -X main.HOSTNAME=${HOSTNAME}" -o hdfs-mount
$(GOPATH)/src/bazil.org/fuse: $(GOPATH)/src/github.com/bazil/fuse
ln -s $(GOPATH)/src/github.com/bazil $(GOPATH)/src/bazil.org

15
Version.go Normal file
Просмотреть файл

@ -0,0 +1,15 @@
package main
var (
//TODO: Add Version tag, manually update
// VERSION = "0.0.1"
// GITCommit overwritten automatically by the build
GITCOMMIT = "HEAD"
// Built time overwritten automatically by the build
BUILDTIME = "NOW"
// Built hostname overwritten automatically by build
HOSTNAME = "LOCALHOST"
)

Просмотреть файл

@ -45,6 +45,8 @@ func main() {
os.Exit(2)
}
log.Print("hdfs-mount: current head GITCommit: ", GITCOMMIT, ", Built time: ", BUILDTIME, ", Built by:", HOSTNAME)
allowedPrefixes := strings.Split(*allowedPrefixesString, ",")
retryPolicy.MaxAttempts += 1 // converting # of retry attempts to total # of attempts