This commit is contained in:
Hosung Song 2018-04-20 12:59:36 -07:00
Родитель dcceea9dbb
Коммит 461b3ceea5
4 изменённых файлов: 35 добавлений и 34 удалений

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

@ -25,41 +25,9 @@ cache:
directories:
- node_modules
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 AZMDLGROUP="azmdl-travis-$TRAVIS_BUILD_NUMBER"
fi
- 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 "$AZMDLGROUP"
else
echo "Skipping Azure setup."
fi
- 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."
fi
- 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."
fi
script: ./etc/travis.sh
after_script: # Teardown group and created resource after build.
- if [ "$RUNBUILD" = "true" ]; then
az group delete -g "moodle-azure-$TRAVIS_BUILD_NUMBER" -y --no-wait
az group delete -g "$AZMDLGROUP" -y --no-wait
fi

0
etc/changeBranchInURL.sh Normal file → Executable file
Просмотреть файл

0
etc/keyvault.sh Normal file → Executable file
Просмотреть файл

33
etc/travis.sh Executable file
Просмотреть файл

@ -0,0 +1,33 @@
#!/bin/bash
set -ev
# Run the lint tests, then if env vars are present validate the template then try building the stack.
npm test
if [ -z "$SPNAME" -o -z "$SPPASSWORD" -o -z "$SPTENANT" -o -z "$SPSSHKEY" ]; then
echo "No Azure deployment info given, skipping test deployment and exiting..."
exit 0
fi
export RUNBUILD="true"
export AZMDLGROUP="azmdl-travis-$TRAVIS_BUILD_NUMBER"
if [ -z "$LOCATION" ]; then
export LOCATION="westus"
fi
echo "Running Azure setup steps."
az login --service-principal -u "$SPNAME" -p "$SPPASSWORD" --tenant "$SPTENANT"
az group create -l "$LOCATION" -g "$AZMDLGROUP"
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
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