Skip to content

Commit

Permalink
MINOR: make docker image sha1 repeatable
Browse files Browse the repository at this point in the history
  • Loading branch information
ivanmatmati authored and oktalz committed Jun 20, 2023
1 parent 206d961 commit a82eeb3
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 17 deletions.
4 changes: 2 additions & 2 deletions build/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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)
Expand Down
26 changes: 13 additions & 13 deletions version.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,20 +26,20 @@ var GitCommit = ""
// GitDirty ...
var GitDirty = "dirty"

// BuildTime ...
var BuildTime = ""
// GitCommitDate ...
var GitCommitDate = ""

// IngressControllerInfo console pretty print
const IngressControllerInfo = `
_ _ _ ____
| | | | / \ | _ \ _ __ _____ ___ _
| |_| | / _ \ | |_) | '__/ _ \ \/ / | | |
| _ |/ ___ \| __/| | | (_) > <| |_| |
|_| |_/_/ \_\_| |_| \___/_/\_\\__, |
_ __ _ |___/ ___ ____
| |/ / _| |__ ___ _ __ _ __ ___| |_ ___ ___ |_ _/ ___|
| ' / | | | '_ \ / _ \ '__| '_ \ / _ \ __/ _ \/ __| | | |
| . \ |_| | |_) | __/ | | | | | __/ || __/\__ \ | | |___
|_|\_\__,_|_.__/ \___|_| |_| |_|\___|\__\___||___/ |___\____|
_ _ _ ____
| | | | / \ | _ \ _ __ _____ ___ _
| |_| | / _ \ | |_) | '__/ _ \ \/ / | | |
| _ |/ ___ \| __/| | | (_) > <| |_| |
|_| |_/_/ \_\_| |_| \___/_/\_\\__, |
_ __ _ |___/ ___ ____
| |/ / _| |__ ___ _ __ _ __ ___| |_ ___ ___ |_ _/ ___|
| ' / | | | '_ \ / _ \ '__| '_ \ / _ \ __/ _ \/ __| | | |
| . \ |_| | |_) | __/ | | | | | __/ || __/\__ \ | | |___
|_|\_\__,_|_.__/ \___|_| |_| |_|\___|\__\___||___/ |___\____|
`

0 comments on commit a82eeb3

Please sign in to comment.