diff --git a/Jenkinsfile b/Jenkinsfile index 61fc12e5aa..efc859f3e2 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -332,7 +332,8 @@ pipeline { always { sh ''' echo "Ensuring container killed." - docker rm -vf docker-pr$BUILD_NUMBER || true + cids=$(docker ps -aq -f name=docker-pr${BUILD_NUMBER}-*) + [ -n "$cids" ] && docker rm -vf $cids || true ''' sh ''' @@ -701,8 +702,6 @@ pipeline { sh ''' echo "Ensuring container killed." docker rm -vf docker-pr$BUILD_NUMBER || true - cids=$(docker ps -aq -f name=docker-pr${BUILD_NUMBER}-*) - [ -n "$cids" ] && docker rm -vf $cids || true ''' sh '''