зеркало из https://github.com/Azure/Moodle.git
Update CI script
This commit is contained in:
Родитель
dcceea9dbb
Коммит
461b3ceea5
36
.travis.yml
36
.travis.yml
|
@ -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,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
|
Загрузка…
Ссылка в новой задаче