Skip to content

Commit 1ccf2c6

Browse files
CCM-11942 Updating script with debug info
1 parent 203f169 commit 1ccf2c6

File tree

2 files changed

+15
-2
lines changed

2 files changed

+15
-2
lines changed

.github/scripts/dispatch_internal_repo_workflow.sh

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,10 @@ while [[ $# -gt 0 ]]; do
6767
internalRef="$2"
6868
shift 2
6969
;;
70+
--overrides) # Terraform overrides for passing in extra variables (optional)
71+
overrides="$2"
72+
shift 2
73+
;;
7074
*)
7175
echo "[ERROR] Unknown argument: $1"
7276
exit 1
@@ -84,6 +88,10 @@ if [[ -z "$jobName" ]]; then
8488
jobName="${infraRepoName}-${targetComponent}-${terraformAction}"
8589
fi
8690

91+
if [[ -z "$overrides" ]]; then
92+
overrides=""
93+
fi
94+
8795
if [[ -z "$terraformAction" ]]; then
8896
terraformAction="plan"
8997
fi
@@ -102,6 +110,7 @@ echo " targetComponent: $targetComponent"
102110
echo " targetAccountGroup: $targetAccountGroup"
103111
echo " terraformAction: $terraformAction"
104112
echo " internalRef: $internalRef"
113+
echo " overrides: $overrides"
105114

106115
callerRunId="${GITHUB_RUN_ID}-${jobName}-${GITHUB_RUN_ATTEMPT}"
107116

@@ -114,6 +123,7 @@ DISPATCH_EVENT=$(jq -ncM \
114123
--arg terraformAction "$terraformAction" \
115124
--arg callerRunId "$callerRunId" \
116125
--arg targetWorkflow "$targetWorkflow" \
126+
--arg overrides "$overrides" \
117127
'{
118128
"ref": "'"$internalRef"'",
119129
"inputs": (
@@ -141,14 +151,17 @@ trigger_response=$(curl -s -L \
141151
-H "X-GitHub-Api-Version: 2022-11-28" \
142152
"https://api.github.com/repos/NHSDigital/nhs-notify-internal/actions/workflows/$targetWorkflow/dispatches" \
143153
-d "$DISPATCH_EVENT" 2>&1)
154+
144155
if [[ $? -ne 0 ]]; then
145156
echo "[ERROR] Failed to trigger workflow. Response: $trigger_response"
146157
exit 1
147158
fi
159+
148160
echo "[INFO] Workflow trigger request sent successfully, waiting for completion..."
149161

150162
# Poll GitHub API to check the workflow status
151163
workflow_run_url=""
164+
152165
for _ in {1..18}; do
153166

154167
response=$(curl -s -L \

.github/workflows/pr_create_dynamic_env.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
21
name: PR Create Environment
32

43
on:
@@ -28,4 +27,5 @@ jobs:
2827
--targetEnvironment "pr${{ github.event.number }}" \
2928
--targetComponent "branch" \
3029
--targetAccountGroup "nhs-notify-template-management-dev" \
31-
--terraformAction "apply"
30+
--terraformAction "apply" \
31+
--overrides "branch_name=${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}"

0 commit comments

Comments
 (0)