Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 13 additions & 3 deletions .github/scripts/dispatch_internal_repo_workflow.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@
# --internalRef <ref> \
# --overrides <overrides> \
# --overrideProjectName <name> \
# --overrideRoleName <name>
# --overrideRoleName <name> \
# --shardCount <count>

#
# All arguments are required except terraformAction, and internalRef.
Expand All @@ -30,7 +31,8 @@
# --internalRef "main" \
# --overrides "tf_var=someString" \
# --overrideProjectName nhs \
# --overrideRoleName nhs-service-iam-role
# --overrideRoleName nhs-service-iam-role \
# --shardCount "4"

set -e

Expand All @@ -48,7 +50,8 @@ Usage:
[--internalRef <ref>] \
[--overrides <overrides>] \
[--overrideProjectName <name>] \
[--overrideRoleName <name>]
[--overrideRoleName <name>] \
[--shardCount <count>]
EOF
return 0
}
Expand Down Expand Up @@ -112,6 +115,10 @@ while [[ $# -gt 0 ]]; do
overrideRoleName="$2"
shift 2
;;
--shardCount) # Number of parallel shards to split tests across (optional)
shardCount="$2"
shift 2
;;
*)
echo "[ERROR] Unknown argument: $1" >&2
exit 1
Expand Down Expand Up @@ -208,6 +215,7 @@ echo " internalRef: $internalRef"
echo " overrides: $overrides"
echo " overrideProjectName: $overrideProjectName"
echo " overrideRoleName: $overrideRoleName"
echo " shardCount: ${shardCount:-}"

DISPATCH_EVENT=$(jq -ncM \
--arg internalRef "$internalRef" \
Expand All @@ -221,13 +229,15 @@ DISPATCH_EVENT=$(jq -ncM \
--arg overrides "$overrides" \
--arg overrideProjectName "$overrideProjectName" \
--arg overrideRoleName "$overrideRoleName" \
--arg shardCount "${shardCount:-}" \
'{
"ref": $internalRef,
"inputs": (
(if $infraRepoName != "" then { "infraRepoName": $infraRepoName } else {} end) +
(if $terraformAction != "" then { "terraformAction": $terraformAction } else {} end) +
(if $overrideProjectName != "" then { "overrideProjectName": $overrideProjectName } else {} end) +
(if $overrideRoleName != "" then { "overrideRoleName": $overrideRoleName } else {} end) +
(if $shardCount != "" then { "shardCount": $shardCount } else {} end) +
{
"releaseVersion": $releaseVersion,
"targetEnvironment": $targetEnvironment,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,12 @@ echo "COMPONENT=$COMPONENT"
echo "AWS_REGION=$REGION"
echo "AWS_ACCOUNT_ID=$AWS_ACCOUNT_ID"

# No build steps required for output action
if [ "${ACTION}" = "output" ]; then
echo "ACTION=output: skipping build and dependency steps."
return 0
fi

# Calculate container image prefix from PROJECT, ENVIRONMENT, COMPONENT
CONTAINER_IMAGE_PREFIX="${PROJECT}-${ENVIRONMENT}-${COMPONENT}"
echo "CONTAINER_IMAGE_PREFIX: ${CONTAINER_IMAGE_PREFIX}"
Expand Down
Loading