This repository has been archived by the owner on Nov 28, 2024. It is now read-only.
forked from fabric8-services/fabric8-tenant
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Jenkinsfile
69 lines (60 loc) · 2.06 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
#!/usr/bin/groovy
@Library('github.com/fabric8io/fabric8-pipeline-library@master')
def utils = new io.fabric8.Utils()
def initServiceGitHash
def releaseVersion
goTemplate{
dockerNode{
ws {
checkout scm
if (utils.isCI()){
goCI{
githubOrganisation = 'fabric8-services'
dockerOrganisation = 'fabric8'
project = 'fabric8-tenant'
dockerBuildOptions = '--file Dockerfile.deploy'
}
} else if (utils.isCD()){
def v = goRelease{
githubOrganisation = 'fabric8-services'
dockerOrganisation = 'fabric8'
project = 'fabric8-tenant'
dockerBuildOptions = '--file Dockerfile.deploy'
}
releaseVersion = readFile('TEAM_VERSION').trim()
initServiceGitHash = sh(script: 'git rev-parse HEAD', returnStdout: true).toString().trim()
pushPomPropertyChangePR{
propertyName = 'init-tenant.version'
projects = [
'fabric8io/fabric8-platform'
]
version = v
containerName = 'go'
}
}
}
if (utils.isCD()){
ws{
container(name: 'go') {
def gitRepo = 'openshiftio/saas-openshiftio'
def flow = new io.fabric8.Fabric8Commands()
sh 'chmod 600 /root/.ssh-git/ssh-key'
sh 'chmod 600 /root/.ssh-git/ssh-key.pub'
sh 'chmod 700 /root/.ssh-git'
git "[email protected]:${gitRepo}"
sh "git config user.email [email protected]"
sh "git config user.name fabric8-cd"
def uid = UUID.randomUUID().toString()
def branch = "versionUpdate${uid}"
sh "git checkout -b ${branch}"
sh "sed -i -r 's/- hash: .*/- hash: ${initServiceGitHash}/g' dsaas-services/f8-tenant.yaml"
def message = "Update tenants version to ${releaseVersion}"
sh "git commit -a -m \"${message}\""
sh "git push origin ${branch}"
def prId = flow.createPullRequest(message, gitRepo, branch)
flow.mergePR(gitRepo, prId)
}
}
}
}
}