66# ./dispatch_internal_repo_workflow.sh \
77# --infraRepoName <repo> \
88# --releaseVersion <version> \
9- # --targetWorkflow <workflow.yaml> \
9+ # --targ echo " targetDomain: $targetDomain"
10+ echo " version: $version "
11+
12+ DISPATCH_EVENT=$( jq -ncM \r kflow < workflow.yaml> \
1013# --targetEnvironment <env> \
1114# --targetComponent <component> \
1215# --targetAccountGroup <group> \
1720# --overrideRoleName <name>
1821
1922#
20- # All arguments are required except terraformAction, and internalRef.
23+ # Required arguments are:
24+ # infraRepoName, releaseVersion, targetWorkflow, targetEnvironment, targetComponent, targetAccountGroup.
25+ #
26+ # All other arguments are optional.
27+ #
2128# Example:
2229# ./dispatch_internal_repo_workflow.sh \
2330# --infraRepoName "nhs-notify-web-template-management" \
3037# --internalRef "main" \
3138# --overrides "tf_var=someString" \
3239# --overrideProjectName nhs \
33- # --overrideRoleName nhs-service-iam-role
40+ # --overrideRoleName nhs-service-iam-role \
41+ # --extraSecretNames '["MY_API_KEY"]'
42+
3443
3544set -e
3645
@@ -104,6 +113,14 @@ while [[ $# -gt 0 ]]; do
104113 version=" $2 "
105114 shift 2
106115 ;;
116+ --extraSecretNames) # JSON array of secret names to fetch in the internal repo (optional)
117+ extraSecretNames=" $2 "
118+ shift 2
119+ ;;
120+ --testsToRun) # JSON array of test types to run, overriding test-types.json (optional)
121+ testsToRun=" $2 "
122+ shift 2
123+ ;;
107124 * )
108125 echo " [ERROR] Unknown argument: $1 "
109126 exit 1
@@ -202,6 +219,14 @@ if [[ -z "$version" ]]; then
202219 version=" "
203220fi
204221
222+ if [[ -z " $extraSecretNames " ]]; then
223+ extraSecretNames=" "
224+ fi
225+
226+ if [[ -z " $testsToRun " ]]; then
227+ testsToRun=" "
228+ fi
229+
205230echo " ==================== Workflow Dispatch Parameters ===================="
206231echo " infraRepoName: $infraRepoName "
207232echo " releaseVersion: $releaseVersion "
@@ -240,6 +265,8 @@ DISPATCH_EVENT=$(jq -ncM \
240265 --arg boundedContext " $boundedContext " \
241266 --arg targetDomain " $targetDomain " \
242267 --arg version " $version " \
268+ --argjson extraSecretNames " ${extraSecretNames:- null} " \
269+ --argjson testsToRun " ${testsToRun:- null} " \
243270 ' {
244271 "ref": "' " $internalRef " ' ",
245272 "inputs": (
@@ -255,6 +282,8 @@ DISPATCH_EVENT=$(jq -ncM \
255282 (if $boundedContext != "" then { "boundedContext": $boundedContext } else {} end) +
256283 (if $targetDomain != "" then { "targetDomain": $targetDomain } else {} end) +
257284 (if $version != "" then { "version": $version } else {} end) +
285+ (if $extraSecretNames != null then { "extraSecretNames": ($extraSecretNames | tojson) } else {} end) +
286+ (if $testsToRun != null then { "testsToRun": ($testsToRun | tojson) } else {} end) +
258287 (if $targetAccountGroup != "" then { "targetAccountGroup": $targetAccountGroup } else {} end) +
259288 {
260289 "releaseVersion": $releaseVersion,
0 commit comments