forked from istio/old_mixer_repo
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathJenkinsfile
67 lines (58 loc) · 1.47 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
#!groovy
@Library('testutils@stable-838b134')
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) {
pullRequest(utils) {
node {
gitUtils.initialize()
bazel.setVars()
}
if (utils.runStage('PRESUBMIT')) {
presubmit(gitUtils, bazel, utils)
}
if (utils.runStage('POSTSUBMIT')) {
postsubmit(gitUtils, bazel, utils)
}
}
}
def presubmit(gitUtils, bazel, utils) {
goBuildNode(gitUtils, 'istio.io/mixer') {
bazel.updateBazelRc()
stage('Bazel Build') {
bazel.fetch('-k //...')
bazel.build('//...')
}
stage('Bazel Tests') {
bazel.test('//...')
}
stage('Code Check') {
sh('bin/linters.sh')
sh('bin/racetest.sh')
}
stage('Code Coverage') {
sh('bin/codecov.sh')
utils.publishCodeCoverage('MIXER_CODECOV_TOKEN')
}
stage('Docker Test Push') {
def images = 'mixer'
def tags = gitUtils.GIT_SHA
utils.publishDockerImagesToContainerRegistry(images, tags)
}
}
}
def postsubmit(gitUtils, bazel, utils) {
buildNode(gitUtils) {
stage('Docker Push') {
bazel.updateBazelRc()
def images = 'mixer,mixer_debug'
def tags = "${gitUtils.GIT_SHORT_SHA},\$(date +%Y-%m-%d-%H.%M.%S),latest"
utils.publishDockerImages(images, tags)
}
}
}