Update .travis.yml for minor things

This commit is contained in:
Hosung Song 2018-04-20 12:42:26 -07:00
Родитель 8477d16579
Коммит dcceea9dbb
1 изменённых файлов: 28 добавлений и 18 удалений

Просмотреть файл

@ -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:
@ -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