Skip to content

Commit 28b7f84

Browse files
committed
Specify ko build options
1 parent 824effa commit 28b7f84

File tree

2 files changed

+17
-1
lines changed

2 files changed

+17
-1
lines changed

.ko.yaml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,13 @@
11
defaultBaseImage: public.ecr.aws/eks-distro-build-tooling/eks-distro-minimal-base-nonroot:2022-07-27-1658910674.2
2+
builds:
3+
- env:
4+
- CGO_ENABLED=0
5+
flags:
6+
- -mod=readonly
7+
ldflags:
8+
- -s
9+
- -w
10+
- -X sigs.k8s.io/aws-load-balancer-controller/pkg/version.GitVersion={{.Env.GIT_VERSION}}
11+
- -X sigs.k8s.io/aws-load-balancer-controller/pkg/version.GitCommit={{.Env.GIT_COMMIT}}
12+
- -X sigs.k8s.io/aws-load-balancer-controller/pkg/version.BuildDate={{.Env.BUILD_DATE}}
13+

Makefile

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,11 @@ docker-push: aws-load-balancer-controller-push
8383

8484
.PHONY: aws-load-balancer-controller-push
8585
aws-load-balancer-controller-push: ko
86-
KO_DOCKER_REPO=$(firstword $(subst :, ,${IMG})) ko build --tags $(word 2,$(subst :, ,${IMG})) --platform=${IMG_PLATFORM} --bare --sbom ${IMG_SBOM} .
86+
KO_DOCKER_REPO=$(firstword $(subst :, ,${IMG})) \
87+
GIT_VERSION=$(shell git describe --tags --dirty --always) \
88+
GIT_COMMIT=$(shell git rev-parse HEAD) \
89+
BUILD_DATE=$(shell date +%Y-%m-%dT%H:%M:%S%z) \
90+
ko build --tags $(word 2,$(subst :, ,${IMG})) --platform=${IMG_PLATFORM} --bare --sbom ${IMG_SBOM} .
8791

8892
# find or download controller-gen
8993
# download controller-gen if necessary

0 commit comments

Comments
 (0)