This repository has been archived by the owner on May 7, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 18
/
Copy pathJenkinsfile
94 lines (82 loc) · 2.9 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
87
88
89
90
91
92
93
94
@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-runtime-console'
def ciDeploy = false
def tempVersion
def imageName
node{
properties([
disableConcurrentBuilds()
])
}
fabric8UITemplate{
dockerNode{
ws {
if (utils.isCI()){
checkout scm
readTrusted 'release.groovy'
def pipeline = load 'release.groovy'
container('ui'){
pipeline.ci()
}
container('ui'){
tempVersion = pipeline.ciBuildDownstreamProject(project)
}
imageName = "fabric8/fabric8-ui:${tempVersion}"
container('docker'){
pipeline.buildImage(imageName)
}
ciDeploy = true
} else if (utils.isCD()){
git "https://github.com/${project}.git"
readTrusted 'release.groovy'
sh "git remote set-url origin [email protected]:${project}.git"
def pipeline = load 'release.groovy'
def branch
def published
def releaseVersion
container('ui'){
pipeline.ci()
branch = utils.getBranch()
published = pipeline.cd(branch)
releaseVersion = utils.getLatestVersionFromTag()
}
if (published){
pipeline.updateDownstreamProjects(releaseVersion)
}
}
}
}
}
// 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){
error "no commit author found so cannot comment on PR"
}
def pr = env.CHANGE_ID
if (!pr){
error "no pull request number found so cannot comment on PR"
}
def message = "@${changeAuthor} ${imageName} is deployed and available for testing at https://${route}"
container('clients'){
flow.addCommentToPullRequest(message, pr, project)
}
}
}
}