-
Notifications
You must be signed in to change notification settings - Fork 11
/
Makefile
147 lines (104 loc) · 4.18 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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
# This file is part of kuberpult.
# Kuberpult is free software: you can redistribute it and/or modify
# it under the terms of the Expat(MIT) License as published by
# the Free Software Foundation.
# Kuberpult is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# MIT License for more details.
# You should have received a copy of the MIT License
# along with kuberpult. If not, see <https://directory.fsf.org/wiki/License:Expat>.
# Copyright freiheit.com
SHELL := sh
include ./Makefile.variables
MAKEFLAGS += --no-builtin-rules
SCRIPTS_BASE:=infrastructure/scripts/make
MAKEDIRS := services/cd-service services/rollout-service services/frontend-service charts/kuberpult pkg
ARTIFACT_REGISTRY_URI := europe-west3-docker.pkg.dev/fdc-public-docker-registry/kuberpult
export USER_UID := $(shell id -u)
.install:
touch .install
$(addsuffix /release,$(MAKEDIRS)):
make -C $(dir $@) release
release: $(addsuffix /release,$(MAKEDIRS))
git tag $(VERSION)
$(addsuffix /clean,$(MAKEDIRS)):
make -C $(dir $@) clean
clean: $(addsuffix /clean,$(MAKEDIRS))
$(addsuffix /test,$(MAKEDIRS)):
make -C $(dir $@) test
test: $(addsuffix /test,$(MAKEDIRS))
$(addsuffix /all,$(MAKEDIRS)):
make -C $(dir $@) all
plan:
@infrastructure/scripts/execution-plan/plan-pr.sh
all: $(addsuffix /all,$(MAKEDIRS))
init:
.PHONY: release $(addsuffix /release,$(MAKEDIRS)) all $(addsuffix /all,$(MAKEDIRS)) clean $(addsuffix /clean,$(MAKEDIRS))
.PHONY: version
version:
@echo $(VERSION)
.PHONY: cleanup-pr
cleanup-pr:
@echo "Nothing to do"
.PHONY: cleanup-main
cleanup-main:
@echo "Nothing to do"
.PHONY: builder
builder:
IMAGE_TAG=latest make -C infrastructure/docker/builder build
compose-down:
docker compose down
kuberpult: compose-down
earthly +all-services --UID=$(USER_UID)
docker compose -f docker-compose.yml -f docker-compose.persist.yml up
kuberpult-freshdb: compose-down
earthly +all-services --UID=$(USER_UID)
docker compose up
all-services:
earthly +all-services --tag=$(VERSION)
integration-test:
earthly -P +integration-test --kuberpult_version=$(IMAGE_TAG_KUBERPULT) --charts_version=$(VERSION)
pull-service-image/%:
docker pull $(DOCKER_REGISTRY_URI)/$*:main-$(VERSION)
docker pull $(ARTIFACT_REGISTRY_URI)/$*:main-$(VERSION)-datadog
tag-service-image/%: pull-service-image/%
docker tag $(DOCKER_REGISTRY_URI)/$*:main-$(VERSION) $(DOCKER_REGISTRY_URI)/$*:$(RELEASE_IMAGE_TAG)
docker tag $(ARTIFACT_REGISTRY_URI)/$*:main-$(VERSION)-datadog $(ARTIFACT_REGISTRY_URI)/$*:$(RELEASE_IMAGE_TAG)-datadog
docker tag $(ARTIFACT_REGISTRY_URI)/$*:main-$(VERSION)-datadog $(DOCKER_REGISTRY_URI)/$*:$(RELEASE_IMAGE_TAG)-datadog
push-service-image/%: tag-service-image/%
docker push $(DOCKER_REGISTRY_URI)/$*:$(RELEASE_IMAGE_TAG)
docker push $(ARTIFACT_REGISTRY_URI)/$*:$(RELEASE_IMAGE_TAG)-datadog
docker push $(DOCKER_REGISTRY_URI)/$*:$(RELEASE_IMAGE_TAG)-datadog
.PHONY: tag-release-images
tag-release-images: $(foreach i,$(SERVICE_IMAGES),push-service-image/$i)
true
# CLI is only stored in gcp docker registry
pull-cli-image:
docker pull $(DOCKER_REGISTRY_URI)/$(CLI_IMAGE):main-$(VERSION)
tag-cli-image: pull-cli-image
docker tag $(DOCKER_REGISTRY_URI)/$(CLI_IMAGE):main-$(VERSION) $(DOCKER_REGISTRY_URI)/$(CLI_IMAGE):$(RELEASE_IMAGE_TAG)
push-cli-image: tag-cli-image
docker push $(DOCKER_REGISTRY_URI)/$(CLI_IMAGE):$(RELEASE_IMAGE_TAG)
.PHONY: tag-cli-image
tag-cli-release-image: push-cli-image
true
.PHONY: commitlint
commitlint:
gh pr view $${GITHUB_HEAD_REF} --json title,body --template '{{.title}}{{ "\n\n" }}{{.body}}' > commitlint.msg
@echo "commit message that will be linted:"
@cat commitlint.msg
@echo
earthly +commitlint
rm commitlint.msg
.PHONY: pull-trivy check-secrets
pull-trivy:
docker pull aquasec/trivy@sha256:$$(cat ./.trivy-image.SHA256)
check-secrets:
docker run aquasec/trivy@sha256:$$(cat ./.trivy-image.SHA256) fs --scanners=secret .
.git/hooks/pre-commit: hooks/pre-commit
cp $< $@
.git/hooks/commit-msg: hooks/commit-msg
cp $< $@
# kuberpult and kuberpult-earthly should install/update the precommit hook as a sideeffect
kuberpult kuberpult-earthly: .git/hooks/pre-commit