-
Notifications
You must be signed in to change notification settings - Fork 3
/
Jenkinsfile
36 lines (32 loc) · 1.23 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
pipeline {
environment {
// This registry is important for removing the image after the tests
registry = "fernaperg/cv2tools"
}
agent any
stages {
stage("Test") {
steps {
script {
// Building the Docker image
dockerImage = docker.build registry + ":$BUILD_NUMBER"
try {
dockerImage.inside() {
// Extracting the PROJECTDIR environment variable from inside the container
def PROJECTDIR = sh(script: 'echo \$PROJECTDIR', returnStdout: true).trim()
// Copying the project tests into our workspace
sh "cp -r '$PROJECTDIR/test' '$WORKSPACE'"
// Running the tests inside the new directory
dir("$WORKSPACE/test") {
sh "python -m unittest"
}
}
} finally {
// Removing the docker image
sh "docker rmi $registry:$BUILD_NUMBER"
}
}
}
}
}
}