Skip to content
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

Pass argument '--rm' to avoid wkdev-create container name collission #59

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

dpino
Copy link
Member

@dpino dpino commented Sep 30, 2024

Follow-up to d347129.

Command wkdev-create allows passing argument --rm which stops and removes a container in case it already exists. This can be useful to avoid the container name collission, instead of creating a temporal name for the container and stopping and removing it late.

To avoid the home directory collission, wkdev-create can delete the home directory in case it already exists and create-home was passed as an argument.

@dpino
Copy link
Member Author

dpino commented Sep 30, 2024

I'm not sure about this change. What happens if two processes are running this step simultaneously? Giving an unique name to each container guarantees isolation. Perhaps what it makes sense is to have a wkdev-remove command to remove a container (and home directory) in a clean way.

@TingPing
Copy link
Member

I think switching to a tmp dir instead of based on date sounds fine.

@dpino dpino marked this pull request as draft October 1, 2024 09:16
@@ -85,6 +85,10 @@ process_command_line_arguments() {
host_hostname="$(hostnamectl hostname)"
container_hostname="$(basename "${container_name}").${host_hostname}"

if argsparse_is_option_set "create-home" && -d "${container_user_home}"; then
rm -rf "${container_user_home}"
Copy link
Member

Choose a reason for hiding this comment

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

I was always afraid about adding an option that does an rm -rf :-)

Copy link
Member Author

Choose a reason for hiding this comment

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

I think we need a counterpart of wkdev-create but to remove a container.

Now in the runner there's:

$ podman ps
CONTAINER ID  IMAGE                            COMMAND               CREATED      STATUS          PORTS       NAMES
97f83258b59f  ghcr.io/igalia/wkdev-sdk:latest  /wkdev-sdk/script...  3 weeks ago  Up 3 weeks ago              wkdev-1727468367
fa1c67dc62f4  ghcr.io/igalia/wkdev-sdk:latest  /wkdev-sdk/script...  3 weeks ago  Up 4 days ago               wkdev

For some reason, the temporal container wkdev-1727468367 was not removed.

Copy link
Member

Choose a reason for hiding this comment

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

We usually used podman rm directly. However, I'm not objecting to a wkdev-destroy script.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants