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

monitor: on-error: support long-form for allowing configuring the container #1917

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

ktock
Copy link
Collaborator

@ktock ktock commented Jun 27, 2023

This commit introduces type=on-error option to the long form of --invoke.
This allows users specifying shell command (default is /bin/sh) to run in the container with on-error mode.

Short form of on-error (/bin/sh is launched):

$ BUILDX_EXPERIMENTAL=1 /tmp/out/buildx build --progress=plain --invoke on-error /tmp/ctx4
...
Launching interactive container. Press Ctrl-a-c to switch to monitor console
Interactive container was restarted with process "xx3sxqjypyforw6zhbuegfu0q". Press Ctrl-a-c to switch to the new container
# ps auxww
USER         PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMAND
root           1  0.2  0.0   2888   984 pts/0    Ss   12:33   0:00 /bin/sh
root           7  0.0  0.0   7060  1556 pts/0    R+   12:34   0:00 ps auxww

Long form of on-error (bash is launched):

$ BUILDX_EXPERIMENTAL=1 /tmp/out/buildx build --progress=plain --invoke 'type=on-error,args=bash' /tmp/ctx4
...
Launching interactive container. Press Ctrl-a-c to switch to monitor console
Interactive container was restarted with process "oi0qk0guub5e5qp9kogiit8te". Press Ctrl-a-c to switch to the new container
root@buildkitsandbox:/# ps auxww
USER         PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMAND
root           1  0.6  0.0   4628  3604 pts/0    Ss   12:36   0:00 bash
root           9  0.0  0.0   7060  1552 pts/0    R+   12:37   0:00 ps auxww

Signed-off-by: Kohei Tokunaga <ktokunaga.mail@gmail.com>
Signed-off-by: Kohei Tokunaga <ktokunaga.mail@gmail.com>
@tonistiigi
Copy link
Member

@ktock Has this been superseded by other PRs that are already merged?

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.

2 participants