diff --git a/deploy-this/restart-docker.jenkinsfile b/deploy-this/restart-docker.jenkinsfile index 1d2bf02..562285b 100755 --- a/deploy-this/restart-docker.jenkinsfile +++ b/deploy-this/restart-docker.jenkinsfile @@ -3,21 +3,10 @@ pipeline { stages { stage('restart docker') { steps { - sh ''' - # Get all running container IDs - ALL_CONTAINERS=$(docker ps -q) - - # Skip Jenkins and GitBlit if they exist - for container in $ALL_CONTAINERS; do - container_name=$(docker inspect --format '{{.Name}}' $container | sed 's/^\///') - if [ "$container_name" != "jenkins" ] && [ "$container_name" != "gitblit" ]; then - echo "Restarting $container_name ($container)" - docker restart $container - else - echo "Skipping $container_name" - fi - done - ''' + sh """ + docker ps -q --filter "name=jenkins" --filter "name=gitblit" --format "{{.ID}}" | \ + xargs docker restart + """ } } }