File tree Expand file tree Collapse file tree 1 file changed +49
-0
lines changed Expand file tree Collapse file tree 1 file changed +49
-0
lines changed Original file line number Diff line number Diff line change
1
+ PLATFORM_MASTER = 'master-4.5'
2
+
3
+ pipeline {
4
+ // by default run on the master node, since it's the only one with direct repo access
5
+ agent { label 'master' }
6
+ options {
7
+ // no checkout needed
8
+ skipDefaultCheckout()
9
+ buildDiscarder(logRotator(numToKeepStr: '100'))
10
+ timestamps()
11
+ }
12
+ stages {
13
+ stage('Update commit id in the composite repo') {
14
+ steps {
15
+ script {
16
+ commitToHiveMQCompositeRepo()
17
+ }
18
+ }
19
+ }
20
+ }
21
+ post {
22
+ cleanup {
23
+ cleanWs()
24
+ }
25
+ }
26
+ }
27
+
28
+ private void commitToHiveMQCompositeRepo() {
29
+ def projectName = determineProjectName()
30
+ def branchName = env.BRANCH_NAME
31
+ def url = determineRepoUrl()
32
+ sh("git clone git@github.com:hivemq/hivemq.git --branch=$PLATFORM_MASTER")
33
+ dir("hivemq/") {
34
+ sh("./tooling/reportScmChange.sh $branchName $url $projectName")
35
+ }
36
+ }
37
+
38
+ private String determineProjectName() {
39
+ return scm.getUserRemoteConfigs()[0].getUrl().tokenize('/').last().split("\\.")[0]
40
+ }
41
+
42
+ private String determineRepoUrl() {
43
+ String repo = scm.userRemoteConfigs[0].url
44
+ if (repo.startsWith("https://github.com/")) {
45
+ return repo.replaceFirst("https://github.com/", "git@github.com:")
46
+ } else {
47
+ return repo
48
+ }
49
+ }
You can’t perform that action at this time.
0 commit comments