-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
70 lines (56 loc) · 1.45 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
SHELL := /bin/bash
.ONESHELL:
TAG = $$(git rev-parse --short HEAD)
IMG ?= ghcr.io/xenitab/acr-proxy:$(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/acr-proxy ./src/main.go
.PHONY: docker-build
docker-build:
docker build . -t $(IMG)
.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 terraform
terraform init
terraform apply -auto-approve -var-file="../.tmp/lab.tfvars"
.PHONY: terraform-up-customerapptest
terraform-up-customerapptest:
cd test/client-app
terraform init
terraform apply -auto-approve -var-file="../../.tmp/customerapptest.tfvars"
.PHONY: terraform-down-customerapptest
terraform-down-customerapptest:
cd test/client-app
terraform init
terraform destroy -auto-approve -var-file="../../.tmp/customerapptest.tfvars"
.PHONY: run
run:
go run ./... \
--allowed-tenant-ids $${ALLOWED_TENANTS} \
--azure-container-registry-name $${REGISTRY_NAME} \
--azure-container-registry-user $${REGISTRY_USER} \
--azure-container-registry-password $${REGISTRY_PASSWORD}