-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
31 lines (23 loc) · 1.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
check_defined = \
$(strip $(foreach 1,$1, \
$(call __check_defined,$1,$(strip $(value 2)))))
__check_defined = \
$(if $(value $1),, \
$(error Undefined $1$(if $2, ($2))))
S3_BUCKET=sts-lambdas
AWS_REGION=eu-west-1
AWS_PROFILE=stackstate-tooling
.PHONY: build, package, deploy, clean, aws/s3/mb, aws/s3/rb, guard/SLACK_TOKEN
build: $(addprefix bin/,$(subst .go,,$(wildcard *.go)))
bin/%: %.go
GOOS=linux GOARCH=amd64 go build -o bin/$(@F) $(@F).go
aws/s3/%:
aws s3 --profile ${AWS_PROFILE} $(@F) s3://${S3_BUCKET}
package: build
aws cloudformation package --profile ${AWS_PROFILE} --template-file cerberus.yaml --output-template-file bin/package.yaml --s3-bucket ${S3_BUCKET}
deploy:
@:$(call check_defined,SLACK_TOKEN)
@:$(call check_defined,GITLAB_TOKEN)
@aws cloudformation deploy --profile ${AWS_PROFILE} --template-file bin/package.yaml --stack-name sam-cerberus --capabilities CAPABILITY_IAM --parameter-overrides SlackToken=${SLACK_TOKEN} GitlabToken=${GITLAB_TOKEN}
clean:
rm bin/$(subst .go,,$(wildcard *.go))