forked from fabric8-ui/fabric8-ui
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Jenkinsfile
86 lines (77 loc) · 2.63 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
85
86
@Library('github.com/fabric8io/fabric8-pipeline-library@master')
def utils = new io.fabric8.Utils()
def flow = new io.fabric8.Fabric8Commands()
def project = 'fabric8-ui/fabric8-ui'
def ciDeploy = false
def imageName
node{
properties([
disableConcurrentBuilds()
])
}
fabric8UITemplate{
dockerNode{
timeout(time: 1, unit: 'HOURS') {
ws {
checkout scm
readTrusted 'release.groovy'
def pipeline = load 'release.groovy'
if (utils.isCI()){
container('ui'){
pipeline.ci()
}
imageName = "fabric8/fabric8-ui:SNAPSHOT-${env.BRANCH_NAME}-${env.BUILD_NUMBER}"
container('docker'){
pipeline.buildImage(imageName)
}
ciDeploy = true
} else if (utils.isCD()){
container('ui'){
pipeline.ci()
}
def v = getNewVersion {}
imageName = "fabric8/fabric8-ui:${v}"
container('docker'){
pipeline.buildImage(imageName)
}
pipeline.updateDownstreamProjects(v)
}
}
}
}
}
// deploy a snapshot fabric8-ui pod and notify pull request of details
if (ciDeploy){
def prj = 'fabric8-ui-'+ env.BRANCH_NAME
prj = prj.toLowerCase()
def route
deployOpenShiftNode(openshiftConfigSecretName: 'fabric8-intcluster-config'){
stage("deploy ${prj}"){
route = deployOpenShiftSnapshot{
mavenRepo = 'http://central.maven.org/maven2/io/fabric8/online/apps/fabric8-ui'
githubRepo = 'fabric8-ui'
originalImageName = 'registry.devshift.net/fabric8-ui/fabric8-ui'
newImageName = imageName
openShiftProject = prj
}
}
stage('notify'){
def changeAuthor = env.CHANGE_AUTHOR
if (!changeAuthor){
echo "no commit author found so cannot comment on PR"
}
def pr = env.CHANGE_ID
if (!pr){
echo "no pull request number found so cannot comment on PR"
}
def message = "@${changeAuthor} ${imageName} fabric8-ui is deployed and available for testing at https://${route}"
if (!pr){
echo message
} else {
container('clients'){
flow.addCommentToPullRequest(message, pr, project)
}
}
}
}
}