File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1111 id-token : write
1212 contents : read
1313 packages : write
14- uses : datum-cloud/actions/.github/workflows/publish-docker.yaml@v1.5 .1
14+ uses : datum-cloud/actions/.github/workflows/publish-docker.yaml@v1.13 .1
1515 with :
1616 image-name : workload-operator
17+ platforms : linux/amd64,linux/arm64
1718 secrets : inherit
1819
1920 publish-kustomize-bundles :
Original file line number Diff line number Diff line change 11# Build the manager binary
2- FROM golang:1.24 AS builder
2+ FROM --platform=$BUILDPLATFORM golang:1.24 AS builder
33ARG TARGETOS
44ARG TARGETARCH
5+ ARG VERSION=dev
6+ ARG GIT_COMMIT=unknown
7+ ARG GIT_TREE_STATE=unknown
8+ ARG BUILD_DATE=unknown
59
610WORKDIR /workspace
711# Copy the Go Modules manifests
@@ -26,7 +30,13 @@ ENV GOCACHE=/root/.cache/go-build
2630ENV GOTMPDIR=/root/.cache/go-build
2731RUN --mount=type=cache,target=/go/pkg/mod/ \
2832 --mount=type=cache,target="/root/.cache/go-build" \
29- CGO_ENABLED=0 GOOS=${TARGETOS:-linux} GOARCH=${TARGETARCH} go build -a -o manager cmd/main.go
33+ CGO_ENABLED=0 GOOS=${TARGETOS:-linux} GOARCH=${TARGETARCH} go build \
34+ -ldflags "-s -w \
35+ -X main.version=${VERSION} \
36+ -X main.gitCommit=${GIT_COMMIT} \
37+ -X main.gitTreeState=${GIT_TREE_STATE} \
38+ -X main.buildDate=${BUILD_DATE}" \
39+ -o manager cmd/main.go
3040
3141# Use distroless as minimal base image to package the manager binary
3242# Refer to https://github.com/GoogleContainerTools/distroless for more details
Original file line number Diff line number Diff line change 4444 scheme = runtime .NewScheme ()
4545 setupLog = ctrl .Log .WithName ("setup" )
4646 codecs = serializer .NewCodecFactory (scheme , serializer .EnableStrict )
47+
48+ // Build metadata, set via -ldflags at build time. See Dockerfile.
49+ version = "dev"
50+ gitCommit = "unknown"
51+ gitTreeState = "unknown"
52+ buildDate = "unknown"
4753)
4854
4955func init () {
@@ -81,6 +87,13 @@ func main() {
8187
8288 ctrl .SetLogger (zap .New (zap .UseFlagOptions (& opts )))
8389
90+ setupLog .Info ("starting workload-operator" ,
91+ "version" , version ,
92+ "gitCommit" , gitCommit ,
93+ "gitTreeState" , gitTreeState ,
94+ "buildDate" , buildDate ,
95+ )
96+
8497 var serverConfig config.WorkloadOperator
8598 var configData []byte
8699 if len (serverConfigFile ) > 0 {
You can’t perform that action at this time.
0 commit comments