Skip to content
This repository was archived by the owner on Jun 23, 2020. It is now read-only.

Commit ddde142

Browse files
committed
Add build information to
1 parent 255652a commit ddde142

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

Makefile

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,10 @@ BIN := oci
1616
BUILD_DIR := dist
1717
BIN_DIR := ${BUILD_DIR}/bin
1818

19+
BUILD := $(shell git describe --always --dirty)
1920
# Allow overriding for release versions
20-
VERSION ?= $(shell git describe --always --dirty)
21+
# Else just equal the build (git hash)
22+
VERSION ?= ${BUILD}
2123
GOOS ?= linux
2224
GOARCH ?= amd64
2325

@@ -55,7 +57,7 @@ build:
5557
go build \
5658
-i \
5759
-v \
58-
-ldflags="-s -w -X main.version=${VERSION}" \
60+
-ldflags="-s -w -X main.version=${VERSION} -X main.build=${BUILD}" \
5961
-o ${BIN_DIR}/${BIN} ./cmd/oci/
6062

6163
.PHONY: build-integration-tests

cmd/oci/main.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,9 @@ import (
2323
"github.com/oracle/oci-flexvolume-driver/pkg/oci/driver"
2424
)
2525

26-
// version is set at build time to the version of the driver being built.
26+
// version/build is set at build time to the version of the driver being built.
2727
var version string
28+
var build string
2829

2930
// GetLogPath returns the default path to the driver log file.
3031
func GetLogPath() string {
@@ -45,6 +46,6 @@ func main() {
4546
defer f.Close()
4647
log.SetOutput(f)
4748

48-
log.Printf("OCI FlexVolume Driver version: %s", version)
49+
log.Printf("OCI FlexVolume Driver version: %s (%s)", version, build)
4950
flexvolume.ExecDriver(&driver.OCIFlexvolumeDriver{}, os.Args)
5051
}

0 commit comments

Comments
 (0)