Skip to content

Commit

Permalink
Update .travis.yml for minor things
Browse files Browse the repository at this point in the history
  • Loading branch information
Hosung Song committed Apr 20, 2018
1 parent 8477d16 commit dcceea9
Showing 1 changed file with 28 additions and 18 deletions.
46 changes: 28 additions & 18 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
dist: trusty
sudo: off

branches:
only:
- master

language: node_js # Base language is Nodejs (used for liniting and basic validation).

addons:
Expand All @@ -24,32 +28,38 @@ cache:
script: # Run the lint tests, then if env vars are present validate the template then try building the stack.
- npm test
- if [ "$SPNAME" != "" -a "$SPPASSWORD" != "" -a "$SPTENANT" != "" -a "$SPSSHKEY" != "" ]; then
export RUNBUILD="true";
export RUNBUILD="true"
export AZMDLGROUP="azmdl-travis-$TRAVIS_BUILD_NUMBER"
fi
- if [ "$LOCATION" == "" ]; then
export LOCATION="westus";
- if [ -z "$LOCATION" ]; then
export LOCATION="westus"
fi
- if [ "$RUNBUILD" == "true" ]; then
echo "Running Azure setup steps.";
az login --service-principal -u "$SPNAME" -p "$SPPASSWORD" --tenant "$SPTENANT";
az group create -l "$LOCATION" -g "moodle-azure-$TRAVIS_BUILD_NUMBER";
- if [ "$RUNBUILD" = "true" ]; then
echo "Running Azure setup steps."
az login --service-principal -u "$SPNAME" -p "$SPPASSWORD" --tenant "$SPTENANT"
az group create -l "$LOCATION" -g "$AZMDLGROUP"
else
echo "Skipping Azure setup.";
echo "Skipping Azure setup."
fi
- if [ "$RUNBUILD" == "true" ]; then
echo "Running Azure validation step.";
az group deployment validate --resource-group "moodle-azure-$TRAVIS_BUILD_NUMBER" --template-file azuredeploy.json --parameters azuredeploy.parameters.json --parameters sshPublicKey="$SPSSHKEY";
- if [ "$RUNBUILD" = "true" ]; then
echo "Running Azure validation step."
VALIDATION_RESULT=$(az group deployment validate --resource-group "$AZMDLGROUP" --template-file azuredeploy.json --parameters azuredeploy.parameters.json --parameters sshPublicKey="$SPSSHKEY")
if [ -n "$VALIDATION_RESULT" ]; then
echo "Azure template validation failed! Error message:"
echo $VALIDATION_RESULT
exit 1
fi
else
echo "Skipping Azure validation.";
echo "Skipping Azure validation."
fi
- if [ "$RUNBUILD" == "true" ]; then
echo "Running Azure build step.";
az group deployment create --resource-group "moodle-azure-$TRAVIS_BUILD_NUMBER" --template-file azuredeploy.json --parameters azuredeploy.parameters.json --parameters sshPublicKey="$SPSSHKEY" --debug --verbose;
- if [ "$RUNBUILD" = "true" ]; then
echo "Running Azure build step."
az group deployment create --resource-group "$AZMDLGROUP" --template-file azuredeploy.json --parameters azuredeploy.parameters.json --parameters sshPublicKey="$SPSSHKEY" --debug --verbose
else
echo "Skipping Azure build.";
echo "Skipping Azure build."
fi

after_script: # Teardown group and created resource after build.
- if [ "$RUNBUILD" == "true" ]; then
az group delete -g "moodle-azure-$TRAVIS_BUILD_NUMBER" -y;
- if [ "$RUNBUILD" = "true" ]; then
az group delete -g "moodle-azure-$TRAVIS_BUILD_NUMBER" -y --no-wait
fi

0 comments on commit dcceea9

Please sign in to comment.