diff --git a/build/Dockerfile b/build/Dockerfile index 33e37de4..077b3c7f 100644 --- a/build/Dockerfile +++ b/build/Dockerfile @@ -26,14 +26,14 @@ RUN mkdir -p /var/run/vars && \ cd /src && \ git config --get remote.origin.url > /var/run/vars/GIT_REPO && \ git rev-parse --short HEAD > /var/run/vars/GIT_HEAD_COMMIT && \ + git log -1 --date=format:"%Y/%m/%d %T" --format="%ad" > /var/run/vars/GIT_DATE_LAST_COMMIT && \ git describe --abbrev=0 --tags > /var/run/vars/GIT_LAST_TAG && \ git rev-parse --short $(cat /var/run/vars/GIT_LAST_TAG) > /var/run/vars/GIT_TAG_COMMIT && \ git diff $(cat /var/run/vars/GIT_HEAD_COMMIT) $(cat /var/run/vars/GIT_TAG_COMMIT) --quiet > /var/run/vars/GIT_MODIFIED1 || echo '.dev' > /var/run/vars/GIT_MODIFIED1 && \ git diff --quiet > /var/run/vars/GIT_MODIFIED2 || echo '.dirty' > /var/run/vars/GIT_MODIFIED2 && \ cat /var/run/vars/GIT_MODIFIED1 /var/run/vars/GIT_MODIFIED2 | tr -d '\n' > /var/run/vars/GIT_MODIFIED && \ - date '+%Y-%m-%dT%H:%M:%S' > /var/run/vars/BUILD_DATE && \ CGO_ENABLED=0 go build \ - -ldflags "-X main.GitRepo=$(cat /var/run/vars/GIT_REPO) -X main.GitTag=$(cat /var/run/vars/GIT_LAST_TAG) -X main.GitCommit=$(cat /var/run/vars/GIT_HEAD_COMMIT) -X main.GitDirty=$(cat /var/run/vars/GIT_MODIFIED) -X main.BuildTime=$(cat /var/run/vars/BUILD_DATE)" \ + -ldflags "-X main.GitRepo=$(cat /var/run/vars/GIT_REPO) -X main.GitTag=$(cat /var/run/vars/GIT_LAST_TAG) -X main.GitCommit=$(cat /var/run/vars/GIT_HEAD_COMMIT) -X main.GitDirty=$(cat /var/run/vars/GIT_MODIFIED) -X \"main.GitCommitDate=$(cat /var/run/vars/GIT_DATE_LAST_COMMIT)\"" \ -o fs/haproxy-ingress-controller . FROM haproxytech/haproxy-alpine:2.7 diff --git a/main.go b/main.go index 1892997f..c2412488 100644 --- a/main.go +++ b/main.go @@ -135,7 +135,7 @@ func logInfo(logger utils.Logger, osArgs utils.OSArgs) { if len(osArgs.Version) > 0 { fmt.Printf("HAProxy Ingress Controller %s %s%s", GitTag, GitCommit, GitDirty) fmt.Printf("Build from: %s", GitRepo) - fmt.Printf("Build date: %s\n", BuildTime) + fmt.Printf("Git commit date: %s", GitCommitDate) if len(osArgs.Version) > 1 { fmt.Printf("ConfigMap: %s", osArgs.ConfigMap) fmt.Printf("Ingress class: %s", osArgs.IngressClass) @@ -147,7 +147,7 @@ func logInfo(logger utils.Logger, osArgs utils.OSArgs) { logger.Print(IngressControllerInfo) logger.Printf("HAProxy Ingress Controller %s %s%s", GitTag, GitCommit, GitDirty) logger.Printf("Build from: %s", GitRepo) - logger.Printf("Build date: %s\n", BuildTime) + logger.Printf("Git commit date: %s", GitCommitDate) logger.Printf("ConfigMap: %s", osArgs.ConfigMap) logger.Printf("Ingress class: %s", osArgs.IngressClass) logger.Printf("Empty Ingress class: %t", osArgs.EmptyIngressClass) diff --git a/version.go b/version.go index 7d5e2faa..ea238638 100644 --- a/version.go +++ b/version.go @@ -26,20 +26,20 @@ var GitCommit = "" // GitDirty ... var GitDirty = "dirty" -// BuildTime ... -var BuildTime = "" +// GitCommitDate ... +var GitCommitDate = "" // IngressControllerInfo console pretty print const IngressControllerInfo = ` - _ _ _ ____ -| | | | / \ | _ \ _ __ _____ ___ _ -| |_| | / _ \ | |_) | '__/ _ \ \/ / | | | -| _ |/ ___ \| __/| | | (_) > <| |_| | -|_| |_/_/ \_\_| |_| \___/_/\_\\__, | - _ __ _ |___/ ___ ____ -| |/ / _| |__ ___ _ __ _ __ ___| |_ ___ ___ |_ _/ ___| -| ' / | | | '_ \ / _ \ '__| '_ \ / _ \ __/ _ \/ __| | | | -| . \ |_| | |_) | __/ | | | | | __/ || __/\__ \ | | |___ -|_|\_\__,_|_.__/ \___|_| |_| |_|\___|\__\___||___/ |___\____| - + _ _ _ ____ +| | | | / \ | _ \ _ __ _____ ___ _ +| |_| | / _ \ | |_) | '__/ _ \ \/ / | | | +| _ |/ ___ \| __/| | | (_) > <| |_| | +|_| |_/_/ \_\_| |_| \___/_/\_\\__, | + _ __ _ |___/ ___ ____ +| |/ / _| |__ ___ _ __ _ __ ___| |_ ___ ___ |_ _/ ___| +| ' / | | | '_ \ / _ \ '__| '_ \ / _ \ __/ _ \/ __| | | | +| . \ |_| | |_) | __/ | | | | | __/ || __/\__ \ | | |___ +|_|\_\__,_|_.__/ \___|_| |_| |_|\___|\__\___||___/ |___\____| + `