Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions earthfile2llb/converter.go
Original file line number Diff line number Diff line change
Expand Up @@ -2559,7 +2559,7 @@ func (c *Converter) internalRun(ctx context.Context, opts ConvertRunOpts) (pllb.
}
}

if opts.shellWrap == nil {
if opts.shellWrap == nil && opts.WithShell {
opts.shellWrap = withShellAndEnvVars
}

Expand Down Expand Up @@ -2753,7 +2753,10 @@ func (c *Converter) internalRun(ctx context.Context, opts ConvertRunOpts) (pllb.
// Shell and debugger wrap.
prependDebugger := !opts.Locally

finalArgs = opts.shellWrap(finalArgs, extraEnvVars, opts.WithShell, prependDebugger, isInteractive)
if opts.WithShell {
finalArgs = opts.shellWrap(finalArgs, extraEnvVars, opts.WithShell, prependDebugger, isInteractive)
}

if opts.NoCache {
// llb.IgnoreCache is not always enough; we will force a different cache key as a work-around
finalArgs = append(finalArgs, "#"+uuid.NewString())
Expand Down
4 changes: 4 additions & 0 deletions tests/Earthfile
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ ga-no-qemu-group4:
BUILD +end-comment
BUILD +file-copying
BUILD +run-no-cache
BUILD +run-exec-form-test
BUILD +save-artifact-file-as-dot
BUILD +save-artifact-dir-as-dot
BUILD +save-artifact-force-overwrite
Expand Down Expand Up @@ -803,6 +804,9 @@ gen-dockerfile-test:
comments-test:
DO +RUN_EARTHLY --earthfile=comments.earth --extra_args="--no-output" --target=+test

run-exec-form-test:
DO +RUN_EARTHLY --earthfile=run-exec-form.earth --extra_args="--no-output" --target=+test-exec-form-run

chown-test:
RUN echo "test" > ./a.txt
DO +RUN_EARTHLY --earthfile=chown.earth --target=+test
Expand Down
5 changes: 5 additions & 0 deletions tests/run-exec-form.earth
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
VERSION 0.8
FROM gcr.io/distroless/python3-debian13@sha256:6a4de1cbdac6b94b74b71a33298a9c7fed918161ff686bd501bfe9454113ae58

test-exec-form-run:
RUN ["python3", "--version"]
Loading