-
Notifications
You must be signed in to change notification settings - Fork 0
/
deploy.sh
executable file
·36 lines (31 loc) · 1.06 KB
/
deploy.sh
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
#!/usr/bin/env bash
cd "$(dirname "${BASH_SOURCE[0]}")"
set -eu
stack_name="${1:-}"
common_stack_name="${2:-}"
secret_prefix="${3:-}"
if ! [[ "$stack_name" ]]; then
[[ $(aws sts get-caller-identity --query Arn --output text) =~ \/([^\/\.]+)\. ]] && user="${BASH_REMATCH[1]}" || exit
stack_name="$user-kbv-api"
echo "» Using stack name '$stack_name'"
fi
sam validate -t infrastructure/lambda/template.yaml
sam validate -t infrastructure/lambda/template.yaml --lint
sam build -t infrastructure/lambda/template.yaml --cached --parallel
sam deploy --stack-name "$stack_name" \
--no-fail-on-empty-changeset \
--no-confirm-changeset \
--resolve-s3 \
--s3-prefix "$stack_name" \
--region "${AWS_REGION:-eu-west-2}" \
--capabilities CAPABILITY_IAM \
--tags \
cri:component=ipv-cri-kbv-api \
cri:stack-type=dev \
cri:application=Orange \
cri:deployment-source=manual \
--parameter-overrides \
Environment=dev \
SecretPrefix=pre-merge-test \
${common_stack_name:+CommonStackName=$common_stack_name} \
${secret_prefix:+SecretPrefix=$secret_prefix}