Skip to content

Commit

Permalink
chore(build): issues/218 apply stable deploy paths
Browse files Browse the repository at this point in the history
* pre script, minor local variable rename to avoid confusion
* proxy run, stable path additions for spandx config, local run
* custom release, beta and stable branches for ci, qa, prod
  • Loading branch information
cdcabrera committed Mar 12, 2020
1 parent fca5041 commit ae69e0b
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 25 deletions.
46 changes: 25 additions & 21 deletions .travis/custom_release.sh
Original file line number Diff line number Diff line change
@@ -1,40 +1,44 @@
#!/bin/bash
#
#
# CI/Dev beta release for "ci-beta" and "qa-beta" branches, based on deploy stage name
# Release a branch
release()
{
local DEPLOY_BRANCH=$1

printf "${YELLOW}PUSHING ${DEPLOY_BRANCH}${NOCOLOR}\n"
rm -rf ./build/.git
.travis/release.sh "${DEPLOY_BRANCH}"
printf "${GREEN}COMPLETED ${DEPLOY_BRANCH}${NOCOLOR}\n"
}
#
#
# CI/Dev beta release for "ci" and "qa" "beta" and "stable" branches, based on deploy stage name
#
releaseDev()
{
if [[ "${TRAVIS_BRANCH}" = "ci" ]] && [[ $TRAVIS_BUILD_STAGE_NAME == *"Beta"* ]]; then
printf "${YELLOW}PUSHING ci-beta${NOCOLOR}\n"
rm -rf ./build/.git
.travis/release.sh "ci-beta"
printf "${GREEN}COMPLETED ci-beta${NOCOLOR}\n"
if [[ "${TRAVIS_BRANCH}" = "ci-beta" || "${TRAVIS_BRANCH}" = "dev" || "${TRAVIS_BRANCH}" = "ci" ]] && [[ $TRAVIS_BUILD_STAGE_NAME == *"Beta"* ]]; then
release "ci-beta"
release "qa-beta"
fi

printf "${YELLOW}PUSHING qa-beta${NOCOLOR}\n"
rm -rf ./build/.git
.travis/release.sh "qa-beta"
printf "${GREEN}COMPLETED qa-beta${NOCOLOR}\n"
if [[ "${TRAVIS_BRANCH}" = "ci-stable" || "${TRAVIS_BRANCH}" = "test" ]] && [[ $TRAVIS_BUILD_STAGE_NAME != *"Beta"* ]]; then
release "ci-stable"
release "qa-stable"
fi
}
#
#
# Prod release for "master" branch based on deploy stage name.
# Prod release for "master" and "stage" branches based on deploy stage name.
#
releaseProd()
{
if [[ "${TRAVIS_BRANCH}" = "master" ]] && [[ $TRAVIS_BUILD_STAGE_NAME == *"Beta"* ]]; then
printf "${YELLOW}PUSHING prod-beta${NOCOLOR}\n"
rm -rf ./build/.git
.travis/release.sh "prod-beta"
printf "${GREEN}COMPLETED prod-beta${NOCOLOR}\n"
if [[ "${TRAVIS_BRANCH}" = "prod-beta" || "${TRAVIS_BRANCH}" = "stage" ]] && [[ $TRAVIS_BUILD_STAGE_NAME == *"Beta"* ]]; then
release "prod-beta"
fi

if [[ "${TRAVIS_BRANCH}" = "master" ]] && [[ $TRAVIS_BUILD_STAGE_NAME != *"Beta"* ]]; then
printf "${YELLOW}PUSHING prod-stable${NOCOLOR}\n"
rm -rf ./build/.git
.travis/release.sh "prod-stable"
printf "${GREEN}COMPLETED prod-stable${NOCOLOR}\n"
if [[ "${TRAVIS_BRANCH}" = "prod-stable" || "${TRAVIS_BRANCH}" = "master" ]] && [[ $TRAVIS_BUILD_STAGE_NAME != *"Beta"* ]]; then
release "prod-stable"
fi
}
#
Expand Down
9 changes: 9 additions & 0 deletions config/spandx.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,21 @@ module.exports = {
'/static': {
host: `https://${localhost}:5001`
},
'/apps/subscriptions': {
host: `https://${localhost}:5001`
},
'/beta/apps/subscriptions': {
host: `https://${localhost}:5001`
},
'/staging/subscriptions': {
host: `https://${localhost}:5001`
},
'/beta/staging/subscriptions': {
host: `https://${localhost}:5001`
},
'/subscriptions': {
host: `https://${localhost}:5001`
},
'/beta/subscriptions': {
host: `https://${localhost}:5001`
},
Expand Down
8 changes: 4 additions & 4 deletions scripts/pre.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,18 @@
#
deployPaths()
{
local CI_BRANCH=$1
local CI_BUILD_STAGE=$2
local DEPLOY_BRANCH=$1
local DEPLOY_BUILD_STAGE=$2

DEPLOY_PATH_PREFIX=""

if [[ $CI_BUILD_STAGE == *"Beta"* ]]; then
if [[ $DEPLOY_BUILD_STAGE == *"Beta"* ]]; then
DEPLOY_PATH_PREFIX=/beta
fi

echo UI_DEPLOY_PATH_PREFIX="$DEPLOY_PATH_PREFIX" >> ./.env.production.local

echo "\"${CI_BUILD_STAGE}\" build stage config for branch \"${CI_BRANCH}\"..."
echo "\"${DEPLOY_BUILD_STAGE}\" build stage config for branch \"${DEPLOY_BRANCH}\"..."
printf "Deploy path prefix ... ${GREEN}UI_DEPLOY_PATH_PREFIX=$DEPLOY_PATH_PREFIX${NOCOLOR}\n"
}
#
Expand Down

0 comments on commit ae69e0b

Please sign in to comment.