-
Notifications
You must be signed in to change notification settings - Fork 14
/
Jenkinsfile
56 lines (47 loc) · 1.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
#!groovy
@Library('testutils@stable-41b0bf6')
import org.istio.testutils.Utilities
import org.istio.testutils.GitUtilities
// Utilities shared amongst modules
def gitUtils = new GitUtilities()
def utils = new Utilities()
mainFlow(utils) {
node {
gitUtils.initialize()
}
// PR on every branch
if (utils.runStage('PRESUBMIT')) {
presubmit(gitUtils)
}
// Postsubmit from every branch
if (utils.runStage('POSTSUBMIT')) {
postsubmit(gitUtils, utils)
}
}
def checkJekyll() {
sh('docker run --rm --label=jekyll --volume=\$(pwd):/srv/jekyll ' +
'jekyll/jekyll sh -c "bundle install && rake test"')
}
def pushDocs(utils) {
projectId = utils.getParam('FIREBASE_PROJECT_ID')
release = utils.getParam('MINOR_RELEASE')
if (projectId == '' || release == '') {
return
}
withEnv("PROJECT_ID=${projectId}", "RELEASE=${release}") {
withCredentials([string(credentialsId: FIREBASE_TOKEN, variable: 'FIREBASE_TOKEN')]) {
sh('scripts/build.sh')
}
}
}
def presubmit(gitUtils) {
defaultNode(gitUtils) {
checkJekyll()
}
}
def postsubmit(gitUtils, utils) {
defaultNode(gitUtils) {
checkJekyll()
pushDocs(utils)
}
}