@@ -68,6 +68,10 @@ while [[ $# -gt 0 ]]; do
6868 internalRef=" $2 "
6969 shift 2
7070 ;;
71+ --runId) # Github Run ID (optional)
72+ runId=" $2 "
73+ shift 2
74+ ;;
7175 --overrides) # Terraform overrides for passing in extra variables (optional)
7276 overrides=" $2 "
7377 shift 2
@@ -80,6 +84,26 @@ while [[ $# -gt 0 ]]; do
8084 overrideRoleName=" $2 "
8185 shift 2
8286 ;;
87+ --buildSandbox) # Build sandbox flag (optional)
88+ buildSandbox=" $2 "
89+ shift 2
90+ ;;
91+ --apimEnvironment) # APIM environment (optional)
92+ apimEnvironment=" $2 "
93+ shift 2
94+ ;;
95+ --boundedContext) # Bounded context (optional)
96+ boundedContext=" $2 "
97+ shift 2
98+ ;;
99+ --targetDomain) # Target domain (optional)
100+ targetDomain=" $2 "
101+ shift 2
102+ ;;
103+ --version) # Version (optional)
104+ version=" $2 "
105+ shift 2
106+ ;;
83107 * )
84108 echo " [ERROR] Unknown argument: $1 "
85109 exit 1
@@ -101,6 +125,30 @@ if [[ -z "$internalRef" ]]; then
101125 internalRef=" main"
102126fi
103127
128+ if [[ -z " $runId " ]]; then
129+ runId=" "
130+ fi
131+
132+ if [[ -z " $buildSandbox " ]]; then
133+ buildSandbox=" "
134+ fi
135+
136+ if [[ -z " $apimEnvironment " ]]; then
137+ apimEnvironment=" "
138+ fi
139+
140+ if [[ -z " $boundedContext " ]]; then
141+ boundedContext=" "
142+ fi
143+
144+ if [[ -z " $targetDomain " ]]; then
145+ targetDomain=" "
146+ fi
147+
148+ if [[ -z " $version " ]]; then
149+ version=" "
150+ fi
151+
104152echo " ==================== Workflow Dispatch Parameters ===================="
105153echo " infraRepoName: $infraRepoName "
106154echo " releaseVersion: $releaseVersion "
@@ -114,6 +162,12 @@ echo " overrides: $overrides"
114162echo " overrideProjectName: $overrideProjectName "
115163echo " overrideRoleName: $overrideRoleName "
116164echo " targetProject: $targetProject "
165+ echo " runId: $runId "
166+ echo " buildSandbox: $buildSandbox "
167+ echo " apimEnvironment: $apimEnvironment "
168+ echo " boundedContext: $boundedContext "
169+ echo " targetDomain: $targetDomain "
170+ echo " version: $version "
117171
118172DISPATCH_EVENT=$( jq -ncM \
119173 --arg infraRepoName " $infraRepoName " \
@@ -127,6 +181,12 @@ DISPATCH_EVENT=$(jq -ncM \
127181 --arg overrideProjectName " $overrideProjectName " \
128182 --arg overrideRoleName " $overrideRoleName " \
129183 --arg targetProject " $targetProject " \
184+ --arg runId " $runId " \
185+ --arg buildSandbox " $buildSandbox " \
186+ --arg apimEnvironment " $apimEnvironment " \
187+ --arg boundedContext " $boundedContext " \
188+ --arg targetDomain " $targetDomain " \
189+ --arg version " $version " \
130190 ' {
131191 "ref": "' " $internalRef " ' ",
132192 "inputs": (
@@ -135,18 +195,26 @@ DISPATCH_EVENT=$(jq -ncM \
135195 (if $overrideProjectName != "" then { "overrideProjectName": $overrideProjectName } else {} end) +
136196 (if $overrideRoleName != "" then { "overrideRoleName": $overrideRoleName } else {} end) +
137197 (if $targetProject != "" then { "targetProject": $targetProject } else {} end) +
198+ (if $overrides != "" then { "overrides": $overrides } else {} end) +
199+ (if $runId != "" then { "runId": $runId } else {} end) +
200+ (if $buildSandbox != "" then { "buildSandbox": $buildSandbox } else {} end) +
201+ (if $apimEnvironment != "" then { "apimEnvironment": $apimEnvironment } else {} end) +
202+ (if $boundedContext != "" then { "boundedContext": $boundedContext } else {} end) +
203+ (if $targetDomain != "" then { "targetDomain": $targetDomain } else {} end) +
204+ (if $version != "" then { "version": $version } else {} end) +
205+ (if $targetAccountGroup != "" then { "targetAccountGroup": $targetAccountGroup } else {} end) +
138206 {
139207 "releaseVersion": $releaseVersion,
140208 "targetEnvironment": $targetEnvironment,
141- "targetAccountGroup": $targetAccountGroup,
142209 "targetComponent": $targetComponent,
143- "overrides": $overrides,
144210 }
145211 )
146212 }' )
147213
148214echo " [INFO] Triggering workflow '$targetWorkflow ' in nhs-notify-internal..."
149215
216+ echo " [DEBUG] Dispatch event payload: $DISPATCH_EVENT "
217+
150218trigger_response=$( curl -s -L \
151219 --fail \
152220 -X POST \
@@ -185,16 +253,12 @@ for _ in {1..18}; do
185253 workflow_run_url=$( echo " $response " | jq -r \
186254 --arg targetWorkflow " $targetWorkflow " \
187255 --arg targetEnvironment " $targetEnvironment " \
188- --arg targetAccountGroup " $targetAccountGroup " \
189256 --arg targetComponent " $targetComponent " \
190- --arg terraformAction " $terraformAction " \
191257 ' .workflow_runs[]
192258 | select(.path == ".github/workflows/" + $targetWorkflow)
193259 | select(.name
194260 | contains($targetEnvironment)
195- and contains($targetAccountGroup)
196261 and contains($targetComponent)
197- and contains($terraformAction)
198262 )
199263 | .url' )
200264
0 commit comments