File tree Expand file tree Collapse file tree 2 files changed +7
-11
lines changed Expand file tree Collapse file tree 2 files changed +7
-11
lines changed Original file line number Diff line number Diff line change @@ -12,11 +12,13 @@ BUILD_IN_CONTAINER = 1
12
12
PUSH_TO_GCR =
13
13
GENERATE_DEFAULT_CERT_AND_KEY =
14
14
15
+ GIT_COMMIT =$(shell git rev-parse --short HEAD)
16
+
15
17
nginx-ingress :
16
18
ifeq ($(BUILD_IN_CONTAINER ) ,1)
17
- $(DOCKER_RUN) -e CGO_ENABLED=0 $(GOLANG_CONTAINER) go build -a -installsuffix cgo -ldflags "-w -X main.version=${VERSION}" -o nginx-ingress *.go
19
+ $(DOCKER_RUN) -e CGO_ENABLED=0 $(GOLANG_CONTAINER) go build -a -installsuffix cgo -ldflags "-w -X main.version=${VERSION} -X main.gitCommit=${GIT_COMMIT} " -o nginx-ingress *.go
18
20
else
19
- CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -ldflags "-w -X main.version=${VERSION}" -o nginx-ingress *.go
21
+ CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -ldflags "-w -X main.version=${VERSION} -X main.gitCommit=${GIT_COMMIT} " -o nginx-ingress *.go
20
22
endif
21
23
22
24
test :
41
43
docker push $(PREFIX):$(TAG)
42
44
endif
43
45
44
- osx :
45
- ifeq ($(BUILD_IN_CONTAINER ) ,1)
46
- $(DOCKER_RUN) -e CGO_ENABLED=0 -e GOOS=darwin $(GOLANG_CONTAINER) go build -a -installsuffix cgo -ldflags "-w -X main.version=${VERSION}" -o osx-nginx-ingress *.go
47
- else
48
- CGO_ENABLED=0 GOOS=darwin go build -a -installsuffix cgo -ldflags "-w -X main.version=${VERSION}" -o osx-nginx-ingress *.go
49
- endif
50
-
51
46
clean :
52
47
rm -f nginx-ingress
Original file line number Diff line number Diff line change @@ -22,7 +22,8 @@ import (
22
22
23
23
var (
24
24
// Set during build
25
- version string
25
+ version string
26
+ gitCommit string
26
27
27
28
healthStatus = flag .Bool ("health-status" , false ,
28
29
`If present, the default server listening on port 80 with the health check
@@ -61,7 +62,7 @@ func main() {
61
62
flag .Parse ()
62
63
flag .Lookup ("logtostderr" ).Value .Set ("true" )
63
64
64
- glog .Infof ("Starting NGINX Ingress controller Version %v\n " , version )
65
+ glog .Infof ("Starting NGINX Ingress controller Version=%v GitCommit= %v\n " , version , gitCommit )
65
66
66
67
var err error
67
68
var config * rest.Config
You can’t perform that action at this time.
0 commit comments