-
Notifications
You must be signed in to change notification settings - Fork 2
/
Makefile
103 lines (86 loc) · 2.33 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
SHELL := /bin/bash
.ONESHELL:
TAG = $$(git rev-parse --short HEAD)
IMG ?= ghcr.io/xenitab/azcagit:$(TAG)
TEST_ENV_FILE = .tmp/env
ifneq (,$(wildcard $(TEST_ENV_FILE)))
include $(TEST_ENV_FILE)
export
endif
.PHONY: all
all: fmt vet lint test
.PHONY: lint
lint:
golangci-lint run ./...
.PHONY: fmt
fmt:
go fmt ./...
.PHONY: vet
vet:
go vet ./...
.PHONY: build
build:
CGO_ENABLED=0 go build -installsuffix 'static' -o bin/azcagit ./src/main.go
.PHONY: generate-schema
generate-schema:
go run ./generate_schema.go
.PHONY: test
test: fmt vet
go test --cover ./...
.PHONY: cover
cover:
mkdir -p .tmp
go test -timeout 5m -coverpkg=./src/... -coverprofile=.tmp/coverage.out ./src/...
go tool cover -html=.tmp/coverage.out
.PHONY: terraform-up
terraform-up:
cd test/terraform
terraform init
terraform apply -auto-approve -var-file="../../.tmp/lab.tfvars"
.PHONY: terraform-mr-up
terraform-mr-up:
cd test/terraform-multi-region
terraform init
terraform apply -auto-approve -var-file="../../.tmp/lab.tfvars"
.PHONY: run
run:
# AZURE_TENANT_ID=$${TENANT_ID} AZURE_CLIENT_ID=$${CLIENT_ID} AZURE_CLIENT_SECRET=$${CLIENT_SECRET} \
go run ./src \
reconcile \
--debug \
--resource-group-name $${RG_NAME} \
--own-resource-group-name $${OWN_RG_NAME} \
--subscription-id $${SUB_ID} \
--managed-environment-id $${ME_ID} \
--key-vault-name $${KV_NAME} \
--location westeurope \
--git-url $${GIT_URL_AND_CREDS} \
--git-branch "main" \
--git-yaml-path "yaml/" \
--notifications-enabled \
--environment $${ENV} \
--cosmosdb-account $${CDB_ACCOUNT}
.PHONY: docker-build
docker-build:
docker build . -t $(IMG)
.PHONY: docker-run
docker-run: docker-build
docker run -it --rm -e AZURE_TENANT_ID=$${TENANT_ID} -e AZURE_CLIENT_ID=$${CLIENT_ID} -e AZURE_CLIENT_SECRET=$${CLIENT_SECRET} $(IMG) \
reconcile \
--debug \
--resource-group-name $${RG_NAME} \
--own-resource-group-name $${OWN_RG_NAME} \
--subscription-id $${SUB_ID} \
--managed-environment-id $${ME_ID} \
--key-vault-name $${KV_NAME} \
--location westeurope \
--reconcile-interval "10s" \
--git-url $${GIT_URL_AND_CREDS} \
--git-branch "main" \
--git-yaml-path "yaml/" \
--notifications-enabled \
--environment $${ENV} \
--cosmosdb-account $${CDB_ACCOUNT}
.PHONY: k6-http-get
k6-http-get:
k6 run -e LOAD_TEST_URI=$${LOAD_TEST_URI} test/k6/http_get.js