Avere/azure-pipelines.yml

123 строки
4.4 KiB
YAML

# https://aka.ms/yaml
trigger:
- master
- releases/*
jobs:
- job: template
timeoutInMinutes: 180
pool:
vmImage: 'Ubuntu 16.04'
steps:
- task: UsePythonVersion@0
inputs:
versionSpec: '3.7'
architecture: 'x64'
- script: |
mkdir ~/.ssh
ssh-keygen -t rsa -N "" -f ~/.ssh/id_rsa
ls -al ~/.ssh
echo "SSH PUBLIC KEY: $(cat ~/.ssh/id_rsa.pub)"
displayName: 'Generate SSH keys'
- script: |
pip install --upgrade pip setuptools wheel
pip install -r test/requirements.txt
displayName: 'Install Python dependencies'
- script: |
pytest test/test_avere_template_deploy.py --doctest-modules --junitxml=junit/test-results1a.xml
displayName: 'Test template-based deployment of Avere vFXT'
env:
AVERE_ADMIN_PW: $(controllerpassword)
AVERE_CONTROLLER_PW: $(controllerpassword)
AZURE_TENANT_ID: $(SPTENANTID)
AZURE_CLIENT_ID: $(SPAPPID)
AZURE_CLIENT_SECRET: $(SPPW)
AZURE_SUBSCRIPTION_ID: $(AZURE-SUBSCRIPTION-ID)
VFXT_TEST_VARS_FILE: pipelines.json
- script: |
pytest test/test_vfxt_cluster_status.py --doctest-modules --junitxml=junit/test-results1b.xml
displayName: 'Test cluster status, health, etc.'
condition: succeeded()
env:
AVERE_ADMIN_PW: $(controllerpassword)
AVERE_CONTROLLER_PW: $(controllerpassword)
AZURE_TENANT_ID: $(SPTENANTID)
AZURE_CLIENT_ID: $(SPAPPID)
AZURE_CLIENT_SECRET: $(SPPW)
AZURE_SUBSCRIPTION_ID: $(AZURE-SUBSCRIPTION-ID)
VFXT_TEST_VARS_FILE: pipelines.json
- script: |
CONTROLLER_IP=$(grep controller_ip $VFXT_TEST_VARS_FILE | sed -E 's/^.*controller_ip": "([^"]+)".*$/\1/')
CONTROLLER_NAME=$(grep controller_name $VFXT_TEST_VARS_FILE | sed -E 's/^.*controller_name": "([^"]+)".*$/\1/')
CONTROLLER_USER=$(grep controller_user $VFXT_TEST_VARS_FILE | sed -E 's/^.*controller_user": "([^"]+)".*$/\1/')
echo "CONTROLLER_IP : $CONTROLLER_IP"
echo "CONTROLLER_NAME: $CONTROLLER_NAME"
echo "CONTROLLER_USER: $CONTROLLER_USER"
mkdir $BUILD_SOURCESDIRECTORY/test_artifacts
ARTIFACTS_DIR="$BUILD_SOURCESDIRECTORY/test_artifacts"
scp -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -r $CONTROLLER_USER@$CONTROLLER_IP:~/vfxt.log $ARTIFACTS_DIR/vfxt.$CONTROLLER_NAME.log
scp -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -r $CONTROLLER_USER@$CONTROLLER_IP:~/vfxt_deploy_artifacts.* $ARTIFACTS_DIR/.
echo "vfxt.log from $CONTROLLER_NAME:"
cat $ARTIFACTS_DIR/vfxt.$CONTROLLER_NAME.log
displayName: 'Collect vFXT deployment artifacts from controller; dump vfxt.log'
condition: always()
env:
VFXT_TEST_VARS_FILE: pipelines.json
- script: |
CONTROLLER_NAME=$(grep controller_name $VFXT_TEST_VARS_FILE | sed -E 's/^.*controller_name": "([^"]+)".*$/\1/')
echo "CONTROLLER_NAME: $CONTROLLER_NAME"
LOCAL_VFXT_LOG="$BUILD_SOURCESDIRECTORY/test_artifacts/vfxt.$CONTROLLER_NAME.log"
grep -i -C 5 -e vfxt:ERROR -e exception $LOCAL_VFXT_LOG
displayName: 'Grep errors from vfxt.log (+/- 5 lines)'
condition: or(failed(), canceled())
env:
VFXT_TEST_VARS_FILE: pipelines.json
# - script: |
# pytest test/test_vdbench.py --doctest-modules --junitxml=junit/test-results2.xml
# displayName: 'Test vdbench on Avere vFXT'
# env:
# AZURE_TENANT_ID: $(SPTENANTID)
# AZURE_CLIENT_ID: $(SPAPPID)
# AZURE_CLIENT_SECRET: $(SPPW)
# AZURE_SUBSCRIPTION_ID: $(AZURE-SUBSCRIPTION-ID)
# VFXT_TEST_VARS_FILE: pipelines.json
- task: PublishPipelineArtifact@0
displayName: 'Publish Pipelines Artifacts (node logs, rolling trace)'
inputs:
artifactName: 'testArtifacts'
targetPath: 'test_artifacts'
condition: always()
- script: |
az login --service-principal -u $AZURE_CLIENT_ID -p $AZURE_CLIENT_SECRET --tenant $AZURE_TENANT_ID
RESOURCE_GROUP=$(grep resource_group $VFXT_TEST_VARS_FILE | sed -E 's/^.*resource_group": "([^"]+)".*$/\1/')
echo "RESOURCE_GROUP: $RESOURCE_GROUP"
az group delete --yes -n $RESOURCE_GROUP
displayName: 'Delete resource group'
condition: always()
env:
AZURE_TENANT_ID: $(SPTENANTID)
AZURE_CLIENT_ID: $(SPAPPID)
AZURE_CLIENT_SECRET: $(SPPW)
VFXT_TEST_VARS_FILE: pipelines.json
- task: PublishTestResults@2
condition: always()
inputs:
testResultsFiles: 'junit/test-results*.xml'
testRunTitle: 'Publish pytest results'