#!/usr/bin/env groovy node("slave") { withCredentials([[$class: 'UsernamePasswordMultiBinding', credentialsId: 'AZURE_CLI_SPN_ACS_TEST', passwordVariable: 'SPN_PASSWORD', usernameVariable: 'SPN_USER']]) { timestamps { wrap([$class: 'AnsiColorBuildWrapper', 'colorMapName': 'XTerm']) { env.GOPATH="${WORKSPACE}" env.PATH="${env.PATH}:${env.GOPATH}/bin" def clone_dir = "${env.GOPATH}/src/github.com/Azure/acs-engine" env.HOME=clone_dir String locations_str = "${LOCATIONS}" Integer scalingDelay = SCALE_CYCLE_DELAY_MIN.toInteger() String sendTo = "${SEND_TO}".trim() Integer timeoutInMinutes = STAGE_TIMEOUT.toInteger() def autoclean="${AUTOCLEAN}" if(locations_str.equals("all")) { locations_str = "\ australiaeast australiasoutheast \ brazilsouth \ canadacentral canadaeast \ centralindia southindia \ centralus eastus2 eastus northcentralus southcentralus westcentralus westus2 westus \ eastasia southeastasia \ koreacentral koreasouth \ japaneast japanwest \ northeurope westeurope \ uksouth ukwest" } def locations = locations_str.tokenize('[ \t\n]+') dir(clone_dir) { def img = null stage('Init') { deleteDir() checkout scm img = docker.build('acs-engine-test', '--pull .') } img.inside("-u root:root") { def junit_dir = "_junit" try { String canonicalName = sh(returnStdout: true, script: 'echo "${CLUSTER_DEFINITION%.*}" | sed "s/\\//_/g"').trim() stage('Setup') { // Set up Azure sh("az login --service-principal -u ${SPN_USER} -p ${SPN_PASSWORD} --tenant ${TENANT_ID}") sh("az account set --subscription ${SUBSCRIPTION_ID}") // Create report directory sh("mkdir ${junit_dir}") // Build and test acs-engine sh('make ci') // Create template env.CLUSTER_DEFINITION = pwd()+"/examples/${CLUSTER_DEFINITION}" env.ORCHESTRATOR = sh(returnStdout: true, script: './test/step.sh get_orchestrator_type').trim() sh("printf 'acs-test%x' \$(date '+%s') > INSTANCE_NAME") env.INSTANCE_NAME = readFile('INSTANCE_NAME').trim() env.CLUSTER_SERVICE_PRINCIPAL_CLIENT_ID="${CLUSTER_SERVICE_PRINCIPAL_CLIENT_ID}" env.CLUSTER_SERVICE_PRINCIPAL_CLIENT_SECRET="${CLUSTER_SERVICE_PRINCIPAL_CLIENT_SECRET}" timeout(time: timeoutInMinutes, unit: 'MINUTES') { sh('./test/step.sh generate_template') } } for (i = 0; i ${test}/junit.xml") } sh("grep 'failures=\"0\"' ${junit_dir}/${test}/junit.xml") } } catch(exc) { env.CLEANUP = autoclean echo "Exception in [deploy ${canonicalName}/${env.LOCATION}] : ${exc}" ok = false } // Scale-up cycle try { def counts = "${AGENT_POOL_SIZES}".tokenize('[ \t\n]+') for (i = 0; i ${test}/junit.xml") } sh("grep 'failures=\"0\"' ${junit_dir}/${test}/junit.xml") } } } } catch(exc) { env.CLEANUP = autoclean echo "Exception in [scale ${canonicalName}/${env.LOCATION}] : ${exc}" ok = false } // Validate deployment try { stage("${env.LOCATION} validate") { if(ok) { env.EXPECTED_NODE_COUNT = sh(returnStdout: true, script: './test/step.sh get_node_count').trim() env.EXPECTED_ORCHESTRATOR_VERSION = sh(returnStdout: true, script: './test/step.sh get_orchestrator_release').trim() def test = "validate-${env.LOCATION}" sh("mkdir -p ${junit_dir}/${test}") sh("cp ./test/shunit/validate_deployment.sh ${junit_dir}/${test}/t.sh") timeout(time: timeoutInMinutes, unit: 'MINUTES') { sh("cd ${junit_dir}; shunit.sh -t ${test} > ${test}/junit.xml") } sh("grep 'failures=\"0\"' ${junit_dir}/${test}/junit.xml") } else { echo "Skipped verification for ${env.RESOURCE_GROUP}" } } } catch(exc) { env.CLEANUP = autoclean echo "Exception in [validate ${canonicalName}/${env.LOCATION}] : ${exc}" } // Clean up try { sh('./test/step.sh cleanup') } catch(exc) { echo "Exception ${exc}" } } // for (i = 0; i