forked from istio/istio
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Jenkinsfile
84 lines (78 loc) · 2.18 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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
#!groovy
@Library('testutils@stable-5f5673a')
import org.istio.testutils.Utilities
import org.istio.testutils.GitUtilities
import org.istio.testutils.Bazel
// Utilities shared amongst modules
def gitUtils = new GitUtilities()
def utils = new Utilities()
def bazel = new Bazel()
mainFlow(utils) {
node {
gitUtils.initialize()
bazel.setVars()
}
if (utils.runStage('PRESUBMIT')) {
presubmit(gitUtils, bazel, utils)
}
if (utils.runStage('SMOKE_TEST')) {
smokeTest(gitUtils, bazel, utils)
}
}
def presubmit(gitUtils, bazel, utils) {
goBuildNode(gitUtils, 'istio.io/istio') {
bazel.updateBazelRc()
utils.initTestingCluster()
stage('Bazel Build') {
bazel.build('//...')
}
stage('Code Check') {
sh('bin/linters.sh')
}
stage('Bazel Test') {
bazel.test('//...')
}
stage('Demo Test') {
sh("tests/kubeTest.sh")
}
stage('Smoke Test') {
sh("tests/e2e.sh --logs_bucket_path ${gitUtils.logsPath()}")
}
}
}
def smokeTest(gitUtils, bazel, utils) {
goBuildNode(gitUtils, 'istio.io/istio') {
bazel.updateBazelRc()
utils.initTestingCluster()
def kubeTestArgs = ''
def e2eArgs = "--logs_bucket_path ${gitUtils.logsPath()} "
if (utils.getParam('GITHUB_PR_HEAD_SHA') != '') {
def prSha = utils.failIfNullOrEmpty(env.GITHUB_PR_HEAD_SHA)
def prUrl = utils.failIfNullOrEmpty(env.GITHUB_PR_URL)
def repo = prUrl.split('/')[4]
def hub = 'gcr.io/istio-testing'
switch (repo) {
case 'manager':
def istioctlUrl = "https://storage.googleapis.com/istio-artifacts/${prSha}/artifacts/istioctl"
kubeTestArgs = "-m ${hub},${prSha} " +
"-i ${istioctlUrl}"
e2eArgs += "--manager_hub=${hub} " +
"--manager_tag=${prSha} " +
"--istioctl_url=${istioctlUrl}"
break
case 'mixer':
kubeTestArgs = "-x ${hub},${prSha}"
e2eArgs += "--mixer_hub=${hub} " +
"--mixer_tag=${prSha}"
break
default:
break
}
}
stage('Demo Test') {
sh("tests/kubeTest.sh ${kubeTestArgs}")
}
stage('Smoke Test')
sh("tests/e2e.sh ${e2eArgs}")
}
}