forked from Azure/azure-cli
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Jenkinsfile
70 lines (66 loc) · 2.11 KB
/
Jenkinsfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
pipeline {
agent none
triggers { cron('0 3 * * *') }
stages {
stage ('Build') {
agent { label 'linux-build' }
steps {
checkout scm
sh './scripts/jenkins_build.sh'
sh './scripts/jenkins_archive.sh'
deleteDir()
}
post {
always { deleteDir() }
}
}
stage ('Test') {
steps {
script {
def test_tasks = [:]
// Add live test tasks
def modules = ['acs', 'keyvault', 'storage', 'sql', 'role', 'vm', 'network']
for (int i = 0; i < modules.size(); ++i) {
def name = modules.get(i)
test_tasks["Live Test: ${name}"] = {
node('linux-build') {
checkout scm
withCredentials([[$class: 'UsernamePasswordMultiBinding',
credentialsId: 'AzureSDKADGraph2',
usernameVariable: 'AZURE_CLI_TEST_DEV_SP_NAME',
passwordVariable: 'AZURE_CLI_TEST_DEV_SP_PASSWORD']]) {
withCredentials([string(credentialsId: 'AzureSDKADGraph2_Tenant',
variable: 'AZURE_CLI_TEST_DEV_SP_TENANT')]) {
sh "./scripts/jenkins_live_test.sh ${name}"
}}
}
}
}
// Add performance test tasks
def platforms = ['perf-ubuntu-a0', 'perf-ubuntu-ds1']
for (int i = 0; i < platforms.size(); i++) {
platform = platforms.get(i)
test_tasks["Performance Test: ${platform}"] = perf_closure(platform)
}
test_tasks.failFast = false
parallel test_tasks
}
}
}
}
}
def perf_closure(platform) {
return {
node (platform) {
if (env.BRANCH_NAME != null && (env.BRANCH_NAME == 'master' || env.BRANCH_NAME == 'jenkins' || env.BRANCH_NAME.startsWith('performance'))) {
checkout scm
echo "Running performance test on ${platform}."
sh './scripts/jenkins_perf.sh'
deleteDir()
}
else {
echo "Skip performance test."
}
}
}
}