Hi there,
I am trying to add a deploy functionality on circle-ci for our test servers.
I would like to execute my deploy-branch-on-test.sh
after the tests are run. However right now they also execute when the test fails.
How could I prevent it from being deployed when the test fails ?
I cannot use the deploy command in the circle.yml
file as the branches we use change all the time and would be quite cumbersome to update on every branch…
Cheers
#!/bin/sh
BRANCH_TO_DEPLOY=$1
TEST_INSTANCE=$2
if [ -z ${BRANCH_TO_DEPLOY} ]; then
echo "Please specifiy a branch to deploy."
echo
echo "e.g. ./scripts/deploy-branch-on-test.sh sprint-39/battle test"
echo
exit
fi
if [ -z ${TEST_INSTANCE} ]; then
echo "Please specifiy on which test instance you want to deploy your branch."
echo
echo "e.g. ./scripts/deploy-branch-on-test.sh sprint-39/battle test"
echo
exit
fi
if [ "${CIRCLE_BRANCH}" == "${BRANCH_TO_DEPLOY}" ]; then
ssh $TEST_INSTANCE "cd server && git checkout ${BRANCH_TO_DEPLOY} && git pull && docker restart web && ./node_modules/.bin/webpack"
fi