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
1212PUSH_TO_GCR =
1313GENERATE_DEFAULT_CERT_AND_KEY =
1414
15+ GIT_COMMIT =$(shell git rev-parse --short HEAD)
16+
1517nginx-ingress :
1618ifeq ($(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
1820else
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
2022endif
2123
2224test :
4143 docker push $(PREFIX):$(TAG)
4244endif
4345
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-
5146clean :
5247 rm -f nginx-ingress
Original file line number Diff line number Diff line change @@ -22,7 +22,8 @@ import (
2222
2323var (
2424 // Set during build
25- version string
25+ version string
26+ gitCommit string
2627
2728 healthStatus = flag .Bool ("health-status" , false ,
2829 `If present, the default server listening on port 80 with the health check
@@ -61,7 +62,7 @@ func main() {
6162 flag .Parse ()
6263 flag .Lookup ("logtostderr" ).Value .Set ("true" )
6364
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 )
6566
6667 var err error
6768 var config * rest.Config
You can’t perform that action at this time.
0 commit comments