diff --git a/Makefile b/Makefile index 32e6016a9..05a7a56e2 100644 --- a/Makefile +++ b/Makefile @@ -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 diff --git a/app/main.go b/app/main.go index 6ada28a8f..553cd174a 100644 --- a/app/main.go +++ b/app/main.go @@ -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 diff --git a/probe/main.go b/probe/main.go index 79c9d1bb1..ace5a50a1 100644 --- a/probe/main.go +++ b/probe/main.go @@ -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 != "" {