Skip to content
This repository was archived by the owner on Oct 13, 2023. It is now read-only.

Commit ca10f69

Browse files
Tibor Vassandrewhsu
authored andcommitted
Jenkinsfile: ensure all containers are cleaned up
By convention, containers spawned by jenkins jobs have the name: docker-pr${BUILD_NUMBER} That works fine for jobs with a single container. This commit cleans up when multiple containers are spawned with the convention that their names share the same "docker-pr${BUILD_NUMBER}-" prefix. Signed-off-by: Tibor Vass <tibor@docker.com> (cherry picked from commit f470698c2c10c2382080fab34f83088450fabdd6) Signed-off-by: Andrew Hsu <andrewhsu@docker.com> Upstream-commit: 4b5c535be9e3b6c8f35f4072395235aaeeed96e7 Component: engine
1 parent c73dca1 commit ca10f69

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

components/engine/Jenkinsfile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -662,6 +662,8 @@ pipeline {
662662
sh '''
663663
echo "Ensuring container killed."
664664
docker rm -vf docker-pr$BUILD_NUMBER || true
665+
cids=$(docker ps -aq -f name=docker-pr${BUILD_NUMBER}-*)
666+
[ -n "$cids" ] && docker rm -vf $cids || true
665667
'''
666668

667669
sh '''

0 commit comments

Comments
 (0)