-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathrelease_code.sh
More file actions
executable file
·59 lines (51 loc) · 2.56 KB
/
release_code.sh
File metadata and controls
executable file
·59 lines (51 loc) · 2.56 KB
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
#!/usr/bin/env bash
echo "$COMMIT_ID"
artifact_bucket=$(aws cloudformation list-exports --output json | jq -r '.Exports[] | select(.Name == "account-resources:ArtifactsBucket") | .Value' | grep -o '[^:]*$')
export artifact_bucket
cloud_formation_execution_role=$(aws cloudformation list-exports --output json | jq -r '.Exports[] | select(.Name == "ci-resources:CloudFormationExecutionRole") | .Value' )
export cloud_formation_execution_role
TRUSTSTORE_BUCKET_ARN=$(aws cloudformation describe-stacks --stack-name account-resources --query "Stacks[0].Outputs[?OutputKey=='TrustStoreBucket'].OutputValue" --output text)
TRUSTSTORE_BUCKET_NAME=$(echo "${TRUSTSTORE_BUCKET_ARN}" | cut -d ":" -f 6)
LATEST_TRUSTSTORE_VERSION=$(aws s3api list-object-versions --bucket "${TRUSTSTORE_BUCKET_NAME}" --prefix "${TRUSTSTORE_FILE}" --query 'Versions[?IsLatest].[VersionId]' --output text)
export LATEST_TRUSTSTORE_VERSION
cd ../../.aws-sam/build || exit
REPO=prescriptionsforpatients
CFN_DRIFT_DETECTION_GROUP="pfp"
if [[ "$STACK_NAME" =~ -pr-[0-9]+$ ]]; then
CFN_DRIFT_DETECTION_GROUP="pfp-pull-request"
fi
IS_PULL_REQUEST=${IS_PULL_REQUEST:-false}
sam deploy \
--template-file "$TEMPLATE_FILE" \
--stack-name "$STACK_NAME" \
--capabilities CAPABILITY_NAMED_IAM CAPABILITY_AUTO_EXPAND \
--region eu-west-2 \
--s3-bucket "$artifact_bucket" \
--s3-prefix "$ARTIFACT_BUCKET_PREFIX" \
--config-file samconfig_package_and_deploy.toml \
--no-fail-on-empty-changeset \
--role-arn "$cloud_formation_execution_role" \
--no-confirm-changeset \
--force-upload \
--tags "version=$VERSION_NUMBER stack=$STACK_NAME repo=$REPO cfnDriftDetectionGroup=$CFN_DRIFT_DETECTION_GROUP" \
--parameter-overrides \
TruststoreVersion="$LATEST_TRUSTSTORE_VERSION" \
TruststoreFile="$TRUSTSTORE_FILE" \
EnableMutualTLS="$ENABLE_MUTUAL_TLS" \
TargetSpineServer="$TARGET_SPINE_SERVER" \
TargetServiceSearchServer="$TARGET_SERVICE_SEARCH_SERVER" \
EnableSplunk=true \
VersionNumber="$VERSION_NUMBER" \
CommitId="$COMMIT_ID" \
LogLevel="$LOG_LEVEL" \
LogRetentionInDays="$LOG_RETENTION_DAYS" \
IsPullRequest="$IS_PULL_REQUEST" \
Env="$TARGET_ENVIRONMENT" \
ToggleGetStatusUpdates="$TOGGLE_GET_STATUS_UPDATES" \
EnableAlerts="$ENABLE_ALERTS" \
StateMachineLogLevel="$STATE_MACHINE_LOG_LEVEL" \
ForwardCsocLogs="$FORWARD_CSOC_LOGS" \
TC007NHSNumberValue="$TC007_NHS_NUMBERS" \
TC008NHSNumberValue="$TC008_NHS_NUMBERS" \
TC009NHSNumberValue="$TC009_NHS_NUMBERS" \
AllowNHSNumberOverride="$ALLOW_NHS_NUMBER_OVERRIDE"