-
Notifications
You must be signed in to change notification settings - Fork 386
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
RUN --interactive #833
RUN --interactive #833
Conversation
…CKER (because its confusing how it works)
@@ -147,6 +147,9 @@ func (c *Converter) fromTarget(ctx context.Context, targetName string, platform | |||
if err != nil { | |||
return errors.Wrapf(err, "apply build %s", depTarget.String()) | |||
} | |||
if mts.Final.RanInteractive { | |||
return errors.New("Cannot FROM a target ending with an --interactive") | |||
} |
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.
This check was needed because we wouldn't otherwise fail on this case, since the FROM
that should fail is technically already evaluated:
test:
FROM alpine:3.13
RUN apk add bash
RUN --interactive type=ephemeral bash
from-interactive:
FROM +test
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.
This looks great!
The only comment I have is regarding that type
switch. It feels very wordy for the user to remember. I would go with your first alternative, but have one as "the default".
Alternative 1: Two args, --interactive-save / --interactive-ephemeral that bake this into the arg itself
I would do --interactive
(this is the ephemeral one) and --interactive-keep
(save has a somewhat different meaning in other places of Earthly).
…es since they are more internal now.
I did this. Plus allowed |
Executive Summary:
Allows interactive sessions at the ends of builds; with the option to persist those changes into the result or not.
Example uses:
General:
In
WITH DOCKER
:In a
--push
:Of note, ephemeral sessions are evaluated at the end; much like Images and Artifacts. This is to avoid logging interruptions, and avoid other parallelization issues (see the new
InteractiveSession
struct and its similarities toSave(Image/Artifact)
. Saved sessions are evaluated inline and do not suffer from this issue.Invalid, but tempting things you may attempt:
LOCALLY
. Just open an new shell, why would you do this?--interactive
sessions within a single invocationIF
-like statement by hiding one in a--push
--interactive
FROM
-ing a target with an--interactive
type
arg. This is because I can't "undo" parsing the next token as part of the interactive sessions arguments; which lead to weird syntax (--interactive --
) or accidentally stealing the first part of the command.--interactive-save
/--interactive-ephemeral
that bake this into the arg itself--interactive
and--omit
to instruct it to ignore the stateRUN
-like full command; and has options--save
or--omit
(default)--strict
is present or implied.Later Ideas:
NewContainer
buildkit API. This would require an equal, but different set of hacks.Things Left To Do: