-
Notifications
You must be signed in to change notification settings - Fork 10
/
Makefile
79 lines (63 loc) · 2.03 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
.PHONY: test lint build-docker docs build-docs
# Required parameters
flavor ?= null
version ?= null
# Dynamic parameters
prefix ?= $(shell hostname | tr '[:upper:]' '[:lower:]' | tr '.' '-')
deployment_name ?= $(prefix)-$(flavor)
# Deployment outputs
job_name ?= $(shell az deployment sub show --name '$(deployment_name)' | yq '.properties.outputs["jobName"].value')
rg_name ?= $(shell az deployment sub show --name '$(deployment_name)' | yq '.properties.outputs["rgName"].value')
test:
@echo "➡️ Running Prettier"
npx --yes prettier@2.8.8 --editorconfig --check .
@echo "➡️ Running Hadolint"
find . -name "Dockerfile*" -exec bash -c "echo 'File {}:' && hadolint {}" \;
@echo "➡️ Running Azure Bicep Validate"
az deployment sub validate \
--location westeurope \
--no-prompt \
--parameters test/bicep/lint.example.json \
--template-file src/bicep/main.bicep \
--verbose
lint:
@echo "➡️ Running Prettier"
npx --yes prettier@2.8.8 --editorconfig --write .
@echo "➡️ Running Hadolint"
find . -name "Dockerfile*" -exec bash -c "echo 'File {}:' && hadolint {}" \;
@echo "➡️ Running Bicep lint"
az bicep lint \
--file src/bicep/main.bicep \
--verbose
deploy-bicep:
@echo "➡️ Decrypting Bicep parameters"
sops -d test/bicep/test.enc.json > test/bicep/test.json
@echo "➡️ Deploying Bicep"
az deployment sub create \
--location westeurope \
--name $(deployment_name) \
--no-prompt \
--parameters \
test/bicep/test.json \
imageFlavor=$(flavor) \
imageVersion=$(version) \
--template-file src/bicep/main.bicep
@echo "➡️ Cleaning up Bicep parameters"
rm test/bicep/test.json
@echo "➡️ Starting init job"
az containerapp job start \
--name $(job_name) \
--resource-group $(rg_name)
destroy-bicep:
@echo "➡️ Destroying"
az group delete \
--name "$(rg_name)" \
--yes
integration:
@bash test/integration.sh $(prefix) $(flavor) $(version) $(job_name)
docs:
cd docs && hugo server
build-docker:
@bash cicd/docker-build-local.sh
build-docs:
cd docs && hugo --gc --minify