-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathJenkinsfile
52 lines (52 loc) · 1.59 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
pipeline {
agent any
environment {
branch = BRANCH_NAME.replaceAll('/','-')
job_name = JOB_NAME.replaceAll(' ','_').replaceAll('/','-').replaceAll('%2F','-')
container_name = "xml_unittests_${job_name}_${branch}_${BUILD_ID}_${GIT_COMMIT}"
}
stages {
stage("Pre-build cleanup") {
steps {
sh """
git clean -dxf
"""
}
}
stage("Create results directory") {
steps {
sh """
mkdir -p ${WORKSPACE}/tests/results
chmod 777 ${WORKSPACE}/tests/results
"""
}
}
stage("Pull down the docker image") {
steps {
script {
sh """
docker pull lsstts/robot:latest
"""
}
}
}
stage("Run the unit tests") {
steps {
script {
sh """
docker run --name ${container_name} -di --rm -v ${WORKSPACE}:/home/saluser/trunk/ts_xml -w /home/saluser/trunk/ts_xml lsstts/robot:latest
docker exec -u saluser -w /home/saluser/trunk/ts_xml ${container_name} sh -c "python3 -m pip install .[test] && \
pytest -ra -o junit_family=xunit2 --junitxml=tests/results/results.xml"
docker stop ${container_name}
echo "Test complete"
"""
}
}
}
}
post {
always {
junit 'tests/results/results.xml'
}
}
}