forked from wunderio/silta-circleci
-
Notifications
You must be signed in to change notification settings - Fork 0
/
generate-kontena-config
executable file
·31 lines (26 loc) · 1.23 KB
/
generate-kontena-config
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# Replace non-alphanumeric in the branch name with a dash.
BRANCH_SLUG=${CIRCLE_BRANCH//[^[:alnum:]]/-}
# Strip common branch prefixes
STACK_SLUG=${BRANCH_SLUG#feature-}
STACK_SLUG=${STACK_SLUG#bug-}
STACK_SLUG=${STACK_SLUG#bugfix-}
STACK_SLUG=${STACK_SLUG#hotfix-}
STACK_SLUG=${STACK_SLUG#dependabot-composer-}
STACK_SLUG=${STACK_SLUG#dependabot-yarn-}
# Strip common repository name prefixes
PROJECT_SLUG=${CIRCLE_PROJECT_REPONAME//internal-/}
PROJECT_SLUG=${PROJECT_SLUG//client-de-/}
PROJECT_SLUG=${PROJECT_SLUG//client-ee-/}
PROJECT_SLUG=${PROJECT_SLUG//client-fi-/}
PROJECT_SLUG=${PROJECT_SLUG//client-lv-/}
PROJECT_SLUG=${PROJECT_SLUG//client-uk-/}
# Build the stack name based on the shortened project and branch names.
STACK_NAME="${PROJECT_SLUG:0:14}-${STACK_SLUG:0:14}"
# Output variable definitions, outputting this to $BASH_ENV will persist between circleCI steps.
echo "export BRANCH_SLUG=$BRANCH_SLUG"
echo "export STACK_NAME=$STACK_NAME"
echo "export VIRTUALHOST=${BRANCH_SLUG,,}.${CIRCLE_PROJECT_REPONAME,,}.dev.wdr.io"
echo "export DOCKER_IMAGE_PREFIX=${CIRCLE_PROJECT_REPONAME,,}"
echo "export DOCKER_IMAGE_VERSION=$CIRCLE_SHA1"
echo "export LOADBALANCER=loadbalancer/dev_lb"
echo "export BASICAUTH='user wunder insecure-password wunder'"