-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathJenkinsfile
50 lines (44 loc) · 1.62 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
pipeline {
agent any
parameters {
string(name: 'PR_BRANCHES', defaultValue: '', description: 'Comma separated list of additional pull request branches (e.g. meta-trustx=PR-177,meta-trustx-rpi=PR-2,gyroidos_build=PR-97)')
}
stages {
stage('build GyroidOS') {
steps {
script {
REPO_NAME = determineRepoName()
if (CHANGE_TARGET != null) {
// in case this is a PR build
// set the BASE_BRANCH to the target
// e.g. PR-123 -> kirkstone
BASE_BRANCH = env.CHANGE_TARGET
} else {
// in case this is a regular build
// let the BASE_BRANCH equal this branch
// e.g. kirkstone -> kirkstone
BASE_BRANCH = env.BRANCH_NAME
}
}
build job: "../gyroidos/${BASE_BRANCH}", wait: true, parameters: [
string(name: "PR_BRANCHES", value: "${REPO_NAME}=${env.BRANCH_NAME},${env.PR_BRANCHES}"),
string(name: "GYROID_ARCH", value: "arm64"),
string(name: "GYROID_MACHINE", value: "raspberrypi3-64"),
string(name: "BUILD_INSTALLER", value: "n")
]
build job: "../gyroidos/${BASE_BRANCH}", wait: true, parameters: [
string(name: "PR_BRANCHES", value: "${REPO_NAME}=${env.BRANCH_NAME},${env.PR_BRANCHES}"),
string(name: "GYROID_ARCH", value: "arm32"),
string(name: "GYROID_MACHINE", value: "raspberrypi2"),
string(name: "BUILD_INSTALLER", value: "n")
]
}
}
}
}
// Determine the Repository name from its URL.
// Avoids hardcoding the name in every Jenkinsfile individually.
// Source: https://stackoverflow.com/a/45690925
String determineRepoName() {
return scm.getUserRemoteConfigs()[0].getUrl().tokenize('/').last().split("\\.")[0]
}