Skip to content

Commit

Permalink
Fix Jenkins build dockerfiles with same name
Browse files Browse the repository at this point in the history
  • Loading branch information
legonigel committed Apr 11, 2019
1 parent 1d2f8f0 commit 22572d9
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ pipeline {
).trim()}"""

DOCKER_IMAGE_TAG = "panda:build-${env.BUILD_ID}"
DOCKER_NAME = "panda-test-${env.BUILD_ID}"
}
stages {
stage('Build Docker Image') {
Expand All @@ -26,7 +27,7 @@ pipeline {
lock(resource: "Pandas", inversePrecedence: true, quantity:1){
timeout(time: 60, unit: 'MINUTES') {
sh "docker stop panda-test || true && docker rm panda-test || true"
sh "docker run --name panda-test --privileged --volume /dev/bus/usb:/dev/bus/usb --volume /var/run/dbus:/var/run/dbus --net host ${env.DOCKER_IMAGE_TAG} bash -c 'cd /tmp/panda; ./run_automated_tests.sh '"
sh "docker run --name ${env.DOCKER_NAME} --privileged --volume /dev/bus/usb:/dev/bus/usb --volume /var/run/dbus:/var/run/dbus --net host ${env.DOCKER_IMAGE_TAG} bash -c 'cd /tmp/panda; ./run_automated_tests.sh '"
}
}
}
Expand All @@ -35,9 +36,9 @@ pipeline {
steps {
lock(resource: "Pandas", inversePrecedence: true, quantity:1){
timeout(time: 60, unit: 'MINUTES') {
sh "docker cp panda-test:/tmp/panda/nosetests.xml test_results_dev.xml"
sh "touch EON && docker cp EON panda-test:/EON"
sh "docker start -a panda-test"
sh "docker cp ${env.DOCKER_NAME}:/tmp/panda/nosetests.xml test_results_dev.xml"
sh "touch EON && docker cp EON ${env.DOCKER_NAME}:/EON"
sh "docker start -a ${env.DOCKER_NAME}"
}
}
}
Expand All @@ -46,8 +47,8 @@ pipeline {
post {
always {
script {
sh "docker cp panda-test:/tmp/panda/nosetests.xml test_results_EON.xml"
sh "docker rm panda-test"
sh "docker cp ${env.DOCKER_NAME}:/tmp/panda/nosetests.xml test_results_EON.xml"
sh "docker rm ${env.DOCKER_NAME}"
}
junit "test_results*.xml"
}
Expand Down

0 comments on commit 22572d9

Please sign in to comment.