Skip to content

Commit f7aa62f

Browse files
[4.7] Create composite ci (#40)
1 parent 9957273 commit f7aa62f

File tree

1 file changed

+49
-0
lines changed

1 file changed

+49
-0
lines changed

CompositeJenkinsfile

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
PLATFORM_MASTER = 'master'
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+
}

0 commit comments

Comments
 (0)