forked from cmattoon/aws-ssm
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
58 lines (45 loc) · 1.14 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
.PHONY:
AWS_REGION ?= us-west-2
AWS_ACCESS_KEY ?= none
AWS_SECRET_KEY ?= none
RELEASE_NAME ?= aws-ssm
RELEASE_NAMESPACE ?= kube-system
DOCKER_REPO ?= cmattoon
IMAGE_NAME ?= aws-ssm
IMAGE_TAG ?= $(shell git log -1 --pretty=format:"%h")
CURRENT_IMAGE=$(DOCKER_REPO)/$(IMAGE_NAME):$(IMAGE_TAG)
LATEST_IMAGE=$(DOCKER_REPO)/$(IMAGE_NAME):latest
DOCKERFILE_DIR=.
DOCKERFILE=Dockerfile
# Output file
AWS_SSM_EXE=build/aws-ssm
CHART_DIR ?= $(IMAGE_NAME)
EXTRA_ARGS ?=
.PHONY: test
test:
./scripts/go_test.sh
.PHONY: build
build:
go build -o $(AWS_SSM_EXE)
.PHONY: container
container:
docker build -t $(CURRENT_IMAGE) $(DOCKERFILE_DIR) -f $(DOCKERFILE)
docker tag $(CURRENT_IMAGE) $(LATEST_IMAGE)
.PHONY: chart
chart:
helm lint aws-ssm
.PHONY: push-container
push-container: container
docker push $(CURRENT_IMAGE)
.PHONY: install
install:
helm upgrade --install $(RELEASE_NAME) \
--namespace $(RELEASE_NAMESPACE) \
--set image.tag=$(IMAGE_TAG) \
--set aws.region=$(AWS_REGION) \
--set aws.access_key=$(AWS_ACCESS_KEY) \
--set aws.secret_key=$(AWS_SECRET_KEY) \
$(EXTRA_ARGS) $(CHART_DIR)
.PHONY: purge
purge:
helm del --purge $(RELEASE_NAME)