Skip to content

Commit c5307de

Browse files
committed
Add check for aws environment
1 parent 7b79283 commit c5307de

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

scripts/build_sandbox.sh

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,25 @@
11
#!/bin/bash
22
set -euo pipefail
33

4+
required_profile="NDR-Dev-RW"
5+
6+
if [[ "${AWS_PROFILE:-}" != "$required_profile" ]]; then
7+
echo "❌ Error: AWS_PROFILE must be set to \"$required_profile\""
8+
echo "👉 Example: export AWS_PROFILE=$required_profile"
9+
exit 1
10+
fi
11+
412
branch="${WORKSPACE:-$(git rev-parse --abbrev-ref HEAD)}"
513
branch=$(echo "$branch" | sed 's/[^a-zA-Z0-9]//g')
614
branch="${branch,,}"
715
apply="${APPLY:-false}"
816

917
# Forbidden branches
10-
forbidden_branches=("main" "prod" "pre-prod" "ndr-test" "ndr-dev")
18+
forbidden_workspaces=("main" "prod" "pre-prod" "ndr-test" "ndr-dev" "preprod" "ndrtest" "ndrdev")
1119

12-
for fb in "${forbidden_branches[@]}"; do
20+
for fb in "${forbidden_workspaces[@]}"; do
1321
if [[ "$branch" == "$fb" ]]; then
14-
echo "❌ Error: Deployment from branch '$branch' is not allowed."
22+
echo "❌ Error: Deployment of workspace '$fb' is not allowed. If you are trying to deploy main to your sandbox then provide a workspace name."
1523
exit 1
1624
fi
1725
done

0 commit comments

Comments
 (0)