camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From astefanu...@apache.org
Subject [camel-k] branch master updated: chore: include build info in camel-k operator
Date Tue, 28 May 2019 10:01:08 GMT
This is an automated email from the ASF dual-hosted git repository.

astefanutti pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/camel-k.git


The following commit(s) were added to refs/heads/master by this push:
     new cc0e15c  chore: include build info in camel-k operator
cc0e15c is described below

commit cc0e15c7d4046f90b22355486cca3e3b2af3b9ce
Author: lburgazzoli <lburgazzoli@gmail.com>
AuthorDate: Tue May 28 07:04:49 2019 +0200

    chore: include build info in camel-k operator
---
 cmd/manager/main.go | 4 ++++
 script/Makefile     | 6 +++++-
 2 files changed, 9 insertions(+), 1 deletion(-)

diff --git a/cmd/manager/main.go b/cmd/manager/main.go
index d22aef8..ee3ccb3 100644
--- a/cmd/manager/main.go
+++ b/cmd/manager/main.go
@@ -28,6 +28,7 @@ import (
 
 	"github.com/apache/camel-k/pkg/apis"
 	"github.com/apache/camel-k/pkg/controller"
+	"github.com/apache/camel-k/pkg/util/defaults"
 	"github.com/operator-framework/operator-sdk/pkg/k8sutil"
 	"github.com/operator-framework/operator-sdk/pkg/leader"
 	"github.com/operator-framework/operator-sdk/pkg/ready"
@@ -41,11 +42,14 @@ import (
 )
 
 var log = logf.Log.WithName("cmd")
+var GitCommit string
 
 func printVersion() {
 	log.Info(fmt.Sprintf("Go Version: %s", runtime.Version()))
 	log.Info(fmt.Sprintf("Go OS/Arch: %s/%s", runtime.GOOS, runtime.GOARCH))
 	log.Info(fmt.Sprintf("operator-sdk Version: %v", sdkVersion.Version))
+	log.Info(fmt.Sprintf("Camel K Operator Version: %v", defaults.Version))
+	log.Info(fmt.Sprintf("Camel K Git Commit: %v", GitCommit))
 }
 
 func main() {
diff --git a/script/Makefile b/script/Makefile
index 06c56ec..38eb164 100644
--- a/script/Makefile
+++ b/script/Makefile
@@ -7,6 +7,10 @@ BASE_IMAGE := fabric8/s2i-java:3.0-java8
 LOCAL_REPOSITORY := /tmp/artifacts/m2
 IMAGE_NAME := docker.io/apache/camel-k
 RELEASE_GIT_REMOTE := upstream
+GIT_COMMIT := $(shell git rev-list -1 HEAD)
+
+GOLDFLAGS += -X main.GitCommit=$(GIT_COMMIT)
+GOFLAGS = -ldflags "$(GOLDFLAGS)"
 
 default: test
 
@@ -54,7 +58,7 @@ test-integration: build
 	go test ./... -tags=integration
 
 build-operator:
-	go build -o camel-k ./cmd/manager/*.go
+	go build $(GOFLAGS) -o camel-k ./cmd/manager/*.go
 
 build-kamel:
 	go build -o kamel ./cmd/kamel/*.go


Mime
View raw message