-
Notifications
You must be signed in to change notification settings - Fork 0
/
Jenkinsfile
80 lines (64 loc) · 1.77 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
#!/usr/bin/groovy
@Library('github.com/fabric8io/fabric8-pipeline-library@master')
def localItestPattern = ""
try {
localItestPattern = ITEST_PATTERN
} catch (Throwable e) {
localItestPattern = "*KT"
}
def localFailIfNoTests = ""
try {
localFailIfNoTests = ITEST_FAIL_IF_NO_TEST
} catch (Throwable e) {
localFailIfNoTests = "false"
}
def versionPrefix = ""
try {
versionPrefix = VERSION_PREFIX
} catch (Throwable e) {
versionPrefix = "2.0"
}
def canaryVersion = "2.0.${env.BUILD_NUMBER}"
def fabric8Console = "${env.FABRIC8_CONSOLE ?: ''}"
def utils = new io.fabric8.Utils()
def label = "buildpod.${env.JOB_NAME}.${env.BUILD_NUMBER}".replace('-', '_').replace('/', '_')
def envStage = utils.environmentNamespace('stage')
def envProd = utils.environmentNamespace('run')
def stashName = ""
mavenNode {
checkout scm
if (utils.isCI()){
mavenCI{}
} else if (utils.isCD()){
echo 'NOTE: running pipelines for the first time will take longer as build and base docker images are pulled onto the node'
container(name: 'maven') {
stage('Build Release')
mavenCanaryRelease {
version = canaryVersion
}
stage('Integration Testing')
mavenIntegrationTest {
environment = 'Test'
failIfNoTests = localFailIfNoTests
itestPattern = localItestPattern
}
stage('Rollout to Stage')
kubernetesApply(environment: envStage)
//stash deployments
stashName = label
stash includes: '**/*', name: stashName
}
}
node {
stage('Approve')
approve {
room = null
version = canaryVersion
console = fabric8Console
environment = 'Stage'
}
stage('Rollout to Run')
unstash stashName
kubernetesApply(environment: envProd)
}
}