-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
44 lines (40 loc) · 1.36 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
SHELL := /bin/bash
REGISTRY_URI := dkr.ecr.eu-west-2.amazonaws.com
REPO_NAME := manage_runners
STACK_NAME := manage-runners
TAG_NAME := python3.9-v1
infrastructure:
terraform init
terraform apply -auto-approve -var-file=secrets.tfvars
.ONESHELL:
build-image:
security_group_id=$$(terraform output -raw gha_runner_image_builder_security_group_name | xargs)
subnet_id=$$(terraform output subnet_name | xargs | awk '{ print $$2 }' | sed s/,//)
packer init .
packer build -var="security_group_id=$$security_group_id" \
-var="subnet_id=$$subnet_id" gha-runner.pkr.hcl
deploy-create-instance-function:
(
cd lambda/manage_runners
docker build \
--tag $$AWS_ACCOUNT_NUMBER.${REGISTRY_URI}/${REPO_NAME}:${TAG_NAME} \
.
)
docker push $$AWS_ACCOUNT_NUMBER.${REGISTRY_URI}/${REPO_NAME}:${TAG_NAME}
(
security_group_id=$$(terraform output -raw gha_runner_security_group_name | xargs)
subnet_id=$$(terraform output subnet_name | xargs | awk '{ print $$2 }' | sed s/,//)
cd lambda
sam deploy \
--stack-name ${STACK_NAME} \
--template template.yaml \
--resolve-image-repos \
--s3-bucket maidsafe-ci-infra \
--s3-prefix manage_runners_lambda \
--parameter-overrides Ec2SecurityGroupId=$$security_group_id Ec2VpcSubnetId=$$subnet_id
)
clean-create-instance-function:
(
cd lambda
sam delete --stack-name ${STACK_NAME} --no-prompts --region eu-west-2
)