Skip to content

Commit eb69d7f

Browse files
committed
add ko build
1 parent 5ee4de4 commit eb69d7f

3 files changed

Lines changed: 62 additions & 1 deletion

File tree

Makefile

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ include Makefile.cosign
55
# The packages to build
66
GO_PACKAGES ?= cmd/apply-setters cmd/digester cmd/gatekeeper-set-enforcement-action cmd/helm-upgrader cmd/kubeconform cmd/remove-local-config-resources cmd/render-helm-chart cmd/set-annotations cmd/set-labels cmd/source-helm-chart cmd/package-compositor # cmd/template-kyaml
77

8+
KO_PACKAGES ?= cmd/kubeconform cmd/remove-local-config-resources
9+
810
# The platforms we support
911
#ALL_PLATFORMS ?= linux/amd64 linux/arm linux/arm64 linux/ppc64le linux/s390x
1012
ALL_PLATFORMS ?= linux/amd64 linux/arm linux/arm64
@@ -26,7 +28,9 @@ MAKEFLAGS += --no-print-directory
2628
# For functions building on top of Helm
2729
HELM_VERSION=v3.16.1
2830

29-
REGISTRY ?= ghcr.io/krm-functions
31+
# REGISTRY ?= ghcr.io/krm-functions
32+
REGISTRY ?= ko.local
33+
CONTAINER_PUSH ?= false
3034

3135
# This version-strategy uses git tags to set the version string
3236
VERSION ?= $(shell git describe --tags --always --dirty)
@@ -70,6 +74,14 @@ build-package:
7074
./$(PACKAGE); \
7175
fi
7276

77+
## Build all containers
78+
.PHONY: containers
79+
containers:
80+
export KO_DOCKER_REPO=$(REGISTRY); \
81+
for package in $(KO_PACKAGES); do \
82+
ko build ./$$package --base-import-paths --push=$(CONTAINER_PUSH); \
83+
done
84+
7385
.PHONY: clean
7486
clean:
7587
rm -rf $(BIN_DIR)

devbox.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
"gnumake@4.4.1",
55
"go@1.24.3",
66
"golangci-lint@2.1.6",
7+
"ko@0.18.0",
78
"kpt@1.0.0-beta.55",
89
"yq@3.4.3"
910
]

devbox.lock

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -193,6 +193,54 @@
193193
}
194194
}
195195
},
196+
"ko@0.18.0": {
197+
"last_modified": "2025-11-23T21:50:36Z",
198+
"resolved": "github:NixOS/nixpkgs/ee09932cedcef15aaf476f9343d1dea2cb77e261#ko",
199+
"source": "devbox-search",
200+
"version": "0.18.0",
201+
"systems": {
202+
"aarch64-darwin": {
203+
"outputs": [
204+
{
205+
"name": "out",
206+
"path": "/nix/store/fv07zmsacfcx03prilrls23ng12783rz-ko-0.18.0",
207+
"default": true
208+
}
209+
],
210+
"store_path": "/nix/store/fv07zmsacfcx03prilrls23ng12783rz-ko-0.18.0"
211+
},
212+
"aarch64-linux": {
213+
"outputs": [
214+
{
215+
"name": "out",
216+
"path": "/nix/store/bb7zb20f0vxbpq2ddxzvba2lih4xmlj1-ko-0.18.0",
217+
"default": true
218+
}
219+
],
220+
"store_path": "/nix/store/bb7zb20f0vxbpq2ddxzvba2lih4xmlj1-ko-0.18.0"
221+
},
222+
"x86_64-darwin": {
223+
"outputs": [
224+
{
225+
"name": "out",
226+
"path": "/nix/store/sblcy1ciry7msqa0y4m5nmb3s1grrpyf-ko-0.18.0",
227+
"default": true
228+
}
229+
],
230+
"store_path": "/nix/store/sblcy1ciry7msqa0y4m5nmb3s1grrpyf-ko-0.18.0"
231+
},
232+
"x86_64-linux": {
233+
"outputs": [
234+
{
235+
"name": "out",
236+
"path": "/nix/store/6an2xmjlzjlvid1qxhsjsf7g6bs7ljvr-ko-0.18.0",
237+
"default": true
238+
}
239+
],
240+
"store_path": "/nix/store/6an2xmjlzjlvid1qxhsjsf7g6bs7ljvr-ko-0.18.0"
241+
}
242+
}
243+
},
196244
"kpt@1.0.0-beta.55": {
197245
"last_modified": "2025-06-20T02:24:11Z",
198246
"resolved": "github:NixOS/nixpkgs/076e8c6678d8c54204abcb4b1b14c366835a58bb#kpt",

0 commit comments

Comments
 (0)