Skip to content

Commit

Permalink
Specify ko build options
Browse files Browse the repository at this point in the history
  • Loading branch information
johngmyers committed Jan 21, 2023
1 parent 824effa commit 28b7f84
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
12 changes: 12 additions & 0 deletions .ko.yaml
Original file line number Diff line number Diff line change
@@ -1 +1,13 @@
defaultBaseImage: public.ecr.aws/eks-distro-build-tooling/eks-distro-minimal-base-nonroot:2022-07-27-1658910674.2
builds:
- env:
- CGO_ENABLED=0
flags:
- -mod=readonly
ldflags:
- -s
- -w
- -X sigs.k8s.io/aws-load-balancer-controller/pkg/version.GitVersion={{.Env.GIT_VERSION}}
- -X sigs.k8s.io/aws-load-balancer-controller/pkg/version.GitCommit={{.Env.GIT_COMMIT}}
- -X sigs.k8s.io/aws-load-balancer-controller/pkg/version.BuildDate={{.Env.BUILD_DATE}}

6 changes: 5 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,11 @@ docker-push: aws-load-balancer-controller-push

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

# find or download controller-gen
# download controller-gen if necessary
Expand Down

0 comments on commit 28b7f84

Please sign in to comment.