Skip to content
This repository was archived by the owner on Aug 26, 2022. It is now read-only.

Commit d6a028c

Browse files
authored
Adding version log (#323)
* Adding version log * Adding Major version and lint
1 parent 0822acc commit d6a028c

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

Makefile

+3-2
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ else
4343
endif
4444

4545
COMMON_GO_ARGS=-race
46+
GIT_COMMIT=$(shell git rev-list -1 HEAD)
4647

4748
# Run the unit tests and build all binaries
4849
build:
@@ -95,11 +96,11 @@ build-catalog-md:
9596

9697
# build the CNF test binary
9798
build-cnf-tests:
98-
PATH=${PATH}:${GOBIN} ginkgo build ./test-network-function
99+
PATH=${PATH}:${GOBIN} ginkgo build -ldflags "-X github.com/test-network-function/test-network-function/test-network-function.GitCommit=${GIT_COMMIT}" ./test-network-function
99100
make build-catalog-md
100101

101102
build-cnf-tests-debug:
102-
PATH=${PATH}:${GOBIN} ginkgo build -gcflags "all=-N -l" -ldflags "-extldflags '-z relro -z now'" ./test-network-function
103+
PATH=${PATH}:${GOBIN} ginkgo build -gcflags "all=-N -l" -ldflags "-X github.com/test-network-function/test-network-function/test-network-function.GitCommit=${GIT_COMMIT} -extldflags '-z relro -z now'" ./test-network-function
103104
make build-catalog-md
104105

105106
# run all CNF tests

test-network-function/suite_test.go

+4-1
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ import (
4949
)
5050

5151
const (
52+
programVersion = "3.0"
5253
claimFileName = "claim.json"
5354
claimFilePermissions = 0644
5455
claimPathFlagKey = "claimloc"
@@ -68,6 +69,7 @@ const (
6869
var (
6970
claimPath *string
7071
junitPath *string
72+
GitCommit string
7173
)
7274

7375
func init() {
@@ -106,11 +108,12 @@ func loadJUnitXMLIntoMap(result map[string]interface{}, junitFilename, key strin
106108
}
107109
}
108110

109-
// TestTest invokes the CNF Certification Test Suite.
111+
//nolint:funlen // TestTest invokes the CNF Certification Test Suite.
110112
func TestTest(t *testing.T) {
111113
// set up input flags and register failure handlers.
112114
flag.Parse()
113115
gomega.RegisterFailHandler(ginkgo.Fail)
116+
log.Info("Version: ", programVersion, " ( ", GitCommit, " )")
114117
common.SetLogLevel()
115118

116119
// Initialize the claim with the start time, tnf version, etc.

0 commit comments

Comments
 (0)