-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathJenkinsfile
66 lines (53 loc) · 1.91 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
@Library('ecdc-pipeline')
import ecdcpipeline.ContainerBuildNode
import ecdcpipeline.PipelineBuilder
project = "streaming-data-types"
container_build_nodes = [
'centos7': ContainerBuildNode.getDefaultContainerBuildNode('centos7-gcc11')
]
pipeline_builder = new PipelineBuilder(this, container_build_nodes)
pipeline_builder.activateEmailFailureNotifications()
builders = pipeline_builder.createBuilders { container ->
pipeline_builder.stage("${container.key}: checkout") {
dir(pipeline_builder.project) {
scm_vars = checkout scm
}
// Copy source code to container
container.copyTo(pipeline_builder.project, pipeline_builder.project)
} // stage
pipeline_builder.stage("${container.key}: get dependencies") {
// Rebuild flatc otherwise package from conan center remote is built against wrong version of glibc
container.sh """
mkdir build
cd build
conan install ../${project}/conanfile.txt --build=outdated --build=flatc
"""
} // stage
pipeline_builder.stage("${container.key}: test") {
container.sh """
source build/activate_run.sh
cd ${project}
jenkins/done.bash
"""
} // stage
} // create builders
def failure_function(exception_obj, failureMessage) {
def toEmails = [[$class: 'DevelopersRecipientProvider']]
emailext body: '${DEFAULT_CONTENT}\n\"' + failureMessage + '\"\n\nCheck console output at $BUILD_URL to view the results.', recipientProviders: toEmails, subject: '${DEFAULT_SUBJECT}'
throw exception_obj
}
node {
cleanWs()
stage('Checkout') {
dir("${project}") {
try {
scm_vars = checkout scm
} catch (e) {
failure_function(e, 'Checkout failed')
}
}
}
parallel builders
// Delete workspace when build is done
cleanWs()
}