New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ci: Prune dangling images on RESTART_CI_DOCKER_BEFORE_RUN #27777
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -42,7 +42,9 @@ if [ -z "$DANGER_RUN_CI_ON_HOST" ]; then | |||||
|
||||||
if [ -n "${RESTART_CI_DOCKER_BEFORE_RUN}" ] ; then | ||||||
echo "Restart docker before run to stop and clear all containers started with --rm" | ||||||
systemctl restart docker | ||||||
podman container kill --all # Similar to "systemctl restart docker" | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Looks like this doesn't work some of the time:
|
||||||
echo "Prune all dangling images" | ||||||
docker image prune --force | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Would it be prudent to use the
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do dangling image (layer)s have a label? Anyway, this isn't for local runs, only for the persistent runners, guarded via There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Yeah they do, just tested it to confirm.
Fair enough, looks like this is unlikely to be hit locally. I don't think renaming to There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ok, could make sense in a follow-up to apply the label to both places and then unguard the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done in #27793 |
||||||
fi | ||||||
|
||||||
# shellcheck disable=SC2086 | ||||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure this works? Even though the CLIs have a compatible syntax, I think they operate on their own set of resources. I'm pretty sure
podman ps
right before this line won't show anything, so I think no containers are killed after this line? At least, that's what I get when I try locally spinning up a container withdocker run
and then try to show/kill it withpodman ps
orpodman container kill --all
.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I already switched all machines to
podman-docker
, because it is not possible to installdocker.io
andpodman-docker
at the same time. Sodocker run
is actually just an alias forpodman run
.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay, I can't comment on that. Since there is no mention of
podman
anywhere else in the codebase/documentation, I think this may make maintaining the CI more opaque, but perhaps that's an okay tradeoff.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I don't expect anyone to use
RESTART_CI_DOCKER_BEFORE_RUN
beside the persistent workers, so it is an undocumented setting. Anyone using it is expected to infer the documentation from the two echo calls and two lines of code.