forked from istio/istio
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Jenkinsfile
77 lines (71 loc) · 2.16 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
#!groovy
@Library('testutils@stable-41b0bf6')
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('Build and Checks') {
sh('bin/linters.sh')
}
stage('Bazel Test') {
bazel.test('//...')
}
stage('Smoke Test') {
def logHost = 'stackdriver'
def projID = utils.failIfNullOrEmpty(env.PROJECT)
def e2eArgs = "--logs_bucket_path ${gitUtils.logsPath()} --log_provider=${logHost} --project_id=${projID} "
sh("tests/e2e.sh ${e2eArgs}")
}
}
}
def smokeTest(gitUtils, bazel, utils) {
goBuildNode(gitUtils, 'istio.io/istio') {
bazel.updateBazelRc()
utils.initTestingCluster()
def logHost = 'stackdriver'
def projID = utils.failIfNullOrEmpty(env.PROJECT)
def e2eArgs = "--logs_bucket_path ${gitUtils.logsPath()} --log_provider=${logHost} --project_id=${projID} "
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 'pilot':
def istioctlUrl = "https://storage.googleapis.com/istio-artifacts/${repo}/${prSha}/artifacts/istioctl"
e2eArgs += "--pilot_hub=${hub} " +
"--pilot_tag=${prSha} " +
"--istioctl_url=${istioctlUrl}"
break
case 'mixer':
e2eArgs += "--mixer_hub=${hub} " +
"--mixer_tag=${prSha}"
break
default:
break
}
}
stage('Smoke Test') {
sh("tests/e2e.sh ${e2eArgs}")
}
}
}