From 90e6170b793c165869708626708f32e9dd6da315 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Artur=20Ku=C5=9B?= Date: Wed, 26 Mar 2025 06:51:46 +0100 Subject: [PATCH] simpler version restart jenkins + gitblit --- deploy-this/restart-docker.jenkinsfile | 19 ++++--------------- 1 file changed, 4 insertions(+), 15 deletions(-) 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 + """ } } }