File tree Expand file tree Collapse file tree 1 file changed +9
-1
lines changed Expand file tree Collapse file tree 1 file changed +9
-1
lines changed Original file line number Diff line number Diff line change 16
16
17
17
# Default to main branch, but support pipelines using other branches
18
18
TARGET_BRANCH=${TARGET_BRANCH-' main' }
19
+
19
20
if [ " $TARGET_BRANCH " == " main" ]
20
21
then
21
22
STACK_NAME=" javabuilder-cicd"
22
23
else
23
- STACK_NAME=" javabuilder-${TARGET_BRANCH} -cicd"
24
+ # only allow alphanumeric branch names that may contain an internal hyphen.
25
+ # to avoid complicated logic elsewhere, we're constraining it here.
26
+ if [[ " $TARGET_BRANCH " =~ ^[a-z0-9]([-a-z0-9]* [a-z0-9])$ ]]; then
27
+ STACK_NAME=" javabuilder-${TARGET_BRANCH} -cicd"
28
+ else
29
+ echo " Invalid branch name '${TARGET_BRANCH} ', branches must be alphanumeric and may contain hyphens."
30
+ exit
31
+ fi
24
32
fi
25
33
26
34
ENVIRONMENT_TYPE=${ENVIRONMENT_TYPE-' standard' }
You can’t perform that action at this time.
0 commit comments