This repository has been archived by the owner on Dec 3, 2024. It is now read-only.
forked from mlz-ictrl/nicos
-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathJenkinsfile
82 lines (67 loc) · 2.22 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
72
73
74
75
76
77
78
79
80
81
82
@Library('ecdc-pipeline')
import ecdcpipeline.ContainerBuildNode
import ecdcpipeline.PipelineBuilder
project = "nicos"
container_build_nodes = [
'centos7-release': ContainerBuildNode.getDefaultContainerBuildNode('centos7-gcc11')
]
// Define number of old builds to keep.
num_artifacts_to_keep = '1'
// Set number of old builds to keep.
properties([[
$class: 'BuildDiscarderProperty',
strategy: [
$class: 'LogRotator',
artifactDaysToKeepStr: '',
artifactNumToKeepStr: num_artifacts_to_keep,
daysToKeepStr: '',
numToKeepStr: ''
]
]]);
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
}
container.copyTo(pipeline_builder.project, pipeline_builder.project)
} // stage
pipeline_builder.stage("${container.key}: Dependencies") {
def conan_remote = "ess-dmsc-local"
// Install test related stuff separately as we don't need all the other dev stuff
// Also need to install some dependencies relating to other facilities.
container.sh """
which python
python -m venv venv
. venv/bin/activate
python -m pip install --upgrade pip
python --version
python -m pip install -r ${project}/nicos_ess/requirements.txt
python -m pip install pytest pytest-timeout mock lxml Pillow
python -m pip install 'requests<2.30.0'
"""
} // stage
pipeline_builder.stage("${container.key}: Test") {
def test_output = "TestResults.xml"
container.sh """
. venv/bin/activate
cd ${project}/test
python -m pytest --junitxml=${test_output} --ignore=nicos_sinq
"""
container.copyFrom("${project}/test/${test_output}", ".")
xunit thresholds: [failed(unstableThreshold: '0')], tools: [JUnit(deleteOutputFiles: true, pattern: '*.xml', skipNoTestFiles: false, stopProcessingIfError: false)]
} // stage
} // createBuilders
node {
dir("${project}") {
scm_vars = checkout scm
}
try {
parallel builders
} catch (e) {
throw e
}
// Delete workspace when build is done
cleanWs()
}