This repository has been archived by the owner on Mar 19, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 66
/
release.groovy
105 lines (83 loc) · 3.43 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
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
95
96
97
98
99
100
101
102
103
104
105
#!/usr/bin/groovy
def stage(){
return stageProject{
project = 'fabric8io/fabric8-platform'
useGitTagForNextVersion = true
}
}
def approveRelease(project){
def releaseVersion = project[1]
approve{
room = null
version = releaseVersion
console = null
environment = 'fabric8'
}
}
def release(project){
releaseProject{
stagedProject = project
useGitTagForNextVersion = true
helmPush = false
groupId = 'io.fabric8.platform.distro'
githubOrganisation = 'fabric8io'
artifactIdToWatchInCentral = 'distro'
artifactExtensionToWatchInCentral = 'pom'
promoteToDockerRegistry = 'docker.io'
dockerOrganisation = 'fabric8'
imagesToPromoteToDockerHub = []
extraImagesToTag = null
}
}
def approve(project){
def releaseVersion = project[1]
def stagedPlatformKube = "https://oss.sonatype.org/content/repositories/staging/io/fabric8/platform/packages/fabric8-platform/${releaseVersion}/fabric8-platform-${releaseVersion}-kubernetes.yml"
def stagedPlatformOpenShift = "https://oss.sonatype.org/content/repositories/staging/io/fabric8/platform/packages/fabric8-platform/${releaseVersion}/fabric8-platform-${releaseVersion}-openshift.yml"
def proceedMessage = """
The fabric8-platform is available for QA. Please review and approve.
minishift
curl ${stagedPlatformOpenShift} > fabric8-platform-${releaseVersion}-openshift.yml
gofabric8 start --minishift --package=fabric8-platform-${releaseVersion}-openshift.yml
minikube
curl ${stagedPlatformKube} > fabric8-platform-${releaseVersion}-kubernetes.yml
gofabric8 start --package=fabric8-platform-${releaseVersion}-kubernetes.yml
Once all the pods have started you can run a system test via:
git clone https://github.com/fabric8io/fabric8-forge.git
cd fabric8-forge
./systest.sh
More details on the system tests: https://github.com/fabric8io/fabric8-forge/blob/master/fabric8-forge-rest-client/ReadMe.md
Approve release?
"""
hubotApprove message: proceedMessage, room: 'release'
def id = approveRequestedEvent(app: "${env.JOB_NAME}", environment: 'community')
try {
input id: 'Proceed', message: "\n${proceedMessage}"
} catch (err) {
approveReceivedEvent(id: id, approved: false)
throw err
}
approveReceivedEvent(id: id, approved: true)
}
def promoteYamls(releaseVersion) {
def cwd=sh(script: 'pwd', returnStdout: true).trim()
container(name: 'clients') {
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]:fabric8io/fabric8-resources.git'
sh "git config user.email [email protected]"
sh "git config user.name fabric8-cd"
def uid = UUID.randomUUID().toString()
sh "git checkout -b versionUpdate${uid}"
sh "cp ${cwd}/packages/fabric8-system/target/classes/META-INF/fabric8/kubernetes.yml fabric8-system.yml"
sh "cp ${cwd}/packages/fabric8-system/target/classes/META-INF/fabric8/openshift.yml fabric8-system-openshift.yml"
def message = "Update fabric8-system YAMLs to version ${releaseVersion}"
sh "git add *.yml"
sh "git commit -a -m \"${message}\""
sh "git push origin versionUpdate${uid}"
def prId = flow.createPullRequest(message,'fabric8io/fabric8-resources',"versionUpdate${uid}")
flow.mergePR('fabric8io/fabric8-resources',prId)
}
}
return this;