-
Notifications
You must be signed in to change notification settings - Fork 6
/
Makefile
82 lines (61 loc) · 2.04 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
GIT_HASH ?= $(shell git rev-parse HEAD)
GIT_TAG ?= $(shell git describe --tags --always --dirty)
KO_DOCKER_REPO ?= ghcr.io/uwu-tools/peribolos
.PHONY: ko-build
ko-build:
ko build --tags $(GIT_TAG),latest --bare \
--platform=linux/amd64 --image-refs imagerefs \
github.com/uwu-tools/peribolos
.PHONY: ko-local
ko-local:
KO_DOCKER_REPO=ko.local ko build --base-import-paths github.com/uwu-tools/peribolos
.PHONY: build-sign-images
build-sign-images: ko-build
GIT_HASH=$(GIT_HASH) GIT_TAG=$(GIT_TAG) ./scripts/sign-images.sh
# kubernetes/org make targets
# TODO(k-org): Remove once integrated into peribolos
SHELL := /usr/bin/env bash
# available for override
GITHUB_TOKEN_PATH ?=
# intentionally hardcoded list to ensure it's high friction to remove someone
ADMINS = cpanato justaugustus
ORGS = $(shell find ./config -type d -mindepth 1 -maxdepth 1 | cut -d/ -f3)
# use absolute path to ./_output, which is .gitignored
OUTPUT_DIR := $(shell pwd)/_output
OUTPUT_BIN_DIR := $(OUTPUT_DIR)/bin
PERIBOLOS_CMD := $(OUTPUT_BIN_DIR)/peribolos
MERGE_CMD := $(PERIBOLOS_CMD) merge
CONFIG_FILES = $(shell find config/ -type f -name '*.yaml')
MERGED_CONFIG := $(OUTPUT_DIR)/gen-config.yaml
# convenience targets for humans
.PHONY: clean
clean:
rm -rf $(OUTPUT_DIR)
.PHONY: merge
merge: $(MERGE_CMD)
.PHONY: config
config: $(MERGED_CONFIG)
.PHONY: peribolos
peribolos: $(PERIBOLOS_CMD)
# TODO(merge): Fix this test
.PHONY: test
test: config
go test ./... --config=$(MERGED_CONFIG)
.PHONY: verify
verify:
./hack/verify.sh
.PHONY: update-prep
update-prep: peribolos # TODO(merge): Fix this test "config test peribolos"
.PHONY: deploy # --confirm
deploy:
./admin-update.sh
$(-*-command-variables-*-) $(filter-out $@,$(MAKECMDGOALS))
# actual targets that only get built if they don't already exist
$(MERGED_CONFIG): $(MERGE_CMD) $(CONFIG_FILES)
mkdir -p "$(OUTPUT_DIR)"
$(MERGE_CMD) \
--merge-teams \
$(shell for o in $(ORGS); do echo "--org-part=$$o=config/$$o/org.yaml"; done) \
> $(MERGED_CONFIG)
$(PERIBOLOS_CMD): clean
go build -v -trimpath -o $(PERIBOLOS_CMD)