diff --git a/jobs/templates/swh-build-docker-image.groovy.j2 b/jobs/templates/swh-build-docker-image.groovy.j2 --- a/jobs/templates/swh-build-docker-image.groovy.j2 +++ b/jobs/templates/swh-build-docker-image.groovy.j2 @@ -41,13 +41,19 @@ "--pull --no-cache -f docker/Dockerfile --label ${image_label} docker" ) } + stage ('Test image') { + sh "make -C tests test" + } stage ('Push image') { docker.withRegistry(registry_url, dockerCredentialsKeyID) { dockerImage.push() } } - stage ('Clean up workspace and images') { - cleanWs() - sh "docker image ls -q --filter label=${image_label} | uniq | xargs -r -t docker rmi --force" + post { + always { + cleanWs() + # Clean up local image resulting from that jenkins build + sh "docker image ls -q --filter label=${image_label} | uniq | xargs -r -t docker rmi --force" + } } }