-
Notifications
You must be signed in to change notification settings - Fork 2
/
Makefile
164 lines (149 loc) · 3.09 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
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
export COMPOSE_DOCKER_CLI_BUILD = 1
export DOCKER_BUILDKIT = 1
export COMPOSE_PROJECT_NAME = vault
export ARCH = $(shell uname -m | sed 's/x86_64/amd64/' | sed 's/aarch64/arm64/')
export META = $(shell git rev-parse --abbrev-ref HEAD 2> /dev/null | sed 's:.*/::')
export VERSION = $(shell git fetch --tags --force 2> /dev/null; tags=($$(git tag --sort=-v:refname)) && ([ "$${\#tags[@]}" -eq 0 ] && echo v0.0.0 || echo $${tags[0]}) | sed -e "s/^v//")
.ONESHELL:
.PHONY: arm64
.PHONY: amd64
.PHONY: all
all: bootstrap sync test package bbtest perf
.PHONY: package
package:
@$(MAKE) bundle-binaries-$(ARCH)
@$(MAKE) bundle-debian-$(ARCH)
@$(MAKE) bundle-docker-$(ARCH)
.PHONY: bundle-binaries-%
bundle-binaries-%: %
@\
docker \
compose \
run \
--rm package \
--arch linux/$^ \
--source /go/src/github.com/jancajthaml-openbank/vault-rest \
--output /project/packaging/bin
@\
docker \
compose \
run \
--rm package \
--arch linux/$^ \
--source /go/src/github.com/jancajthaml-openbank/vault-unit \
--output /project/packaging/bin
.PHONY: bundle-debian-%
bundle-debian-%: %
@\
docker \
compose \
run \
--rm debian-package \
--version $(VERSION) \
--arch $^ \
--pkg vault \
--source /project/packaging
.PHONY: bundle-docker-%
bundle-docker-%: %
@\
docker \
build \
-t openbank/vault:$^-$(VERSION).$(META) \
-f packaging/docker/$^/Dockerfile \
.
.PHONY: bootstrap
bootstrap:
@\
docker \
compose \
build \
--force-rm go
.PHONY: lint
lint:
@\
docker \
compose \
run \
--rm lint \
--source /go/src/github.com/jancajthaml-openbank/vault-rest \
|| :
@\
docker \
compose \
run \
--rm lint \
--source /go/src/github.com/jancajthaml-openbank/vault-unit \
|| :
.PHONY: sec
sec:
@\
docker \
compose \
run \
--rm sec \
--source /go/src/github.com/jancajthaml-openbank/vault-rest \
|| :
@\
docker \
compose \
run \
--rm sec \
--source /go/src/github.com/jancajthaml-openbank/vault-unit \
|| :
.PHONY: sync
sync:
@\
docker \
compose \
run \
--rm sync \
--source /go/src/github.com/jancajthaml-openbank/vault-rest
@\
docker \
compose \
run \
--rm sync \
--source /go/src/github.com/jancajthaml-openbank/vault-unit
.PHONY: scan-%
scan-%: %
@\
docker \
scan \
openbank/vault:$^-$(VERSION).$(META) \
--file ./packaging/docker/$^/Dockerfile \
--exclude-base
.PHONY: test
test:
@\
docker \
compose \
run \
--rm test \
--source /go/src/github.com/jancajthaml-openbank/vault-unit \
--output /project/reports/unit-tests
@\
docker \
compose \
run \
--rm test \
--source /go/src/github.com/jancajthaml-openbank/vault-rest \
--output /project/reports/unit-tests
.PHONY: release
release:
@\
docker \
compose \
run \
--rm release \
--version $(VERSION) \
--token ${GITHUB_RELEASE_TOKEN}
.PHONY: bbtest
bbtest:
@docker compose up -d bbtest
@docker exec -t $$(docker compose ps -q bbtest) python3 /opt/app/bbtest/main.py
@docker compose down -v
.PHONY: perf
perf:
@docker compose up -d perf
@docker exec -t $$(docker compose ps -q perf) python3 /opt/app/perf/main.py
@docker compose down -v