Skip to content

Commit

Permalink
Merge pull request #306 from gocardless/rnaveiras-fix-ldflags
Browse files Browse the repository at this point in the history
Update Theatre go ldflags
  • Loading branch information
rnaveiras committed Jun 20, 2023
2 parents 2589933 + 94cb6db commit d35bd70
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 7 deletions.
6 changes: 3 additions & 3 deletions .goreleaser.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ builds:
- goos: linux
goarch: arm64
ldflags: >
-X github.com/gocardless/theatre/cmd.Version={{.Version}}
-X github.com/gocardless/theatre/cmd.Commit={{.Commit}}
-X github.com/gocardless/theatre/cmd.Date={{.Date}}
-X github.com/gocardless/theatre/v3/cmd.Version={{.Version}}
-X github.com/gocardless/theatre/v3/cmd.Commit={{.Commit}}
-X github.com/gocardless/theatre/v3/cmd.Date={{.Date}}
-a
-installsuffix cgo
env:
Expand Down
6 changes: 5 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,10 @@ FROM golang:1.20.5 as builder
WORKDIR /go/src/github.com/gocardless/theatre

COPY . /go/src/github.com/gocardless/theatre
ARG git_revision=unset
RUN echo $git_revision > REVISION
RUN set -x \
&& make VERSION="$(cat VERSION)" build
&& make VERSION="$(cat VERSION)" GIT_REVISION="$(cat REVISION)" build

# Use ubuntu as our base package to enable generic system tools
FROM ubuntu:jammy-20230522
Expand All @@ -20,4 +22,6 @@ RUN set -x \

WORKDIR /
COPY --from=builder /go/src/github.com/gocardless/theatre/bin/* /usr/local/bin/
ARG git_revision=unset
RUN echo $git_revision > REVISION
ENTRYPOINT ["/bin/bash"]
7 changes: 5 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
PROG=bin/rbac-manager bin/vault-manager bin/theatre-secrets bin/workloads-manager bin/theatre-consoles
PROJECT=github.com/gocardless/theatre
IMAGE=eu.gcr.io/gc-containers/gocardless/theatre
VERSION=$(shell git rev-parse --short HEAD)-dev
BUILD_COMMAND=go build -ldflags "-s -w -X main.Version=$(VERSION)"
VERSION=$(shell git describe --tags --dirty --long)
GIT_REVISION=$(shell git rev-parse HEAD)
DATE=$(shell date +"%Y%m%d.%H%M%S")
LDFLAGS=-ldflags "-s -X github.com/gocardless/theatre/v3/cmd.Version=$(VERSION) -X github.com/gocardless/theatre/v3/cmd.Commit=$(GIT_REVISION) -X github.com/gocardless/theatre/v3/cmd.Date=$(DATE)"
BUILD_COMMAND=go build $(LDFLAGS)

# Get the currently used golang install path (in GOPATH/bin, unless GOBIN is set)
ifeq (,$(shell go env GOBIN))
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
4.2.0
4.2.1

0 comments on commit d35bd70

Please sign in to comment.