Merge pull request #89 from tomwilkie/build

Embed the git commit id in a go file and print it on startup.
This commit is contained in:
Tom Wilkie
2015-05-22 14:38:02 +01:00
3 changed files with 11 additions and 2 deletions

View File

@@ -11,6 +11,7 @@ SCOPE_IMAGE=$(DOCKERHUB_USER)/scope
SCOPE_EXPORT=scope.tar
SCOPE_UI_BUILD_EXPORT=scope_ui_build.tar
SCOPE_UI_BUILD_IMAGE=$(DOCKERHUB_USER)/scope-ui-build
GIT_REVISION=$(shell git rev-parse HEAD)
all: $(SCOPE_EXPORT)
@@ -25,7 +26,7 @@ $(PROBE_EXE): probe/*.go report/*.go xfer/*.go
$(APP_EXE) $(PROBE_EXE):
go get -tags netgo ./$(@D)
go build -ldflags "-extldflags \"-static\"" -tags netgo -o $@ ./$(@D)
go build -ldflags "-extldflags \"-static\" -X main.version $(GIT_REVISION)" -tags netgo -o $@ ./$(@D)
static: client/dist/scripts/bundle.js
esc -o app/static.go -prefix client/dist client/dist

View File

@@ -18,6 +18,9 @@ import (
"github.com/weaveworks/scope/xfer"
)
// Set during buildtime.
var version = "unknown"
func main() {
var (
defaultProbes = []string{fmt.Sprintf("localhost:%d", xfer.ProbePort), fmt.Sprintf("scope.weave.local:%d", xfer.ProbePort)}
@@ -63,7 +66,7 @@ func main() {
defer os.Remove(*pidfile)
}
log.Printf("starting")
log.Printf("app starting, version %s", version)
// Collector deals with the probes, and generates merged reports.
xfer.MaxBackoff = 10 * time.Second

View File

@@ -18,6 +18,9 @@ import (
"github.com/weaveworks/scope/xfer"
)
// Set during buildtime.
var version = "unknown"
func main() {
var (
httpListen = flag.String("http.listen", "", "listen address for HTTP profiling and instrumentation server")
@@ -39,6 +42,8 @@ func main() {
os.Exit(1)
}
log.Printf("probe starting, version %s", version)
procspy.SetProcRoot(*procRoot)
if *httpListen != "" {