Skip to content

Jenkinsfile: ensure all containers are cleaned up#39957

Merged
tiborvass merged 1 commit intomoby:masterfrom
tiborvass:jenkins-cleanup-all-containers
Sep 18, 2019
Merged

Jenkinsfile: ensure all containers are cleaned up#39957
tiborvass merged 1 commit intomoby:masterfrom
tiborvass:jenkins-cleanup-all-containers

Conversation

@tiborvass
Copy link
Contributor

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

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>
@tiborvass
Copy link
Contributor Author

This was after investigating the out of memory failures on #39911 and discovered that there was a running container from the amd64 job of #39953 which was not cleaned up.

Copy link
Contributor

@andrewhsu andrewhsu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM on green

This PR should fix the problem of having docker container with names like docker-pr1-3 slip through the cracks during cleanup:

moby/Jenkinsfile

Lines 334 to 335 in ad1b781

echo "Ensuring container killed."
docker rm -vf docker-pr$BUILD_NUMBER || true

@andrewhsu
Copy link
Contributor

I've confirmed that the changes in this PR does the thing.

Copy link
Member

@cpuguy83 cpuguy83 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants