Skip to content

Commit 4770a2f

Browse files
committed
more makefile targets
1 parent df5e9d8 commit 4770a2f

14 files changed

Lines changed: 125 additions & 26 deletions

.devcontainer/Dockerfile

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,9 @@ RUN asdf plugin add python; \
3939
asdf plugin add poetry https://github.com/asdf-community/asdf-poetry.git; \
4040
asdf plugin add shellcheck https://github.com/luizm/asdf-shellcheck.git; \
4141
asdf plugin-add java; \
42-
asdf plugin-add maven;
42+
asdf plugin-add maven; \
43+
asdf plugin add direnv; \
44+
asdf plugin add actionlint;
4345

4446
WORKDIR /workspaces/validation-service-fhir-r4
4547
ADD .tool-versions /workspaces/validation-service-fhir-r4/.tool-versions
File renamed without changes.
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
#!/usr/bin/env bash
2+
3+
echo "calling mark jira released"
4+
5+
cat <<EOF > payload.json
6+
{
7+
"releaseVersion": "EPS-FHIR-Validator-$RELEASE_TAG"
8+
}
9+
EOF
10+
cat payload.json
11+
12+
function_arn=$(aws cloudformation list-exports --query "Exports[?Name=='release-notes:MarkJiraReleasedLambdaArn'].Value" --output text)
13+
aws lambda invoke --function-name "${function_arn}" --cli-binary-format raw-in-base64-out --payload file://payload.json out.txt
14+
cat out.txt
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
#!/usr/bin/env bash
2+
3+
cat <<EOF > payload.json
4+
{
5+
"currentTag": "$CURRENT_DEPLOYED_TAG",
6+
"targetTag": "$DEV_TAG",
7+
"repoName": "eps-FHIR-validator-lambda",
8+
"targetEnvironment": "$ENV",
9+
"productName": "EPS FHIR Validator lambda",
10+
"releaseNotesPageId": "$PAGE_ID",
11+
"releaseNotesPageTitle": "Current EPS FHIR Validator lambda - $ENV"
12+
}
13+
EOF
14+
cat payload.json
15+
16+
function_arn=$(aws cloudformation list-exports --query "Exports[?Name=='release-notes:CreateReleaseNotesLambdaArn'].Value" --output text)
17+
aws lambda invoke --function-name "${function_arn}" --cli-binary-format raw-in-base64-out --payload file://payload.json out.txt
18+
cat out.txt
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
#!/usr/bin/env bash
2+
3+
cat <<EOF > payload.json
4+
{
5+
"currentTag": "$CURRENT_DEPLOYED_TAG",
6+
"targetTag": "$RELEASE_TAG",
7+
"repoName": "eps-FHIR-validator-lambda",
8+
"targetEnvironment": "INT",
9+
"productName": "EPS FHIR Validator lambda",
10+
"releaseNotesPageId": "$PAGE_ID",
11+
"releaseNotesPageTitle": "EPS-FHIR-Validator-$RELEASE_TAG - Deployed to [INT] on $(date +'%d-%m-%y')",
12+
"createReleaseCandidate": "true",
13+
"releasePrefix": "EPS-FHIR-Validator-"
14+
}
15+
EOF
16+
cat payload.json
17+
18+
function_arn=$(aws cloudformation list-exports --query "Exports[?Name=='release-notes:CreateReleaseNotesLambdaArn'].Value" --output text)
19+
aws lambda invoke --function-name "${function_arn}" --cli-binary-format raw-in-base64-out --payload file://payload.json out.txt
20+
cat out.txt

.github/scripts/delete_stacks.sh

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
#!/usr/bin/env bash
2+
3+
ACTIVE_STACKS=$(aws cloudformation list-stacks | jq -r '.StackSummaries[] | select ( .StackStatus != "DELETE_COMPLETE" ) | select( .StackName | capture("^fhir-validator-pr-(sandbox-)?(\\d+)$") ) | .StackName ')
4+
5+
mapfile -t ACTIVE_STACKS_ARRAY <<< "$ACTIVE_STACKS"
6+
7+
for i in "${ACTIVE_STACKS_ARRAY[@]}"
8+
do
9+
echo "Checking if stack $i has open pull request"
10+
PULL_REQUEST=${i//pr-/}
11+
PULL_REQUEST=${PULL_REQUEST//sandbox-/}
12+
echo "Checking pull request id ${PULL_REQUEST}"
13+
URL="https://api.github.com/repos/NHSDigital/eps-FHIR-validator-lambda/pulls/${PULL_REQUEST}"
14+
RESPONSE=$(curl "${URL}" 2>/dev/null)
15+
STATE=$(echo "${RESPONSE}" | jq -r .state)
16+
if [ "$STATE" == "closed" ]; then
17+
echo "** going to delete stack $i as state is ${STATE} **"
18+
aws cloudformation delete-stack --stack-name "${i}"
19+
else
20+
echo "not going to delete stack $i as state is ${STATE}"
21+
fi
22+
done
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
#!/usr/bin/env bash
2+
3+
dev_tag=$(aws cloudformation describe-stacks --stack-name fhir-validator --query "Stacks[0].Tags[?Key=='version'].Value" --output text)
4+
5+
echo "DEV_TAG=${dev_tag}" >> "$GITHUB_ENV"
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
#!/usr/bin/env bash
2+
3+
current_deployed_tag=$(aws cloudformation describe-stacks --stack-name fhir-validator --query "Stacks[0].Tags[?Key=='version'].Value" --output text)
4+
5+
echo "CURRENT_DEPLOYED_TAG=${current_deployed_tag}" >> "$GITHUB_ENV"

.github/scripts/release_code.sh

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
#!/usr/bin/env bash
2+
3+
echo "$COMMIT_ID"
4+
5+
artifact_bucket=$(aws cloudformation list-exports --output json | jq -r '.Exports[] | select(.Name == "account-resources:ArtifactsBucket") | .Value' | grep -o '[^:]*$')
6+
export artifact_bucket
7+
8+
cloud_formation_execution_role=$(aws cloudformation list-exports --output json | jq -r '.Exports[] | select(.Name == "ci-resources:CloudFormationExecutionRole") | .Value' )
9+
export cloud_formation_execution_role
10+
11+
TRUSTSTORE_BUCKET_ARN=$(aws cloudformation describe-stacks --stack-name account-resources --query "Stacks[0].Outputs[?OutputKey=='TrustStoreBucket'].OutputValue" --output text)
12+
TRUSTSTORE_BUCKET_NAME=$(echo "${TRUSTSTORE_BUCKET_ARN}" | cut -d ":" -f 6)
13+
LATEST_TRUSTSTORE_VERSION=$(aws s3api list-object-versions --bucket "${TRUSTSTORE_BUCKET_NAME}" --prefix "${TRUSTSTORE_FILE}" --query 'Versions[?IsLatest].[VersionId]' --output text)
14+
export LATEST_TRUSTSTORE_VERSION
15+
16+
cd ../../.aws-sam/build || exit
17+
make sam-deploy-package

0 commit comments

Comments
 (0)