-
Notifications
You must be signed in to change notification settings - Fork 10
Expand file tree
/
Copy pathJenkinsfile
More file actions
191 lines (189 loc) · 7.72 KB
/
Jenkinsfile
File metadata and controls
191 lines (189 loc) · 7.72 KB
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
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
@Library('jenkins-shared-libraries') _
def ENV_LOC=[:]
def EXTRA_ARGS = [
'linux-apdfl-rocky-x64-samples': ' ',
'linux-armv8-apdfl-samples': ' ',
'mac-apdfl-samples': ' ',
'mac-arm-apdfl-samples': ' ',
'sparcsolaris-apdfl-samples': ' ',
'windows-apdfl-samples': ' ',
'windows-ARM-apdfl-samples': ' ',
]
pipeline {
parameters {
choice(name: 'PLATFORM_FILTER', choices: ['all', 'mac-apdfl-samples', 'mac-arm-apdfl-samples', 'linux-armv8-apdfl-samples', 'linux-apdfl-rocky-x64-samples', 'windows-apdfl-samples', 'windows-ARM-apdfl-samples'], description: 'Run on specific platform')
}
options{
timeout(time: 1, unit: "HOURS")
}
agent none
triggers {
parameterizedCron(env.BRANCH_NAME == "develop" ? "0 8 * * *" : "")
}
stages {
stage('Matrix stage') {
matrix {
agent {
label "${NODE}"
}
when { anyOf {
expression { params.PLATFORM_FILTER == 'all' }
expression { params.PLATFORM_FILTER == env.NODE }
} }
axes {
axis {
name 'NODE'
values 'mac-apdfl-samples', 'mac-arm-apdfl-samples', 'linux-armv8-apdfl-samples', 'windows-apdfl-samples', 'windows-ARM-apdfl-samples', 'linux-apdfl-rocky-x64-samples'
}
axis {
name 'BITS'
values '64', '32'
}
}
excludes {
exclude {
axis {
name 'NODE'
values 'mac-apdfl-samples', 'mac-arm-apdfl-samples', 'linux-armv8-apdfl-samples', 'windows-ARM-apdfl-samples', 'linux-apdfl-rocky-x64-samples'
}
axis {
name 'BITS'
values '32'
}
}
}
environment {
CONAN_HOME = "${WORKSPACE}/.conan2"
CONAN_NON_INTERACTIVE = '1'
CONAN_PRINT_RUN_COMMANDS = '1'
CONAN_LOGIN_USERNAME='devauto'
CONAN_PASSWORD=credentials('jfrog-dev-token')
// Disable FileTracker on Windows, which can give FTK1011 on long path names
TRACKFILEACCESS = 'false'
// Disable node reuse, which gives intermittent build errors on Windows
MSBUILDDISABLENODEREUSE = '1'
SKIPPLATFORM = setSkipPlatform(NODE)
}
stages {
stage('Remove Conan local cache') {
when {
not { changeRequest() }
}
steps {
script {
if (isUnix()) {
sh "rm -rf ${WORKSPACE}/.conan2"
} else {
bat "if exist ${WORKSPACE}\\.conan2\\ rmdir/s/q ${WORKSPACE}\\.conan2"
}
}
}
}
stage('Set-Up Environment') {
when {
expression { "${SKIPPLATFORM}" == 'false' }
}
steps {
printPlatformNameInStep()
echo "Set-Up Environment ${NODE} ${BITS}"
script {
ENV_LOC["${NODE}_${BITS}"] = mkenv()
}
}
}
stage('Clean') {
when {
expression { "${SKIPPLATFORM}" == 'false' }
}
steps {
echo "Bootstrap ${NODE} ${BITS}"
script {
if (isUnix()) {
sh """. ${ENV_LOC["${NODE}_${BITS}"]}/bin/activate
unset LIBPATH
invoke distclean
"""
} else {
bat """CALL ${ENV_LOC["${NODE}_${BITS}"]}\\Scripts\\activate
invoke distclean
"""
}
}
}
}
stage('Bootstrap') {
when {
expression { "${SKIPPLATFORM}" == 'false' }
}
steps {
echo "Bootstrap ${NODE} ${BITS}"
script {
bootstrapConfigs([licenseManaged: "False",
pythonEnv: "${ENV_LOC["${NODE}_${BITS}"]}",
buildType: "Release",
extraArguments: "${EXTRA_ARGS[NODE]}"])
}
}
}
stage('Build & Run') {
when {
expression { "${SKIPPLATFORM}" == 'false' }
}
steps {
echo "Build ${NODE} ${BITS}"
script {
if (isUnix()) {
sh """. ${ENV_LOC["${NODE}_${BITS}"]}/bin/activate
unset LIBPATH
invoke build --config Release${EXTRA_ARGS[NODE]}
"""
} else {
bat """CALL ${ENV_LOC["${NODE}_${BITS}"]}\\Scripts\\activate
invoke build --config Release${EXTRA_ARGS[NODE]}
"""
}
}
}
}
}
}
}
}
post {
unsuccessful {
script {
if (env.CHANGE_ID == null) { // i.e. not a pull request; those notify in GitHub
slackSend(channel: "#apdfl-18",
message: "Unsuccessful build: ${env.JOB_NAME} ${env.BUILD_NUMBER} (<${env.BUILD_URL}|Open>)",
color: "danger")
}
}
}
fixed {
script {
if (env.CHANGE_ID == null) { // i.e. not a pull request; those notify in GitHub
slackSend(channel: "#apdfl-18",
message: "Build is now working: ${env.JOB_NAME} ${env.BUILD_NUMBER} (<${env.BUILD_URL}|Open>)",
color: "good")
}
}
}
}
}
//AIX will only run if specific from the platform filter in the Jenkins UI.
def setSkipPlatform(String node) {
if ("${node}" == 'aix-apdfl-samples') {
if (params.PLATFORM_FILTER == 'aix-apdfl-samples') {
return 'false'
}
return 'true'
}
return 'false'
}
void printPlatformNameInStep() {
script {
stage("${node} - ${bits}") {
echo "Building: ${node}"
}
}
}