forked from fabric8io/fabric8-pipeline-library
-
Notifications
You must be signed in to change notification settings - Fork 0
/
release.groovy
48 lines (33 loc) · 1.27 KB
/
release.groovy
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
#!/usr/bin/groovy
import io.fabric8.Fabric8Commands
def tagDownstreamRepos() {
def flow = new Fabric8Commands()
def newVersion
setWorkspace('fabric8io/fabric8-pipeline-library')
newVersion = getJenkinsVersion()
container(name: 'clients') {
println "Pushing Pipeline Library tag ${newVersion}"
flow.pushTag(newVersion)
}
git 'https://github.com/fabric8io/fabric8-jenkinsfile-library.git'
setWorkspace('fabric8io/fabric8-jenkinsfile-library')
container(name: 'clients') {
def uid = UUID.randomUUID().toString()
sh "git checkout -b versionUpdate${uid}"
sh "find -type f -name 'Jenkinsfile' | xargs sed -i -r 's/library@([0-9][0-9]{0,2}.[0-9][0-9]{0,2}(.[0-9][0-9]{0,2})|master)/library@v${newVersion}/g'"
sh "git commit -a -m 'Updated Jenkinsfiles with new library version ${newVersion}'"
println "Pushing Jenkinsfile Library tag ${newVersion}"
flow.pushTag(newVersion)
}
}
def getJenkinsVersion() {
def m = readMavenPom file: 'pom.xml'
def v = m.properties['fabric8.devops.version']
return v
}
def setWorkspace(String project) {
sh "git remote set-url origin git@github.com:${project}.git"
def flow = new Fabric8Commands()
flow.setupGitSSH()
}
return this