Show fission deployment version with cli (#538)
Add version information to binary through go ldflags
This commit is contained in:
+16
-1
@@ -1,2 +1,17 @@
|
||||
#!/bin/sh
|
||||
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -gcflags=-trimpath=$GOPATH -asmflags=-trimpath=$GOPATH
|
||||
version=$1
|
||||
if [ -z $version ]; then
|
||||
version=$(git rev-parse HEAD)
|
||||
fi
|
||||
|
||||
date=$2
|
||||
if [ -z $date ]; then
|
||||
date=$(date -u +'%Y-%m-%dT%H:%M:%SZ')
|
||||
fi
|
||||
|
||||
gitcommit=$3
|
||||
if [ -z $gitcommit ]; then
|
||||
gitcommit=$(git rev-parse HEAD)
|
||||
fi
|
||||
|
||||
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -gcflags=-trimpath=$GOPATH -asmflags=-trimpath=$GOPATH -ldflags "-X github.com/fission/fission.GitCommit=$gitcommit -X github.com/fission/fission.BuildDate=$date -X github.com/fission/fission.Version=$version"
|
||||
|
||||
@@ -1,12 +1,14 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"log"
|
||||
"os"
|
||||
"strconv"
|
||||
|
||||
"github.com/docopt/docopt-go"
|
||||
|
||||
"github.com/fission/fission"
|
||||
"github.com/fission/fission/buildermgr"
|
||||
"github.com/fission/fission/controller"
|
||||
"github.com/fission/fission/executor"
|
||||
@@ -120,6 +122,7 @@ Usage:
|
||||
fission-bundle --builderMgr [--storageSvcUrl=<url>] [--envbuilder-namespace=<namespace>]
|
||||
fission-bundle --timer [--routerUrl=<url>]
|
||||
fission-bundle --mqt [--routerUrl=<url>]
|
||||
fission-bundle --version
|
||||
Options:
|
||||
--controllerPort=<port> Port that the controller should listen on.
|
||||
--routerPort=<port> Port that the router should listen on.
|
||||
@@ -135,8 +138,10 @@ Options:
|
||||
--timer Start Timer.
|
||||
--mqt Start message queue trigger.
|
||||
--builderMgr Start builder manager.
|
||||
--version Print version information
|
||||
`
|
||||
arguments, err := docopt.Parse(usage, nil, true, "fission-bundle", false)
|
||||
version := fmt.Sprintf("Fission Bundle Version: %v", fission.VersionInfo().String())
|
||||
arguments, err := docopt.Parse(usage, nil, true, version, false)
|
||||
if err != nil {
|
||||
log.Fatalf("Error: %v", err)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user