Skip to content

Commit 244283e

Browse files
authored
Merge branch 'project-codeflare:build-logs' into build-logs
2 parents 3f1166c + 4a3eaa7 commit 244283e

File tree

3 files changed

+22
-6
lines changed

3 files changed

+22
-6
lines changed

Makefile

+3-2
Original file line numberDiff line numberDiff line change
@@ -91,11 +91,12 @@ endif
9191
SHELL = /usr/bin/env bash -o pipefail
9292
.SHELLFLAGS = -ec
9393

94-
BUILD_DATE := $(shell date +%Y-%m-%d\ %H:%M)
94+
export BUILD_DATE := $(shell date +%Y-%m-%d\ %H:%M)
95+
9596
BUILD_TAG_SHA := $(shell git rev-list --abbrev-commit --tags --max-count=1)
9697
BUILD_TAG_NAME := $(shell git describe --abbrev=0 --tags ${BUILD_TAG_SHA} 2>/dev/null || true)
9798
BUILD_SHA := $(shell git rev-parse --short HEAD)
98-
BUILD_VERSION := $(BUILD_TAG_NAME:v%=%)
99+
export BUILD_VERSION := $(BUILD_TAG_NAME:v%=%)
99100
ifneq ($(BUILD_SHA), $(BUILD_TAG_SHA))
100101
BUILD_VERSION := $(BUILD_VERSION)-$(BUILD_SHA)
101102
endif

main.go

+4-4
Original file line numberDiff line numberDiff line change
@@ -58,10 +58,10 @@ import (
5858
var (
5959
scheme = runtime.NewScheme()
6060
setupLog = ctrl.Log.WithName("setup")
61-
OperatorVersion = "UNKNOWN"
62-
McadVersion = "UNKNOWN"
63-
InstaScaleVersion = "UNKNOWN"
64-
BuildDate = "UNKNOWN"
61+
OperatorVersion = "BUILD_VERSION"
62+
McadVersion = "MCAD_VERSION"
63+
InstaScaleVersion = "INSTASCALE_VERSION"
64+
BuildDate = "BUILD_DATE"
6565
)
6666

6767
func init() {

pkg/version/version.go

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
package version
2+
3+
import (
4+
"fmt"
5+
)
6+
7+
var (
8+
Version = "dev"
9+
CommitHash = "n/a"
10+
BuildTimestamp = "n/a"
11+
)
12+
13+
func BuildVersion() string {
14+
return fmt.Sprintf("%s-%s (%s)", Version, CommitHash, BuildTimestamp)
15+
}

0 commit comments

Comments
 (0)