Merge pull request #73 from blocklayerhq/exec-dir

op: exec: fix `dir`
This commit is contained in:
Andrea Luzzardi 2021-01-25 16:43:04 -08:00 committed by GitHub
commit d06070b85a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 8 additions and 3 deletions

View File

@ -171,6 +171,8 @@ func (op *Op) Exec(ctx context.Context, fs FS, out *Fillable) (FS, error) {
opts = append(opts, llb.WithCustomName(op.v.Path().String()))
// args
opts = append(opts, llb.Args(cmd.Args))
// dir
opts = append(opts, llb.Dir(cmd.Dir))
// env
for k, v := range cmd.Env {
opts = append(opts, llb.AddEnv(k, v))

View File

@ -7,7 +7,10 @@ package testing
},
{
do: "exec"
args: ["sh", "-c", "echo should not succeed"]
args: ["sh", "-c", """
echo "pwd is: $(pwd)"
[ "$(pwd)" == "/thisisnonexistent" ] || exit 1
"""]
dir: "/thisisnonexistent"
},
]

View File

@ -88,9 +88,9 @@ test::exec(){
test::one "Exec: env with overlay" --exit=0 \
"$dagger" "${DAGGER_BINARY_ARGS[@]}" compute --input 'bar: "overlay environment"' "$d"/exec/env/overlay
disable test::one "Exec: non existent dir (FIXME https://github.com/blocklayerhq/dagger/issues/30)" --exit=0 --stdout={} \
test::one "Exec: non existent dir" --exit=0 --stdout={} \
"$dagger" "${DAGGER_BINARY_ARGS[@]}" compute "$d"/exec/dir/doesnotexist
disable test::one "Exec: valid dir (FIXME https://github.com/blocklayerhq/dagger/issues/30)" --exit=0 --stdout={} \
test::one "Exec: valid dir" --exit=0 --stdout={} \
"$dagger" "${DAGGER_BINARY_ARGS[@]}" compute "$d"/exec/dir/exist
}