Skip to content

Commit 672f3c2

Browse files
CCM-11529 Fixing DynamoDB Types
1 parent 2004b5e commit 672f3c2

File tree

3 files changed

+66
-7
lines changed

3 files changed

+66
-7
lines changed

.github/workflows/pr_create_dynamic_env.yaml

Lines changed: 61 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ jobs:
1717
- name: Trigger nhs-notify-internal dynamic environment workflow
1818
shell: bash
1919
run: |
20-
set -x
2120
this_repo_name=$(echo ${{ github.repository }} | cut -d'/' -f2)
2221
2322
DISPATCH_EVENT=$(jq -ncM \
@@ -46,10 +45,70 @@ jobs:
4645
}
4746
}')
4847
49-
curl --fail -L \
48+
curl --fail -L -s \
5049
-X POST \
5150
-H "Accept: application/vnd.github+json" \
5251
-H "Authorization: Bearer ${{ secrets.PR_TRIGGER_PAT }}" \
5352
-H "X-GitHub-Api-Version: 2022-11-28" \
5453
https://api.github.com/repos/NHSDigital/nhs-notify-internal/actions/workflows/dispatch-deploy-dynamic-env.yaml/dispatches \
5554
-d "${DISPATCH_EVENT}"
55+
56+
echo "Workflow triggered. Waiting for the workflow to complete.."
57+
58+
# Poll GitHub API to check the workflow status
59+
workflow_run_url=""
60+
for i in {1..12}; do
61+
workflow_run_url=$(curl -s \
62+
-H "Accept: application/vnd.github+json" \
63+
-H "Authorization: Bearer ${{ secrets.PR_TRIGGER_PAT }}" \
64+
-H "X-GitHub-Api-Version: 2022-11-28" \
65+
"https://api.github.com/repos/NHSDigital/nhs-notify-internal/actions/runs?event=workflow_dispatch&status=in_progress" \
66+
| jq -r '.workflow_runs[]
67+
| select(.name
68+
| contains("'pr${{ github.event.number }}'") and
69+
contains("'nhs-notify-supplier-api-dev'") and
70+
contains("'api'") and
71+
contains("'apply'"))
72+
| .url')
73+
74+
if [[ -n "$workflow_run_url" && "$workflow_run_url" != null ]]; then
75+
ui_url=${workflow_run_url/api./}
76+
ui_url=${ui_url/\/repos/}
77+
echo "Found workflow run url: $ui_url"
78+
echo "workflow_run_url=$workflow_run_url" >> $GITHUB_ENV
79+
break
80+
fi
81+
82+
echo "Waiting for workflow to start..."
83+
sleep 10
84+
done
85+
86+
if [[ -z "$workflow_run_url" || "$workflow_run_url" == null ]]; then
87+
echo "Failed to get the workflow run url. Exiting."
88+
exit 1
89+
fi
90+
91+
# Wait for workflow completion
92+
while true; do
93+
sleep 10
94+
response=$(curl -s -L \
95+
-H "Authorization: Bearer ${{ secrets.PR_TRIGGER_PAT }}" \
96+
-H "Accept: application/vnd.github+json" \
97+
$workflow_run_url)
98+
99+
status=$(echo "$response" | jq -r '.status')
100+
conclusion=$(echo "$response" | jq -r '.conclusion')
101+
102+
if [ "$status" == "completed" ]; then
103+
if [ "$conclusion" == "success" ]; then
104+
echo "Workflow completed successfully."
105+
exit 0
106+
else
107+
echo "Workflow failed with conclusion: $conclusion"
108+
exit 1
109+
fi
110+
fi
111+
112+
echo "Workflow still running..."
113+
sleep 20
114+
done

infrastructure/terraform/components/api/ddb_table_letters.tf

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,17 +19,17 @@ resource "aws_dynamodb_table" "letters" {
1919

2020
attribute {
2121
name = "id"
22-
type = "string"
22+
type = "S"
2323
}
2424

2525
attribute {
2626
name = "supplierId"
27-
type = "string"
27+
type = "S"
2828
}
2929

3030
attribute {
3131
name = "supplierStatus"
32-
type = "string"
32+
type = "S"
3333
}
3434

3535
point_in_time_recovery {

infrastructure/terraform/components/api/ddb_table_mi.tf

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,12 @@ resource "aws_dynamodb_table" "mi" {
1212

1313
attribute {
1414
name = "id"
15-
type = "string"
15+
type = "S"
1616
}
1717

1818
attribute {
1919
name = "supplierId"
20-
type = "string"
20+
type = "S"
2121
}
2222

2323
point_in_time_recovery {

0 commit comments

Comments
 (0)