-
Notifications
You must be signed in to change notification settings - Fork 23
/
Copy pathJenkinsfile
71 lines (63 loc) · 2.12 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
70
71
pipeline {
agent any
options {
preserveStashes(buildCount: 1)
}
parameters {
string(name: 'PR_BRANCHES', defaultValue: '', description: 'Comma separated list of additional pull request branches (e.g. meta-trustx=PR-177,meta-trustx-nxp=PR-13,gyroidos_build=PR-97)')
string(name: 'CI_LIB_VERSION', defaultValue: 'main', description: 'Version of the gyroidos_ci_common library to be used, e.g. pull/17/head for PR-17 on gyroidos_ci_common')
}
stages {
stage('build GyroidOS') {
parallel {
stage('build x86') {
steps {
script {
REPO_NAME = determineRepoName()
BASE_BRANCH = determineBaseBranch()
}
build job: "../gyroidos/${BASE_BRANCH}", wait: true, parameters: [
string(name: "PR_BRANCHES", value: "${REPO_NAME}=${env.BRANCH_NAME},${env.PR_BRANCHES}"),
string(name: "CI_LIB_VERSION", value: "${CI_LIB_VERSION}"),
string(name: "GYROID_ARCH", value: "x86"),
string(name: "GYROID_MACHINE", value: "genericx86-64")
]
}
}
stage('build arm64') {
steps {
script {
REPO_NAME = determineRepoName()
BASE_BRANCH = determineBaseBranch()
}
build job: "../gyroidos/${BASE_BRANCH}", wait: true, parameters: [
string(name: "PR_BRANCHES", value: "${REPO_NAME}=${env.BRANCH_NAME},${env.PR_BRANCHES}"),
string(name: "CI_LIB_VERSION", value: "${CI_LIB_VERSION}"),
string(name: "GYROID_ARCH", value: "arm64"),
string(name: "GYROID_MACHINE", value: "tqma8mpxl")
]
}
}
}
}
}
}
// 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]
}
String determineBaseBranch() {
if (env.CHANGE_TARGET != null) {
// in case this is a PR build
// set the BASE_BRANCH to the target
// e.g. PR-123 -> kirkstone
return env.CHANGE_TARGET
} else {
// in case this is a regular build
// let the BASE_BRANCH equal this branch
// e.g. kirkstone -> kirkstone
return env.BRANCH_NAME
}
}