status
stringclasses 1
value | repo_name
stringclasses 31
values | repo_url
stringclasses 31
values | issue_id
int64 1
104k
| title
stringlengths 4
233
| body
stringlengths 0
186k
β | issue_url
stringlengths 38
56
| pull_url
stringlengths 37
54
| before_fix_sha
stringlengths 40
40
| after_fix_sha
stringlengths 40
40
| report_datetime
timestamp[us, tz=UTC] | language
stringclasses 5
values | commit_datetime
timestamp[us, tz=UTC] | updated_file
stringlengths 7
188
| chunk_content
stringlengths 1
1.03M
|
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 3,218 |
Don't pollute host stdout/stderr
|
## Problem
In cloak (0.3) the Dagger engine is embedded in a host program (script or tool), which instruments it to run pipelines.
Currently the dagger engine prints all its output to the standard output of the engine, which is inherited from the host program. The result is that dagger "takes over" the standard output of its host, which is not desirable.
## Solution
When a program is run that embeds the dagger engine, the output of the dagger engine should not pollute the host program's standard output and error streams. Instead, all useful outputs from running a pipeline should be available to the host program by making API calls.
|
https://github.com/dagger/dagger/issues/3218
|
https://github.com/dagger/dagger/pull/3339
|
e9d449ce1b41198eab1bdc980b6bbcf788fc8f16
|
79bed0e2bf2d317e57ab5b51899690f39ffdc66e
| 2022-10-03T22:41:44Z |
go
| 2022-10-31T18:01:11Z |
engine/engine.go
|
func (AnyDirSource) LookupDir(name string) (filesync.SyncedDir, bool) {
return filesync.SyncedDir{
Dir: name,
Map: func(p string, st *fstypes.Stat) bool {
st.Uid = 0
st.Gid = 0
return true
},
}, true
}
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 3,551 |
π Odd container behavior with exec / multiple withMountedDirectory
|
### What is the issue?
The following code executes but provides unexpected logs / output. Other similar use cases error due to missing files due to same issue. This may be something very simple (haven't used golang in many years) but seems like there may be an underlying issue with the execution engine.
I would expect this code to run the `ls` command twice, one time showing the two mounted directories, one time showing the root output. Instead in the logs I see `ls` with d1 and d2 (expected), an `ls` with just d1 (??), and then an `ls` with the root fs. This causes issues if the first ls is changed to `ls /example/d2` as it will error the whole pipeline due to missing path.
```golang
workdir := client.Host().Workdir()
d1, err := workdir.Read().Directory("dir1/").ID(ctx)
if err != nil {
return err
}
d2, err := workdir.Read().Directory("dir2/").ID(ctx)
if err != nil {
return err
}
build := client.Container().From("alpine:latest").
WithMountedDirectory("/example/d1", d1).
WithMountedDirectory("/example/d2", d2)
build = build.Exec(dagger.ContainerExecOpts{
Args: []string{"ls", "/example"},
})
_, err = build.ExitCode(ctx)
if err != nil {
return err
}
build = build.Exec(dagger.ContainerExecOpts{
Args: []string{"ls", "/"},
})
_, err = build.ExitCode(ctx)
if err != nil {
return err
}
```
I was able to get the same functionality working fine by using `fs, err := build.FS().WithDirectory(d1, "/example/d1").WithDirectory(d2, "/example/d2").ID(ctx); build = build.WithFS(fs);` so conceptually don't think I'm doing anything wrong.
### Log output
```
#1 resolve image config for docker.io/library/alpine:latest
#1 DONE 0.4s
#2 mkfile /Dockerfile
#2 DONE 0.0s
#3 mkfile /main.go
#3 CACHED
#4 [internal] load metadata for docker.io/library/golang:1.18.2-alpine
#4 DONE 0.1s
#5 local://__dagger_workdir_/home/plaisted/source/OSD.PJI-Temporary/repro
#5 DONE 0.0s
#6 local://__dagger_workdir_/home/plaisted/source/OSD.PJI-Temporary/repro
#6 transferring __dagger_workdir_/home/plaisted/source/OSD.PJI-Temporary/repro: 309B done
#6 DONE 0.0s
#7 [build 1/6] FROM docker.io/library/golang:1.18.2-alpine@sha256:4795c5d21f01e0777707ada02408debe77fe31848be97cf9fa8a1462da78d949
#7 resolve docker.io/library/golang:1.18.2-alpine@sha256:4795c5d21f01e0777707ada02408debe77fe31848be97cf9fa8a1462da78d949 0.0s done
#7 DONE 0.0s
#8 [build 3/6] RUN apk add --no-cache file git
#8 CACHED
#9 [build 4/6] RUN go mod init go.dagger.io/dagger/shim/cmd
#9 CACHED
#10 [build 2/6] WORKDIR /src
#10 CACHED
#11 [build 5/6] COPY . .
#11 CACHED
#12 [build 6/6] RUN CGO_ENABLED=0 go build -o /_shim -ldflags '-s -d -w' .
#12 CACHED
#13 [stage-1 1/1] COPY --from=build /_shim /_shim
#13 CACHED
#14 mkdir /meta
#14 CACHED
#15 copy / /
#15 DONE 0.0s
#16 docker-image://docker.io/library/alpine:latest
#16 resolve docker.io/library/alpine:latest
#16 resolve docker.io/library/alpine:latest 0.1s done
#16 CACHED
#17 copy / /
#17 CACHED
#18 ls /example
#18 0.157 d1
#18 0.157 d2
#18 DONE 0.2s
#1 resolve image config for docker.io/library/alpine:latest
#1 DONE 0.5s
#4 [internal] load metadata for docker.io/library/golang:1.18.2-alpine
#4 DONE 0.4s
#19 ls /example
#19 0.172 d1
#19 DONE 0.2s
#20 ls /
#20 0.105 _shim
#20 0.105 bin
#20 0.105 dagger
#20 0.105 dev
#20 0.105 etc
#20 0.105 example
#20 0.105 home
#20 0.105 lib
#20 0.105 media
#20 0.105 mnt
#20 0.105 opt
#20 0.105 proc
#20 0.105 root
#20 0.105 run
#20 0.105 sbin
#20 0.105 srv
#20 0.105 sys
#20 0.105 tmp
#20 0.105 usr
#20 0.105 var
#20 DONE 0.1s
#0 0.148 d1
#0 0.148 d2
#18 DONE 0.2s
#1 resolve image config for docker.io/library/alpine:latest
#1 DONE 0.4s
#4 [internal] load metadata for docker.io/library/golang:1.18.2-alpine
#4 DONE 0.4s
#19 ls /example
#0 0.135 d1
#19 DONE 0.2s
#20 ls /example
#0 0.104 d1
#0 0.104 d2
#20 DONE 0.1s
```
### Steps to reproduce
* Mount two directories
* Run multiple exec commands and observe logs output
### Dagger version
dagger v0.3.1
### OS version
Ubuntu-20.04
|
https://github.com/dagger/dagger/issues/3551
|
https://github.com/dagger/dagger/pull/3602
|
b734ed35554bbfbc5caf63674eaa9c22692e614e
|
b4bb0b9e06e1edf8b81f9054b7419daabcb5bedb
| 2022-10-26T01:16:16Z |
go
| 2022-10-31T22:13:34Z |
core/container.go
|
package core
import (
"context"
"encoding/json"
"fmt"
"path"
"path/filepath"
"strconv"
"strings"
"github.com/containerd/containerd/platforms"
"github.com/dagger/dagger/core/shim"
"github.com/docker/distribution/reference"
bkclient "github.com/moby/buildkit/client"
"github.com/moby/buildkit/client/llb"
"github.com/moby/buildkit/exporter/containerimage/exptypes"
dockerfilebuilder "github.com/moby/buildkit/frontend/dockerfile/builder"
bkgw "github.com/moby/buildkit/frontend/gateway/client"
"github.com/moby/buildkit/solver/pb"
"github.com/opencontainers/go-digest"
specs "github.com/opencontainers/image-spec/specs-go/v1"
"github.com/pkg/errors"
)
type Container struct {
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 3,551 |
π Odd container behavior with exec / multiple withMountedDirectory
|
### What is the issue?
The following code executes but provides unexpected logs / output. Other similar use cases error due to missing files due to same issue. This may be something very simple (haven't used golang in many years) but seems like there may be an underlying issue with the execution engine.
I would expect this code to run the `ls` command twice, one time showing the two mounted directories, one time showing the root output. Instead in the logs I see `ls` with d1 and d2 (expected), an `ls` with just d1 (??), and then an `ls` with the root fs. This causes issues if the first ls is changed to `ls /example/d2` as it will error the whole pipeline due to missing path.
```golang
workdir := client.Host().Workdir()
d1, err := workdir.Read().Directory("dir1/").ID(ctx)
if err != nil {
return err
}
d2, err := workdir.Read().Directory("dir2/").ID(ctx)
if err != nil {
return err
}
build := client.Container().From("alpine:latest").
WithMountedDirectory("/example/d1", d1).
WithMountedDirectory("/example/d2", d2)
build = build.Exec(dagger.ContainerExecOpts{
Args: []string{"ls", "/example"},
})
_, err = build.ExitCode(ctx)
if err != nil {
return err
}
build = build.Exec(dagger.ContainerExecOpts{
Args: []string{"ls", "/"},
})
_, err = build.ExitCode(ctx)
if err != nil {
return err
}
```
I was able to get the same functionality working fine by using `fs, err := build.FS().WithDirectory(d1, "/example/d1").WithDirectory(d2, "/example/d2").ID(ctx); build = build.WithFS(fs);` so conceptually don't think I'm doing anything wrong.
### Log output
```
#1 resolve image config for docker.io/library/alpine:latest
#1 DONE 0.4s
#2 mkfile /Dockerfile
#2 DONE 0.0s
#3 mkfile /main.go
#3 CACHED
#4 [internal] load metadata for docker.io/library/golang:1.18.2-alpine
#4 DONE 0.1s
#5 local://__dagger_workdir_/home/plaisted/source/OSD.PJI-Temporary/repro
#5 DONE 0.0s
#6 local://__dagger_workdir_/home/plaisted/source/OSD.PJI-Temporary/repro
#6 transferring __dagger_workdir_/home/plaisted/source/OSD.PJI-Temporary/repro: 309B done
#6 DONE 0.0s
#7 [build 1/6] FROM docker.io/library/golang:1.18.2-alpine@sha256:4795c5d21f01e0777707ada02408debe77fe31848be97cf9fa8a1462da78d949
#7 resolve docker.io/library/golang:1.18.2-alpine@sha256:4795c5d21f01e0777707ada02408debe77fe31848be97cf9fa8a1462da78d949 0.0s done
#7 DONE 0.0s
#8 [build 3/6] RUN apk add --no-cache file git
#8 CACHED
#9 [build 4/6] RUN go mod init go.dagger.io/dagger/shim/cmd
#9 CACHED
#10 [build 2/6] WORKDIR /src
#10 CACHED
#11 [build 5/6] COPY . .
#11 CACHED
#12 [build 6/6] RUN CGO_ENABLED=0 go build -o /_shim -ldflags '-s -d -w' .
#12 CACHED
#13 [stage-1 1/1] COPY --from=build /_shim /_shim
#13 CACHED
#14 mkdir /meta
#14 CACHED
#15 copy / /
#15 DONE 0.0s
#16 docker-image://docker.io/library/alpine:latest
#16 resolve docker.io/library/alpine:latest
#16 resolve docker.io/library/alpine:latest 0.1s done
#16 CACHED
#17 copy / /
#17 CACHED
#18 ls /example
#18 0.157 d1
#18 0.157 d2
#18 DONE 0.2s
#1 resolve image config for docker.io/library/alpine:latest
#1 DONE 0.5s
#4 [internal] load metadata for docker.io/library/golang:1.18.2-alpine
#4 DONE 0.4s
#19 ls /example
#19 0.172 d1
#19 DONE 0.2s
#20 ls /
#20 0.105 _shim
#20 0.105 bin
#20 0.105 dagger
#20 0.105 dev
#20 0.105 etc
#20 0.105 example
#20 0.105 home
#20 0.105 lib
#20 0.105 media
#20 0.105 mnt
#20 0.105 opt
#20 0.105 proc
#20 0.105 root
#20 0.105 run
#20 0.105 sbin
#20 0.105 srv
#20 0.105 sys
#20 0.105 tmp
#20 0.105 usr
#20 0.105 var
#20 DONE 0.1s
#0 0.148 d1
#0 0.148 d2
#18 DONE 0.2s
#1 resolve image config for docker.io/library/alpine:latest
#1 DONE 0.4s
#4 [internal] load metadata for docker.io/library/golang:1.18.2-alpine
#4 DONE 0.4s
#19 ls /example
#0 0.135 d1
#19 DONE 0.2s
#20 ls /example
#0 0.104 d1
#0 0.104 d2
#20 DONE 0.1s
```
### Steps to reproduce
* Mount two directories
* Run multiple exec commands and observe logs output
### Dagger version
dagger v0.3.1
### OS version
Ubuntu-20.04
|
https://github.com/dagger/dagger/issues/3551
|
https://github.com/dagger/dagger/pull/3602
|
b734ed35554bbfbc5caf63674eaa9c22692e614e
|
b4bb0b9e06e1edf8b81f9054b7419daabcb5bedb
| 2022-10-26T01:16:16Z |
go
| 2022-10-31T22:13:34Z |
core/container.go
|
ID ContainerID `json:"id"`
}
type ContainerID string
func (id ContainerID) decode() (*containerIDPayload, error) {
if id == "" {
return &containerIDPayload{}, nil
}
var payload containerIDPayload
if err := decodeID(&payload, id); err != nil {
return nil, err
}
return &payload, nil
}
type containerIDPayload struct {
FS *pb.Definition `json:"fs"`
Config specs.ImageConfig `json:"cfg"`
Mounts []ContainerMount `json:"mounts,omitempty"`
Meta *pb.Definition `json:"meta,omitempty"`
Platform specs.Platform `json:"platform,omitempty"`
Secrets []ContainerSecret `json:"secret_env,omitempty"`
}
type ContainerSecret struct {
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 3,551 |
π Odd container behavior with exec / multiple withMountedDirectory
|
### What is the issue?
The following code executes but provides unexpected logs / output. Other similar use cases error due to missing files due to same issue. This may be something very simple (haven't used golang in many years) but seems like there may be an underlying issue with the execution engine.
I would expect this code to run the `ls` command twice, one time showing the two mounted directories, one time showing the root output. Instead in the logs I see `ls` with d1 and d2 (expected), an `ls` with just d1 (??), and then an `ls` with the root fs. This causes issues if the first ls is changed to `ls /example/d2` as it will error the whole pipeline due to missing path.
```golang
workdir := client.Host().Workdir()
d1, err := workdir.Read().Directory("dir1/").ID(ctx)
if err != nil {
return err
}
d2, err := workdir.Read().Directory("dir2/").ID(ctx)
if err != nil {
return err
}
build := client.Container().From("alpine:latest").
WithMountedDirectory("/example/d1", d1).
WithMountedDirectory("/example/d2", d2)
build = build.Exec(dagger.ContainerExecOpts{
Args: []string{"ls", "/example"},
})
_, err = build.ExitCode(ctx)
if err != nil {
return err
}
build = build.Exec(dagger.ContainerExecOpts{
Args: []string{"ls", "/"},
})
_, err = build.ExitCode(ctx)
if err != nil {
return err
}
```
I was able to get the same functionality working fine by using `fs, err := build.FS().WithDirectory(d1, "/example/d1").WithDirectory(d2, "/example/d2").ID(ctx); build = build.WithFS(fs);` so conceptually don't think I'm doing anything wrong.
### Log output
```
#1 resolve image config for docker.io/library/alpine:latest
#1 DONE 0.4s
#2 mkfile /Dockerfile
#2 DONE 0.0s
#3 mkfile /main.go
#3 CACHED
#4 [internal] load metadata for docker.io/library/golang:1.18.2-alpine
#4 DONE 0.1s
#5 local://__dagger_workdir_/home/plaisted/source/OSD.PJI-Temporary/repro
#5 DONE 0.0s
#6 local://__dagger_workdir_/home/plaisted/source/OSD.PJI-Temporary/repro
#6 transferring __dagger_workdir_/home/plaisted/source/OSD.PJI-Temporary/repro: 309B done
#6 DONE 0.0s
#7 [build 1/6] FROM docker.io/library/golang:1.18.2-alpine@sha256:4795c5d21f01e0777707ada02408debe77fe31848be97cf9fa8a1462da78d949
#7 resolve docker.io/library/golang:1.18.2-alpine@sha256:4795c5d21f01e0777707ada02408debe77fe31848be97cf9fa8a1462da78d949 0.0s done
#7 DONE 0.0s
#8 [build 3/6] RUN apk add --no-cache file git
#8 CACHED
#9 [build 4/6] RUN go mod init go.dagger.io/dagger/shim/cmd
#9 CACHED
#10 [build 2/6] WORKDIR /src
#10 CACHED
#11 [build 5/6] COPY . .
#11 CACHED
#12 [build 6/6] RUN CGO_ENABLED=0 go build -o /_shim -ldflags '-s -d -w' .
#12 CACHED
#13 [stage-1 1/1] COPY --from=build /_shim /_shim
#13 CACHED
#14 mkdir /meta
#14 CACHED
#15 copy / /
#15 DONE 0.0s
#16 docker-image://docker.io/library/alpine:latest
#16 resolve docker.io/library/alpine:latest
#16 resolve docker.io/library/alpine:latest 0.1s done
#16 CACHED
#17 copy / /
#17 CACHED
#18 ls /example
#18 0.157 d1
#18 0.157 d2
#18 DONE 0.2s
#1 resolve image config for docker.io/library/alpine:latest
#1 DONE 0.5s
#4 [internal] load metadata for docker.io/library/golang:1.18.2-alpine
#4 DONE 0.4s
#19 ls /example
#19 0.172 d1
#19 DONE 0.2s
#20 ls /
#20 0.105 _shim
#20 0.105 bin
#20 0.105 dagger
#20 0.105 dev
#20 0.105 etc
#20 0.105 example
#20 0.105 home
#20 0.105 lib
#20 0.105 media
#20 0.105 mnt
#20 0.105 opt
#20 0.105 proc
#20 0.105 root
#20 0.105 run
#20 0.105 sbin
#20 0.105 srv
#20 0.105 sys
#20 0.105 tmp
#20 0.105 usr
#20 0.105 var
#20 DONE 0.1s
#0 0.148 d1
#0 0.148 d2
#18 DONE 0.2s
#1 resolve image config for docker.io/library/alpine:latest
#1 DONE 0.4s
#4 [internal] load metadata for docker.io/library/golang:1.18.2-alpine
#4 DONE 0.4s
#19 ls /example
#0 0.135 d1
#19 DONE 0.2s
#20 ls /example
#0 0.104 d1
#0 0.104 d2
#20 DONE 0.1s
```
### Steps to reproduce
* Mount two directories
* Run multiple exec commands and observe logs output
### Dagger version
dagger v0.3.1
### OS version
Ubuntu-20.04
|
https://github.com/dagger/dagger/issues/3551
|
https://github.com/dagger/dagger/pull/3602
|
b734ed35554bbfbc5caf63674eaa9c22692e614e
|
b4bb0b9e06e1edf8b81f9054b7419daabcb5bedb
| 2022-10-26T01:16:16Z |
go
| 2022-10-31T22:13:34Z |
core/container.go
|
Secret SecretID `json:"secret"`
EnvName string `json:"env,omitempty"`
MountPath string `json:"path,omitempty"`
}
func (payload *containerIDPayload) Encode() (ContainerID, error) {
id, err := encodeID(payload)
if err != nil {
return "", err
}
return ContainerID(id), nil
}
func (payload *containerIDPayload) FSState() (llb.State, error) {
if payload.FS == nil {
return llb.Scratch(), nil
}
return defToState(payload.FS)
}
const metaMount = "/.dagger_meta_mount"
const metaSourcePath = "meta"
func (payload *containerIDPayload) MetaState() (*llb.State, error) {
if payload.Meta == nil {
return nil, nil
}
metaSt, err := defToState(payload.Meta)
if err != nil {
return nil, err
}
return &metaSt, nil
}
type ContainerMount struct {
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 3,551 |
π Odd container behavior with exec / multiple withMountedDirectory
|
### What is the issue?
The following code executes but provides unexpected logs / output. Other similar use cases error due to missing files due to same issue. This may be something very simple (haven't used golang in many years) but seems like there may be an underlying issue with the execution engine.
I would expect this code to run the `ls` command twice, one time showing the two mounted directories, one time showing the root output. Instead in the logs I see `ls` with d1 and d2 (expected), an `ls` with just d1 (??), and then an `ls` with the root fs. This causes issues if the first ls is changed to `ls /example/d2` as it will error the whole pipeline due to missing path.
```golang
workdir := client.Host().Workdir()
d1, err := workdir.Read().Directory("dir1/").ID(ctx)
if err != nil {
return err
}
d2, err := workdir.Read().Directory("dir2/").ID(ctx)
if err != nil {
return err
}
build := client.Container().From("alpine:latest").
WithMountedDirectory("/example/d1", d1).
WithMountedDirectory("/example/d2", d2)
build = build.Exec(dagger.ContainerExecOpts{
Args: []string{"ls", "/example"},
})
_, err = build.ExitCode(ctx)
if err != nil {
return err
}
build = build.Exec(dagger.ContainerExecOpts{
Args: []string{"ls", "/"},
})
_, err = build.ExitCode(ctx)
if err != nil {
return err
}
```
I was able to get the same functionality working fine by using `fs, err := build.FS().WithDirectory(d1, "/example/d1").WithDirectory(d2, "/example/d2").ID(ctx); build = build.WithFS(fs);` so conceptually don't think I'm doing anything wrong.
### Log output
```
#1 resolve image config for docker.io/library/alpine:latest
#1 DONE 0.4s
#2 mkfile /Dockerfile
#2 DONE 0.0s
#3 mkfile /main.go
#3 CACHED
#4 [internal] load metadata for docker.io/library/golang:1.18.2-alpine
#4 DONE 0.1s
#5 local://__dagger_workdir_/home/plaisted/source/OSD.PJI-Temporary/repro
#5 DONE 0.0s
#6 local://__dagger_workdir_/home/plaisted/source/OSD.PJI-Temporary/repro
#6 transferring __dagger_workdir_/home/plaisted/source/OSD.PJI-Temporary/repro: 309B done
#6 DONE 0.0s
#7 [build 1/6] FROM docker.io/library/golang:1.18.2-alpine@sha256:4795c5d21f01e0777707ada02408debe77fe31848be97cf9fa8a1462da78d949
#7 resolve docker.io/library/golang:1.18.2-alpine@sha256:4795c5d21f01e0777707ada02408debe77fe31848be97cf9fa8a1462da78d949 0.0s done
#7 DONE 0.0s
#8 [build 3/6] RUN apk add --no-cache file git
#8 CACHED
#9 [build 4/6] RUN go mod init go.dagger.io/dagger/shim/cmd
#9 CACHED
#10 [build 2/6] WORKDIR /src
#10 CACHED
#11 [build 5/6] COPY . .
#11 CACHED
#12 [build 6/6] RUN CGO_ENABLED=0 go build -o /_shim -ldflags '-s -d -w' .
#12 CACHED
#13 [stage-1 1/1] COPY --from=build /_shim /_shim
#13 CACHED
#14 mkdir /meta
#14 CACHED
#15 copy / /
#15 DONE 0.0s
#16 docker-image://docker.io/library/alpine:latest
#16 resolve docker.io/library/alpine:latest
#16 resolve docker.io/library/alpine:latest 0.1s done
#16 CACHED
#17 copy / /
#17 CACHED
#18 ls /example
#18 0.157 d1
#18 0.157 d2
#18 DONE 0.2s
#1 resolve image config for docker.io/library/alpine:latest
#1 DONE 0.5s
#4 [internal] load metadata for docker.io/library/golang:1.18.2-alpine
#4 DONE 0.4s
#19 ls /example
#19 0.172 d1
#19 DONE 0.2s
#20 ls /
#20 0.105 _shim
#20 0.105 bin
#20 0.105 dagger
#20 0.105 dev
#20 0.105 etc
#20 0.105 example
#20 0.105 home
#20 0.105 lib
#20 0.105 media
#20 0.105 mnt
#20 0.105 opt
#20 0.105 proc
#20 0.105 root
#20 0.105 run
#20 0.105 sbin
#20 0.105 srv
#20 0.105 sys
#20 0.105 tmp
#20 0.105 usr
#20 0.105 var
#20 DONE 0.1s
#0 0.148 d1
#0 0.148 d2
#18 DONE 0.2s
#1 resolve image config for docker.io/library/alpine:latest
#1 DONE 0.4s
#4 [internal] load metadata for docker.io/library/golang:1.18.2-alpine
#4 DONE 0.4s
#19 ls /example
#0 0.135 d1
#19 DONE 0.2s
#20 ls /example
#0 0.104 d1
#0 0.104 d2
#20 DONE 0.1s
```
### Steps to reproduce
* Mount two directories
* Run multiple exec commands and observe logs output
### Dagger version
dagger v0.3.1
### OS version
Ubuntu-20.04
|
https://github.com/dagger/dagger/issues/3551
|
https://github.com/dagger/dagger/pull/3602
|
b734ed35554bbfbc5caf63674eaa9c22692e614e
|
b4bb0b9e06e1edf8b81f9054b7419daabcb5bedb
| 2022-10-26T01:16:16Z |
go
| 2022-10-31T22:13:34Z |
core/container.go
|
Source *pb.Definition `json:"source,omitempty"`
SourcePath string `json:"source_path,omitempty"`
Target string `json:"target"`
CacheID string `json:"cache_id,omitempty"`
CacheSharingMode string `json:"cache_sharing,omitempty"`
Tmpfs bool `json:"tmpfs,omitempty"`
}
func (mnt ContainerMount) SourceState() (llb.State, error) {
if mnt.Source == nil {
return llb.Scratch(), nil
}
return defToState(mnt.Source)
}
func (container *Container) From(ctx context.Context, gw bkgw.Client, addr string, platform specs.Platform) (*Container, error) {
refName, err := reference.ParseNormalizedNamed(addr)
if err != nil {
return nil, err
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 3,551 |
π Odd container behavior with exec / multiple withMountedDirectory
|
### What is the issue?
The following code executes but provides unexpected logs / output. Other similar use cases error due to missing files due to same issue. This may be something very simple (haven't used golang in many years) but seems like there may be an underlying issue with the execution engine.
I would expect this code to run the `ls` command twice, one time showing the two mounted directories, one time showing the root output. Instead in the logs I see `ls` with d1 and d2 (expected), an `ls` with just d1 (??), and then an `ls` with the root fs. This causes issues if the first ls is changed to `ls /example/d2` as it will error the whole pipeline due to missing path.
```golang
workdir := client.Host().Workdir()
d1, err := workdir.Read().Directory("dir1/").ID(ctx)
if err != nil {
return err
}
d2, err := workdir.Read().Directory("dir2/").ID(ctx)
if err != nil {
return err
}
build := client.Container().From("alpine:latest").
WithMountedDirectory("/example/d1", d1).
WithMountedDirectory("/example/d2", d2)
build = build.Exec(dagger.ContainerExecOpts{
Args: []string{"ls", "/example"},
})
_, err = build.ExitCode(ctx)
if err != nil {
return err
}
build = build.Exec(dagger.ContainerExecOpts{
Args: []string{"ls", "/"},
})
_, err = build.ExitCode(ctx)
if err != nil {
return err
}
```
I was able to get the same functionality working fine by using `fs, err := build.FS().WithDirectory(d1, "/example/d1").WithDirectory(d2, "/example/d2").ID(ctx); build = build.WithFS(fs);` so conceptually don't think I'm doing anything wrong.
### Log output
```
#1 resolve image config for docker.io/library/alpine:latest
#1 DONE 0.4s
#2 mkfile /Dockerfile
#2 DONE 0.0s
#3 mkfile /main.go
#3 CACHED
#4 [internal] load metadata for docker.io/library/golang:1.18.2-alpine
#4 DONE 0.1s
#5 local://__dagger_workdir_/home/plaisted/source/OSD.PJI-Temporary/repro
#5 DONE 0.0s
#6 local://__dagger_workdir_/home/plaisted/source/OSD.PJI-Temporary/repro
#6 transferring __dagger_workdir_/home/plaisted/source/OSD.PJI-Temporary/repro: 309B done
#6 DONE 0.0s
#7 [build 1/6] FROM docker.io/library/golang:1.18.2-alpine@sha256:4795c5d21f01e0777707ada02408debe77fe31848be97cf9fa8a1462da78d949
#7 resolve docker.io/library/golang:1.18.2-alpine@sha256:4795c5d21f01e0777707ada02408debe77fe31848be97cf9fa8a1462da78d949 0.0s done
#7 DONE 0.0s
#8 [build 3/6] RUN apk add --no-cache file git
#8 CACHED
#9 [build 4/6] RUN go mod init go.dagger.io/dagger/shim/cmd
#9 CACHED
#10 [build 2/6] WORKDIR /src
#10 CACHED
#11 [build 5/6] COPY . .
#11 CACHED
#12 [build 6/6] RUN CGO_ENABLED=0 go build -o /_shim -ldflags '-s -d -w' .
#12 CACHED
#13 [stage-1 1/1] COPY --from=build /_shim /_shim
#13 CACHED
#14 mkdir /meta
#14 CACHED
#15 copy / /
#15 DONE 0.0s
#16 docker-image://docker.io/library/alpine:latest
#16 resolve docker.io/library/alpine:latest
#16 resolve docker.io/library/alpine:latest 0.1s done
#16 CACHED
#17 copy / /
#17 CACHED
#18 ls /example
#18 0.157 d1
#18 0.157 d2
#18 DONE 0.2s
#1 resolve image config for docker.io/library/alpine:latest
#1 DONE 0.5s
#4 [internal] load metadata for docker.io/library/golang:1.18.2-alpine
#4 DONE 0.4s
#19 ls /example
#19 0.172 d1
#19 DONE 0.2s
#20 ls /
#20 0.105 _shim
#20 0.105 bin
#20 0.105 dagger
#20 0.105 dev
#20 0.105 etc
#20 0.105 example
#20 0.105 home
#20 0.105 lib
#20 0.105 media
#20 0.105 mnt
#20 0.105 opt
#20 0.105 proc
#20 0.105 root
#20 0.105 run
#20 0.105 sbin
#20 0.105 srv
#20 0.105 sys
#20 0.105 tmp
#20 0.105 usr
#20 0.105 var
#20 DONE 0.1s
#0 0.148 d1
#0 0.148 d2
#18 DONE 0.2s
#1 resolve image config for docker.io/library/alpine:latest
#1 DONE 0.4s
#4 [internal] load metadata for docker.io/library/golang:1.18.2-alpine
#4 DONE 0.4s
#19 ls /example
#0 0.135 d1
#19 DONE 0.2s
#20 ls /example
#0 0.104 d1
#0 0.104 d2
#20 DONE 0.1s
```
### Steps to reproduce
* Mount two directories
* Run multiple exec commands and observe logs output
### Dagger version
dagger v0.3.1
### OS version
Ubuntu-20.04
|
https://github.com/dagger/dagger/issues/3551
|
https://github.com/dagger/dagger/pull/3602
|
b734ed35554bbfbc5caf63674eaa9c22692e614e
|
b4bb0b9e06e1edf8b81f9054b7419daabcb5bedb
| 2022-10-26T01:16:16Z |
go
| 2022-10-31T22:13:34Z |
core/container.go
|
}
ref := reference.TagNameOnly(refName).String()
_, cfgBytes, err := gw.ResolveImageConfig(ctx, ref, llb.ResolveImageConfigOpt{
Platform: &platform,
ResolveMode: llb.ResolveModeDefault.String(),
})
if err != nil {
return nil, err
}
var imgSpec specs.Image
if err := json.Unmarshal(cfgBytes, &imgSpec); err != nil {
return nil, err
}
dir, err := NewDirectory(ctx, llb.Image(addr), "/", platform)
if err != nil {
return nil, err
}
ctr, err := container.WithFS(ctx, dir, platform)
if err != nil {
return nil, err
}
return ctr.UpdateImageConfig(ctx, func(specs.ImageConfig) specs.ImageConfig {
return imgSpec.Config
})
}
const defaultDockerfileName = "Dockerfile"
func (container *Container) Build(ctx context.Context, gw bkgw.Client, context *Directory, dockerfile string, platform specs.Platform) (*Container, error) {
payload, err := container.ID.decode()
if err != nil {
return nil, err
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 3,551 |
π Odd container behavior with exec / multiple withMountedDirectory
|
### What is the issue?
The following code executes but provides unexpected logs / output. Other similar use cases error due to missing files due to same issue. This may be something very simple (haven't used golang in many years) but seems like there may be an underlying issue with the execution engine.
I would expect this code to run the `ls` command twice, one time showing the two mounted directories, one time showing the root output. Instead in the logs I see `ls` with d1 and d2 (expected), an `ls` with just d1 (??), and then an `ls` with the root fs. This causes issues if the first ls is changed to `ls /example/d2` as it will error the whole pipeline due to missing path.
```golang
workdir := client.Host().Workdir()
d1, err := workdir.Read().Directory("dir1/").ID(ctx)
if err != nil {
return err
}
d2, err := workdir.Read().Directory("dir2/").ID(ctx)
if err != nil {
return err
}
build := client.Container().From("alpine:latest").
WithMountedDirectory("/example/d1", d1).
WithMountedDirectory("/example/d2", d2)
build = build.Exec(dagger.ContainerExecOpts{
Args: []string{"ls", "/example"},
})
_, err = build.ExitCode(ctx)
if err != nil {
return err
}
build = build.Exec(dagger.ContainerExecOpts{
Args: []string{"ls", "/"},
})
_, err = build.ExitCode(ctx)
if err != nil {
return err
}
```
I was able to get the same functionality working fine by using `fs, err := build.FS().WithDirectory(d1, "/example/d1").WithDirectory(d2, "/example/d2").ID(ctx); build = build.WithFS(fs);` so conceptually don't think I'm doing anything wrong.
### Log output
```
#1 resolve image config for docker.io/library/alpine:latest
#1 DONE 0.4s
#2 mkfile /Dockerfile
#2 DONE 0.0s
#3 mkfile /main.go
#3 CACHED
#4 [internal] load metadata for docker.io/library/golang:1.18.2-alpine
#4 DONE 0.1s
#5 local://__dagger_workdir_/home/plaisted/source/OSD.PJI-Temporary/repro
#5 DONE 0.0s
#6 local://__dagger_workdir_/home/plaisted/source/OSD.PJI-Temporary/repro
#6 transferring __dagger_workdir_/home/plaisted/source/OSD.PJI-Temporary/repro: 309B done
#6 DONE 0.0s
#7 [build 1/6] FROM docker.io/library/golang:1.18.2-alpine@sha256:4795c5d21f01e0777707ada02408debe77fe31848be97cf9fa8a1462da78d949
#7 resolve docker.io/library/golang:1.18.2-alpine@sha256:4795c5d21f01e0777707ada02408debe77fe31848be97cf9fa8a1462da78d949 0.0s done
#7 DONE 0.0s
#8 [build 3/6] RUN apk add --no-cache file git
#8 CACHED
#9 [build 4/6] RUN go mod init go.dagger.io/dagger/shim/cmd
#9 CACHED
#10 [build 2/6] WORKDIR /src
#10 CACHED
#11 [build 5/6] COPY . .
#11 CACHED
#12 [build 6/6] RUN CGO_ENABLED=0 go build -o /_shim -ldflags '-s -d -w' .
#12 CACHED
#13 [stage-1 1/1] COPY --from=build /_shim /_shim
#13 CACHED
#14 mkdir /meta
#14 CACHED
#15 copy / /
#15 DONE 0.0s
#16 docker-image://docker.io/library/alpine:latest
#16 resolve docker.io/library/alpine:latest
#16 resolve docker.io/library/alpine:latest 0.1s done
#16 CACHED
#17 copy / /
#17 CACHED
#18 ls /example
#18 0.157 d1
#18 0.157 d2
#18 DONE 0.2s
#1 resolve image config for docker.io/library/alpine:latest
#1 DONE 0.5s
#4 [internal] load metadata for docker.io/library/golang:1.18.2-alpine
#4 DONE 0.4s
#19 ls /example
#19 0.172 d1
#19 DONE 0.2s
#20 ls /
#20 0.105 _shim
#20 0.105 bin
#20 0.105 dagger
#20 0.105 dev
#20 0.105 etc
#20 0.105 example
#20 0.105 home
#20 0.105 lib
#20 0.105 media
#20 0.105 mnt
#20 0.105 opt
#20 0.105 proc
#20 0.105 root
#20 0.105 run
#20 0.105 sbin
#20 0.105 srv
#20 0.105 sys
#20 0.105 tmp
#20 0.105 usr
#20 0.105 var
#20 DONE 0.1s
#0 0.148 d1
#0 0.148 d2
#18 DONE 0.2s
#1 resolve image config for docker.io/library/alpine:latest
#1 DONE 0.4s
#4 [internal] load metadata for docker.io/library/golang:1.18.2-alpine
#4 DONE 0.4s
#19 ls /example
#0 0.135 d1
#19 DONE 0.2s
#20 ls /example
#0 0.104 d1
#0 0.104 d2
#20 DONE 0.1s
```
### Steps to reproduce
* Mount two directories
* Run multiple exec commands and observe logs output
### Dagger version
dagger v0.3.1
### OS version
Ubuntu-20.04
|
https://github.com/dagger/dagger/issues/3551
|
https://github.com/dagger/dagger/pull/3602
|
b734ed35554bbfbc5caf63674eaa9c22692e614e
|
b4bb0b9e06e1edf8b81f9054b7419daabcb5bedb
| 2022-10-26T01:16:16Z |
go
| 2022-10-31T22:13:34Z |
core/container.go
|
}
ctxPayload, err := context.ID.Decode()
if err != nil {
return nil, err
}
opts := map[string]string{
"platform": platforms.Format(platform),
"contextsubdir": ctxPayload.Dir,
}
if dockerfile != "" {
opts["filename"] = filepath.Join(ctxPayload.Dir, dockerfile)
} else {
opts["filename"] = filepath.Join(ctxPayload.Dir, defaultDockerfileName)
}
inputs := map[string]*pb.Definition{
dockerfilebuilder.DefaultLocalNameContext: ctxPayload.LLB,
dockerfilebuilder.DefaultLocalNameDockerfile: ctxPayload.LLB,
}
res, err := gw.Solve(ctx, bkgw.SolveRequest{
Frontend: "dockerfile.v0",
FrontendOpt: opts,
FrontendInputs: inputs,
})
if err != nil {
return nil, err
}
bkref, err := res.SingleRef()
if err != nil {
return nil, err
}
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 3,551 |
π Odd container behavior with exec / multiple withMountedDirectory
|
### What is the issue?
The following code executes but provides unexpected logs / output. Other similar use cases error due to missing files due to same issue. This may be something very simple (haven't used golang in many years) but seems like there may be an underlying issue with the execution engine.
I would expect this code to run the `ls` command twice, one time showing the two mounted directories, one time showing the root output. Instead in the logs I see `ls` with d1 and d2 (expected), an `ls` with just d1 (??), and then an `ls` with the root fs. This causes issues if the first ls is changed to `ls /example/d2` as it will error the whole pipeline due to missing path.
```golang
workdir := client.Host().Workdir()
d1, err := workdir.Read().Directory("dir1/").ID(ctx)
if err != nil {
return err
}
d2, err := workdir.Read().Directory("dir2/").ID(ctx)
if err != nil {
return err
}
build := client.Container().From("alpine:latest").
WithMountedDirectory("/example/d1", d1).
WithMountedDirectory("/example/d2", d2)
build = build.Exec(dagger.ContainerExecOpts{
Args: []string{"ls", "/example"},
})
_, err = build.ExitCode(ctx)
if err != nil {
return err
}
build = build.Exec(dagger.ContainerExecOpts{
Args: []string{"ls", "/"},
})
_, err = build.ExitCode(ctx)
if err != nil {
return err
}
```
I was able to get the same functionality working fine by using `fs, err := build.FS().WithDirectory(d1, "/example/d1").WithDirectory(d2, "/example/d2").ID(ctx); build = build.WithFS(fs);` so conceptually don't think I'm doing anything wrong.
### Log output
```
#1 resolve image config for docker.io/library/alpine:latest
#1 DONE 0.4s
#2 mkfile /Dockerfile
#2 DONE 0.0s
#3 mkfile /main.go
#3 CACHED
#4 [internal] load metadata for docker.io/library/golang:1.18.2-alpine
#4 DONE 0.1s
#5 local://__dagger_workdir_/home/plaisted/source/OSD.PJI-Temporary/repro
#5 DONE 0.0s
#6 local://__dagger_workdir_/home/plaisted/source/OSD.PJI-Temporary/repro
#6 transferring __dagger_workdir_/home/plaisted/source/OSD.PJI-Temporary/repro: 309B done
#6 DONE 0.0s
#7 [build 1/6] FROM docker.io/library/golang:1.18.2-alpine@sha256:4795c5d21f01e0777707ada02408debe77fe31848be97cf9fa8a1462da78d949
#7 resolve docker.io/library/golang:1.18.2-alpine@sha256:4795c5d21f01e0777707ada02408debe77fe31848be97cf9fa8a1462da78d949 0.0s done
#7 DONE 0.0s
#8 [build 3/6] RUN apk add --no-cache file git
#8 CACHED
#9 [build 4/6] RUN go mod init go.dagger.io/dagger/shim/cmd
#9 CACHED
#10 [build 2/6] WORKDIR /src
#10 CACHED
#11 [build 5/6] COPY . .
#11 CACHED
#12 [build 6/6] RUN CGO_ENABLED=0 go build -o /_shim -ldflags '-s -d -w' .
#12 CACHED
#13 [stage-1 1/1] COPY --from=build /_shim /_shim
#13 CACHED
#14 mkdir /meta
#14 CACHED
#15 copy / /
#15 DONE 0.0s
#16 docker-image://docker.io/library/alpine:latest
#16 resolve docker.io/library/alpine:latest
#16 resolve docker.io/library/alpine:latest 0.1s done
#16 CACHED
#17 copy / /
#17 CACHED
#18 ls /example
#18 0.157 d1
#18 0.157 d2
#18 DONE 0.2s
#1 resolve image config for docker.io/library/alpine:latest
#1 DONE 0.5s
#4 [internal] load metadata for docker.io/library/golang:1.18.2-alpine
#4 DONE 0.4s
#19 ls /example
#19 0.172 d1
#19 DONE 0.2s
#20 ls /
#20 0.105 _shim
#20 0.105 bin
#20 0.105 dagger
#20 0.105 dev
#20 0.105 etc
#20 0.105 example
#20 0.105 home
#20 0.105 lib
#20 0.105 media
#20 0.105 mnt
#20 0.105 opt
#20 0.105 proc
#20 0.105 root
#20 0.105 run
#20 0.105 sbin
#20 0.105 srv
#20 0.105 sys
#20 0.105 tmp
#20 0.105 usr
#20 0.105 var
#20 DONE 0.1s
#0 0.148 d1
#0 0.148 d2
#18 DONE 0.2s
#1 resolve image config for docker.io/library/alpine:latest
#1 DONE 0.4s
#4 [internal] load metadata for docker.io/library/golang:1.18.2-alpine
#4 DONE 0.4s
#19 ls /example
#0 0.135 d1
#19 DONE 0.2s
#20 ls /example
#0 0.104 d1
#0 0.104 d2
#20 DONE 0.1s
```
### Steps to reproduce
* Mount two directories
* Run multiple exec commands and observe logs output
### Dagger version
dagger v0.3.1
### OS version
Ubuntu-20.04
|
https://github.com/dagger/dagger/issues/3551
|
https://github.com/dagger/dagger/pull/3602
|
b734ed35554bbfbc5caf63674eaa9c22692e614e
|
b4bb0b9e06e1edf8b81f9054b7419daabcb5bedb
| 2022-10-26T01:16:16Z |
go
| 2022-10-31T22:13:34Z |
core/container.go
|
st, err := bkref.ToState()
if err != nil {
return nil, err
}
def, err := st.Marshal(ctx, llb.Platform(platform))
if err != nil {
return nil, err
}
payload.FS = def.ToPB()
payload.Platform = platform
cfgBytes, found := res.Metadata[exptypes.ExporterImageConfigKey]
if found {
var imgSpec specs.Image
if err := json.Unmarshal(cfgBytes, &imgSpec); err != nil {
return nil, err
}
payload.Config = imgSpec.Config
}
id, err := payload.Encode()
if err != nil {
return nil, err
}
return &Container{ID: id}, nil
}
func (container *Container) FS(ctx context.Context) (*Directory, error) {
payload, err := container.ID.decode()
if err != nil {
return nil, err
}
return (&directoryIDPayload{
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 3,551 |
π Odd container behavior with exec / multiple withMountedDirectory
|
### What is the issue?
The following code executes but provides unexpected logs / output. Other similar use cases error due to missing files due to same issue. This may be something very simple (haven't used golang in many years) but seems like there may be an underlying issue with the execution engine.
I would expect this code to run the `ls` command twice, one time showing the two mounted directories, one time showing the root output. Instead in the logs I see `ls` with d1 and d2 (expected), an `ls` with just d1 (??), and then an `ls` with the root fs. This causes issues if the first ls is changed to `ls /example/d2` as it will error the whole pipeline due to missing path.
```golang
workdir := client.Host().Workdir()
d1, err := workdir.Read().Directory("dir1/").ID(ctx)
if err != nil {
return err
}
d2, err := workdir.Read().Directory("dir2/").ID(ctx)
if err != nil {
return err
}
build := client.Container().From("alpine:latest").
WithMountedDirectory("/example/d1", d1).
WithMountedDirectory("/example/d2", d2)
build = build.Exec(dagger.ContainerExecOpts{
Args: []string{"ls", "/example"},
})
_, err = build.ExitCode(ctx)
if err != nil {
return err
}
build = build.Exec(dagger.ContainerExecOpts{
Args: []string{"ls", "/"},
})
_, err = build.ExitCode(ctx)
if err != nil {
return err
}
```
I was able to get the same functionality working fine by using `fs, err := build.FS().WithDirectory(d1, "/example/d1").WithDirectory(d2, "/example/d2").ID(ctx); build = build.WithFS(fs);` so conceptually don't think I'm doing anything wrong.
### Log output
```
#1 resolve image config for docker.io/library/alpine:latest
#1 DONE 0.4s
#2 mkfile /Dockerfile
#2 DONE 0.0s
#3 mkfile /main.go
#3 CACHED
#4 [internal] load metadata for docker.io/library/golang:1.18.2-alpine
#4 DONE 0.1s
#5 local://__dagger_workdir_/home/plaisted/source/OSD.PJI-Temporary/repro
#5 DONE 0.0s
#6 local://__dagger_workdir_/home/plaisted/source/OSD.PJI-Temporary/repro
#6 transferring __dagger_workdir_/home/plaisted/source/OSD.PJI-Temporary/repro: 309B done
#6 DONE 0.0s
#7 [build 1/6] FROM docker.io/library/golang:1.18.2-alpine@sha256:4795c5d21f01e0777707ada02408debe77fe31848be97cf9fa8a1462da78d949
#7 resolve docker.io/library/golang:1.18.2-alpine@sha256:4795c5d21f01e0777707ada02408debe77fe31848be97cf9fa8a1462da78d949 0.0s done
#7 DONE 0.0s
#8 [build 3/6] RUN apk add --no-cache file git
#8 CACHED
#9 [build 4/6] RUN go mod init go.dagger.io/dagger/shim/cmd
#9 CACHED
#10 [build 2/6] WORKDIR /src
#10 CACHED
#11 [build 5/6] COPY . .
#11 CACHED
#12 [build 6/6] RUN CGO_ENABLED=0 go build -o /_shim -ldflags '-s -d -w' .
#12 CACHED
#13 [stage-1 1/1] COPY --from=build /_shim /_shim
#13 CACHED
#14 mkdir /meta
#14 CACHED
#15 copy / /
#15 DONE 0.0s
#16 docker-image://docker.io/library/alpine:latest
#16 resolve docker.io/library/alpine:latest
#16 resolve docker.io/library/alpine:latest 0.1s done
#16 CACHED
#17 copy / /
#17 CACHED
#18 ls /example
#18 0.157 d1
#18 0.157 d2
#18 DONE 0.2s
#1 resolve image config for docker.io/library/alpine:latest
#1 DONE 0.5s
#4 [internal] load metadata for docker.io/library/golang:1.18.2-alpine
#4 DONE 0.4s
#19 ls /example
#19 0.172 d1
#19 DONE 0.2s
#20 ls /
#20 0.105 _shim
#20 0.105 bin
#20 0.105 dagger
#20 0.105 dev
#20 0.105 etc
#20 0.105 example
#20 0.105 home
#20 0.105 lib
#20 0.105 media
#20 0.105 mnt
#20 0.105 opt
#20 0.105 proc
#20 0.105 root
#20 0.105 run
#20 0.105 sbin
#20 0.105 srv
#20 0.105 sys
#20 0.105 tmp
#20 0.105 usr
#20 0.105 var
#20 DONE 0.1s
#0 0.148 d1
#0 0.148 d2
#18 DONE 0.2s
#1 resolve image config for docker.io/library/alpine:latest
#1 DONE 0.4s
#4 [internal] load metadata for docker.io/library/golang:1.18.2-alpine
#4 DONE 0.4s
#19 ls /example
#0 0.135 d1
#19 DONE 0.2s
#20 ls /example
#0 0.104 d1
#0 0.104 d2
#20 DONE 0.1s
```
### Steps to reproduce
* Mount two directories
* Run multiple exec commands and observe logs output
### Dagger version
dagger v0.3.1
### OS version
Ubuntu-20.04
|
https://github.com/dagger/dagger/issues/3551
|
https://github.com/dagger/dagger/pull/3602
|
b734ed35554bbfbc5caf63674eaa9c22692e614e
|
b4bb0b9e06e1edf8b81f9054b7419daabcb5bedb
| 2022-10-26T01:16:16Z |
go
| 2022-10-31T22:13:34Z |
core/container.go
|
LLB: payload.FS,
Platform: payload.Platform,
}).ToDirectory()
}
func (container *Container) WithFS(ctx context.Context, dir *Directory, platform specs.Platform) (*Container, error) {
payload, err := container.ID.decode()
if err != nil {
return nil, err
}
dirPayload, err := dir.ID.Decode()
if err != nil {
return nil, err
}
payload.FS = dirPayload.LLB
payload.Platform = platform
id, err := payload.Encode()
if err != nil {
return nil, err
}
return &Container{ID: id}, nil
}
func (container *Container) WithMountedDirectory(ctx context.Context, target string, source *Directory) (*Container, error) {
payload, err := source.ID.Decode()
if err != nil {
return nil, err
}
return container.withMounted(target, payload.LLB, payload.Dir)
}
func (container *Container) WithMountedFile(ctx context.Context, target string, source *File) (*Container, error) {
payload, err := source.ID.decode()
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 3,551 |
π Odd container behavior with exec / multiple withMountedDirectory
|
### What is the issue?
The following code executes but provides unexpected logs / output. Other similar use cases error due to missing files due to same issue. This may be something very simple (haven't used golang in many years) but seems like there may be an underlying issue with the execution engine.
I would expect this code to run the `ls` command twice, one time showing the two mounted directories, one time showing the root output. Instead in the logs I see `ls` with d1 and d2 (expected), an `ls` with just d1 (??), and then an `ls` with the root fs. This causes issues if the first ls is changed to `ls /example/d2` as it will error the whole pipeline due to missing path.
```golang
workdir := client.Host().Workdir()
d1, err := workdir.Read().Directory("dir1/").ID(ctx)
if err != nil {
return err
}
d2, err := workdir.Read().Directory("dir2/").ID(ctx)
if err != nil {
return err
}
build := client.Container().From("alpine:latest").
WithMountedDirectory("/example/d1", d1).
WithMountedDirectory("/example/d2", d2)
build = build.Exec(dagger.ContainerExecOpts{
Args: []string{"ls", "/example"},
})
_, err = build.ExitCode(ctx)
if err != nil {
return err
}
build = build.Exec(dagger.ContainerExecOpts{
Args: []string{"ls", "/"},
})
_, err = build.ExitCode(ctx)
if err != nil {
return err
}
```
I was able to get the same functionality working fine by using `fs, err := build.FS().WithDirectory(d1, "/example/d1").WithDirectory(d2, "/example/d2").ID(ctx); build = build.WithFS(fs);` so conceptually don't think I'm doing anything wrong.
### Log output
```
#1 resolve image config for docker.io/library/alpine:latest
#1 DONE 0.4s
#2 mkfile /Dockerfile
#2 DONE 0.0s
#3 mkfile /main.go
#3 CACHED
#4 [internal] load metadata for docker.io/library/golang:1.18.2-alpine
#4 DONE 0.1s
#5 local://__dagger_workdir_/home/plaisted/source/OSD.PJI-Temporary/repro
#5 DONE 0.0s
#6 local://__dagger_workdir_/home/plaisted/source/OSD.PJI-Temporary/repro
#6 transferring __dagger_workdir_/home/plaisted/source/OSD.PJI-Temporary/repro: 309B done
#6 DONE 0.0s
#7 [build 1/6] FROM docker.io/library/golang:1.18.2-alpine@sha256:4795c5d21f01e0777707ada02408debe77fe31848be97cf9fa8a1462da78d949
#7 resolve docker.io/library/golang:1.18.2-alpine@sha256:4795c5d21f01e0777707ada02408debe77fe31848be97cf9fa8a1462da78d949 0.0s done
#7 DONE 0.0s
#8 [build 3/6] RUN apk add --no-cache file git
#8 CACHED
#9 [build 4/6] RUN go mod init go.dagger.io/dagger/shim/cmd
#9 CACHED
#10 [build 2/6] WORKDIR /src
#10 CACHED
#11 [build 5/6] COPY . .
#11 CACHED
#12 [build 6/6] RUN CGO_ENABLED=0 go build -o /_shim -ldflags '-s -d -w' .
#12 CACHED
#13 [stage-1 1/1] COPY --from=build /_shim /_shim
#13 CACHED
#14 mkdir /meta
#14 CACHED
#15 copy / /
#15 DONE 0.0s
#16 docker-image://docker.io/library/alpine:latest
#16 resolve docker.io/library/alpine:latest
#16 resolve docker.io/library/alpine:latest 0.1s done
#16 CACHED
#17 copy / /
#17 CACHED
#18 ls /example
#18 0.157 d1
#18 0.157 d2
#18 DONE 0.2s
#1 resolve image config for docker.io/library/alpine:latest
#1 DONE 0.5s
#4 [internal] load metadata for docker.io/library/golang:1.18.2-alpine
#4 DONE 0.4s
#19 ls /example
#19 0.172 d1
#19 DONE 0.2s
#20 ls /
#20 0.105 _shim
#20 0.105 bin
#20 0.105 dagger
#20 0.105 dev
#20 0.105 etc
#20 0.105 example
#20 0.105 home
#20 0.105 lib
#20 0.105 media
#20 0.105 mnt
#20 0.105 opt
#20 0.105 proc
#20 0.105 root
#20 0.105 run
#20 0.105 sbin
#20 0.105 srv
#20 0.105 sys
#20 0.105 tmp
#20 0.105 usr
#20 0.105 var
#20 DONE 0.1s
#0 0.148 d1
#0 0.148 d2
#18 DONE 0.2s
#1 resolve image config for docker.io/library/alpine:latest
#1 DONE 0.4s
#4 [internal] load metadata for docker.io/library/golang:1.18.2-alpine
#4 DONE 0.4s
#19 ls /example
#0 0.135 d1
#19 DONE 0.2s
#20 ls /example
#0 0.104 d1
#0 0.104 d2
#20 DONE 0.1s
```
### Steps to reproduce
* Mount two directories
* Run multiple exec commands and observe logs output
### Dagger version
dagger v0.3.1
### OS version
Ubuntu-20.04
|
https://github.com/dagger/dagger/issues/3551
|
https://github.com/dagger/dagger/pull/3602
|
b734ed35554bbfbc5caf63674eaa9c22692e614e
|
b4bb0b9e06e1edf8b81f9054b7419daabcb5bedb
| 2022-10-26T01:16:16Z |
go
| 2022-10-31T22:13:34Z |
core/container.go
|
if err != nil {
return nil, err
}
return container.withMounted(target, payload.LLB, payload.File)
}
func (container *Container) WithMountedCache(ctx context.Context, target string, cache CacheID, source *Directory) (*Container, error) {
payload, err := container.ID.decode()
if err != nil {
return nil, err
}
cachePayload, err := cache.decode()
if err != nil {
return nil, err
}
target = absPath(payload.Config.WorkingDir, target)
mount := ContainerMount{
Target: target,
CacheID: cachePayload.Sum(),
CacheSharingMode: "shared",
}
if source != nil {
srcPayload, err := source.ID.Decode()
if err != nil {
return nil, err
}
mount.Source = srcPayload.LLB
mount.SourcePath = srcPayload.Dir
}
payload.Mounts = append(payload.Mounts, mount)
id, err := payload.Encode()
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 3,551 |
π Odd container behavior with exec / multiple withMountedDirectory
|
### What is the issue?
The following code executes but provides unexpected logs / output. Other similar use cases error due to missing files due to same issue. This may be something very simple (haven't used golang in many years) but seems like there may be an underlying issue with the execution engine.
I would expect this code to run the `ls` command twice, one time showing the two mounted directories, one time showing the root output. Instead in the logs I see `ls` with d1 and d2 (expected), an `ls` with just d1 (??), and then an `ls` with the root fs. This causes issues if the first ls is changed to `ls /example/d2` as it will error the whole pipeline due to missing path.
```golang
workdir := client.Host().Workdir()
d1, err := workdir.Read().Directory("dir1/").ID(ctx)
if err != nil {
return err
}
d2, err := workdir.Read().Directory("dir2/").ID(ctx)
if err != nil {
return err
}
build := client.Container().From("alpine:latest").
WithMountedDirectory("/example/d1", d1).
WithMountedDirectory("/example/d2", d2)
build = build.Exec(dagger.ContainerExecOpts{
Args: []string{"ls", "/example"},
})
_, err = build.ExitCode(ctx)
if err != nil {
return err
}
build = build.Exec(dagger.ContainerExecOpts{
Args: []string{"ls", "/"},
})
_, err = build.ExitCode(ctx)
if err != nil {
return err
}
```
I was able to get the same functionality working fine by using `fs, err := build.FS().WithDirectory(d1, "/example/d1").WithDirectory(d2, "/example/d2").ID(ctx); build = build.WithFS(fs);` so conceptually don't think I'm doing anything wrong.
### Log output
```
#1 resolve image config for docker.io/library/alpine:latest
#1 DONE 0.4s
#2 mkfile /Dockerfile
#2 DONE 0.0s
#3 mkfile /main.go
#3 CACHED
#4 [internal] load metadata for docker.io/library/golang:1.18.2-alpine
#4 DONE 0.1s
#5 local://__dagger_workdir_/home/plaisted/source/OSD.PJI-Temporary/repro
#5 DONE 0.0s
#6 local://__dagger_workdir_/home/plaisted/source/OSD.PJI-Temporary/repro
#6 transferring __dagger_workdir_/home/plaisted/source/OSD.PJI-Temporary/repro: 309B done
#6 DONE 0.0s
#7 [build 1/6] FROM docker.io/library/golang:1.18.2-alpine@sha256:4795c5d21f01e0777707ada02408debe77fe31848be97cf9fa8a1462da78d949
#7 resolve docker.io/library/golang:1.18.2-alpine@sha256:4795c5d21f01e0777707ada02408debe77fe31848be97cf9fa8a1462da78d949 0.0s done
#7 DONE 0.0s
#8 [build 3/6] RUN apk add --no-cache file git
#8 CACHED
#9 [build 4/6] RUN go mod init go.dagger.io/dagger/shim/cmd
#9 CACHED
#10 [build 2/6] WORKDIR /src
#10 CACHED
#11 [build 5/6] COPY . .
#11 CACHED
#12 [build 6/6] RUN CGO_ENABLED=0 go build -o /_shim -ldflags '-s -d -w' .
#12 CACHED
#13 [stage-1 1/1] COPY --from=build /_shim /_shim
#13 CACHED
#14 mkdir /meta
#14 CACHED
#15 copy / /
#15 DONE 0.0s
#16 docker-image://docker.io/library/alpine:latest
#16 resolve docker.io/library/alpine:latest
#16 resolve docker.io/library/alpine:latest 0.1s done
#16 CACHED
#17 copy / /
#17 CACHED
#18 ls /example
#18 0.157 d1
#18 0.157 d2
#18 DONE 0.2s
#1 resolve image config for docker.io/library/alpine:latest
#1 DONE 0.5s
#4 [internal] load metadata for docker.io/library/golang:1.18.2-alpine
#4 DONE 0.4s
#19 ls /example
#19 0.172 d1
#19 DONE 0.2s
#20 ls /
#20 0.105 _shim
#20 0.105 bin
#20 0.105 dagger
#20 0.105 dev
#20 0.105 etc
#20 0.105 example
#20 0.105 home
#20 0.105 lib
#20 0.105 media
#20 0.105 mnt
#20 0.105 opt
#20 0.105 proc
#20 0.105 root
#20 0.105 run
#20 0.105 sbin
#20 0.105 srv
#20 0.105 sys
#20 0.105 tmp
#20 0.105 usr
#20 0.105 var
#20 DONE 0.1s
#0 0.148 d1
#0 0.148 d2
#18 DONE 0.2s
#1 resolve image config for docker.io/library/alpine:latest
#1 DONE 0.4s
#4 [internal] load metadata for docker.io/library/golang:1.18.2-alpine
#4 DONE 0.4s
#19 ls /example
#0 0.135 d1
#19 DONE 0.2s
#20 ls /example
#0 0.104 d1
#0 0.104 d2
#20 DONE 0.1s
```
### Steps to reproduce
* Mount two directories
* Run multiple exec commands and observe logs output
### Dagger version
dagger v0.3.1
### OS version
Ubuntu-20.04
|
https://github.com/dagger/dagger/issues/3551
|
https://github.com/dagger/dagger/pull/3602
|
b734ed35554bbfbc5caf63674eaa9c22692e614e
|
b4bb0b9e06e1edf8b81f9054b7419daabcb5bedb
| 2022-10-26T01:16:16Z |
go
| 2022-10-31T22:13:34Z |
core/container.go
|
if err != nil {
return nil, err
}
return &Container{ID: id}, nil
}
func (container *Container) WithMountedTemp(ctx context.Context, target string) (*Container, error) {
payload, err := container.ID.decode()
if err != nil {
return nil, err
}
target = absPath(payload.Config.WorkingDir, target)
payload.Mounts = append(payload.Mounts, ContainerMount{
Target: target,
Tmpfs: true,
})
id, err := payload.Encode()
if err != nil {
return nil, err
}
return &Container{ID: id}, nil
}
func (container *Container) WithMountedSecret(ctx context.Context, target string, source *Secret) (*Container, error) {
payload, err := container.ID.decode()
if err != nil {
return nil, err
}
target = absPath(payload.Config.WorkingDir, target)
payload.Secrets = append(payload.Secrets, ContainerSecret{
Secret: source.ID,
MountPath: target,
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 3,551 |
π Odd container behavior with exec / multiple withMountedDirectory
|
### What is the issue?
The following code executes but provides unexpected logs / output. Other similar use cases error due to missing files due to same issue. This may be something very simple (haven't used golang in many years) but seems like there may be an underlying issue with the execution engine.
I would expect this code to run the `ls` command twice, one time showing the two mounted directories, one time showing the root output. Instead in the logs I see `ls` with d1 and d2 (expected), an `ls` with just d1 (??), and then an `ls` with the root fs. This causes issues if the first ls is changed to `ls /example/d2` as it will error the whole pipeline due to missing path.
```golang
workdir := client.Host().Workdir()
d1, err := workdir.Read().Directory("dir1/").ID(ctx)
if err != nil {
return err
}
d2, err := workdir.Read().Directory("dir2/").ID(ctx)
if err != nil {
return err
}
build := client.Container().From("alpine:latest").
WithMountedDirectory("/example/d1", d1).
WithMountedDirectory("/example/d2", d2)
build = build.Exec(dagger.ContainerExecOpts{
Args: []string{"ls", "/example"},
})
_, err = build.ExitCode(ctx)
if err != nil {
return err
}
build = build.Exec(dagger.ContainerExecOpts{
Args: []string{"ls", "/"},
})
_, err = build.ExitCode(ctx)
if err != nil {
return err
}
```
I was able to get the same functionality working fine by using `fs, err := build.FS().WithDirectory(d1, "/example/d1").WithDirectory(d2, "/example/d2").ID(ctx); build = build.WithFS(fs);` so conceptually don't think I'm doing anything wrong.
### Log output
```
#1 resolve image config for docker.io/library/alpine:latest
#1 DONE 0.4s
#2 mkfile /Dockerfile
#2 DONE 0.0s
#3 mkfile /main.go
#3 CACHED
#4 [internal] load metadata for docker.io/library/golang:1.18.2-alpine
#4 DONE 0.1s
#5 local://__dagger_workdir_/home/plaisted/source/OSD.PJI-Temporary/repro
#5 DONE 0.0s
#6 local://__dagger_workdir_/home/plaisted/source/OSD.PJI-Temporary/repro
#6 transferring __dagger_workdir_/home/plaisted/source/OSD.PJI-Temporary/repro: 309B done
#6 DONE 0.0s
#7 [build 1/6] FROM docker.io/library/golang:1.18.2-alpine@sha256:4795c5d21f01e0777707ada02408debe77fe31848be97cf9fa8a1462da78d949
#7 resolve docker.io/library/golang:1.18.2-alpine@sha256:4795c5d21f01e0777707ada02408debe77fe31848be97cf9fa8a1462da78d949 0.0s done
#7 DONE 0.0s
#8 [build 3/6] RUN apk add --no-cache file git
#8 CACHED
#9 [build 4/6] RUN go mod init go.dagger.io/dagger/shim/cmd
#9 CACHED
#10 [build 2/6] WORKDIR /src
#10 CACHED
#11 [build 5/6] COPY . .
#11 CACHED
#12 [build 6/6] RUN CGO_ENABLED=0 go build -o /_shim -ldflags '-s -d -w' .
#12 CACHED
#13 [stage-1 1/1] COPY --from=build /_shim /_shim
#13 CACHED
#14 mkdir /meta
#14 CACHED
#15 copy / /
#15 DONE 0.0s
#16 docker-image://docker.io/library/alpine:latest
#16 resolve docker.io/library/alpine:latest
#16 resolve docker.io/library/alpine:latest 0.1s done
#16 CACHED
#17 copy / /
#17 CACHED
#18 ls /example
#18 0.157 d1
#18 0.157 d2
#18 DONE 0.2s
#1 resolve image config for docker.io/library/alpine:latest
#1 DONE 0.5s
#4 [internal] load metadata for docker.io/library/golang:1.18.2-alpine
#4 DONE 0.4s
#19 ls /example
#19 0.172 d1
#19 DONE 0.2s
#20 ls /
#20 0.105 _shim
#20 0.105 bin
#20 0.105 dagger
#20 0.105 dev
#20 0.105 etc
#20 0.105 example
#20 0.105 home
#20 0.105 lib
#20 0.105 media
#20 0.105 mnt
#20 0.105 opt
#20 0.105 proc
#20 0.105 root
#20 0.105 run
#20 0.105 sbin
#20 0.105 srv
#20 0.105 sys
#20 0.105 tmp
#20 0.105 usr
#20 0.105 var
#20 DONE 0.1s
#0 0.148 d1
#0 0.148 d2
#18 DONE 0.2s
#1 resolve image config for docker.io/library/alpine:latest
#1 DONE 0.4s
#4 [internal] load metadata for docker.io/library/golang:1.18.2-alpine
#4 DONE 0.4s
#19 ls /example
#0 0.135 d1
#19 DONE 0.2s
#20 ls /example
#0 0.104 d1
#0 0.104 d2
#20 DONE 0.1s
```
### Steps to reproduce
* Mount two directories
* Run multiple exec commands and observe logs output
### Dagger version
dagger v0.3.1
### OS version
Ubuntu-20.04
|
https://github.com/dagger/dagger/issues/3551
|
https://github.com/dagger/dagger/pull/3602
|
b734ed35554bbfbc5caf63674eaa9c22692e614e
|
b4bb0b9e06e1edf8b81f9054b7419daabcb5bedb
| 2022-10-26T01:16:16Z |
go
| 2022-10-31T22:13:34Z |
core/container.go
|
})
id, err := payload.Encode()
if err != nil {
return nil, err
}
return &Container{ID: id}, nil
}
func (container *Container) WithoutMount(ctx context.Context, target string) (*Container, error) {
payload, err := container.ID.decode()
if err != nil {
return nil, err
}
target = absPath(payload.Config.WorkingDir, target)
var found bool
var foundIdx int
for i := len(payload.Mounts) - 1; i >= 0; i-- {
if payload.Mounts[i].Target == target {
found = true
foundIdx = i
break
}
}
if found {
payload.Mounts = append(payload.Mounts[:foundIdx], payload.Mounts[foundIdx+1:]...)
}
id, err := payload.Encode()
if err != nil {
return nil, err
}
return &Container{ID: id}, nil
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 3,551 |
π Odd container behavior with exec / multiple withMountedDirectory
|
### What is the issue?
The following code executes but provides unexpected logs / output. Other similar use cases error due to missing files due to same issue. This may be something very simple (haven't used golang in many years) but seems like there may be an underlying issue with the execution engine.
I would expect this code to run the `ls` command twice, one time showing the two mounted directories, one time showing the root output. Instead in the logs I see `ls` with d1 and d2 (expected), an `ls` with just d1 (??), and then an `ls` with the root fs. This causes issues if the first ls is changed to `ls /example/d2` as it will error the whole pipeline due to missing path.
```golang
workdir := client.Host().Workdir()
d1, err := workdir.Read().Directory("dir1/").ID(ctx)
if err != nil {
return err
}
d2, err := workdir.Read().Directory("dir2/").ID(ctx)
if err != nil {
return err
}
build := client.Container().From("alpine:latest").
WithMountedDirectory("/example/d1", d1).
WithMountedDirectory("/example/d2", d2)
build = build.Exec(dagger.ContainerExecOpts{
Args: []string{"ls", "/example"},
})
_, err = build.ExitCode(ctx)
if err != nil {
return err
}
build = build.Exec(dagger.ContainerExecOpts{
Args: []string{"ls", "/"},
})
_, err = build.ExitCode(ctx)
if err != nil {
return err
}
```
I was able to get the same functionality working fine by using `fs, err := build.FS().WithDirectory(d1, "/example/d1").WithDirectory(d2, "/example/d2").ID(ctx); build = build.WithFS(fs);` so conceptually don't think I'm doing anything wrong.
### Log output
```
#1 resolve image config for docker.io/library/alpine:latest
#1 DONE 0.4s
#2 mkfile /Dockerfile
#2 DONE 0.0s
#3 mkfile /main.go
#3 CACHED
#4 [internal] load metadata for docker.io/library/golang:1.18.2-alpine
#4 DONE 0.1s
#5 local://__dagger_workdir_/home/plaisted/source/OSD.PJI-Temporary/repro
#5 DONE 0.0s
#6 local://__dagger_workdir_/home/plaisted/source/OSD.PJI-Temporary/repro
#6 transferring __dagger_workdir_/home/plaisted/source/OSD.PJI-Temporary/repro: 309B done
#6 DONE 0.0s
#7 [build 1/6] FROM docker.io/library/golang:1.18.2-alpine@sha256:4795c5d21f01e0777707ada02408debe77fe31848be97cf9fa8a1462da78d949
#7 resolve docker.io/library/golang:1.18.2-alpine@sha256:4795c5d21f01e0777707ada02408debe77fe31848be97cf9fa8a1462da78d949 0.0s done
#7 DONE 0.0s
#8 [build 3/6] RUN apk add --no-cache file git
#8 CACHED
#9 [build 4/6] RUN go mod init go.dagger.io/dagger/shim/cmd
#9 CACHED
#10 [build 2/6] WORKDIR /src
#10 CACHED
#11 [build 5/6] COPY . .
#11 CACHED
#12 [build 6/6] RUN CGO_ENABLED=0 go build -o /_shim -ldflags '-s -d -w' .
#12 CACHED
#13 [stage-1 1/1] COPY --from=build /_shim /_shim
#13 CACHED
#14 mkdir /meta
#14 CACHED
#15 copy / /
#15 DONE 0.0s
#16 docker-image://docker.io/library/alpine:latest
#16 resolve docker.io/library/alpine:latest
#16 resolve docker.io/library/alpine:latest 0.1s done
#16 CACHED
#17 copy / /
#17 CACHED
#18 ls /example
#18 0.157 d1
#18 0.157 d2
#18 DONE 0.2s
#1 resolve image config for docker.io/library/alpine:latest
#1 DONE 0.5s
#4 [internal] load metadata for docker.io/library/golang:1.18.2-alpine
#4 DONE 0.4s
#19 ls /example
#19 0.172 d1
#19 DONE 0.2s
#20 ls /
#20 0.105 _shim
#20 0.105 bin
#20 0.105 dagger
#20 0.105 dev
#20 0.105 etc
#20 0.105 example
#20 0.105 home
#20 0.105 lib
#20 0.105 media
#20 0.105 mnt
#20 0.105 opt
#20 0.105 proc
#20 0.105 root
#20 0.105 run
#20 0.105 sbin
#20 0.105 srv
#20 0.105 sys
#20 0.105 tmp
#20 0.105 usr
#20 0.105 var
#20 DONE 0.1s
#0 0.148 d1
#0 0.148 d2
#18 DONE 0.2s
#1 resolve image config for docker.io/library/alpine:latest
#1 DONE 0.4s
#4 [internal] load metadata for docker.io/library/golang:1.18.2-alpine
#4 DONE 0.4s
#19 ls /example
#0 0.135 d1
#19 DONE 0.2s
#20 ls /example
#0 0.104 d1
#0 0.104 d2
#20 DONE 0.1s
```
### Steps to reproduce
* Mount two directories
* Run multiple exec commands and observe logs output
### Dagger version
dagger v0.3.1
### OS version
Ubuntu-20.04
|
https://github.com/dagger/dagger/issues/3551
|
https://github.com/dagger/dagger/pull/3602
|
b734ed35554bbfbc5caf63674eaa9c22692e614e
|
b4bb0b9e06e1edf8b81f9054b7419daabcb5bedb
| 2022-10-26T01:16:16Z |
go
| 2022-10-31T22:13:34Z |
core/container.go
|
}
func (container *Container) Mounts(ctx context.Context) ([]string, error) {
payload, err := container.ID.decode()
if err != nil {
return nil, err
}
mounts := []string{}
for _, mnt := range payload.Mounts {
mounts = append(mounts, mnt.Target)
}
return mounts, nil
}
func (container *Container) WithSecretVariable(ctx context.Context, name string, secret *Secret) (*Container, error) {
payload, err := container.ID.decode()
if err != nil {
return nil, err
}
payload.Secrets = append(payload.Secrets, ContainerSecret{
Secret: secret.ID,
EnvName: name,
})
id, err := payload.Encode()
if err != nil {
return nil, err
}
return &Container{ID: id}, nil
}
func (container *Container) Directory(ctx context.Context, gw bkgw.Client, dirPath string) (*Directory, error) {
dir, err := locatePath(ctx, container, dirPath, gw, NewDirectory)
if err != nil {
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 3,551 |
π Odd container behavior with exec / multiple withMountedDirectory
|
### What is the issue?
The following code executes but provides unexpected logs / output. Other similar use cases error due to missing files due to same issue. This may be something very simple (haven't used golang in many years) but seems like there may be an underlying issue with the execution engine.
I would expect this code to run the `ls` command twice, one time showing the two mounted directories, one time showing the root output. Instead in the logs I see `ls` with d1 and d2 (expected), an `ls` with just d1 (??), and then an `ls` with the root fs. This causes issues if the first ls is changed to `ls /example/d2` as it will error the whole pipeline due to missing path.
```golang
workdir := client.Host().Workdir()
d1, err := workdir.Read().Directory("dir1/").ID(ctx)
if err != nil {
return err
}
d2, err := workdir.Read().Directory("dir2/").ID(ctx)
if err != nil {
return err
}
build := client.Container().From("alpine:latest").
WithMountedDirectory("/example/d1", d1).
WithMountedDirectory("/example/d2", d2)
build = build.Exec(dagger.ContainerExecOpts{
Args: []string{"ls", "/example"},
})
_, err = build.ExitCode(ctx)
if err != nil {
return err
}
build = build.Exec(dagger.ContainerExecOpts{
Args: []string{"ls", "/"},
})
_, err = build.ExitCode(ctx)
if err != nil {
return err
}
```
I was able to get the same functionality working fine by using `fs, err := build.FS().WithDirectory(d1, "/example/d1").WithDirectory(d2, "/example/d2").ID(ctx); build = build.WithFS(fs);` so conceptually don't think I'm doing anything wrong.
### Log output
```
#1 resolve image config for docker.io/library/alpine:latest
#1 DONE 0.4s
#2 mkfile /Dockerfile
#2 DONE 0.0s
#3 mkfile /main.go
#3 CACHED
#4 [internal] load metadata for docker.io/library/golang:1.18.2-alpine
#4 DONE 0.1s
#5 local://__dagger_workdir_/home/plaisted/source/OSD.PJI-Temporary/repro
#5 DONE 0.0s
#6 local://__dagger_workdir_/home/plaisted/source/OSD.PJI-Temporary/repro
#6 transferring __dagger_workdir_/home/plaisted/source/OSD.PJI-Temporary/repro: 309B done
#6 DONE 0.0s
#7 [build 1/6] FROM docker.io/library/golang:1.18.2-alpine@sha256:4795c5d21f01e0777707ada02408debe77fe31848be97cf9fa8a1462da78d949
#7 resolve docker.io/library/golang:1.18.2-alpine@sha256:4795c5d21f01e0777707ada02408debe77fe31848be97cf9fa8a1462da78d949 0.0s done
#7 DONE 0.0s
#8 [build 3/6] RUN apk add --no-cache file git
#8 CACHED
#9 [build 4/6] RUN go mod init go.dagger.io/dagger/shim/cmd
#9 CACHED
#10 [build 2/6] WORKDIR /src
#10 CACHED
#11 [build 5/6] COPY . .
#11 CACHED
#12 [build 6/6] RUN CGO_ENABLED=0 go build -o /_shim -ldflags '-s -d -w' .
#12 CACHED
#13 [stage-1 1/1] COPY --from=build /_shim /_shim
#13 CACHED
#14 mkdir /meta
#14 CACHED
#15 copy / /
#15 DONE 0.0s
#16 docker-image://docker.io/library/alpine:latest
#16 resolve docker.io/library/alpine:latest
#16 resolve docker.io/library/alpine:latest 0.1s done
#16 CACHED
#17 copy / /
#17 CACHED
#18 ls /example
#18 0.157 d1
#18 0.157 d2
#18 DONE 0.2s
#1 resolve image config for docker.io/library/alpine:latest
#1 DONE 0.5s
#4 [internal] load metadata for docker.io/library/golang:1.18.2-alpine
#4 DONE 0.4s
#19 ls /example
#19 0.172 d1
#19 DONE 0.2s
#20 ls /
#20 0.105 _shim
#20 0.105 bin
#20 0.105 dagger
#20 0.105 dev
#20 0.105 etc
#20 0.105 example
#20 0.105 home
#20 0.105 lib
#20 0.105 media
#20 0.105 mnt
#20 0.105 opt
#20 0.105 proc
#20 0.105 root
#20 0.105 run
#20 0.105 sbin
#20 0.105 srv
#20 0.105 sys
#20 0.105 tmp
#20 0.105 usr
#20 0.105 var
#20 DONE 0.1s
#0 0.148 d1
#0 0.148 d2
#18 DONE 0.2s
#1 resolve image config for docker.io/library/alpine:latest
#1 DONE 0.4s
#4 [internal] load metadata for docker.io/library/golang:1.18.2-alpine
#4 DONE 0.4s
#19 ls /example
#0 0.135 d1
#19 DONE 0.2s
#20 ls /example
#0 0.104 d1
#0 0.104 d2
#20 DONE 0.1s
```
### Steps to reproduce
* Mount two directories
* Run multiple exec commands and observe logs output
### Dagger version
dagger v0.3.1
### OS version
Ubuntu-20.04
|
https://github.com/dagger/dagger/issues/3551
|
https://github.com/dagger/dagger/pull/3602
|
b734ed35554bbfbc5caf63674eaa9c22692e614e
|
b4bb0b9e06e1edf8b81f9054b7419daabcb5bedb
| 2022-10-26T01:16:16Z |
go
| 2022-10-31T22:13:34Z |
core/container.go
|
return nil, err
}
info, err := dir.Stat(ctx, gw, ".")
if err != nil {
return nil, err
}
if !info.IsDir() {
return nil, fmt.Errorf("path %s is a file, not a directory", dirPath)
}
return dir, nil
}
func (container *Container) File(ctx context.Context, gw bkgw.Client, filePath string) (*File, error) {
file, err := locatePath(ctx, container, filePath, gw, NewFile)
if err != nil {
return nil, err
}
info, err := file.Stat(ctx, gw)
if err != nil {
return nil, err
}
if info.IsDir() {
return nil, fmt.Errorf("path %s is a directory, not a file", filePath)
}
return file, nil
}
func locatePath[T *File | *Directory](
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 3,551 |
π Odd container behavior with exec / multiple withMountedDirectory
|
### What is the issue?
The following code executes but provides unexpected logs / output. Other similar use cases error due to missing files due to same issue. This may be something very simple (haven't used golang in many years) but seems like there may be an underlying issue with the execution engine.
I would expect this code to run the `ls` command twice, one time showing the two mounted directories, one time showing the root output. Instead in the logs I see `ls` with d1 and d2 (expected), an `ls` with just d1 (??), and then an `ls` with the root fs. This causes issues if the first ls is changed to `ls /example/d2` as it will error the whole pipeline due to missing path.
```golang
workdir := client.Host().Workdir()
d1, err := workdir.Read().Directory("dir1/").ID(ctx)
if err != nil {
return err
}
d2, err := workdir.Read().Directory("dir2/").ID(ctx)
if err != nil {
return err
}
build := client.Container().From("alpine:latest").
WithMountedDirectory("/example/d1", d1).
WithMountedDirectory("/example/d2", d2)
build = build.Exec(dagger.ContainerExecOpts{
Args: []string{"ls", "/example"},
})
_, err = build.ExitCode(ctx)
if err != nil {
return err
}
build = build.Exec(dagger.ContainerExecOpts{
Args: []string{"ls", "/"},
})
_, err = build.ExitCode(ctx)
if err != nil {
return err
}
```
I was able to get the same functionality working fine by using `fs, err := build.FS().WithDirectory(d1, "/example/d1").WithDirectory(d2, "/example/d2").ID(ctx); build = build.WithFS(fs);` so conceptually don't think I'm doing anything wrong.
### Log output
```
#1 resolve image config for docker.io/library/alpine:latest
#1 DONE 0.4s
#2 mkfile /Dockerfile
#2 DONE 0.0s
#3 mkfile /main.go
#3 CACHED
#4 [internal] load metadata for docker.io/library/golang:1.18.2-alpine
#4 DONE 0.1s
#5 local://__dagger_workdir_/home/plaisted/source/OSD.PJI-Temporary/repro
#5 DONE 0.0s
#6 local://__dagger_workdir_/home/plaisted/source/OSD.PJI-Temporary/repro
#6 transferring __dagger_workdir_/home/plaisted/source/OSD.PJI-Temporary/repro: 309B done
#6 DONE 0.0s
#7 [build 1/6] FROM docker.io/library/golang:1.18.2-alpine@sha256:4795c5d21f01e0777707ada02408debe77fe31848be97cf9fa8a1462da78d949
#7 resolve docker.io/library/golang:1.18.2-alpine@sha256:4795c5d21f01e0777707ada02408debe77fe31848be97cf9fa8a1462da78d949 0.0s done
#7 DONE 0.0s
#8 [build 3/6] RUN apk add --no-cache file git
#8 CACHED
#9 [build 4/6] RUN go mod init go.dagger.io/dagger/shim/cmd
#9 CACHED
#10 [build 2/6] WORKDIR /src
#10 CACHED
#11 [build 5/6] COPY . .
#11 CACHED
#12 [build 6/6] RUN CGO_ENABLED=0 go build -o /_shim -ldflags '-s -d -w' .
#12 CACHED
#13 [stage-1 1/1] COPY --from=build /_shim /_shim
#13 CACHED
#14 mkdir /meta
#14 CACHED
#15 copy / /
#15 DONE 0.0s
#16 docker-image://docker.io/library/alpine:latest
#16 resolve docker.io/library/alpine:latest
#16 resolve docker.io/library/alpine:latest 0.1s done
#16 CACHED
#17 copy / /
#17 CACHED
#18 ls /example
#18 0.157 d1
#18 0.157 d2
#18 DONE 0.2s
#1 resolve image config for docker.io/library/alpine:latest
#1 DONE 0.5s
#4 [internal] load metadata for docker.io/library/golang:1.18.2-alpine
#4 DONE 0.4s
#19 ls /example
#19 0.172 d1
#19 DONE 0.2s
#20 ls /
#20 0.105 _shim
#20 0.105 bin
#20 0.105 dagger
#20 0.105 dev
#20 0.105 etc
#20 0.105 example
#20 0.105 home
#20 0.105 lib
#20 0.105 media
#20 0.105 mnt
#20 0.105 opt
#20 0.105 proc
#20 0.105 root
#20 0.105 run
#20 0.105 sbin
#20 0.105 srv
#20 0.105 sys
#20 0.105 tmp
#20 0.105 usr
#20 0.105 var
#20 DONE 0.1s
#0 0.148 d1
#0 0.148 d2
#18 DONE 0.2s
#1 resolve image config for docker.io/library/alpine:latest
#1 DONE 0.4s
#4 [internal] load metadata for docker.io/library/golang:1.18.2-alpine
#4 DONE 0.4s
#19 ls /example
#0 0.135 d1
#19 DONE 0.2s
#20 ls /example
#0 0.104 d1
#0 0.104 d2
#20 DONE 0.1s
```
### Steps to reproduce
* Mount two directories
* Run multiple exec commands and observe logs output
### Dagger version
dagger v0.3.1
### OS version
Ubuntu-20.04
|
https://github.com/dagger/dagger/issues/3551
|
https://github.com/dagger/dagger/pull/3602
|
b734ed35554bbfbc5caf63674eaa9c22692e614e
|
b4bb0b9e06e1edf8b81f9054b7419daabcb5bedb
| 2022-10-26T01:16:16Z |
go
| 2022-10-31T22:13:34Z |
core/container.go
|
ctx context.Context,
container *Container,
containerPath string,
gw bkgw.Client,
init func(context.Context, llb.State, string, specs.Platform) (T, error),
) (T, error) {
payload, err := container.ID.decode()
if err != nil {
return nil, err
}
containerPath = absPath(payload.Config.WorkingDir, containerPath)
var found T
for i := len(payload.Mounts) - 1; i >= 0; i-- {
mnt := payload.Mounts[i]
if containerPath == mnt.Target || strings.HasPrefix(containerPath, mnt.Target+"/") {
if mnt.Tmpfs {
return nil, fmt.Errorf("%s: cannot retrieve path from tmpfs", containerPath)
}
if mnt.CacheID != "" {
return nil, fmt.Errorf("%s: cannot retrieve path from cache", containerPath)
}
st, err := mnt.SourceState()
if err != nil {
return nil, err
}
sub := mnt.SourcePath
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 3,551 |
π Odd container behavior with exec / multiple withMountedDirectory
|
### What is the issue?
The following code executes but provides unexpected logs / output. Other similar use cases error due to missing files due to same issue. This may be something very simple (haven't used golang in many years) but seems like there may be an underlying issue with the execution engine.
I would expect this code to run the `ls` command twice, one time showing the two mounted directories, one time showing the root output. Instead in the logs I see `ls` with d1 and d2 (expected), an `ls` with just d1 (??), and then an `ls` with the root fs. This causes issues if the first ls is changed to `ls /example/d2` as it will error the whole pipeline due to missing path.
```golang
workdir := client.Host().Workdir()
d1, err := workdir.Read().Directory("dir1/").ID(ctx)
if err != nil {
return err
}
d2, err := workdir.Read().Directory("dir2/").ID(ctx)
if err != nil {
return err
}
build := client.Container().From("alpine:latest").
WithMountedDirectory("/example/d1", d1).
WithMountedDirectory("/example/d2", d2)
build = build.Exec(dagger.ContainerExecOpts{
Args: []string{"ls", "/example"},
})
_, err = build.ExitCode(ctx)
if err != nil {
return err
}
build = build.Exec(dagger.ContainerExecOpts{
Args: []string{"ls", "/"},
})
_, err = build.ExitCode(ctx)
if err != nil {
return err
}
```
I was able to get the same functionality working fine by using `fs, err := build.FS().WithDirectory(d1, "/example/d1").WithDirectory(d2, "/example/d2").ID(ctx); build = build.WithFS(fs);` so conceptually don't think I'm doing anything wrong.
### Log output
```
#1 resolve image config for docker.io/library/alpine:latest
#1 DONE 0.4s
#2 mkfile /Dockerfile
#2 DONE 0.0s
#3 mkfile /main.go
#3 CACHED
#4 [internal] load metadata for docker.io/library/golang:1.18.2-alpine
#4 DONE 0.1s
#5 local://__dagger_workdir_/home/plaisted/source/OSD.PJI-Temporary/repro
#5 DONE 0.0s
#6 local://__dagger_workdir_/home/plaisted/source/OSD.PJI-Temporary/repro
#6 transferring __dagger_workdir_/home/plaisted/source/OSD.PJI-Temporary/repro: 309B done
#6 DONE 0.0s
#7 [build 1/6] FROM docker.io/library/golang:1.18.2-alpine@sha256:4795c5d21f01e0777707ada02408debe77fe31848be97cf9fa8a1462da78d949
#7 resolve docker.io/library/golang:1.18.2-alpine@sha256:4795c5d21f01e0777707ada02408debe77fe31848be97cf9fa8a1462da78d949 0.0s done
#7 DONE 0.0s
#8 [build 3/6] RUN apk add --no-cache file git
#8 CACHED
#9 [build 4/6] RUN go mod init go.dagger.io/dagger/shim/cmd
#9 CACHED
#10 [build 2/6] WORKDIR /src
#10 CACHED
#11 [build 5/6] COPY . .
#11 CACHED
#12 [build 6/6] RUN CGO_ENABLED=0 go build -o /_shim -ldflags '-s -d -w' .
#12 CACHED
#13 [stage-1 1/1] COPY --from=build /_shim /_shim
#13 CACHED
#14 mkdir /meta
#14 CACHED
#15 copy / /
#15 DONE 0.0s
#16 docker-image://docker.io/library/alpine:latest
#16 resolve docker.io/library/alpine:latest
#16 resolve docker.io/library/alpine:latest 0.1s done
#16 CACHED
#17 copy / /
#17 CACHED
#18 ls /example
#18 0.157 d1
#18 0.157 d2
#18 DONE 0.2s
#1 resolve image config for docker.io/library/alpine:latest
#1 DONE 0.5s
#4 [internal] load metadata for docker.io/library/golang:1.18.2-alpine
#4 DONE 0.4s
#19 ls /example
#19 0.172 d1
#19 DONE 0.2s
#20 ls /
#20 0.105 _shim
#20 0.105 bin
#20 0.105 dagger
#20 0.105 dev
#20 0.105 etc
#20 0.105 example
#20 0.105 home
#20 0.105 lib
#20 0.105 media
#20 0.105 mnt
#20 0.105 opt
#20 0.105 proc
#20 0.105 root
#20 0.105 run
#20 0.105 sbin
#20 0.105 srv
#20 0.105 sys
#20 0.105 tmp
#20 0.105 usr
#20 0.105 var
#20 DONE 0.1s
#0 0.148 d1
#0 0.148 d2
#18 DONE 0.2s
#1 resolve image config for docker.io/library/alpine:latest
#1 DONE 0.4s
#4 [internal] load metadata for docker.io/library/golang:1.18.2-alpine
#4 DONE 0.4s
#19 ls /example
#0 0.135 d1
#19 DONE 0.2s
#20 ls /example
#0 0.104 d1
#0 0.104 d2
#20 DONE 0.1s
```
### Steps to reproduce
* Mount two directories
* Run multiple exec commands and observe logs output
### Dagger version
dagger v0.3.1
### OS version
Ubuntu-20.04
|
https://github.com/dagger/dagger/issues/3551
|
https://github.com/dagger/dagger/pull/3602
|
b734ed35554bbfbc5caf63674eaa9c22692e614e
|
b4bb0b9e06e1edf8b81f9054b7419daabcb5bedb
| 2022-10-26T01:16:16Z |
go
| 2022-10-31T22:13:34Z |
core/container.go
|
if containerPath != mnt.Target {
dirSub := strings.TrimPrefix(containerPath, mnt.Target+"/")
if dirSub != "" {
sub = path.Join(sub, dirSub)
}
}
found, err = init(ctx, st, sub, payload.Platform)
if err != nil {
return nil, err
}
break
}
}
if found == nil {
st, err := payload.FSState()
if err != nil {
return nil, err
}
found, err = init(ctx, st, containerPath, payload.Platform)
if err != nil {
return nil, err
}
}
return found, nil
}
func (container *Container) withMounted(target string, srcDef *pb.Definition, srcPath string) (*Container, error) {
payload, err := container.ID.decode()
if err != nil {
return nil, err
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 3,551 |
π Odd container behavior with exec / multiple withMountedDirectory
|
### What is the issue?
The following code executes but provides unexpected logs / output. Other similar use cases error due to missing files due to same issue. This may be something very simple (haven't used golang in many years) but seems like there may be an underlying issue with the execution engine.
I would expect this code to run the `ls` command twice, one time showing the two mounted directories, one time showing the root output. Instead in the logs I see `ls` with d1 and d2 (expected), an `ls` with just d1 (??), and then an `ls` with the root fs. This causes issues if the first ls is changed to `ls /example/d2` as it will error the whole pipeline due to missing path.
```golang
workdir := client.Host().Workdir()
d1, err := workdir.Read().Directory("dir1/").ID(ctx)
if err != nil {
return err
}
d2, err := workdir.Read().Directory("dir2/").ID(ctx)
if err != nil {
return err
}
build := client.Container().From("alpine:latest").
WithMountedDirectory("/example/d1", d1).
WithMountedDirectory("/example/d2", d2)
build = build.Exec(dagger.ContainerExecOpts{
Args: []string{"ls", "/example"},
})
_, err = build.ExitCode(ctx)
if err != nil {
return err
}
build = build.Exec(dagger.ContainerExecOpts{
Args: []string{"ls", "/"},
})
_, err = build.ExitCode(ctx)
if err != nil {
return err
}
```
I was able to get the same functionality working fine by using `fs, err := build.FS().WithDirectory(d1, "/example/d1").WithDirectory(d2, "/example/d2").ID(ctx); build = build.WithFS(fs);` so conceptually don't think I'm doing anything wrong.
### Log output
```
#1 resolve image config for docker.io/library/alpine:latest
#1 DONE 0.4s
#2 mkfile /Dockerfile
#2 DONE 0.0s
#3 mkfile /main.go
#3 CACHED
#4 [internal] load metadata for docker.io/library/golang:1.18.2-alpine
#4 DONE 0.1s
#5 local://__dagger_workdir_/home/plaisted/source/OSD.PJI-Temporary/repro
#5 DONE 0.0s
#6 local://__dagger_workdir_/home/plaisted/source/OSD.PJI-Temporary/repro
#6 transferring __dagger_workdir_/home/plaisted/source/OSD.PJI-Temporary/repro: 309B done
#6 DONE 0.0s
#7 [build 1/6] FROM docker.io/library/golang:1.18.2-alpine@sha256:4795c5d21f01e0777707ada02408debe77fe31848be97cf9fa8a1462da78d949
#7 resolve docker.io/library/golang:1.18.2-alpine@sha256:4795c5d21f01e0777707ada02408debe77fe31848be97cf9fa8a1462da78d949 0.0s done
#7 DONE 0.0s
#8 [build 3/6] RUN apk add --no-cache file git
#8 CACHED
#9 [build 4/6] RUN go mod init go.dagger.io/dagger/shim/cmd
#9 CACHED
#10 [build 2/6] WORKDIR /src
#10 CACHED
#11 [build 5/6] COPY . .
#11 CACHED
#12 [build 6/6] RUN CGO_ENABLED=0 go build -o /_shim -ldflags '-s -d -w' .
#12 CACHED
#13 [stage-1 1/1] COPY --from=build /_shim /_shim
#13 CACHED
#14 mkdir /meta
#14 CACHED
#15 copy / /
#15 DONE 0.0s
#16 docker-image://docker.io/library/alpine:latest
#16 resolve docker.io/library/alpine:latest
#16 resolve docker.io/library/alpine:latest 0.1s done
#16 CACHED
#17 copy / /
#17 CACHED
#18 ls /example
#18 0.157 d1
#18 0.157 d2
#18 DONE 0.2s
#1 resolve image config for docker.io/library/alpine:latest
#1 DONE 0.5s
#4 [internal] load metadata for docker.io/library/golang:1.18.2-alpine
#4 DONE 0.4s
#19 ls /example
#19 0.172 d1
#19 DONE 0.2s
#20 ls /
#20 0.105 _shim
#20 0.105 bin
#20 0.105 dagger
#20 0.105 dev
#20 0.105 etc
#20 0.105 example
#20 0.105 home
#20 0.105 lib
#20 0.105 media
#20 0.105 mnt
#20 0.105 opt
#20 0.105 proc
#20 0.105 root
#20 0.105 run
#20 0.105 sbin
#20 0.105 srv
#20 0.105 sys
#20 0.105 tmp
#20 0.105 usr
#20 0.105 var
#20 DONE 0.1s
#0 0.148 d1
#0 0.148 d2
#18 DONE 0.2s
#1 resolve image config for docker.io/library/alpine:latest
#1 DONE 0.4s
#4 [internal] load metadata for docker.io/library/golang:1.18.2-alpine
#4 DONE 0.4s
#19 ls /example
#0 0.135 d1
#19 DONE 0.2s
#20 ls /example
#0 0.104 d1
#0 0.104 d2
#20 DONE 0.1s
```
### Steps to reproduce
* Mount two directories
* Run multiple exec commands and observe logs output
### Dagger version
dagger v0.3.1
### OS version
Ubuntu-20.04
|
https://github.com/dagger/dagger/issues/3551
|
https://github.com/dagger/dagger/pull/3602
|
b734ed35554bbfbc5caf63674eaa9c22692e614e
|
b4bb0b9e06e1edf8b81f9054b7419daabcb5bedb
| 2022-10-26T01:16:16Z |
go
| 2022-10-31T22:13:34Z |
core/container.go
|
}
target = absPath(payload.Config.WorkingDir, target)
payload.Mounts = append(payload.Mounts, ContainerMount{
Source: srcDef,
SourcePath: srcPath,
Target: target,
})
id, err := payload.Encode()
if err != nil {
return nil, err
}
return &Container{ID: id}, nil
}
func (container *Container) ImageConfig(ctx context.Context) (specs.ImageConfig, error) {
payload, err := container.ID.decode()
if err != nil {
return specs.ImageConfig{}, err
}
return payload.Config, nil
}
func (container *Container) UpdateImageConfig(ctx context.Context, updateFn func(specs.ImageConfig) specs.ImageConfig) (*Container, error) {
payload, err := container.ID.decode()
if err != nil {
return nil, err
}
payload.Config = updateFn(payload.Config)
id, err := payload.Encode()
if err != nil {
return nil, err
}
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 3,551 |
π Odd container behavior with exec / multiple withMountedDirectory
|
### What is the issue?
The following code executes but provides unexpected logs / output. Other similar use cases error due to missing files due to same issue. This may be something very simple (haven't used golang in many years) but seems like there may be an underlying issue with the execution engine.
I would expect this code to run the `ls` command twice, one time showing the two mounted directories, one time showing the root output. Instead in the logs I see `ls` with d1 and d2 (expected), an `ls` with just d1 (??), and then an `ls` with the root fs. This causes issues if the first ls is changed to `ls /example/d2` as it will error the whole pipeline due to missing path.
```golang
workdir := client.Host().Workdir()
d1, err := workdir.Read().Directory("dir1/").ID(ctx)
if err != nil {
return err
}
d2, err := workdir.Read().Directory("dir2/").ID(ctx)
if err != nil {
return err
}
build := client.Container().From("alpine:latest").
WithMountedDirectory("/example/d1", d1).
WithMountedDirectory("/example/d2", d2)
build = build.Exec(dagger.ContainerExecOpts{
Args: []string{"ls", "/example"},
})
_, err = build.ExitCode(ctx)
if err != nil {
return err
}
build = build.Exec(dagger.ContainerExecOpts{
Args: []string{"ls", "/"},
})
_, err = build.ExitCode(ctx)
if err != nil {
return err
}
```
I was able to get the same functionality working fine by using `fs, err := build.FS().WithDirectory(d1, "/example/d1").WithDirectory(d2, "/example/d2").ID(ctx); build = build.WithFS(fs);` so conceptually don't think I'm doing anything wrong.
### Log output
```
#1 resolve image config for docker.io/library/alpine:latest
#1 DONE 0.4s
#2 mkfile /Dockerfile
#2 DONE 0.0s
#3 mkfile /main.go
#3 CACHED
#4 [internal] load metadata for docker.io/library/golang:1.18.2-alpine
#4 DONE 0.1s
#5 local://__dagger_workdir_/home/plaisted/source/OSD.PJI-Temporary/repro
#5 DONE 0.0s
#6 local://__dagger_workdir_/home/plaisted/source/OSD.PJI-Temporary/repro
#6 transferring __dagger_workdir_/home/plaisted/source/OSD.PJI-Temporary/repro: 309B done
#6 DONE 0.0s
#7 [build 1/6] FROM docker.io/library/golang:1.18.2-alpine@sha256:4795c5d21f01e0777707ada02408debe77fe31848be97cf9fa8a1462da78d949
#7 resolve docker.io/library/golang:1.18.2-alpine@sha256:4795c5d21f01e0777707ada02408debe77fe31848be97cf9fa8a1462da78d949 0.0s done
#7 DONE 0.0s
#8 [build 3/6] RUN apk add --no-cache file git
#8 CACHED
#9 [build 4/6] RUN go mod init go.dagger.io/dagger/shim/cmd
#9 CACHED
#10 [build 2/6] WORKDIR /src
#10 CACHED
#11 [build 5/6] COPY . .
#11 CACHED
#12 [build 6/6] RUN CGO_ENABLED=0 go build -o /_shim -ldflags '-s -d -w' .
#12 CACHED
#13 [stage-1 1/1] COPY --from=build /_shim /_shim
#13 CACHED
#14 mkdir /meta
#14 CACHED
#15 copy / /
#15 DONE 0.0s
#16 docker-image://docker.io/library/alpine:latest
#16 resolve docker.io/library/alpine:latest
#16 resolve docker.io/library/alpine:latest 0.1s done
#16 CACHED
#17 copy / /
#17 CACHED
#18 ls /example
#18 0.157 d1
#18 0.157 d2
#18 DONE 0.2s
#1 resolve image config for docker.io/library/alpine:latest
#1 DONE 0.5s
#4 [internal] load metadata for docker.io/library/golang:1.18.2-alpine
#4 DONE 0.4s
#19 ls /example
#19 0.172 d1
#19 DONE 0.2s
#20 ls /
#20 0.105 _shim
#20 0.105 bin
#20 0.105 dagger
#20 0.105 dev
#20 0.105 etc
#20 0.105 example
#20 0.105 home
#20 0.105 lib
#20 0.105 media
#20 0.105 mnt
#20 0.105 opt
#20 0.105 proc
#20 0.105 root
#20 0.105 run
#20 0.105 sbin
#20 0.105 srv
#20 0.105 sys
#20 0.105 tmp
#20 0.105 usr
#20 0.105 var
#20 DONE 0.1s
#0 0.148 d1
#0 0.148 d2
#18 DONE 0.2s
#1 resolve image config for docker.io/library/alpine:latest
#1 DONE 0.4s
#4 [internal] load metadata for docker.io/library/golang:1.18.2-alpine
#4 DONE 0.4s
#19 ls /example
#0 0.135 d1
#19 DONE 0.2s
#20 ls /example
#0 0.104 d1
#0 0.104 d2
#20 DONE 0.1s
```
### Steps to reproduce
* Mount two directories
* Run multiple exec commands and observe logs output
### Dagger version
dagger v0.3.1
### OS version
Ubuntu-20.04
|
https://github.com/dagger/dagger/issues/3551
|
https://github.com/dagger/dagger/pull/3602
|
b734ed35554bbfbc5caf63674eaa9c22692e614e
|
b4bb0b9e06e1edf8b81f9054b7419daabcb5bedb
| 2022-10-26T01:16:16Z |
go
| 2022-10-31T22:13:34Z |
core/container.go
|
return &Container{ID: id}, nil
}
func (container *Container) Exec(ctx context.Context, gw bkgw.Client, opts ContainerExecOpts) (*Container, error) {
payload, err := container.ID.decode()
if err != nil {
return nil, fmt.Errorf("decode id: %w", err)
}
cfg := payload.Config
mounts := payload.Mounts
platform := payload.Platform
shimSt, err := shim.Build(ctx, gw, platform)
if err != nil {
return nil, fmt.Errorf("build shim: %w", err)
}
args := opts.Args
if len(args) == 0 {
args = cfg.Cmd
}
if len(cfg.Entrypoint) > 0 {
args = append(cfg.Entrypoint, args...)
}
runOpts := []llb.RunOption{
llb.AddMount(shim.Path, shimSt, llb.SourcePath(shim.Path)),
llb.Args(append([]string{shim.Path}, args...)),
llb.WithCustomName(strings.Join(args, " ")),
}
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 3,551 |
π Odd container behavior with exec / multiple withMountedDirectory
|
### What is the issue?
The following code executes but provides unexpected logs / output. Other similar use cases error due to missing files due to same issue. This may be something very simple (haven't used golang in many years) but seems like there may be an underlying issue with the execution engine.
I would expect this code to run the `ls` command twice, one time showing the two mounted directories, one time showing the root output. Instead in the logs I see `ls` with d1 and d2 (expected), an `ls` with just d1 (??), and then an `ls` with the root fs. This causes issues if the first ls is changed to `ls /example/d2` as it will error the whole pipeline due to missing path.
```golang
workdir := client.Host().Workdir()
d1, err := workdir.Read().Directory("dir1/").ID(ctx)
if err != nil {
return err
}
d2, err := workdir.Read().Directory("dir2/").ID(ctx)
if err != nil {
return err
}
build := client.Container().From("alpine:latest").
WithMountedDirectory("/example/d1", d1).
WithMountedDirectory("/example/d2", d2)
build = build.Exec(dagger.ContainerExecOpts{
Args: []string{"ls", "/example"},
})
_, err = build.ExitCode(ctx)
if err != nil {
return err
}
build = build.Exec(dagger.ContainerExecOpts{
Args: []string{"ls", "/"},
})
_, err = build.ExitCode(ctx)
if err != nil {
return err
}
```
I was able to get the same functionality working fine by using `fs, err := build.FS().WithDirectory(d1, "/example/d1").WithDirectory(d2, "/example/d2").ID(ctx); build = build.WithFS(fs);` so conceptually don't think I'm doing anything wrong.
### Log output
```
#1 resolve image config for docker.io/library/alpine:latest
#1 DONE 0.4s
#2 mkfile /Dockerfile
#2 DONE 0.0s
#3 mkfile /main.go
#3 CACHED
#4 [internal] load metadata for docker.io/library/golang:1.18.2-alpine
#4 DONE 0.1s
#5 local://__dagger_workdir_/home/plaisted/source/OSD.PJI-Temporary/repro
#5 DONE 0.0s
#6 local://__dagger_workdir_/home/plaisted/source/OSD.PJI-Temporary/repro
#6 transferring __dagger_workdir_/home/plaisted/source/OSD.PJI-Temporary/repro: 309B done
#6 DONE 0.0s
#7 [build 1/6] FROM docker.io/library/golang:1.18.2-alpine@sha256:4795c5d21f01e0777707ada02408debe77fe31848be97cf9fa8a1462da78d949
#7 resolve docker.io/library/golang:1.18.2-alpine@sha256:4795c5d21f01e0777707ada02408debe77fe31848be97cf9fa8a1462da78d949 0.0s done
#7 DONE 0.0s
#8 [build 3/6] RUN apk add --no-cache file git
#8 CACHED
#9 [build 4/6] RUN go mod init go.dagger.io/dagger/shim/cmd
#9 CACHED
#10 [build 2/6] WORKDIR /src
#10 CACHED
#11 [build 5/6] COPY . .
#11 CACHED
#12 [build 6/6] RUN CGO_ENABLED=0 go build -o /_shim -ldflags '-s -d -w' .
#12 CACHED
#13 [stage-1 1/1] COPY --from=build /_shim /_shim
#13 CACHED
#14 mkdir /meta
#14 CACHED
#15 copy / /
#15 DONE 0.0s
#16 docker-image://docker.io/library/alpine:latest
#16 resolve docker.io/library/alpine:latest
#16 resolve docker.io/library/alpine:latest 0.1s done
#16 CACHED
#17 copy / /
#17 CACHED
#18 ls /example
#18 0.157 d1
#18 0.157 d2
#18 DONE 0.2s
#1 resolve image config for docker.io/library/alpine:latest
#1 DONE 0.5s
#4 [internal] load metadata for docker.io/library/golang:1.18.2-alpine
#4 DONE 0.4s
#19 ls /example
#19 0.172 d1
#19 DONE 0.2s
#20 ls /
#20 0.105 _shim
#20 0.105 bin
#20 0.105 dagger
#20 0.105 dev
#20 0.105 etc
#20 0.105 example
#20 0.105 home
#20 0.105 lib
#20 0.105 media
#20 0.105 mnt
#20 0.105 opt
#20 0.105 proc
#20 0.105 root
#20 0.105 run
#20 0.105 sbin
#20 0.105 srv
#20 0.105 sys
#20 0.105 tmp
#20 0.105 usr
#20 0.105 var
#20 DONE 0.1s
#0 0.148 d1
#0 0.148 d2
#18 DONE 0.2s
#1 resolve image config for docker.io/library/alpine:latest
#1 DONE 0.4s
#4 [internal] load metadata for docker.io/library/golang:1.18.2-alpine
#4 DONE 0.4s
#19 ls /example
#0 0.135 d1
#19 DONE 0.2s
#20 ls /example
#0 0.104 d1
#0 0.104 d2
#20 DONE 0.1s
```
### Steps to reproduce
* Mount two directories
* Run multiple exec commands and observe logs output
### Dagger version
dagger v0.3.1
### OS version
Ubuntu-20.04
|
https://github.com/dagger/dagger/issues/3551
|
https://github.com/dagger/dagger/pull/3602
|
b734ed35554bbfbc5caf63674eaa9c22692e614e
|
b4bb0b9e06e1edf8b81f9054b7419daabcb5bedb
| 2022-10-26T01:16:16Z |
go
| 2022-10-31T22:13:34Z |
core/container.go
|
meta := llb.Mkdir(metaSourcePath, 0777)
if opts.Stdin != "" {
meta = meta.Mkfile(path.Join(metaSourcePath, "stdin"), 0600, []byte(opts.Stdin))
}
runOpts = append(runOpts,
llb.AddMount(metaMount,
llb.Scratch().File(meta),
llb.SourcePath(metaSourcePath)))
if opts.RedirectStdout != "" {
runOpts = append(runOpts, llb.AddEnv("_DAGGER_REDIRECT_STDOUT", opts.RedirectStdout))
}
if opts.RedirectStderr != "" {
runOpts = append(runOpts, llb.AddEnv("_DAGGER_REDIRECT_STDERR", opts.RedirectStderr))
}
if cfg.User != "" {
runOpts = append(runOpts, llb.User(cfg.User))
}
if cfg.WorkingDir != "" {
runOpts = append(runOpts, llb.Dir(cfg.WorkingDir))
}
for _, env := range cfg.Env {
name, val, ok := strings.Cut(env, "=")
if !ok {
_ = ok
}
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 3,551 |
π Odd container behavior with exec / multiple withMountedDirectory
|
### What is the issue?
The following code executes but provides unexpected logs / output. Other similar use cases error due to missing files due to same issue. This may be something very simple (haven't used golang in many years) but seems like there may be an underlying issue with the execution engine.
I would expect this code to run the `ls` command twice, one time showing the two mounted directories, one time showing the root output. Instead in the logs I see `ls` with d1 and d2 (expected), an `ls` with just d1 (??), and then an `ls` with the root fs. This causes issues if the first ls is changed to `ls /example/d2` as it will error the whole pipeline due to missing path.
```golang
workdir := client.Host().Workdir()
d1, err := workdir.Read().Directory("dir1/").ID(ctx)
if err != nil {
return err
}
d2, err := workdir.Read().Directory("dir2/").ID(ctx)
if err != nil {
return err
}
build := client.Container().From("alpine:latest").
WithMountedDirectory("/example/d1", d1).
WithMountedDirectory("/example/d2", d2)
build = build.Exec(dagger.ContainerExecOpts{
Args: []string{"ls", "/example"},
})
_, err = build.ExitCode(ctx)
if err != nil {
return err
}
build = build.Exec(dagger.ContainerExecOpts{
Args: []string{"ls", "/"},
})
_, err = build.ExitCode(ctx)
if err != nil {
return err
}
```
I was able to get the same functionality working fine by using `fs, err := build.FS().WithDirectory(d1, "/example/d1").WithDirectory(d2, "/example/d2").ID(ctx); build = build.WithFS(fs);` so conceptually don't think I'm doing anything wrong.
### Log output
```
#1 resolve image config for docker.io/library/alpine:latest
#1 DONE 0.4s
#2 mkfile /Dockerfile
#2 DONE 0.0s
#3 mkfile /main.go
#3 CACHED
#4 [internal] load metadata for docker.io/library/golang:1.18.2-alpine
#4 DONE 0.1s
#5 local://__dagger_workdir_/home/plaisted/source/OSD.PJI-Temporary/repro
#5 DONE 0.0s
#6 local://__dagger_workdir_/home/plaisted/source/OSD.PJI-Temporary/repro
#6 transferring __dagger_workdir_/home/plaisted/source/OSD.PJI-Temporary/repro: 309B done
#6 DONE 0.0s
#7 [build 1/6] FROM docker.io/library/golang:1.18.2-alpine@sha256:4795c5d21f01e0777707ada02408debe77fe31848be97cf9fa8a1462da78d949
#7 resolve docker.io/library/golang:1.18.2-alpine@sha256:4795c5d21f01e0777707ada02408debe77fe31848be97cf9fa8a1462da78d949 0.0s done
#7 DONE 0.0s
#8 [build 3/6] RUN apk add --no-cache file git
#8 CACHED
#9 [build 4/6] RUN go mod init go.dagger.io/dagger/shim/cmd
#9 CACHED
#10 [build 2/6] WORKDIR /src
#10 CACHED
#11 [build 5/6] COPY . .
#11 CACHED
#12 [build 6/6] RUN CGO_ENABLED=0 go build -o /_shim -ldflags '-s -d -w' .
#12 CACHED
#13 [stage-1 1/1] COPY --from=build /_shim /_shim
#13 CACHED
#14 mkdir /meta
#14 CACHED
#15 copy / /
#15 DONE 0.0s
#16 docker-image://docker.io/library/alpine:latest
#16 resolve docker.io/library/alpine:latest
#16 resolve docker.io/library/alpine:latest 0.1s done
#16 CACHED
#17 copy / /
#17 CACHED
#18 ls /example
#18 0.157 d1
#18 0.157 d2
#18 DONE 0.2s
#1 resolve image config for docker.io/library/alpine:latest
#1 DONE 0.5s
#4 [internal] load metadata for docker.io/library/golang:1.18.2-alpine
#4 DONE 0.4s
#19 ls /example
#19 0.172 d1
#19 DONE 0.2s
#20 ls /
#20 0.105 _shim
#20 0.105 bin
#20 0.105 dagger
#20 0.105 dev
#20 0.105 etc
#20 0.105 example
#20 0.105 home
#20 0.105 lib
#20 0.105 media
#20 0.105 mnt
#20 0.105 opt
#20 0.105 proc
#20 0.105 root
#20 0.105 run
#20 0.105 sbin
#20 0.105 srv
#20 0.105 sys
#20 0.105 tmp
#20 0.105 usr
#20 0.105 var
#20 DONE 0.1s
#0 0.148 d1
#0 0.148 d2
#18 DONE 0.2s
#1 resolve image config for docker.io/library/alpine:latest
#1 DONE 0.4s
#4 [internal] load metadata for docker.io/library/golang:1.18.2-alpine
#4 DONE 0.4s
#19 ls /example
#0 0.135 d1
#19 DONE 0.2s
#20 ls /example
#0 0.104 d1
#0 0.104 d2
#20 DONE 0.1s
```
### Steps to reproduce
* Mount two directories
* Run multiple exec commands and observe logs output
### Dagger version
dagger v0.3.1
### OS version
Ubuntu-20.04
|
https://github.com/dagger/dagger/issues/3551
|
https://github.com/dagger/dagger/pull/3602
|
b734ed35554bbfbc5caf63674eaa9c22692e614e
|
b4bb0b9e06e1edf8b81f9054b7419daabcb5bedb
| 2022-10-26T01:16:16Z |
go
| 2022-10-31T22:13:34Z |
core/container.go
|
runOpts = append(runOpts, llb.AddEnv(name, val))
}
for i, secret := range payload.Secrets {
secretOpts := []llb.SecretOption{llb.SecretID(string(secret.Secret))}
var secretDest string
switch {
case secret.EnvName != "":
secretDest = secret.EnvName
secretOpts = append(secretOpts, llb.SecretAsEnv(true))
case secret.MountPath != "":
secretDest = secret.MountPath
default:
return nil, fmt.Errorf("malformed secret config at index %d", i)
}
runOpts = append(runOpts, llb.AddSecret(secretDest, secretOpts...))
}
fsSt, err := payload.FSState()
if err != nil {
return nil, fmt.Errorf("fs state: %w", err)
}
execSt := fsSt.Run(runOpts...)
for i, mnt := range mounts {
srcSt, err := mnt.SourceState()
if err != nil {
return nil, fmt.Errorf("mount %s: %w", mnt.Target, err)
}
mountOpts := []llb.MountOption{}
if mnt.SourcePath != "" {
mountOpts = append(mountOpts, llb.SourcePath(mnt.SourcePath))
}
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 3,551 |
π Odd container behavior with exec / multiple withMountedDirectory
|
### What is the issue?
The following code executes but provides unexpected logs / output. Other similar use cases error due to missing files due to same issue. This may be something very simple (haven't used golang in many years) but seems like there may be an underlying issue with the execution engine.
I would expect this code to run the `ls` command twice, one time showing the two mounted directories, one time showing the root output. Instead in the logs I see `ls` with d1 and d2 (expected), an `ls` with just d1 (??), and then an `ls` with the root fs. This causes issues if the first ls is changed to `ls /example/d2` as it will error the whole pipeline due to missing path.
```golang
workdir := client.Host().Workdir()
d1, err := workdir.Read().Directory("dir1/").ID(ctx)
if err != nil {
return err
}
d2, err := workdir.Read().Directory("dir2/").ID(ctx)
if err != nil {
return err
}
build := client.Container().From("alpine:latest").
WithMountedDirectory("/example/d1", d1).
WithMountedDirectory("/example/d2", d2)
build = build.Exec(dagger.ContainerExecOpts{
Args: []string{"ls", "/example"},
})
_, err = build.ExitCode(ctx)
if err != nil {
return err
}
build = build.Exec(dagger.ContainerExecOpts{
Args: []string{"ls", "/"},
})
_, err = build.ExitCode(ctx)
if err != nil {
return err
}
```
I was able to get the same functionality working fine by using `fs, err := build.FS().WithDirectory(d1, "/example/d1").WithDirectory(d2, "/example/d2").ID(ctx); build = build.WithFS(fs);` so conceptually don't think I'm doing anything wrong.
### Log output
```
#1 resolve image config for docker.io/library/alpine:latest
#1 DONE 0.4s
#2 mkfile /Dockerfile
#2 DONE 0.0s
#3 mkfile /main.go
#3 CACHED
#4 [internal] load metadata for docker.io/library/golang:1.18.2-alpine
#4 DONE 0.1s
#5 local://__dagger_workdir_/home/plaisted/source/OSD.PJI-Temporary/repro
#5 DONE 0.0s
#6 local://__dagger_workdir_/home/plaisted/source/OSD.PJI-Temporary/repro
#6 transferring __dagger_workdir_/home/plaisted/source/OSD.PJI-Temporary/repro: 309B done
#6 DONE 0.0s
#7 [build 1/6] FROM docker.io/library/golang:1.18.2-alpine@sha256:4795c5d21f01e0777707ada02408debe77fe31848be97cf9fa8a1462da78d949
#7 resolve docker.io/library/golang:1.18.2-alpine@sha256:4795c5d21f01e0777707ada02408debe77fe31848be97cf9fa8a1462da78d949 0.0s done
#7 DONE 0.0s
#8 [build 3/6] RUN apk add --no-cache file git
#8 CACHED
#9 [build 4/6] RUN go mod init go.dagger.io/dagger/shim/cmd
#9 CACHED
#10 [build 2/6] WORKDIR /src
#10 CACHED
#11 [build 5/6] COPY . .
#11 CACHED
#12 [build 6/6] RUN CGO_ENABLED=0 go build -o /_shim -ldflags '-s -d -w' .
#12 CACHED
#13 [stage-1 1/1] COPY --from=build /_shim /_shim
#13 CACHED
#14 mkdir /meta
#14 CACHED
#15 copy / /
#15 DONE 0.0s
#16 docker-image://docker.io/library/alpine:latest
#16 resolve docker.io/library/alpine:latest
#16 resolve docker.io/library/alpine:latest 0.1s done
#16 CACHED
#17 copy / /
#17 CACHED
#18 ls /example
#18 0.157 d1
#18 0.157 d2
#18 DONE 0.2s
#1 resolve image config for docker.io/library/alpine:latest
#1 DONE 0.5s
#4 [internal] load metadata for docker.io/library/golang:1.18.2-alpine
#4 DONE 0.4s
#19 ls /example
#19 0.172 d1
#19 DONE 0.2s
#20 ls /
#20 0.105 _shim
#20 0.105 bin
#20 0.105 dagger
#20 0.105 dev
#20 0.105 etc
#20 0.105 example
#20 0.105 home
#20 0.105 lib
#20 0.105 media
#20 0.105 mnt
#20 0.105 opt
#20 0.105 proc
#20 0.105 root
#20 0.105 run
#20 0.105 sbin
#20 0.105 srv
#20 0.105 sys
#20 0.105 tmp
#20 0.105 usr
#20 0.105 var
#20 DONE 0.1s
#0 0.148 d1
#0 0.148 d2
#18 DONE 0.2s
#1 resolve image config for docker.io/library/alpine:latest
#1 DONE 0.4s
#4 [internal] load metadata for docker.io/library/golang:1.18.2-alpine
#4 DONE 0.4s
#19 ls /example
#0 0.135 d1
#19 DONE 0.2s
#20 ls /example
#0 0.104 d1
#0 0.104 d2
#20 DONE 0.1s
```
### Steps to reproduce
* Mount two directories
* Run multiple exec commands and observe logs output
### Dagger version
dagger v0.3.1
### OS version
Ubuntu-20.04
|
https://github.com/dagger/dagger/issues/3551
|
https://github.com/dagger/dagger/pull/3602
|
b734ed35554bbfbc5caf63674eaa9c22692e614e
|
b4bb0b9e06e1edf8b81f9054b7419daabcb5bedb
| 2022-10-26T01:16:16Z |
go
| 2022-10-31T22:13:34Z |
core/container.go
|
if mnt.CacheSharingMode != "" {
var sharingMode llb.CacheMountSharingMode
switch mnt.CacheSharingMode {
case "shared":
sharingMode = llb.CacheMountShared
case "private":
sharingMode = llb.CacheMountPrivate
case "locked":
sharingMode = llb.CacheMountLocked
default:
return nil, errors.Errorf("invalid cache mount sharing mode %q", mnt.CacheSharingMode)
}
mountOpts = append(mountOpts, llb.AsPersistentCacheDir(mnt.CacheID, sharingMode))
}
if mnt.Tmpfs {
mountOpts = append(mountOpts, llb.Tmpfs())
}
mountSt := execSt.AddMount(mnt.Target, srcSt, mountOpts...)
if !mnt.Tmpfs && mnt.CacheID == "" {
execMountDef, err := mountSt.Marshal(ctx, llb.Platform(platform))
if err != nil {
return nil, fmt.Errorf("propagate %s: %w", mnt.Target, err)
}
mounts[i].Source = execMountDef.ToPB()
}
}
execDef, err := execSt.Root().Marshal(ctx, llb.Platform(platform))
if err != nil {
return nil, fmt.Errorf("marshal root: %w", err)
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 3,551 |
π Odd container behavior with exec / multiple withMountedDirectory
|
### What is the issue?
The following code executes but provides unexpected logs / output. Other similar use cases error due to missing files due to same issue. This may be something very simple (haven't used golang in many years) but seems like there may be an underlying issue with the execution engine.
I would expect this code to run the `ls` command twice, one time showing the two mounted directories, one time showing the root output. Instead in the logs I see `ls` with d1 and d2 (expected), an `ls` with just d1 (??), and then an `ls` with the root fs. This causes issues if the first ls is changed to `ls /example/d2` as it will error the whole pipeline due to missing path.
```golang
workdir := client.Host().Workdir()
d1, err := workdir.Read().Directory("dir1/").ID(ctx)
if err != nil {
return err
}
d2, err := workdir.Read().Directory("dir2/").ID(ctx)
if err != nil {
return err
}
build := client.Container().From("alpine:latest").
WithMountedDirectory("/example/d1", d1).
WithMountedDirectory("/example/d2", d2)
build = build.Exec(dagger.ContainerExecOpts{
Args: []string{"ls", "/example"},
})
_, err = build.ExitCode(ctx)
if err != nil {
return err
}
build = build.Exec(dagger.ContainerExecOpts{
Args: []string{"ls", "/"},
})
_, err = build.ExitCode(ctx)
if err != nil {
return err
}
```
I was able to get the same functionality working fine by using `fs, err := build.FS().WithDirectory(d1, "/example/d1").WithDirectory(d2, "/example/d2").ID(ctx); build = build.WithFS(fs);` so conceptually don't think I'm doing anything wrong.
### Log output
```
#1 resolve image config for docker.io/library/alpine:latest
#1 DONE 0.4s
#2 mkfile /Dockerfile
#2 DONE 0.0s
#3 mkfile /main.go
#3 CACHED
#4 [internal] load metadata for docker.io/library/golang:1.18.2-alpine
#4 DONE 0.1s
#5 local://__dagger_workdir_/home/plaisted/source/OSD.PJI-Temporary/repro
#5 DONE 0.0s
#6 local://__dagger_workdir_/home/plaisted/source/OSD.PJI-Temporary/repro
#6 transferring __dagger_workdir_/home/plaisted/source/OSD.PJI-Temporary/repro: 309B done
#6 DONE 0.0s
#7 [build 1/6] FROM docker.io/library/golang:1.18.2-alpine@sha256:4795c5d21f01e0777707ada02408debe77fe31848be97cf9fa8a1462da78d949
#7 resolve docker.io/library/golang:1.18.2-alpine@sha256:4795c5d21f01e0777707ada02408debe77fe31848be97cf9fa8a1462da78d949 0.0s done
#7 DONE 0.0s
#8 [build 3/6] RUN apk add --no-cache file git
#8 CACHED
#9 [build 4/6] RUN go mod init go.dagger.io/dagger/shim/cmd
#9 CACHED
#10 [build 2/6] WORKDIR /src
#10 CACHED
#11 [build 5/6] COPY . .
#11 CACHED
#12 [build 6/6] RUN CGO_ENABLED=0 go build -o /_shim -ldflags '-s -d -w' .
#12 CACHED
#13 [stage-1 1/1] COPY --from=build /_shim /_shim
#13 CACHED
#14 mkdir /meta
#14 CACHED
#15 copy / /
#15 DONE 0.0s
#16 docker-image://docker.io/library/alpine:latest
#16 resolve docker.io/library/alpine:latest
#16 resolve docker.io/library/alpine:latest 0.1s done
#16 CACHED
#17 copy / /
#17 CACHED
#18 ls /example
#18 0.157 d1
#18 0.157 d2
#18 DONE 0.2s
#1 resolve image config for docker.io/library/alpine:latest
#1 DONE 0.5s
#4 [internal] load metadata for docker.io/library/golang:1.18.2-alpine
#4 DONE 0.4s
#19 ls /example
#19 0.172 d1
#19 DONE 0.2s
#20 ls /
#20 0.105 _shim
#20 0.105 bin
#20 0.105 dagger
#20 0.105 dev
#20 0.105 etc
#20 0.105 example
#20 0.105 home
#20 0.105 lib
#20 0.105 media
#20 0.105 mnt
#20 0.105 opt
#20 0.105 proc
#20 0.105 root
#20 0.105 run
#20 0.105 sbin
#20 0.105 srv
#20 0.105 sys
#20 0.105 tmp
#20 0.105 usr
#20 0.105 var
#20 DONE 0.1s
#0 0.148 d1
#0 0.148 d2
#18 DONE 0.2s
#1 resolve image config for docker.io/library/alpine:latest
#1 DONE 0.4s
#4 [internal] load metadata for docker.io/library/golang:1.18.2-alpine
#4 DONE 0.4s
#19 ls /example
#0 0.135 d1
#19 DONE 0.2s
#20 ls /example
#0 0.104 d1
#0 0.104 d2
#20 DONE 0.1s
```
### Steps to reproduce
* Mount two directories
* Run multiple exec commands and observe logs output
### Dagger version
dagger v0.3.1
### OS version
Ubuntu-20.04
|
https://github.com/dagger/dagger/issues/3551
|
https://github.com/dagger/dagger/pull/3602
|
b734ed35554bbfbc5caf63674eaa9c22692e614e
|
b4bb0b9e06e1edf8b81f9054b7419daabcb5bedb
| 2022-10-26T01:16:16Z |
go
| 2022-10-31T22:13:34Z |
core/container.go
|
}
metaDef, err := execSt.GetMount(metaMount).Marshal(ctx, llb.Platform(platform))
if err != nil {
return nil, fmt.Errorf("get meta mount: %w", err)
}
payload.FS = execDef.ToPB()
payload.Mounts = mounts
payload.Meta = metaDef.ToPB()
id, err := payload.Encode()
if err != nil {
return nil, fmt.Errorf("encode: %w", err)
}
return &Container{ID: id}, nil
}
func (container *Container) ExitCode(ctx context.Context, gw bkgw.Client) (*int, error) {
file, err := container.MetaFile(ctx, gw, "exitCode")
if err != nil {
return nil, err
}
if file == nil {
return nil, nil
}
content, err := file.Contents(ctx, gw)
if err != nil {
return nil, err
}
exitCode, err := strconv.Atoi(string(content))
if err != nil {
return nil, err
}
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 3,551 |
π Odd container behavior with exec / multiple withMountedDirectory
|
### What is the issue?
The following code executes but provides unexpected logs / output. Other similar use cases error due to missing files due to same issue. This may be something very simple (haven't used golang in many years) but seems like there may be an underlying issue with the execution engine.
I would expect this code to run the `ls` command twice, one time showing the two mounted directories, one time showing the root output. Instead in the logs I see `ls` with d1 and d2 (expected), an `ls` with just d1 (??), and then an `ls` with the root fs. This causes issues if the first ls is changed to `ls /example/d2` as it will error the whole pipeline due to missing path.
```golang
workdir := client.Host().Workdir()
d1, err := workdir.Read().Directory("dir1/").ID(ctx)
if err != nil {
return err
}
d2, err := workdir.Read().Directory("dir2/").ID(ctx)
if err != nil {
return err
}
build := client.Container().From("alpine:latest").
WithMountedDirectory("/example/d1", d1).
WithMountedDirectory("/example/d2", d2)
build = build.Exec(dagger.ContainerExecOpts{
Args: []string{"ls", "/example"},
})
_, err = build.ExitCode(ctx)
if err != nil {
return err
}
build = build.Exec(dagger.ContainerExecOpts{
Args: []string{"ls", "/"},
})
_, err = build.ExitCode(ctx)
if err != nil {
return err
}
```
I was able to get the same functionality working fine by using `fs, err := build.FS().WithDirectory(d1, "/example/d1").WithDirectory(d2, "/example/d2").ID(ctx); build = build.WithFS(fs);` so conceptually don't think I'm doing anything wrong.
### Log output
```
#1 resolve image config for docker.io/library/alpine:latest
#1 DONE 0.4s
#2 mkfile /Dockerfile
#2 DONE 0.0s
#3 mkfile /main.go
#3 CACHED
#4 [internal] load metadata for docker.io/library/golang:1.18.2-alpine
#4 DONE 0.1s
#5 local://__dagger_workdir_/home/plaisted/source/OSD.PJI-Temporary/repro
#5 DONE 0.0s
#6 local://__dagger_workdir_/home/plaisted/source/OSD.PJI-Temporary/repro
#6 transferring __dagger_workdir_/home/plaisted/source/OSD.PJI-Temporary/repro: 309B done
#6 DONE 0.0s
#7 [build 1/6] FROM docker.io/library/golang:1.18.2-alpine@sha256:4795c5d21f01e0777707ada02408debe77fe31848be97cf9fa8a1462da78d949
#7 resolve docker.io/library/golang:1.18.2-alpine@sha256:4795c5d21f01e0777707ada02408debe77fe31848be97cf9fa8a1462da78d949 0.0s done
#7 DONE 0.0s
#8 [build 3/6] RUN apk add --no-cache file git
#8 CACHED
#9 [build 4/6] RUN go mod init go.dagger.io/dagger/shim/cmd
#9 CACHED
#10 [build 2/6] WORKDIR /src
#10 CACHED
#11 [build 5/6] COPY . .
#11 CACHED
#12 [build 6/6] RUN CGO_ENABLED=0 go build -o /_shim -ldflags '-s -d -w' .
#12 CACHED
#13 [stage-1 1/1] COPY --from=build /_shim /_shim
#13 CACHED
#14 mkdir /meta
#14 CACHED
#15 copy / /
#15 DONE 0.0s
#16 docker-image://docker.io/library/alpine:latest
#16 resolve docker.io/library/alpine:latest
#16 resolve docker.io/library/alpine:latest 0.1s done
#16 CACHED
#17 copy / /
#17 CACHED
#18 ls /example
#18 0.157 d1
#18 0.157 d2
#18 DONE 0.2s
#1 resolve image config for docker.io/library/alpine:latest
#1 DONE 0.5s
#4 [internal] load metadata for docker.io/library/golang:1.18.2-alpine
#4 DONE 0.4s
#19 ls /example
#19 0.172 d1
#19 DONE 0.2s
#20 ls /
#20 0.105 _shim
#20 0.105 bin
#20 0.105 dagger
#20 0.105 dev
#20 0.105 etc
#20 0.105 example
#20 0.105 home
#20 0.105 lib
#20 0.105 media
#20 0.105 mnt
#20 0.105 opt
#20 0.105 proc
#20 0.105 root
#20 0.105 run
#20 0.105 sbin
#20 0.105 srv
#20 0.105 sys
#20 0.105 tmp
#20 0.105 usr
#20 0.105 var
#20 DONE 0.1s
#0 0.148 d1
#0 0.148 d2
#18 DONE 0.2s
#1 resolve image config for docker.io/library/alpine:latest
#1 DONE 0.4s
#4 [internal] load metadata for docker.io/library/golang:1.18.2-alpine
#4 DONE 0.4s
#19 ls /example
#0 0.135 d1
#19 DONE 0.2s
#20 ls /example
#0 0.104 d1
#0 0.104 d2
#20 DONE 0.1s
```
### Steps to reproduce
* Mount two directories
* Run multiple exec commands and observe logs output
### Dagger version
dagger v0.3.1
### OS version
Ubuntu-20.04
|
https://github.com/dagger/dagger/issues/3551
|
https://github.com/dagger/dagger/pull/3602
|
b734ed35554bbfbc5caf63674eaa9c22692e614e
|
b4bb0b9e06e1edf8b81f9054b7419daabcb5bedb
| 2022-10-26T01:16:16Z |
go
| 2022-10-31T22:13:34Z |
core/container.go
|
return &exitCode, nil
}
func (container *Container) MetaFile(ctx context.Context, gw bkgw.Client, filePath string) (*File, error) {
payload, err := container.ID.decode()
if err != nil {
return nil, err
}
meta, err := payload.MetaState()
if err != nil {
return nil, err
}
if meta == nil {
return nil, nil
}
return NewFile(ctx, *meta, path.Join(metaSourcePath, filePath), payload.Platform)
}
func (container *Container) Publish(
ctx context.Context,
ref string,
bkClient *bkclient.Client,
solveOpts bkclient.SolveOpt,
solveCh chan<- *bkclient.SolveStatus,
) (string, error) {
payload, err := container.ID.decode()
if err != nil {
return "", err
}
st, err := payload.FSState()
if err != nil {
return "", err
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 3,551 |
π Odd container behavior with exec / multiple withMountedDirectory
|
### What is the issue?
The following code executes but provides unexpected logs / output. Other similar use cases error due to missing files due to same issue. This may be something very simple (haven't used golang in many years) but seems like there may be an underlying issue with the execution engine.
I would expect this code to run the `ls` command twice, one time showing the two mounted directories, one time showing the root output. Instead in the logs I see `ls` with d1 and d2 (expected), an `ls` with just d1 (??), and then an `ls` with the root fs. This causes issues if the first ls is changed to `ls /example/d2` as it will error the whole pipeline due to missing path.
```golang
workdir := client.Host().Workdir()
d1, err := workdir.Read().Directory("dir1/").ID(ctx)
if err != nil {
return err
}
d2, err := workdir.Read().Directory("dir2/").ID(ctx)
if err != nil {
return err
}
build := client.Container().From("alpine:latest").
WithMountedDirectory("/example/d1", d1).
WithMountedDirectory("/example/d2", d2)
build = build.Exec(dagger.ContainerExecOpts{
Args: []string{"ls", "/example"},
})
_, err = build.ExitCode(ctx)
if err != nil {
return err
}
build = build.Exec(dagger.ContainerExecOpts{
Args: []string{"ls", "/"},
})
_, err = build.ExitCode(ctx)
if err != nil {
return err
}
```
I was able to get the same functionality working fine by using `fs, err := build.FS().WithDirectory(d1, "/example/d1").WithDirectory(d2, "/example/d2").ID(ctx); build = build.WithFS(fs);` so conceptually don't think I'm doing anything wrong.
### Log output
```
#1 resolve image config for docker.io/library/alpine:latest
#1 DONE 0.4s
#2 mkfile /Dockerfile
#2 DONE 0.0s
#3 mkfile /main.go
#3 CACHED
#4 [internal] load metadata for docker.io/library/golang:1.18.2-alpine
#4 DONE 0.1s
#5 local://__dagger_workdir_/home/plaisted/source/OSD.PJI-Temporary/repro
#5 DONE 0.0s
#6 local://__dagger_workdir_/home/plaisted/source/OSD.PJI-Temporary/repro
#6 transferring __dagger_workdir_/home/plaisted/source/OSD.PJI-Temporary/repro: 309B done
#6 DONE 0.0s
#7 [build 1/6] FROM docker.io/library/golang:1.18.2-alpine@sha256:4795c5d21f01e0777707ada02408debe77fe31848be97cf9fa8a1462da78d949
#7 resolve docker.io/library/golang:1.18.2-alpine@sha256:4795c5d21f01e0777707ada02408debe77fe31848be97cf9fa8a1462da78d949 0.0s done
#7 DONE 0.0s
#8 [build 3/6] RUN apk add --no-cache file git
#8 CACHED
#9 [build 4/6] RUN go mod init go.dagger.io/dagger/shim/cmd
#9 CACHED
#10 [build 2/6] WORKDIR /src
#10 CACHED
#11 [build 5/6] COPY . .
#11 CACHED
#12 [build 6/6] RUN CGO_ENABLED=0 go build -o /_shim -ldflags '-s -d -w' .
#12 CACHED
#13 [stage-1 1/1] COPY --from=build /_shim /_shim
#13 CACHED
#14 mkdir /meta
#14 CACHED
#15 copy / /
#15 DONE 0.0s
#16 docker-image://docker.io/library/alpine:latest
#16 resolve docker.io/library/alpine:latest
#16 resolve docker.io/library/alpine:latest 0.1s done
#16 CACHED
#17 copy / /
#17 CACHED
#18 ls /example
#18 0.157 d1
#18 0.157 d2
#18 DONE 0.2s
#1 resolve image config for docker.io/library/alpine:latest
#1 DONE 0.5s
#4 [internal] load metadata for docker.io/library/golang:1.18.2-alpine
#4 DONE 0.4s
#19 ls /example
#19 0.172 d1
#19 DONE 0.2s
#20 ls /
#20 0.105 _shim
#20 0.105 bin
#20 0.105 dagger
#20 0.105 dev
#20 0.105 etc
#20 0.105 example
#20 0.105 home
#20 0.105 lib
#20 0.105 media
#20 0.105 mnt
#20 0.105 opt
#20 0.105 proc
#20 0.105 root
#20 0.105 run
#20 0.105 sbin
#20 0.105 srv
#20 0.105 sys
#20 0.105 tmp
#20 0.105 usr
#20 0.105 var
#20 DONE 0.1s
#0 0.148 d1
#0 0.148 d2
#18 DONE 0.2s
#1 resolve image config for docker.io/library/alpine:latest
#1 DONE 0.4s
#4 [internal] load metadata for docker.io/library/golang:1.18.2-alpine
#4 DONE 0.4s
#19 ls /example
#0 0.135 d1
#19 DONE 0.2s
#20 ls /example
#0 0.104 d1
#0 0.104 d2
#20 DONE 0.1s
```
### Steps to reproduce
* Mount two directories
* Run multiple exec commands and observe logs output
### Dagger version
dagger v0.3.1
### OS version
Ubuntu-20.04
|
https://github.com/dagger/dagger/issues/3551
|
https://github.com/dagger/dagger/pull/3602
|
b734ed35554bbfbc5caf63674eaa9c22692e614e
|
b4bb0b9e06e1edf8b81f9054b7419daabcb5bedb
| 2022-10-26T01:16:16Z |
go
| 2022-10-31T22:13:34Z |
core/container.go
|
}
stDef, err := st.Marshal(ctx, llb.Platform(payload.Platform))
if err != nil {
return "", err
}
cfgBytes, err := json.Marshal(specs.Image{
Architecture: payload.Platform.Architecture,
OS: payload.Platform.OS,
OSVersion: payload.Platform.OSVersion,
OSFeatures: payload.Platform.OSFeatures,
Config: payload.Config,
})
if err != nil {
return "", err
}
solveOpts.Exports = []bkclient.ExportEntry{
{
Type: bkclient.ExporterImage,
Attrs: map[string]string{
"name": ref,
"push": "true",
},
},
}
ch, wg := mirrorCh(solveCh)
defer wg.Wait()
res, err := bkClient.Build(ctx, solveOpts, "", func(ctx context.Context, gw bkgw.Client) (*bkgw.Result, error) {
res, err := gw.Solve(ctx, bkgw.SolveRequest{
Evaluate: true,
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 3,551 |
π Odd container behavior with exec / multiple withMountedDirectory
|
### What is the issue?
The following code executes but provides unexpected logs / output. Other similar use cases error due to missing files due to same issue. This may be something very simple (haven't used golang in many years) but seems like there may be an underlying issue with the execution engine.
I would expect this code to run the `ls` command twice, one time showing the two mounted directories, one time showing the root output. Instead in the logs I see `ls` with d1 and d2 (expected), an `ls` with just d1 (??), and then an `ls` with the root fs. This causes issues if the first ls is changed to `ls /example/d2` as it will error the whole pipeline due to missing path.
```golang
workdir := client.Host().Workdir()
d1, err := workdir.Read().Directory("dir1/").ID(ctx)
if err != nil {
return err
}
d2, err := workdir.Read().Directory("dir2/").ID(ctx)
if err != nil {
return err
}
build := client.Container().From("alpine:latest").
WithMountedDirectory("/example/d1", d1).
WithMountedDirectory("/example/d2", d2)
build = build.Exec(dagger.ContainerExecOpts{
Args: []string{"ls", "/example"},
})
_, err = build.ExitCode(ctx)
if err != nil {
return err
}
build = build.Exec(dagger.ContainerExecOpts{
Args: []string{"ls", "/"},
})
_, err = build.ExitCode(ctx)
if err != nil {
return err
}
```
I was able to get the same functionality working fine by using `fs, err := build.FS().WithDirectory(d1, "/example/d1").WithDirectory(d2, "/example/d2").ID(ctx); build = build.WithFS(fs);` so conceptually don't think I'm doing anything wrong.
### Log output
```
#1 resolve image config for docker.io/library/alpine:latest
#1 DONE 0.4s
#2 mkfile /Dockerfile
#2 DONE 0.0s
#3 mkfile /main.go
#3 CACHED
#4 [internal] load metadata for docker.io/library/golang:1.18.2-alpine
#4 DONE 0.1s
#5 local://__dagger_workdir_/home/plaisted/source/OSD.PJI-Temporary/repro
#5 DONE 0.0s
#6 local://__dagger_workdir_/home/plaisted/source/OSD.PJI-Temporary/repro
#6 transferring __dagger_workdir_/home/plaisted/source/OSD.PJI-Temporary/repro: 309B done
#6 DONE 0.0s
#7 [build 1/6] FROM docker.io/library/golang:1.18.2-alpine@sha256:4795c5d21f01e0777707ada02408debe77fe31848be97cf9fa8a1462da78d949
#7 resolve docker.io/library/golang:1.18.2-alpine@sha256:4795c5d21f01e0777707ada02408debe77fe31848be97cf9fa8a1462da78d949 0.0s done
#7 DONE 0.0s
#8 [build 3/6] RUN apk add --no-cache file git
#8 CACHED
#9 [build 4/6] RUN go mod init go.dagger.io/dagger/shim/cmd
#9 CACHED
#10 [build 2/6] WORKDIR /src
#10 CACHED
#11 [build 5/6] COPY . .
#11 CACHED
#12 [build 6/6] RUN CGO_ENABLED=0 go build -o /_shim -ldflags '-s -d -w' .
#12 CACHED
#13 [stage-1 1/1] COPY --from=build /_shim /_shim
#13 CACHED
#14 mkdir /meta
#14 CACHED
#15 copy / /
#15 DONE 0.0s
#16 docker-image://docker.io/library/alpine:latest
#16 resolve docker.io/library/alpine:latest
#16 resolve docker.io/library/alpine:latest 0.1s done
#16 CACHED
#17 copy / /
#17 CACHED
#18 ls /example
#18 0.157 d1
#18 0.157 d2
#18 DONE 0.2s
#1 resolve image config for docker.io/library/alpine:latest
#1 DONE 0.5s
#4 [internal] load metadata for docker.io/library/golang:1.18.2-alpine
#4 DONE 0.4s
#19 ls /example
#19 0.172 d1
#19 DONE 0.2s
#20 ls /
#20 0.105 _shim
#20 0.105 bin
#20 0.105 dagger
#20 0.105 dev
#20 0.105 etc
#20 0.105 example
#20 0.105 home
#20 0.105 lib
#20 0.105 media
#20 0.105 mnt
#20 0.105 opt
#20 0.105 proc
#20 0.105 root
#20 0.105 run
#20 0.105 sbin
#20 0.105 srv
#20 0.105 sys
#20 0.105 tmp
#20 0.105 usr
#20 0.105 var
#20 DONE 0.1s
#0 0.148 d1
#0 0.148 d2
#18 DONE 0.2s
#1 resolve image config for docker.io/library/alpine:latest
#1 DONE 0.4s
#4 [internal] load metadata for docker.io/library/golang:1.18.2-alpine
#4 DONE 0.4s
#19 ls /example
#0 0.135 d1
#19 DONE 0.2s
#20 ls /example
#0 0.104 d1
#0 0.104 d2
#20 DONE 0.1s
```
### Steps to reproduce
* Mount two directories
* Run multiple exec commands and observe logs output
### Dagger version
dagger v0.3.1
### OS version
Ubuntu-20.04
|
https://github.com/dagger/dagger/issues/3551
|
https://github.com/dagger/dagger/pull/3602
|
b734ed35554bbfbc5caf63674eaa9c22692e614e
|
b4bb0b9e06e1edf8b81f9054b7419daabcb5bedb
| 2022-10-26T01:16:16Z |
go
| 2022-10-31T22:13:34Z |
core/container.go
|
Definition: stDef.ToPB(),
})
if err != nil {
return nil, err
}
res.AddMeta(exptypes.ExporterImageConfigKey, cfgBytes)
return res, nil
}, ch)
if err != nil {
return "", err
}
refName, err := reference.ParseNormalizedNamed(ref)
if err != nil {
return "", err
}
imageDigest, found := res.ExporterResponse[exptypes.ExporterImageDigestKey]
if found {
dig, err := digest.Parse(imageDigest)
if err != nil {
return "", fmt.Errorf("parse digest: %w", err)
}
withDig, err := reference.WithDigest(refName, dig)
if err != nil {
return "", fmt.Errorf("with digest: %w", err)
}
return withDig.String(), nil
}
return ref, nil
}
type ContainerExecOpts struct {
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 3,551 |
π Odd container behavior with exec / multiple withMountedDirectory
|
### What is the issue?
The following code executes but provides unexpected logs / output. Other similar use cases error due to missing files due to same issue. This may be something very simple (haven't used golang in many years) but seems like there may be an underlying issue with the execution engine.
I would expect this code to run the `ls` command twice, one time showing the two mounted directories, one time showing the root output. Instead in the logs I see `ls` with d1 and d2 (expected), an `ls` with just d1 (??), and then an `ls` with the root fs. This causes issues if the first ls is changed to `ls /example/d2` as it will error the whole pipeline due to missing path.
```golang
workdir := client.Host().Workdir()
d1, err := workdir.Read().Directory("dir1/").ID(ctx)
if err != nil {
return err
}
d2, err := workdir.Read().Directory("dir2/").ID(ctx)
if err != nil {
return err
}
build := client.Container().From("alpine:latest").
WithMountedDirectory("/example/d1", d1).
WithMountedDirectory("/example/d2", d2)
build = build.Exec(dagger.ContainerExecOpts{
Args: []string{"ls", "/example"},
})
_, err = build.ExitCode(ctx)
if err != nil {
return err
}
build = build.Exec(dagger.ContainerExecOpts{
Args: []string{"ls", "/"},
})
_, err = build.ExitCode(ctx)
if err != nil {
return err
}
```
I was able to get the same functionality working fine by using `fs, err := build.FS().WithDirectory(d1, "/example/d1").WithDirectory(d2, "/example/d2").ID(ctx); build = build.WithFS(fs);` so conceptually don't think I'm doing anything wrong.
### Log output
```
#1 resolve image config for docker.io/library/alpine:latest
#1 DONE 0.4s
#2 mkfile /Dockerfile
#2 DONE 0.0s
#3 mkfile /main.go
#3 CACHED
#4 [internal] load metadata for docker.io/library/golang:1.18.2-alpine
#4 DONE 0.1s
#5 local://__dagger_workdir_/home/plaisted/source/OSD.PJI-Temporary/repro
#5 DONE 0.0s
#6 local://__dagger_workdir_/home/plaisted/source/OSD.PJI-Temporary/repro
#6 transferring __dagger_workdir_/home/plaisted/source/OSD.PJI-Temporary/repro: 309B done
#6 DONE 0.0s
#7 [build 1/6] FROM docker.io/library/golang:1.18.2-alpine@sha256:4795c5d21f01e0777707ada02408debe77fe31848be97cf9fa8a1462da78d949
#7 resolve docker.io/library/golang:1.18.2-alpine@sha256:4795c5d21f01e0777707ada02408debe77fe31848be97cf9fa8a1462da78d949 0.0s done
#7 DONE 0.0s
#8 [build 3/6] RUN apk add --no-cache file git
#8 CACHED
#9 [build 4/6] RUN go mod init go.dagger.io/dagger/shim/cmd
#9 CACHED
#10 [build 2/6] WORKDIR /src
#10 CACHED
#11 [build 5/6] COPY . .
#11 CACHED
#12 [build 6/6] RUN CGO_ENABLED=0 go build -o /_shim -ldflags '-s -d -w' .
#12 CACHED
#13 [stage-1 1/1] COPY --from=build /_shim /_shim
#13 CACHED
#14 mkdir /meta
#14 CACHED
#15 copy / /
#15 DONE 0.0s
#16 docker-image://docker.io/library/alpine:latest
#16 resolve docker.io/library/alpine:latest
#16 resolve docker.io/library/alpine:latest 0.1s done
#16 CACHED
#17 copy / /
#17 CACHED
#18 ls /example
#18 0.157 d1
#18 0.157 d2
#18 DONE 0.2s
#1 resolve image config for docker.io/library/alpine:latest
#1 DONE 0.5s
#4 [internal] load metadata for docker.io/library/golang:1.18.2-alpine
#4 DONE 0.4s
#19 ls /example
#19 0.172 d1
#19 DONE 0.2s
#20 ls /
#20 0.105 _shim
#20 0.105 bin
#20 0.105 dagger
#20 0.105 dev
#20 0.105 etc
#20 0.105 example
#20 0.105 home
#20 0.105 lib
#20 0.105 media
#20 0.105 mnt
#20 0.105 opt
#20 0.105 proc
#20 0.105 root
#20 0.105 run
#20 0.105 sbin
#20 0.105 srv
#20 0.105 sys
#20 0.105 tmp
#20 0.105 usr
#20 0.105 var
#20 DONE 0.1s
#0 0.148 d1
#0 0.148 d2
#18 DONE 0.2s
#1 resolve image config for docker.io/library/alpine:latest
#1 DONE 0.4s
#4 [internal] load metadata for docker.io/library/golang:1.18.2-alpine
#4 DONE 0.4s
#19 ls /example
#0 0.135 d1
#19 DONE 0.2s
#20 ls /example
#0 0.104 d1
#0 0.104 d2
#20 DONE 0.1s
```
### Steps to reproduce
* Mount two directories
* Run multiple exec commands and observe logs output
### Dagger version
dagger v0.3.1
### OS version
Ubuntu-20.04
|
https://github.com/dagger/dagger/issues/3551
|
https://github.com/dagger/dagger/pull/3602
|
b734ed35554bbfbc5caf63674eaa9c22692e614e
|
b4bb0b9e06e1edf8b81f9054b7419daabcb5bedb
| 2022-10-26T01:16:16Z |
go
| 2022-10-31T22:13:34Z |
core/container.go
|
Args []string
Stdin string
RedirectStdout string
RedirectStderr string
}
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 3,551 |
π Odd container behavior with exec / multiple withMountedDirectory
|
### What is the issue?
The following code executes but provides unexpected logs / output. Other similar use cases error due to missing files due to same issue. This may be something very simple (haven't used golang in many years) but seems like there may be an underlying issue with the execution engine.
I would expect this code to run the `ls` command twice, one time showing the two mounted directories, one time showing the root output. Instead in the logs I see `ls` with d1 and d2 (expected), an `ls` with just d1 (??), and then an `ls` with the root fs. This causes issues if the first ls is changed to `ls /example/d2` as it will error the whole pipeline due to missing path.
```golang
workdir := client.Host().Workdir()
d1, err := workdir.Read().Directory("dir1/").ID(ctx)
if err != nil {
return err
}
d2, err := workdir.Read().Directory("dir2/").ID(ctx)
if err != nil {
return err
}
build := client.Container().From("alpine:latest").
WithMountedDirectory("/example/d1", d1).
WithMountedDirectory("/example/d2", d2)
build = build.Exec(dagger.ContainerExecOpts{
Args: []string{"ls", "/example"},
})
_, err = build.ExitCode(ctx)
if err != nil {
return err
}
build = build.Exec(dagger.ContainerExecOpts{
Args: []string{"ls", "/"},
})
_, err = build.ExitCode(ctx)
if err != nil {
return err
}
```
I was able to get the same functionality working fine by using `fs, err := build.FS().WithDirectory(d1, "/example/d1").WithDirectory(d2, "/example/d2").ID(ctx); build = build.WithFS(fs);` so conceptually don't think I'm doing anything wrong.
### Log output
```
#1 resolve image config for docker.io/library/alpine:latest
#1 DONE 0.4s
#2 mkfile /Dockerfile
#2 DONE 0.0s
#3 mkfile /main.go
#3 CACHED
#4 [internal] load metadata for docker.io/library/golang:1.18.2-alpine
#4 DONE 0.1s
#5 local://__dagger_workdir_/home/plaisted/source/OSD.PJI-Temporary/repro
#5 DONE 0.0s
#6 local://__dagger_workdir_/home/plaisted/source/OSD.PJI-Temporary/repro
#6 transferring __dagger_workdir_/home/plaisted/source/OSD.PJI-Temporary/repro: 309B done
#6 DONE 0.0s
#7 [build 1/6] FROM docker.io/library/golang:1.18.2-alpine@sha256:4795c5d21f01e0777707ada02408debe77fe31848be97cf9fa8a1462da78d949
#7 resolve docker.io/library/golang:1.18.2-alpine@sha256:4795c5d21f01e0777707ada02408debe77fe31848be97cf9fa8a1462da78d949 0.0s done
#7 DONE 0.0s
#8 [build 3/6] RUN apk add --no-cache file git
#8 CACHED
#9 [build 4/6] RUN go mod init go.dagger.io/dagger/shim/cmd
#9 CACHED
#10 [build 2/6] WORKDIR /src
#10 CACHED
#11 [build 5/6] COPY . .
#11 CACHED
#12 [build 6/6] RUN CGO_ENABLED=0 go build -o /_shim -ldflags '-s -d -w' .
#12 CACHED
#13 [stage-1 1/1] COPY --from=build /_shim /_shim
#13 CACHED
#14 mkdir /meta
#14 CACHED
#15 copy / /
#15 DONE 0.0s
#16 docker-image://docker.io/library/alpine:latest
#16 resolve docker.io/library/alpine:latest
#16 resolve docker.io/library/alpine:latest 0.1s done
#16 CACHED
#17 copy / /
#17 CACHED
#18 ls /example
#18 0.157 d1
#18 0.157 d2
#18 DONE 0.2s
#1 resolve image config for docker.io/library/alpine:latest
#1 DONE 0.5s
#4 [internal] load metadata for docker.io/library/golang:1.18.2-alpine
#4 DONE 0.4s
#19 ls /example
#19 0.172 d1
#19 DONE 0.2s
#20 ls /
#20 0.105 _shim
#20 0.105 bin
#20 0.105 dagger
#20 0.105 dev
#20 0.105 etc
#20 0.105 example
#20 0.105 home
#20 0.105 lib
#20 0.105 media
#20 0.105 mnt
#20 0.105 opt
#20 0.105 proc
#20 0.105 root
#20 0.105 run
#20 0.105 sbin
#20 0.105 srv
#20 0.105 sys
#20 0.105 tmp
#20 0.105 usr
#20 0.105 var
#20 DONE 0.1s
#0 0.148 d1
#0 0.148 d2
#18 DONE 0.2s
#1 resolve image config for docker.io/library/alpine:latest
#1 DONE 0.4s
#4 [internal] load metadata for docker.io/library/golang:1.18.2-alpine
#4 DONE 0.4s
#19 ls /example
#0 0.135 d1
#19 DONE 0.2s
#20 ls /example
#0 0.104 d1
#0 0.104 d2
#20 DONE 0.1s
```
### Steps to reproduce
* Mount two directories
* Run multiple exec commands and observe logs output
### Dagger version
dagger v0.3.1
### OS version
Ubuntu-20.04
|
https://github.com/dagger/dagger/issues/3551
|
https://github.com/dagger/dagger/pull/3602
|
b734ed35554bbfbc5caf63674eaa9c22692e614e
|
b4bb0b9e06e1edf8b81f9054b7419daabcb5bedb
| 2022-10-26T01:16:16Z |
go
| 2022-10-31T22:13:34Z |
core/integration/container_test.go
|
package core
import (
"context"
"strings"
"testing"
"dagger.io/dagger"
"github.com/dagger/dagger/core"
"github.com/dagger/dagger/core/schema"
"github.com/dagger/dagger/internal/testutil"
"github.com/moby/buildkit/identity"
"github.com/stretchr/testify/require"
)
func TestContainerScratch(t *testing.T) {
t.Parallel()
res := struct {
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 3,551 |
π Odd container behavior with exec / multiple withMountedDirectory
|
### What is the issue?
The following code executes but provides unexpected logs / output. Other similar use cases error due to missing files due to same issue. This may be something very simple (haven't used golang in many years) but seems like there may be an underlying issue with the execution engine.
I would expect this code to run the `ls` command twice, one time showing the two mounted directories, one time showing the root output. Instead in the logs I see `ls` with d1 and d2 (expected), an `ls` with just d1 (??), and then an `ls` with the root fs. This causes issues if the first ls is changed to `ls /example/d2` as it will error the whole pipeline due to missing path.
```golang
workdir := client.Host().Workdir()
d1, err := workdir.Read().Directory("dir1/").ID(ctx)
if err != nil {
return err
}
d2, err := workdir.Read().Directory("dir2/").ID(ctx)
if err != nil {
return err
}
build := client.Container().From("alpine:latest").
WithMountedDirectory("/example/d1", d1).
WithMountedDirectory("/example/d2", d2)
build = build.Exec(dagger.ContainerExecOpts{
Args: []string{"ls", "/example"},
})
_, err = build.ExitCode(ctx)
if err != nil {
return err
}
build = build.Exec(dagger.ContainerExecOpts{
Args: []string{"ls", "/"},
})
_, err = build.ExitCode(ctx)
if err != nil {
return err
}
```
I was able to get the same functionality working fine by using `fs, err := build.FS().WithDirectory(d1, "/example/d1").WithDirectory(d2, "/example/d2").ID(ctx); build = build.WithFS(fs);` so conceptually don't think I'm doing anything wrong.
### Log output
```
#1 resolve image config for docker.io/library/alpine:latest
#1 DONE 0.4s
#2 mkfile /Dockerfile
#2 DONE 0.0s
#3 mkfile /main.go
#3 CACHED
#4 [internal] load metadata for docker.io/library/golang:1.18.2-alpine
#4 DONE 0.1s
#5 local://__dagger_workdir_/home/plaisted/source/OSD.PJI-Temporary/repro
#5 DONE 0.0s
#6 local://__dagger_workdir_/home/plaisted/source/OSD.PJI-Temporary/repro
#6 transferring __dagger_workdir_/home/plaisted/source/OSD.PJI-Temporary/repro: 309B done
#6 DONE 0.0s
#7 [build 1/6] FROM docker.io/library/golang:1.18.2-alpine@sha256:4795c5d21f01e0777707ada02408debe77fe31848be97cf9fa8a1462da78d949
#7 resolve docker.io/library/golang:1.18.2-alpine@sha256:4795c5d21f01e0777707ada02408debe77fe31848be97cf9fa8a1462da78d949 0.0s done
#7 DONE 0.0s
#8 [build 3/6] RUN apk add --no-cache file git
#8 CACHED
#9 [build 4/6] RUN go mod init go.dagger.io/dagger/shim/cmd
#9 CACHED
#10 [build 2/6] WORKDIR /src
#10 CACHED
#11 [build 5/6] COPY . .
#11 CACHED
#12 [build 6/6] RUN CGO_ENABLED=0 go build -o /_shim -ldflags '-s -d -w' .
#12 CACHED
#13 [stage-1 1/1] COPY --from=build /_shim /_shim
#13 CACHED
#14 mkdir /meta
#14 CACHED
#15 copy / /
#15 DONE 0.0s
#16 docker-image://docker.io/library/alpine:latest
#16 resolve docker.io/library/alpine:latest
#16 resolve docker.io/library/alpine:latest 0.1s done
#16 CACHED
#17 copy / /
#17 CACHED
#18 ls /example
#18 0.157 d1
#18 0.157 d2
#18 DONE 0.2s
#1 resolve image config for docker.io/library/alpine:latest
#1 DONE 0.5s
#4 [internal] load metadata for docker.io/library/golang:1.18.2-alpine
#4 DONE 0.4s
#19 ls /example
#19 0.172 d1
#19 DONE 0.2s
#20 ls /
#20 0.105 _shim
#20 0.105 bin
#20 0.105 dagger
#20 0.105 dev
#20 0.105 etc
#20 0.105 example
#20 0.105 home
#20 0.105 lib
#20 0.105 media
#20 0.105 mnt
#20 0.105 opt
#20 0.105 proc
#20 0.105 root
#20 0.105 run
#20 0.105 sbin
#20 0.105 srv
#20 0.105 sys
#20 0.105 tmp
#20 0.105 usr
#20 0.105 var
#20 DONE 0.1s
#0 0.148 d1
#0 0.148 d2
#18 DONE 0.2s
#1 resolve image config for docker.io/library/alpine:latest
#1 DONE 0.4s
#4 [internal] load metadata for docker.io/library/golang:1.18.2-alpine
#4 DONE 0.4s
#19 ls /example
#0 0.135 d1
#19 DONE 0.2s
#20 ls /example
#0 0.104 d1
#0 0.104 d2
#20 DONE 0.1s
```
### Steps to reproduce
* Mount two directories
* Run multiple exec commands and observe logs output
### Dagger version
dagger v0.3.1
### OS version
Ubuntu-20.04
|
https://github.com/dagger/dagger/issues/3551
|
https://github.com/dagger/dagger/pull/3602
|
b734ed35554bbfbc5caf63674eaa9c22692e614e
|
b4bb0b9e06e1edf8b81f9054b7419daabcb5bedb
| 2022-10-26T01:16:16Z |
go
| 2022-10-31T22:13:34Z |
core/integration/container_test.go
|
Container struct {
ID string
Fs struct {
Entries []string
}
}
}{}
err := testutil.Query(
`{
container {
id
fs {
entries
}
}
}`, &res, nil)
require.NoError(t, err)
require.Empty(t, res.Container.ID)
require.Empty(t, res.Container.Fs.Entries)
}
func TestContainerFrom(t *testing.T) {
t.Parallel()
res := struct {
Container struct {
From struct {
Fs struct {
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 3,551 |
π Odd container behavior with exec / multiple withMountedDirectory
|
### What is the issue?
The following code executes but provides unexpected logs / output. Other similar use cases error due to missing files due to same issue. This may be something very simple (haven't used golang in many years) but seems like there may be an underlying issue with the execution engine.
I would expect this code to run the `ls` command twice, one time showing the two mounted directories, one time showing the root output. Instead in the logs I see `ls` with d1 and d2 (expected), an `ls` with just d1 (??), and then an `ls` with the root fs. This causes issues if the first ls is changed to `ls /example/d2` as it will error the whole pipeline due to missing path.
```golang
workdir := client.Host().Workdir()
d1, err := workdir.Read().Directory("dir1/").ID(ctx)
if err != nil {
return err
}
d2, err := workdir.Read().Directory("dir2/").ID(ctx)
if err != nil {
return err
}
build := client.Container().From("alpine:latest").
WithMountedDirectory("/example/d1", d1).
WithMountedDirectory("/example/d2", d2)
build = build.Exec(dagger.ContainerExecOpts{
Args: []string{"ls", "/example"},
})
_, err = build.ExitCode(ctx)
if err != nil {
return err
}
build = build.Exec(dagger.ContainerExecOpts{
Args: []string{"ls", "/"},
})
_, err = build.ExitCode(ctx)
if err != nil {
return err
}
```
I was able to get the same functionality working fine by using `fs, err := build.FS().WithDirectory(d1, "/example/d1").WithDirectory(d2, "/example/d2").ID(ctx); build = build.WithFS(fs);` so conceptually don't think I'm doing anything wrong.
### Log output
```
#1 resolve image config for docker.io/library/alpine:latest
#1 DONE 0.4s
#2 mkfile /Dockerfile
#2 DONE 0.0s
#3 mkfile /main.go
#3 CACHED
#4 [internal] load metadata for docker.io/library/golang:1.18.2-alpine
#4 DONE 0.1s
#5 local://__dagger_workdir_/home/plaisted/source/OSD.PJI-Temporary/repro
#5 DONE 0.0s
#6 local://__dagger_workdir_/home/plaisted/source/OSD.PJI-Temporary/repro
#6 transferring __dagger_workdir_/home/plaisted/source/OSD.PJI-Temporary/repro: 309B done
#6 DONE 0.0s
#7 [build 1/6] FROM docker.io/library/golang:1.18.2-alpine@sha256:4795c5d21f01e0777707ada02408debe77fe31848be97cf9fa8a1462da78d949
#7 resolve docker.io/library/golang:1.18.2-alpine@sha256:4795c5d21f01e0777707ada02408debe77fe31848be97cf9fa8a1462da78d949 0.0s done
#7 DONE 0.0s
#8 [build 3/6] RUN apk add --no-cache file git
#8 CACHED
#9 [build 4/6] RUN go mod init go.dagger.io/dagger/shim/cmd
#9 CACHED
#10 [build 2/6] WORKDIR /src
#10 CACHED
#11 [build 5/6] COPY . .
#11 CACHED
#12 [build 6/6] RUN CGO_ENABLED=0 go build -o /_shim -ldflags '-s -d -w' .
#12 CACHED
#13 [stage-1 1/1] COPY --from=build /_shim /_shim
#13 CACHED
#14 mkdir /meta
#14 CACHED
#15 copy / /
#15 DONE 0.0s
#16 docker-image://docker.io/library/alpine:latest
#16 resolve docker.io/library/alpine:latest
#16 resolve docker.io/library/alpine:latest 0.1s done
#16 CACHED
#17 copy / /
#17 CACHED
#18 ls /example
#18 0.157 d1
#18 0.157 d2
#18 DONE 0.2s
#1 resolve image config for docker.io/library/alpine:latest
#1 DONE 0.5s
#4 [internal] load metadata for docker.io/library/golang:1.18.2-alpine
#4 DONE 0.4s
#19 ls /example
#19 0.172 d1
#19 DONE 0.2s
#20 ls /
#20 0.105 _shim
#20 0.105 bin
#20 0.105 dagger
#20 0.105 dev
#20 0.105 etc
#20 0.105 example
#20 0.105 home
#20 0.105 lib
#20 0.105 media
#20 0.105 mnt
#20 0.105 opt
#20 0.105 proc
#20 0.105 root
#20 0.105 run
#20 0.105 sbin
#20 0.105 srv
#20 0.105 sys
#20 0.105 tmp
#20 0.105 usr
#20 0.105 var
#20 DONE 0.1s
#0 0.148 d1
#0 0.148 d2
#18 DONE 0.2s
#1 resolve image config for docker.io/library/alpine:latest
#1 DONE 0.4s
#4 [internal] load metadata for docker.io/library/golang:1.18.2-alpine
#4 DONE 0.4s
#19 ls /example
#0 0.135 d1
#19 DONE 0.2s
#20 ls /example
#0 0.104 d1
#0 0.104 d2
#20 DONE 0.1s
```
### Steps to reproduce
* Mount two directories
* Run multiple exec commands and observe logs output
### Dagger version
dagger v0.3.1
### OS version
Ubuntu-20.04
|
https://github.com/dagger/dagger/issues/3551
|
https://github.com/dagger/dagger/pull/3602
|
b734ed35554bbfbc5caf63674eaa9c22692e614e
|
b4bb0b9e06e1edf8b81f9054b7419daabcb5bedb
| 2022-10-26T01:16:16Z |
go
| 2022-10-31T22:13:34Z |
core/integration/container_test.go
|
File struct {
Contents string
}
}
}
}
}{}
err := testutil.Query(
`{
container {
from(address: "alpine:3.16.2") {
fs {
file(path: "/etc/alpine-release") {
contents
}
}
}
}
}`, &res, nil)
require.NoError(t, err)
require.Equal(t, res.Container.From.Fs.File.Contents, "3.16.2\n")
}
func TestContainerBuild(t *testing.T) {
ctx := context.Background()
c, err := dagger.Connect(ctx)
require.NoError(t, err)
defer c.Close()
contextDir := c.Directory().
WithNewFile("main.go", dagger.DirectoryWithNewFileOpts{
Contents: `package main
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 3,551 |
π Odd container behavior with exec / multiple withMountedDirectory
|
### What is the issue?
The following code executes but provides unexpected logs / output. Other similar use cases error due to missing files due to same issue. This may be something very simple (haven't used golang in many years) but seems like there may be an underlying issue with the execution engine.
I would expect this code to run the `ls` command twice, one time showing the two mounted directories, one time showing the root output. Instead in the logs I see `ls` with d1 and d2 (expected), an `ls` with just d1 (??), and then an `ls` with the root fs. This causes issues if the first ls is changed to `ls /example/d2` as it will error the whole pipeline due to missing path.
```golang
workdir := client.Host().Workdir()
d1, err := workdir.Read().Directory("dir1/").ID(ctx)
if err != nil {
return err
}
d2, err := workdir.Read().Directory("dir2/").ID(ctx)
if err != nil {
return err
}
build := client.Container().From("alpine:latest").
WithMountedDirectory("/example/d1", d1).
WithMountedDirectory("/example/d2", d2)
build = build.Exec(dagger.ContainerExecOpts{
Args: []string{"ls", "/example"},
})
_, err = build.ExitCode(ctx)
if err != nil {
return err
}
build = build.Exec(dagger.ContainerExecOpts{
Args: []string{"ls", "/"},
})
_, err = build.ExitCode(ctx)
if err != nil {
return err
}
```
I was able to get the same functionality working fine by using `fs, err := build.FS().WithDirectory(d1, "/example/d1").WithDirectory(d2, "/example/d2").ID(ctx); build = build.WithFS(fs);` so conceptually don't think I'm doing anything wrong.
### Log output
```
#1 resolve image config for docker.io/library/alpine:latest
#1 DONE 0.4s
#2 mkfile /Dockerfile
#2 DONE 0.0s
#3 mkfile /main.go
#3 CACHED
#4 [internal] load metadata for docker.io/library/golang:1.18.2-alpine
#4 DONE 0.1s
#5 local://__dagger_workdir_/home/plaisted/source/OSD.PJI-Temporary/repro
#5 DONE 0.0s
#6 local://__dagger_workdir_/home/plaisted/source/OSD.PJI-Temporary/repro
#6 transferring __dagger_workdir_/home/plaisted/source/OSD.PJI-Temporary/repro: 309B done
#6 DONE 0.0s
#7 [build 1/6] FROM docker.io/library/golang:1.18.2-alpine@sha256:4795c5d21f01e0777707ada02408debe77fe31848be97cf9fa8a1462da78d949
#7 resolve docker.io/library/golang:1.18.2-alpine@sha256:4795c5d21f01e0777707ada02408debe77fe31848be97cf9fa8a1462da78d949 0.0s done
#7 DONE 0.0s
#8 [build 3/6] RUN apk add --no-cache file git
#8 CACHED
#9 [build 4/6] RUN go mod init go.dagger.io/dagger/shim/cmd
#9 CACHED
#10 [build 2/6] WORKDIR /src
#10 CACHED
#11 [build 5/6] COPY . .
#11 CACHED
#12 [build 6/6] RUN CGO_ENABLED=0 go build -o /_shim -ldflags '-s -d -w' .
#12 CACHED
#13 [stage-1 1/1] COPY --from=build /_shim /_shim
#13 CACHED
#14 mkdir /meta
#14 CACHED
#15 copy / /
#15 DONE 0.0s
#16 docker-image://docker.io/library/alpine:latest
#16 resolve docker.io/library/alpine:latest
#16 resolve docker.io/library/alpine:latest 0.1s done
#16 CACHED
#17 copy / /
#17 CACHED
#18 ls /example
#18 0.157 d1
#18 0.157 d2
#18 DONE 0.2s
#1 resolve image config for docker.io/library/alpine:latest
#1 DONE 0.5s
#4 [internal] load metadata for docker.io/library/golang:1.18.2-alpine
#4 DONE 0.4s
#19 ls /example
#19 0.172 d1
#19 DONE 0.2s
#20 ls /
#20 0.105 _shim
#20 0.105 bin
#20 0.105 dagger
#20 0.105 dev
#20 0.105 etc
#20 0.105 example
#20 0.105 home
#20 0.105 lib
#20 0.105 media
#20 0.105 mnt
#20 0.105 opt
#20 0.105 proc
#20 0.105 root
#20 0.105 run
#20 0.105 sbin
#20 0.105 srv
#20 0.105 sys
#20 0.105 tmp
#20 0.105 usr
#20 0.105 var
#20 DONE 0.1s
#0 0.148 d1
#0 0.148 d2
#18 DONE 0.2s
#1 resolve image config for docker.io/library/alpine:latest
#1 DONE 0.4s
#4 [internal] load metadata for docker.io/library/golang:1.18.2-alpine
#4 DONE 0.4s
#19 ls /example
#0 0.135 d1
#19 DONE 0.2s
#20 ls /example
#0 0.104 d1
#0 0.104 d2
#20 DONE 0.1s
```
### Steps to reproduce
* Mount two directories
* Run multiple exec commands and observe logs output
### Dagger version
dagger v0.3.1
### OS version
Ubuntu-20.04
|
https://github.com/dagger/dagger/issues/3551
|
https://github.com/dagger/dagger/pull/3602
|
b734ed35554bbfbc5caf63674eaa9c22692e614e
|
b4bb0b9e06e1edf8b81f9054b7419daabcb5bedb
| 2022-10-26T01:16:16Z |
go
| 2022-10-31T22:13:34Z |
core/integration/container_test.go
|
import "fmt"
import "os"
func main() {
for _, env := range os.Environ() {
fmt.Println(env)
}
}`,
})
t.Run("default Dockerfile location", func(t *testing.T) {
srcID, err := contextDir.
WithNewFile("Dockerfile", dagger.DirectoryWithNewFileOpts{
Contents: `FROM golang:1.18.2-alpine
WORKDIR /src
COPY main.go .
RUN go mod init hello
RUN go build -o /usr/bin/goenv main.go
ENV FOO=bar
CMD goenv
`,
}).
ID(ctx)
require.NoError(t, err)
env, err := c.Container().Build(srcID).Exec().Stdout().Contents(ctx)
require.NoError(t, err)
require.Contains(t, env, "FOO=bar\n")
})
t.Run("custom Dockerfile location", func(t *testing.T) {
srcID, err := contextDir.
WithNewFile("subdir/Dockerfile.whee", dagger.DirectoryWithNewFileOpts{
Contents: `FROM golang:1.18.2-alpine
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 3,551 |
π Odd container behavior with exec / multiple withMountedDirectory
|
### What is the issue?
The following code executes but provides unexpected logs / output. Other similar use cases error due to missing files due to same issue. This may be something very simple (haven't used golang in many years) but seems like there may be an underlying issue with the execution engine.
I would expect this code to run the `ls` command twice, one time showing the two mounted directories, one time showing the root output. Instead in the logs I see `ls` with d1 and d2 (expected), an `ls` with just d1 (??), and then an `ls` with the root fs. This causes issues if the first ls is changed to `ls /example/d2` as it will error the whole pipeline due to missing path.
```golang
workdir := client.Host().Workdir()
d1, err := workdir.Read().Directory("dir1/").ID(ctx)
if err != nil {
return err
}
d2, err := workdir.Read().Directory("dir2/").ID(ctx)
if err != nil {
return err
}
build := client.Container().From("alpine:latest").
WithMountedDirectory("/example/d1", d1).
WithMountedDirectory("/example/d2", d2)
build = build.Exec(dagger.ContainerExecOpts{
Args: []string{"ls", "/example"},
})
_, err = build.ExitCode(ctx)
if err != nil {
return err
}
build = build.Exec(dagger.ContainerExecOpts{
Args: []string{"ls", "/"},
})
_, err = build.ExitCode(ctx)
if err != nil {
return err
}
```
I was able to get the same functionality working fine by using `fs, err := build.FS().WithDirectory(d1, "/example/d1").WithDirectory(d2, "/example/d2").ID(ctx); build = build.WithFS(fs);` so conceptually don't think I'm doing anything wrong.
### Log output
```
#1 resolve image config for docker.io/library/alpine:latest
#1 DONE 0.4s
#2 mkfile /Dockerfile
#2 DONE 0.0s
#3 mkfile /main.go
#3 CACHED
#4 [internal] load metadata for docker.io/library/golang:1.18.2-alpine
#4 DONE 0.1s
#5 local://__dagger_workdir_/home/plaisted/source/OSD.PJI-Temporary/repro
#5 DONE 0.0s
#6 local://__dagger_workdir_/home/plaisted/source/OSD.PJI-Temporary/repro
#6 transferring __dagger_workdir_/home/plaisted/source/OSD.PJI-Temporary/repro: 309B done
#6 DONE 0.0s
#7 [build 1/6] FROM docker.io/library/golang:1.18.2-alpine@sha256:4795c5d21f01e0777707ada02408debe77fe31848be97cf9fa8a1462da78d949
#7 resolve docker.io/library/golang:1.18.2-alpine@sha256:4795c5d21f01e0777707ada02408debe77fe31848be97cf9fa8a1462da78d949 0.0s done
#7 DONE 0.0s
#8 [build 3/6] RUN apk add --no-cache file git
#8 CACHED
#9 [build 4/6] RUN go mod init go.dagger.io/dagger/shim/cmd
#9 CACHED
#10 [build 2/6] WORKDIR /src
#10 CACHED
#11 [build 5/6] COPY . .
#11 CACHED
#12 [build 6/6] RUN CGO_ENABLED=0 go build -o /_shim -ldflags '-s -d -w' .
#12 CACHED
#13 [stage-1 1/1] COPY --from=build /_shim /_shim
#13 CACHED
#14 mkdir /meta
#14 CACHED
#15 copy / /
#15 DONE 0.0s
#16 docker-image://docker.io/library/alpine:latest
#16 resolve docker.io/library/alpine:latest
#16 resolve docker.io/library/alpine:latest 0.1s done
#16 CACHED
#17 copy / /
#17 CACHED
#18 ls /example
#18 0.157 d1
#18 0.157 d2
#18 DONE 0.2s
#1 resolve image config for docker.io/library/alpine:latest
#1 DONE 0.5s
#4 [internal] load metadata for docker.io/library/golang:1.18.2-alpine
#4 DONE 0.4s
#19 ls /example
#19 0.172 d1
#19 DONE 0.2s
#20 ls /
#20 0.105 _shim
#20 0.105 bin
#20 0.105 dagger
#20 0.105 dev
#20 0.105 etc
#20 0.105 example
#20 0.105 home
#20 0.105 lib
#20 0.105 media
#20 0.105 mnt
#20 0.105 opt
#20 0.105 proc
#20 0.105 root
#20 0.105 run
#20 0.105 sbin
#20 0.105 srv
#20 0.105 sys
#20 0.105 tmp
#20 0.105 usr
#20 0.105 var
#20 DONE 0.1s
#0 0.148 d1
#0 0.148 d2
#18 DONE 0.2s
#1 resolve image config for docker.io/library/alpine:latest
#1 DONE 0.4s
#4 [internal] load metadata for docker.io/library/golang:1.18.2-alpine
#4 DONE 0.4s
#19 ls /example
#0 0.135 d1
#19 DONE 0.2s
#20 ls /example
#0 0.104 d1
#0 0.104 d2
#20 DONE 0.1s
```
### Steps to reproduce
* Mount two directories
* Run multiple exec commands and observe logs output
### Dagger version
dagger v0.3.1
### OS version
Ubuntu-20.04
|
https://github.com/dagger/dagger/issues/3551
|
https://github.com/dagger/dagger/pull/3602
|
b734ed35554bbfbc5caf63674eaa9c22692e614e
|
b4bb0b9e06e1edf8b81f9054b7419daabcb5bedb
| 2022-10-26T01:16:16Z |
go
| 2022-10-31T22:13:34Z |
core/integration/container_test.go
|
WORKDIR /src
COPY main.go .
RUN go mod init hello
RUN go build -o /usr/bin/goenv main.go
ENV FOO=bar
CMD goenv
`,
}).
ID(ctx)
require.NoError(t, err)
env, err := c.Container().Build(srcID, dagger.ContainerBuildOpts{
Dockerfile: "subdir/Dockerfile.whee",
}).Exec().Stdout().Contents(ctx)
require.NoError(t, err)
require.Contains(t, env, "FOO=bar\n")
})
t.Run("subdirectory with default Dockerfile location", func(t *testing.T) {
srcID, err := contextDir.
WithNewFile("Dockerfile", dagger.DirectoryWithNewFileOpts{
Contents: `FROM golang:1.18.2-alpine
WORKDIR /src
COPY main.go .
RUN go mod init hello
RUN go build -o /usr/bin/goenv main.go
ENV FOO=bar
CMD goenv
`,
}).
ID(ctx)
require.NoError(t, err)
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 3,551 |
π Odd container behavior with exec / multiple withMountedDirectory
|
### What is the issue?
The following code executes but provides unexpected logs / output. Other similar use cases error due to missing files due to same issue. This may be something very simple (haven't used golang in many years) but seems like there may be an underlying issue with the execution engine.
I would expect this code to run the `ls` command twice, one time showing the two mounted directories, one time showing the root output. Instead in the logs I see `ls` with d1 and d2 (expected), an `ls` with just d1 (??), and then an `ls` with the root fs. This causes issues if the first ls is changed to `ls /example/d2` as it will error the whole pipeline due to missing path.
```golang
workdir := client.Host().Workdir()
d1, err := workdir.Read().Directory("dir1/").ID(ctx)
if err != nil {
return err
}
d2, err := workdir.Read().Directory("dir2/").ID(ctx)
if err != nil {
return err
}
build := client.Container().From("alpine:latest").
WithMountedDirectory("/example/d1", d1).
WithMountedDirectory("/example/d2", d2)
build = build.Exec(dagger.ContainerExecOpts{
Args: []string{"ls", "/example"},
})
_, err = build.ExitCode(ctx)
if err != nil {
return err
}
build = build.Exec(dagger.ContainerExecOpts{
Args: []string{"ls", "/"},
})
_, err = build.ExitCode(ctx)
if err != nil {
return err
}
```
I was able to get the same functionality working fine by using `fs, err := build.FS().WithDirectory(d1, "/example/d1").WithDirectory(d2, "/example/d2").ID(ctx); build = build.WithFS(fs);` so conceptually don't think I'm doing anything wrong.
### Log output
```
#1 resolve image config for docker.io/library/alpine:latest
#1 DONE 0.4s
#2 mkfile /Dockerfile
#2 DONE 0.0s
#3 mkfile /main.go
#3 CACHED
#4 [internal] load metadata for docker.io/library/golang:1.18.2-alpine
#4 DONE 0.1s
#5 local://__dagger_workdir_/home/plaisted/source/OSD.PJI-Temporary/repro
#5 DONE 0.0s
#6 local://__dagger_workdir_/home/plaisted/source/OSD.PJI-Temporary/repro
#6 transferring __dagger_workdir_/home/plaisted/source/OSD.PJI-Temporary/repro: 309B done
#6 DONE 0.0s
#7 [build 1/6] FROM docker.io/library/golang:1.18.2-alpine@sha256:4795c5d21f01e0777707ada02408debe77fe31848be97cf9fa8a1462da78d949
#7 resolve docker.io/library/golang:1.18.2-alpine@sha256:4795c5d21f01e0777707ada02408debe77fe31848be97cf9fa8a1462da78d949 0.0s done
#7 DONE 0.0s
#8 [build 3/6] RUN apk add --no-cache file git
#8 CACHED
#9 [build 4/6] RUN go mod init go.dagger.io/dagger/shim/cmd
#9 CACHED
#10 [build 2/6] WORKDIR /src
#10 CACHED
#11 [build 5/6] COPY . .
#11 CACHED
#12 [build 6/6] RUN CGO_ENABLED=0 go build -o /_shim -ldflags '-s -d -w' .
#12 CACHED
#13 [stage-1 1/1] COPY --from=build /_shim /_shim
#13 CACHED
#14 mkdir /meta
#14 CACHED
#15 copy / /
#15 DONE 0.0s
#16 docker-image://docker.io/library/alpine:latest
#16 resolve docker.io/library/alpine:latest
#16 resolve docker.io/library/alpine:latest 0.1s done
#16 CACHED
#17 copy / /
#17 CACHED
#18 ls /example
#18 0.157 d1
#18 0.157 d2
#18 DONE 0.2s
#1 resolve image config for docker.io/library/alpine:latest
#1 DONE 0.5s
#4 [internal] load metadata for docker.io/library/golang:1.18.2-alpine
#4 DONE 0.4s
#19 ls /example
#19 0.172 d1
#19 DONE 0.2s
#20 ls /
#20 0.105 _shim
#20 0.105 bin
#20 0.105 dagger
#20 0.105 dev
#20 0.105 etc
#20 0.105 example
#20 0.105 home
#20 0.105 lib
#20 0.105 media
#20 0.105 mnt
#20 0.105 opt
#20 0.105 proc
#20 0.105 root
#20 0.105 run
#20 0.105 sbin
#20 0.105 srv
#20 0.105 sys
#20 0.105 tmp
#20 0.105 usr
#20 0.105 var
#20 DONE 0.1s
#0 0.148 d1
#0 0.148 d2
#18 DONE 0.2s
#1 resolve image config for docker.io/library/alpine:latest
#1 DONE 0.4s
#4 [internal] load metadata for docker.io/library/golang:1.18.2-alpine
#4 DONE 0.4s
#19 ls /example
#0 0.135 d1
#19 DONE 0.2s
#20 ls /example
#0 0.104 d1
#0 0.104 d2
#20 DONE 0.1s
```
### Steps to reproduce
* Mount two directories
* Run multiple exec commands and observe logs output
### Dagger version
dagger v0.3.1
### OS version
Ubuntu-20.04
|
https://github.com/dagger/dagger/issues/3551
|
https://github.com/dagger/dagger/pull/3602
|
b734ed35554bbfbc5caf63674eaa9c22692e614e
|
b4bb0b9e06e1edf8b81f9054b7419daabcb5bedb
| 2022-10-26T01:16:16Z |
go
| 2022-10-31T22:13:34Z |
core/integration/container_test.go
|
subID, err := c.Directory().WithDirectory(srcID, "subcontext").Directory("subcontext").ID(ctx)
require.NoError(t, err)
env, err := c.Container().Build(subID).Exec().Stdout().Contents(ctx)
require.NoError(t, err)
require.Contains(t, env, "FOO=bar\n")
})
t.Run("subdirectory with custom Dockerfile location", func(t *testing.T) {
srcID, err := contextDir.
WithNewFile("subdir/Dockerfile.whee", dagger.DirectoryWithNewFileOpts{
Contents: `FROM golang:1.18.2-alpine
WORKDIR /src
COPY main.go .
RUN go mod init hello
RUN go build -o /usr/bin/goenv main.go
ENV FOO=bar
CMD goenv
`,
}).
ID(ctx)
require.NoError(t, err)
subID, err := c.Directory().WithDirectory(srcID, "subcontext").Directory("subcontext").ID(ctx)
require.NoError(t, err)
env, err := c.Container().Build(subID, dagger.ContainerBuildOpts{
Dockerfile: "subdir/Dockerfile.whee",
}).Exec().Stdout().Contents(ctx)
require.NoError(t, err)
require.Contains(t, env, "FOO=bar\n")
})
}
func TestContainerWithFS(t *testing.T) {
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 3,551 |
π Odd container behavior with exec / multiple withMountedDirectory
|
### What is the issue?
The following code executes but provides unexpected logs / output. Other similar use cases error due to missing files due to same issue. This may be something very simple (haven't used golang in many years) but seems like there may be an underlying issue with the execution engine.
I would expect this code to run the `ls` command twice, one time showing the two mounted directories, one time showing the root output. Instead in the logs I see `ls` with d1 and d2 (expected), an `ls` with just d1 (??), and then an `ls` with the root fs. This causes issues if the first ls is changed to `ls /example/d2` as it will error the whole pipeline due to missing path.
```golang
workdir := client.Host().Workdir()
d1, err := workdir.Read().Directory("dir1/").ID(ctx)
if err != nil {
return err
}
d2, err := workdir.Read().Directory("dir2/").ID(ctx)
if err != nil {
return err
}
build := client.Container().From("alpine:latest").
WithMountedDirectory("/example/d1", d1).
WithMountedDirectory("/example/d2", d2)
build = build.Exec(dagger.ContainerExecOpts{
Args: []string{"ls", "/example"},
})
_, err = build.ExitCode(ctx)
if err != nil {
return err
}
build = build.Exec(dagger.ContainerExecOpts{
Args: []string{"ls", "/"},
})
_, err = build.ExitCode(ctx)
if err != nil {
return err
}
```
I was able to get the same functionality working fine by using `fs, err := build.FS().WithDirectory(d1, "/example/d1").WithDirectory(d2, "/example/d2").ID(ctx); build = build.WithFS(fs);` so conceptually don't think I'm doing anything wrong.
### Log output
```
#1 resolve image config for docker.io/library/alpine:latest
#1 DONE 0.4s
#2 mkfile /Dockerfile
#2 DONE 0.0s
#3 mkfile /main.go
#3 CACHED
#4 [internal] load metadata for docker.io/library/golang:1.18.2-alpine
#4 DONE 0.1s
#5 local://__dagger_workdir_/home/plaisted/source/OSD.PJI-Temporary/repro
#5 DONE 0.0s
#6 local://__dagger_workdir_/home/plaisted/source/OSD.PJI-Temporary/repro
#6 transferring __dagger_workdir_/home/plaisted/source/OSD.PJI-Temporary/repro: 309B done
#6 DONE 0.0s
#7 [build 1/6] FROM docker.io/library/golang:1.18.2-alpine@sha256:4795c5d21f01e0777707ada02408debe77fe31848be97cf9fa8a1462da78d949
#7 resolve docker.io/library/golang:1.18.2-alpine@sha256:4795c5d21f01e0777707ada02408debe77fe31848be97cf9fa8a1462da78d949 0.0s done
#7 DONE 0.0s
#8 [build 3/6] RUN apk add --no-cache file git
#8 CACHED
#9 [build 4/6] RUN go mod init go.dagger.io/dagger/shim/cmd
#9 CACHED
#10 [build 2/6] WORKDIR /src
#10 CACHED
#11 [build 5/6] COPY . .
#11 CACHED
#12 [build 6/6] RUN CGO_ENABLED=0 go build -o /_shim -ldflags '-s -d -w' .
#12 CACHED
#13 [stage-1 1/1] COPY --from=build /_shim /_shim
#13 CACHED
#14 mkdir /meta
#14 CACHED
#15 copy / /
#15 DONE 0.0s
#16 docker-image://docker.io/library/alpine:latest
#16 resolve docker.io/library/alpine:latest
#16 resolve docker.io/library/alpine:latest 0.1s done
#16 CACHED
#17 copy / /
#17 CACHED
#18 ls /example
#18 0.157 d1
#18 0.157 d2
#18 DONE 0.2s
#1 resolve image config for docker.io/library/alpine:latest
#1 DONE 0.5s
#4 [internal] load metadata for docker.io/library/golang:1.18.2-alpine
#4 DONE 0.4s
#19 ls /example
#19 0.172 d1
#19 DONE 0.2s
#20 ls /
#20 0.105 _shim
#20 0.105 bin
#20 0.105 dagger
#20 0.105 dev
#20 0.105 etc
#20 0.105 example
#20 0.105 home
#20 0.105 lib
#20 0.105 media
#20 0.105 mnt
#20 0.105 opt
#20 0.105 proc
#20 0.105 root
#20 0.105 run
#20 0.105 sbin
#20 0.105 srv
#20 0.105 sys
#20 0.105 tmp
#20 0.105 usr
#20 0.105 var
#20 DONE 0.1s
#0 0.148 d1
#0 0.148 d2
#18 DONE 0.2s
#1 resolve image config for docker.io/library/alpine:latest
#1 DONE 0.4s
#4 [internal] load metadata for docker.io/library/golang:1.18.2-alpine
#4 DONE 0.4s
#19 ls /example
#0 0.135 d1
#19 DONE 0.2s
#20 ls /example
#0 0.104 d1
#0 0.104 d2
#20 DONE 0.1s
```
### Steps to reproduce
* Mount two directories
* Run multiple exec commands and observe logs output
### Dagger version
dagger v0.3.1
### OS version
Ubuntu-20.04
|
https://github.com/dagger/dagger/issues/3551
|
https://github.com/dagger/dagger/pull/3602
|
b734ed35554bbfbc5caf63674eaa9c22692e614e
|
b4bb0b9e06e1edf8b81f9054b7419daabcb5bedb
| 2022-10-26T01:16:16Z |
go
| 2022-10-31T22:13:34Z |
core/integration/container_test.go
|
t.Parallel()
ctx := context.Background()
c, err := dagger.Connect(ctx)
require.NoError(t, err)
defer c.Close()
alpine316 := c.Container().From("alpine:3.16.2")
alpine316ReleaseStr, err := alpine316.File("/etc/alpine-release").Contents(ctx)
require.NoError(t, err)
alpine316ReleaseStr = strings.TrimSpace(alpine316ReleaseStr)
dirID, err := alpine316.FS().ID(ctx)
require.NoError(t, err)
exitCode, err := c.Container().WithEnvVariable("ALPINE_RELEASE", alpine316ReleaseStr).WithFS(dirID).Exec(dagger.ContainerExecOpts{
Args: []string{
"/bin/sh",
"-c",
"test -f /etc/alpine-release && test \"$(head -n 1 /etc/alpine-release)\" = \"$ALPINE_RELEASE\"",
},
}).ExitCode(ctx)
require.NoError(t, err)
require.NotEmpty(t, dirID)
require.Equal(t, exitCode, 0)
alpine315 := c.Container().From("alpine:3.15.6")
varVal := "testing123"
alpine315WithVar := alpine315.WithEnvVariable("DAGGER_TEST", varVal)
varValResp, err := alpine315WithVar.EnvVariable(ctx, "DAGGER_TEST")
require.NoError(t, err)
require.Equal(t, varVal, varValResp)
alpine315ReplacedFS := alpine315WithVar.WithFS(dirID)
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 3,551 |
π Odd container behavior with exec / multiple withMountedDirectory
|
### What is the issue?
The following code executes but provides unexpected logs / output. Other similar use cases error due to missing files due to same issue. This may be something very simple (haven't used golang in many years) but seems like there may be an underlying issue with the execution engine.
I would expect this code to run the `ls` command twice, one time showing the two mounted directories, one time showing the root output. Instead in the logs I see `ls` with d1 and d2 (expected), an `ls` with just d1 (??), and then an `ls` with the root fs. This causes issues if the first ls is changed to `ls /example/d2` as it will error the whole pipeline due to missing path.
```golang
workdir := client.Host().Workdir()
d1, err := workdir.Read().Directory("dir1/").ID(ctx)
if err != nil {
return err
}
d2, err := workdir.Read().Directory("dir2/").ID(ctx)
if err != nil {
return err
}
build := client.Container().From("alpine:latest").
WithMountedDirectory("/example/d1", d1).
WithMountedDirectory("/example/d2", d2)
build = build.Exec(dagger.ContainerExecOpts{
Args: []string{"ls", "/example"},
})
_, err = build.ExitCode(ctx)
if err != nil {
return err
}
build = build.Exec(dagger.ContainerExecOpts{
Args: []string{"ls", "/"},
})
_, err = build.ExitCode(ctx)
if err != nil {
return err
}
```
I was able to get the same functionality working fine by using `fs, err := build.FS().WithDirectory(d1, "/example/d1").WithDirectory(d2, "/example/d2").ID(ctx); build = build.WithFS(fs);` so conceptually don't think I'm doing anything wrong.
### Log output
```
#1 resolve image config for docker.io/library/alpine:latest
#1 DONE 0.4s
#2 mkfile /Dockerfile
#2 DONE 0.0s
#3 mkfile /main.go
#3 CACHED
#4 [internal] load metadata for docker.io/library/golang:1.18.2-alpine
#4 DONE 0.1s
#5 local://__dagger_workdir_/home/plaisted/source/OSD.PJI-Temporary/repro
#5 DONE 0.0s
#6 local://__dagger_workdir_/home/plaisted/source/OSD.PJI-Temporary/repro
#6 transferring __dagger_workdir_/home/plaisted/source/OSD.PJI-Temporary/repro: 309B done
#6 DONE 0.0s
#7 [build 1/6] FROM docker.io/library/golang:1.18.2-alpine@sha256:4795c5d21f01e0777707ada02408debe77fe31848be97cf9fa8a1462da78d949
#7 resolve docker.io/library/golang:1.18.2-alpine@sha256:4795c5d21f01e0777707ada02408debe77fe31848be97cf9fa8a1462da78d949 0.0s done
#7 DONE 0.0s
#8 [build 3/6] RUN apk add --no-cache file git
#8 CACHED
#9 [build 4/6] RUN go mod init go.dagger.io/dagger/shim/cmd
#9 CACHED
#10 [build 2/6] WORKDIR /src
#10 CACHED
#11 [build 5/6] COPY . .
#11 CACHED
#12 [build 6/6] RUN CGO_ENABLED=0 go build -o /_shim -ldflags '-s -d -w' .
#12 CACHED
#13 [stage-1 1/1] COPY --from=build /_shim /_shim
#13 CACHED
#14 mkdir /meta
#14 CACHED
#15 copy / /
#15 DONE 0.0s
#16 docker-image://docker.io/library/alpine:latest
#16 resolve docker.io/library/alpine:latest
#16 resolve docker.io/library/alpine:latest 0.1s done
#16 CACHED
#17 copy / /
#17 CACHED
#18 ls /example
#18 0.157 d1
#18 0.157 d2
#18 DONE 0.2s
#1 resolve image config for docker.io/library/alpine:latest
#1 DONE 0.5s
#4 [internal] load metadata for docker.io/library/golang:1.18.2-alpine
#4 DONE 0.4s
#19 ls /example
#19 0.172 d1
#19 DONE 0.2s
#20 ls /
#20 0.105 _shim
#20 0.105 bin
#20 0.105 dagger
#20 0.105 dev
#20 0.105 etc
#20 0.105 example
#20 0.105 home
#20 0.105 lib
#20 0.105 media
#20 0.105 mnt
#20 0.105 opt
#20 0.105 proc
#20 0.105 root
#20 0.105 run
#20 0.105 sbin
#20 0.105 srv
#20 0.105 sys
#20 0.105 tmp
#20 0.105 usr
#20 0.105 var
#20 DONE 0.1s
#0 0.148 d1
#0 0.148 d2
#18 DONE 0.2s
#1 resolve image config for docker.io/library/alpine:latest
#1 DONE 0.4s
#4 [internal] load metadata for docker.io/library/golang:1.18.2-alpine
#4 DONE 0.4s
#19 ls /example
#0 0.135 d1
#19 DONE 0.2s
#20 ls /example
#0 0.104 d1
#0 0.104 d2
#20 DONE 0.1s
```
### Steps to reproduce
* Mount two directories
* Run multiple exec commands and observe logs output
### Dagger version
dagger v0.3.1
### OS version
Ubuntu-20.04
|
https://github.com/dagger/dagger/issues/3551
|
https://github.com/dagger/dagger/pull/3602
|
b734ed35554bbfbc5caf63674eaa9c22692e614e
|
b4bb0b9e06e1edf8b81f9054b7419daabcb5bedb
| 2022-10-26T01:16:16Z |
go
| 2022-10-31T22:13:34Z |
core/integration/container_test.go
|
varValResp, err = alpine315ReplacedFS.EnvVariable(ctx, "DAGGER_TEST")
require.NoError(t, err)
require.Equal(t, varVal, varValResp)
releaseStr, err := alpine315ReplacedFS.File("/etc/alpine-release").Contents(ctx)
require.NoError(t, err)
require.Equal(t, "3.16.2\n", releaseStr)
}
func TestContainerExecExitCode(t *testing.T) {
t.Parallel()
res := struct {
Container struct {
From struct {
Exec struct {
ExitCode *int
}
}
}
}{}
err := testutil.Query(
`{
container {
from(address: "alpine:3.16.2") {
exec(args: ["true"]) {
exitCode
}
}
}
}`, &res, nil)
require.NoError(t, err)
require.NotNil(t, res.Container.From.Exec.ExitCode)
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 3,551 |
π Odd container behavior with exec / multiple withMountedDirectory
|
### What is the issue?
The following code executes but provides unexpected logs / output. Other similar use cases error due to missing files due to same issue. This may be something very simple (haven't used golang in many years) but seems like there may be an underlying issue with the execution engine.
I would expect this code to run the `ls` command twice, one time showing the two mounted directories, one time showing the root output. Instead in the logs I see `ls` with d1 and d2 (expected), an `ls` with just d1 (??), and then an `ls` with the root fs. This causes issues if the first ls is changed to `ls /example/d2` as it will error the whole pipeline due to missing path.
```golang
workdir := client.Host().Workdir()
d1, err := workdir.Read().Directory("dir1/").ID(ctx)
if err != nil {
return err
}
d2, err := workdir.Read().Directory("dir2/").ID(ctx)
if err != nil {
return err
}
build := client.Container().From("alpine:latest").
WithMountedDirectory("/example/d1", d1).
WithMountedDirectory("/example/d2", d2)
build = build.Exec(dagger.ContainerExecOpts{
Args: []string{"ls", "/example"},
})
_, err = build.ExitCode(ctx)
if err != nil {
return err
}
build = build.Exec(dagger.ContainerExecOpts{
Args: []string{"ls", "/"},
})
_, err = build.ExitCode(ctx)
if err != nil {
return err
}
```
I was able to get the same functionality working fine by using `fs, err := build.FS().WithDirectory(d1, "/example/d1").WithDirectory(d2, "/example/d2").ID(ctx); build = build.WithFS(fs);` so conceptually don't think I'm doing anything wrong.
### Log output
```
#1 resolve image config for docker.io/library/alpine:latest
#1 DONE 0.4s
#2 mkfile /Dockerfile
#2 DONE 0.0s
#3 mkfile /main.go
#3 CACHED
#4 [internal] load metadata for docker.io/library/golang:1.18.2-alpine
#4 DONE 0.1s
#5 local://__dagger_workdir_/home/plaisted/source/OSD.PJI-Temporary/repro
#5 DONE 0.0s
#6 local://__dagger_workdir_/home/plaisted/source/OSD.PJI-Temporary/repro
#6 transferring __dagger_workdir_/home/plaisted/source/OSD.PJI-Temporary/repro: 309B done
#6 DONE 0.0s
#7 [build 1/6] FROM docker.io/library/golang:1.18.2-alpine@sha256:4795c5d21f01e0777707ada02408debe77fe31848be97cf9fa8a1462da78d949
#7 resolve docker.io/library/golang:1.18.2-alpine@sha256:4795c5d21f01e0777707ada02408debe77fe31848be97cf9fa8a1462da78d949 0.0s done
#7 DONE 0.0s
#8 [build 3/6] RUN apk add --no-cache file git
#8 CACHED
#9 [build 4/6] RUN go mod init go.dagger.io/dagger/shim/cmd
#9 CACHED
#10 [build 2/6] WORKDIR /src
#10 CACHED
#11 [build 5/6] COPY . .
#11 CACHED
#12 [build 6/6] RUN CGO_ENABLED=0 go build -o /_shim -ldflags '-s -d -w' .
#12 CACHED
#13 [stage-1 1/1] COPY --from=build /_shim /_shim
#13 CACHED
#14 mkdir /meta
#14 CACHED
#15 copy / /
#15 DONE 0.0s
#16 docker-image://docker.io/library/alpine:latest
#16 resolve docker.io/library/alpine:latest
#16 resolve docker.io/library/alpine:latest 0.1s done
#16 CACHED
#17 copy / /
#17 CACHED
#18 ls /example
#18 0.157 d1
#18 0.157 d2
#18 DONE 0.2s
#1 resolve image config for docker.io/library/alpine:latest
#1 DONE 0.5s
#4 [internal] load metadata for docker.io/library/golang:1.18.2-alpine
#4 DONE 0.4s
#19 ls /example
#19 0.172 d1
#19 DONE 0.2s
#20 ls /
#20 0.105 _shim
#20 0.105 bin
#20 0.105 dagger
#20 0.105 dev
#20 0.105 etc
#20 0.105 example
#20 0.105 home
#20 0.105 lib
#20 0.105 media
#20 0.105 mnt
#20 0.105 opt
#20 0.105 proc
#20 0.105 root
#20 0.105 run
#20 0.105 sbin
#20 0.105 srv
#20 0.105 sys
#20 0.105 tmp
#20 0.105 usr
#20 0.105 var
#20 DONE 0.1s
#0 0.148 d1
#0 0.148 d2
#18 DONE 0.2s
#1 resolve image config for docker.io/library/alpine:latest
#1 DONE 0.4s
#4 [internal] load metadata for docker.io/library/golang:1.18.2-alpine
#4 DONE 0.4s
#19 ls /example
#0 0.135 d1
#19 DONE 0.2s
#20 ls /example
#0 0.104 d1
#0 0.104 d2
#20 DONE 0.1s
```
### Steps to reproduce
* Mount two directories
* Run multiple exec commands and observe logs output
### Dagger version
dagger v0.3.1
### OS version
Ubuntu-20.04
|
https://github.com/dagger/dagger/issues/3551
|
https://github.com/dagger/dagger/pull/3602
|
b734ed35554bbfbc5caf63674eaa9c22692e614e
|
b4bb0b9e06e1edf8b81f9054b7419daabcb5bedb
| 2022-10-26T01:16:16Z |
go
| 2022-10-31T22:13:34Z |
core/integration/container_test.go
|
require.Equal(t, 0, *res.Container.From.Exec.ExitCode)
/*
It's not currently possible to get a nonzero exit code back because
Buildkit raises an error.
We could perhaps have the shim mask the exit status and always exit 0, but
we would have to be careful not to let that happen in a big chained LLB
since it would prevent short-circuiting.
We could only do it when the user requests the exitCode, but then we would
actually need to run the command _again_ since we'd need some way to tell
the shim what to do.
Hmm...
err = testutil.Query(
`{
container {
from(address: "alpine:3.16.2") {
exec(args: ["false"]) {
exitCode
}
}
}
}`, &res, nil)
require.NoError(t, err)
require.Equal(t, res.Container.From.Exec.ExitCode, 1)
*/
}
func TestContainerExecStdoutStderr(t *testing.T) {
t.Parallel()
res := struct {
Container struct {
From struct {
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 3,551 |
π Odd container behavior with exec / multiple withMountedDirectory
|
### What is the issue?
The following code executes but provides unexpected logs / output. Other similar use cases error due to missing files due to same issue. This may be something very simple (haven't used golang in many years) but seems like there may be an underlying issue with the execution engine.
I would expect this code to run the `ls` command twice, one time showing the two mounted directories, one time showing the root output. Instead in the logs I see `ls` with d1 and d2 (expected), an `ls` with just d1 (??), and then an `ls` with the root fs. This causes issues if the first ls is changed to `ls /example/d2` as it will error the whole pipeline due to missing path.
```golang
workdir := client.Host().Workdir()
d1, err := workdir.Read().Directory("dir1/").ID(ctx)
if err != nil {
return err
}
d2, err := workdir.Read().Directory("dir2/").ID(ctx)
if err != nil {
return err
}
build := client.Container().From("alpine:latest").
WithMountedDirectory("/example/d1", d1).
WithMountedDirectory("/example/d2", d2)
build = build.Exec(dagger.ContainerExecOpts{
Args: []string{"ls", "/example"},
})
_, err = build.ExitCode(ctx)
if err != nil {
return err
}
build = build.Exec(dagger.ContainerExecOpts{
Args: []string{"ls", "/"},
})
_, err = build.ExitCode(ctx)
if err != nil {
return err
}
```
I was able to get the same functionality working fine by using `fs, err := build.FS().WithDirectory(d1, "/example/d1").WithDirectory(d2, "/example/d2").ID(ctx); build = build.WithFS(fs);` so conceptually don't think I'm doing anything wrong.
### Log output
```
#1 resolve image config for docker.io/library/alpine:latest
#1 DONE 0.4s
#2 mkfile /Dockerfile
#2 DONE 0.0s
#3 mkfile /main.go
#3 CACHED
#4 [internal] load metadata for docker.io/library/golang:1.18.2-alpine
#4 DONE 0.1s
#5 local://__dagger_workdir_/home/plaisted/source/OSD.PJI-Temporary/repro
#5 DONE 0.0s
#6 local://__dagger_workdir_/home/plaisted/source/OSD.PJI-Temporary/repro
#6 transferring __dagger_workdir_/home/plaisted/source/OSD.PJI-Temporary/repro: 309B done
#6 DONE 0.0s
#7 [build 1/6] FROM docker.io/library/golang:1.18.2-alpine@sha256:4795c5d21f01e0777707ada02408debe77fe31848be97cf9fa8a1462da78d949
#7 resolve docker.io/library/golang:1.18.2-alpine@sha256:4795c5d21f01e0777707ada02408debe77fe31848be97cf9fa8a1462da78d949 0.0s done
#7 DONE 0.0s
#8 [build 3/6] RUN apk add --no-cache file git
#8 CACHED
#9 [build 4/6] RUN go mod init go.dagger.io/dagger/shim/cmd
#9 CACHED
#10 [build 2/6] WORKDIR /src
#10 CACHED
#11 [build 5/6] COPY . .
#11 CACHED
#12 [build 6/6] RUN CGO_ENABLED=0 go build -o /_shim -ldflags '-s -d -w' .
#12 CACHED
#13 [stage-1 1/1] COPY --from=build /_shim /_shim
#13 CACHED
#14 mkdir /meta
#14 CACHED
#15 copy / /
#15 DONE 0.0s
#16 docker-image://docker.io/library/alpine:latest
#16 resolve docker.io/library/alpine:latest
#16 resolve docker.io/library/alpine:latest 0.1s done
#16 CACHED
#17 copy / /
#17 CACHED
#18 ls /example
#18 0.157 d1
#18 0.157 d2
#18 DONE 0.2s
#1 resolve image config for docker.io/library/alpine:latest
#1 DONE 0.5s
#4 [internal] load metadata for docker.io/library/golang:1.18.2-alpine
#4 DONE 0.4s
#19 ls /example
#19 0.172 d1
#19 DONE 0.2s
#20 ls /
#20 0.105 _shim
#20 0.105 bin
#20 0.105 dagger
#20 0.105 dev
#20 0.105 etc
#20 0.105 example
#20 0.105 home
#20 0.105 lib
#20 0.105 media
#20 0.105 mnt
#20 0.105 opt
#20 0.105 proc
#20 0.105 root
#20 0.105 run
#20 0.105 sbin
#20 0.105 srv
#20 0.105 sys
#20 0.105 tmp
#20 0.105 usr
#20 0.105 var
#20 DONE 0.1s
#0 0.148 d1
#0 0.148 d2
#18 DONE 0.2s
#1 resolve image config for docker.io/library/alpine:latest
#1 DONE 0.4s
#4 [internal] load metadata for docker.io/library/golang:1.18.2-alpine
#4 DONE 0.4s
#19 ls /example
#0 0.135 d1
#19 DONE 0.2s
#20 ls /example
#0 0.104 d1
#0 0.104 d2
#20 DONE 0.1s
```
### Steps to reproduce
* Mount two directories
* Run multiple exec commands and observe logs output
### Dagger version
dagger v0.3.1
### OS version
Ubuntu-20.04
|
https://github.com/dagger/dagger/issues/3551
|
https://github.com/dagger/dagger/pull/3602
|
b734ed35554bbfbc5caf63674eaa9c22692e614e
|
b4bb0b9e06e1edf8b81f9054b7419daabcb5bedb
| 2022-10-26T01:16:16Z |
go
| 2022-10-31T22:13:34Z |
core/integration/container_test.go
|
Exec struct {
Stdout, Stderr struct {
Contents string
}
}
}
}
}{}
err := testutil.Query(
`{
container {
from(address: "alpine:3.16.2") {
exec(args: ["sh", "-c", "echo hello; echo goodbye >/dev/stderr"]) {
stdout {
contents
}
stderr {
contents
}
}
}
}
}`, &res, nil)
require.NoError(t, err)
require.Equal(t, res.Container.From.Exec.Stdout.Contents, "hello\n")
require.Equal(t, res.Container.From.Exec.Stderr.Contents, "goodbye\n")
}
func TestContainerExecStdin(t *testing.T) {
t.Parallel()
res := struct {
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 3,551 |
π Odd container behavior with exec / multiple withMountedDirectory
|
### What is the issue?
The following code executes but provides unexpected logs / output. Other similar use cases error due to missing files due to same issue. This may be something very simple (haven't used golang in many years) but seems like there may be an underlying issue with the execution engine.
I would expect this code to run the `ls` command twice, one time showing the two mounted directories, one time showing the root output. Instead in the logs I see `ls` with d1 and d2 (expected), an `ls` with just d1 (??), and then an `ls` with the root fs. This causes issues if the first ls is changed to `ls /example/d2` as it will error the whole pipeline due to missing path.
```golang
workdir := client.Host().Workdir()
d1, err := workdir.Read().Directory("dir1/").ID(ctx)
if err != nil {
return err
}
d2, err := workdir.Read().Directory("dir2/").ID(ctx)
if err != nil {
return err
}
build := client.Container().From("alpine:latest").
WithMountedDirectory("/example/d1", d1).
WithMountedDirectory("/example/d2", d2)
build = build.Exec(dagger.ContainerExecOpts{
Args: []string{"ls", "/example"},
})
_, err = build.ExitCode(ctx)
if err != nil {
return err
}
build = build.Exec(dagger.ContainerExecOpts{
Args: []string{"ls", "/"},
})
_, err = build.ExitCode(ctx)
if err != nil {
return err
}
```
I was able to get the same functionality working fine by using `fs, err := build.FS().WithDirectory(d1, "/example/d1").WithDirectory(d2, "/example/d2").ID(ctx); build = build.WithFS(fs);` so conceptually don't think I'm doing anything wrong.
### Log output
```
#1 resolve image config for docker.io/library/alpine:latest
#1 DONE 0.4s
#2 mkfile /Dockerfile
#2 DONE 0.0s
#3 mkfile /main.go
#3 CACHED
#4 [internal] load metadata for docker.io/library/golang:1.18.2-alpine
#4 DONE 0.1s
#5 local://__dagger_workdir_/home/plaisted/source/OSD.PJI-Temporary/repro
#5 DONE 0.0s
#6 local://__dagger_workdir_/home/plaisted/source/OSD.PJI-Temporary/repro
#6 transferring __dagger_workdir_/home/plaisted/source/OSD.PJI-Temporary/repro: 309B done
#6 DONE 0.0s
#7 [build 1/6] FROM docker.io/library/golang:1.18.2-alpine@sha256:4795c5d21f01e0777707ada02408debe77fe31848be97cf9fa8a1462da78d949
#7 resolve docker.io/library/golang:1.18.2-alpine@sha256:4795c5d21f01e0777707ada02408debe77fe31848be97cf9fa8a1462da78d949 0.0s done
#7 DONE 0.0s
#8 [build 3/6] RUN apk add --no-cache file git
#8 CACHED
#9 [build 4/6] RUN go mod init go.dagger.io/dagger/shim/cmd
#9 CACHED
#10 [build 2/6] WORKDIR /src
#10 CACHED
#11 [build 5/6] COPY . .
#11 CACHED
#12 [build 6/6] RUN CGO_ENABLED=0 go build -o /_shim -ldflags '-s -d -w' .
#12 CACHED
#13 [stage-1 1/1] COPY --from=build /_shim /_shim
#13 CACHED
#14 mkdir /meta
#14 CACHED
#15 copy / /
#15 DONE 0.0s
#16 docker-image://docker.io/library/alpine:latest
#16 resolve docker.io/library/alpine:latest
#16 resolve docker.io/library/alpine:latest 0.1s done
#16 CACHED
#17 copy / /
#17 CACHED
#18 ls /example
#18 0.157 d1
#18 0.157 d2
#18 DONE 0.2s
#1 resolve image config for docker.io/library/alpine:latest
#1 DONE 0.5s
#4 [internal] load metadata for docker.io/library/golang:1.18.2-alpine
#4 DONE 0.4s
#19 ls /example
#19 0.172 d1
#19 DONE 0.2s
#20 ls /
#20 0.105 _shim
#20 0.105 bin
#20 0.105 dagger
#20 0.105 dev
#20 0.105 etc
#20 0.105 example
#20 0.105 home
#20 0.105 lib
#20 0.105 media
#20 0.105 mnt
#20 0.105 opt
#20 0.105 proc
#20 0.105 root
#20 0.105 run
#20 0.105 sbin
#20 0.105 srv
#20 0.105 sys
#20 0.105 tmp
#20 0.105 usr
#20 0.105 var
#20 DONE 0.1s
#0 0.148 d1
#0 0.148 d2
#18 DONE 0.2s
#1 resolve image config for docker.io/library/alpine:latest
#1 DONE 0.4s
#4 [internal] load metadata for docker.io/library/golang:1.18.2-alpine
#4 DONE 0.4s
#19 ls /example
#0 0.135 d1
#19 DONE 0.2s
#20 ls /example
#0 0.104 d1
#0 0.104 d2
#20 DONE 0.1s
```
### Steps to reproduce
* Mount two directories
* Run multiple exec commands and observe logs output
### Dagger version
dagger v0.3.1
### OS version
Ubuntu-20.04
|
https://github.com/dagger/dagger/issues/3551
|
https://github.com/dagger/dagger/pull/3602
|
b734ed35554bbfbc5caf63674eaa9c22692e614e
|
b4bb0b9e06e1edf8b81f9054b7419daabcb5bedb
| 2022-10-26T01:16:16Z |
go
| 2022-10-31T22:13:34Z |
core/integration/container_test.go
|
Container struct {
From struct {
Exec struct {
Stdout struct {
Contents string
}
}
}
}
}{}
err := testutil.Query(
`{
container {
from(address: "alpine:3.16.2") {
exec(args: ["cat"], stdin: "hello") {
stdout {
contents
}
}
}
}
}`, &res, nil)
require.NoError(t, err)
require.Equal(t, res.Container.From.Exec.Stdout.Contents, "hello")
}
func TestContainerExecRedirectStdoutStderr(t *testing.T) {
t.Parallel()
res := struct {
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 3,551 |
π Odd container behavior with exec / multiple withMountedDirectory
|
### What is the issue?
The following code executes but provides unexpected logs / output. Other similar use cases error due to missing files due to same issue. This may be something very simple (haven't used golang in many years) but seems like there may be an underlying issue with the execution engine.
I would expect this code to run the `ls` command twice, one time showing the two mounted directories, one time showing the root output. Instead in the logs I see `ls` with d1 and d2 (expected), an `ls` with just d1 (??), and then an `ls` with the root fs. This causes issues if the first ls is changed to `ls /example/d2` as it will error the whole pipeline due to missing path.
```golang
workdir := client.Host().Workdir()
d1, err := workdir.Read().Directory("dir1/").ID(ctx)
if err != nil {
return err
}
d2, err := workdir.Read().Directory("dir2/").ID(ctx)
if err != nil {
return err
}
build := client.Container().From("alpine:latest").
WithMountedDirectory("/example/d1", d1).
WithMountedDirectory("/example/d2", d2)
build = build.Exec(dagger.ContainerExecOpts{
Args: []string{"ls", "/example"},
})
_, err = build.ExitCode(ctx)
if err != nil {
return err
}
build = build.Exec(dagger.ContainerExecOpts{
Args: []string{"ls", "/"},
})
_, err = build.ExitCode(ctx)
if err != nil {
return err
}
```
I was able to get the same functionality working fine by using `fs, err := build.FS().WithDirectory(d1, "/example/d1").WithDirectory(d2, "/example/d2").ID(ctx); build = build.WithFS(fs);` so conceptually don't think I'm doing anything wrong.
### Log output
```
#1 resolve image config for docker.io/library/alpine:latest
#1 DONE 0.4s
#2 mkfile /Dockerfile
#2 DONE 0.0s
#3 mkfile /main.go
#3 CACHED
#4 [internal] load metadata for docker.io/library/golang:1.18.2-alpine
#4 DONE 0.1s
#5 local://__dagger_workdir_/home/plaisted/source/OSD.PJI-Temporary/repro
#5 DONE 0.0s
#6 local://__dagger_workdir_/home/plaisted/source/OSD.PJI-Temporary/repro
#6 transferring __dagger_workdir_/home/plaisted/source/OSD.PJI-Temporary/repro: 309B done
#6 DONE 0.0s
#7 [build 1/6] FROM docker.io/library/golang:1.18.2-alpine@sha256:4795c5d21f01e0777707ada02408debe77fe31848be97cf9fa8a1462da78d949
#7 resolve docker.io/library/golang:1.18.2-alpine@sha256:4795c5d21f01e0777707ada02408debe77fe31848be97cf9fa8a1462da78d949 0.0s done
#7 DONE 0.0s
#8 [build 3/6] RUN apk add --no-cache file git
#8 CACHED
#9 [build 4/6] RUN go mod init go.dagger.io/dagger/shim/cmd
#9 CACHED
#10 [build 2/6] WORKDIR /src
#10 CACHED
#11 [build 5/6] COPY . .
#11 CACHED
#12 [build 6/6] RUN CGO_ENABLED=0 go build -o /_shim -ldflags '-s -d -w' .
#12 CACHED
#13 [stage-1 1/1] COPY --from=build /_shim /_shim
#13 CACHED
#14 mkdir /meta
#14 CACHED
#15 copy / /
#15 DONE 0.0s
#16 docker-image://docker.io/library/alpine:latest
#16 resolve docker.io/library/alpine:latest
#16 resolve docker.io/library/alpine:latest 0.1s done
#16 CACHED
#17 copy / /
#17 CACHED
#18 ls /example
#18 0.157 d1
#18 0.157 d2
#18 DONE 0.2s
#1 resolve image config for docker.io/library/alpine:latest
#1 DONE 0.5s
#4 [internal] load metadata for docker.io/library/golang:1.18.2-alpine
#4 DONE 0.4s
#19 ls /example
#19 0.172 d1
#19 DONE 0.2s
#20 ls /
#20 0.105 _shim
#20 0.105 bin
#20 0.105 dagger
#20 0.105 dev
#20 0.105 etc
#20 0.105 example
#20 0.105 home
#20 0.105 lib
#20 0.105 media
#20 0.105 mnt
#20 0.105 opt
#20 0.105 proc
#20 0.105 root
#20 0.105 run
#20 0.105 sbin
#20 0.105 srv
#20 0.105 sys
#20 0.105 tmp
#20 0.105 usr
#20 0.105 var
#20 DONE 0.1s
#0 0.148 d1
#0 0.148 d2
#18 DONE 0.2s
#1 resolve image config for docker.io/library/alpine:latest
#1 DONE 0.4s
#4 [internal] load metadata for docker.io/library/golang:1.18.2-alpine
#4 DONE 0.4s
#19 ls /example
#0 0.135 d1
#19 DONE 0.2s
#20 ls /example
#0 0.104 d1
#0 0.104 d2
#20 DONE 0.1s
```
### Steps to reproduce
* Mount two directories
* Run multiple exec commands and observe logs output
### Dagger version
dagger v0.3.1
### OS version
Ubuntu-20.04
|
https://github.com/dagger/dagger/issues/3551
|
https://github.com/dagger/dagger/pull/3602
|
b734ed35554bbfbc5caf63674eaa9c22692e614e
|
b4bb0b9e06e1edf8b81f9054b7419daabcb5bedb
| 2022-10-26T01:16:16Z |
go
| 2022-10-31T22:13:34Z |
core/integration/container_test.go
|
Container struct {
From struct {
Exec struct {
Out, Err struct {
Contents string
}
}
}
}
}{}
err := testutil.Query(
`{
container {
from(address: "alpine:3.16.2") {
exec(
args: ["sh", "-c", "echo hello; echo goodbye >/dev/stderr"],
redirectStdout: "out",
redirectStderr: "err"
) {
out: file(path: "out") {
contents
}
err: file(path: "err") {
contents
}
}
}
}
}`, &res, nil)
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 3,551 |
π Odd container behavior with exec / multiple withMountedDirectory
|
### What is the issue?
The following code executes but provides unexpected logs / output. Other similar use cases error due to missing files due to same issue. This may be something very simple (haven't used golang in many years) but seems like there may be an underlying issue with the execution engine.
I would expect this code to run the `ls` command twice, one time showing the two mounted directories, one time showing the root output. Instead in the logs I see `ls` with d1 and d2 (expected), an `ls` with just d1 (??), and then an `ls` with the root fs. This causes issues if the first ls is changed to `ls /example/d2` as it will error the whole pipeline due to missing path.
```golang
workdir := client.Host().Workdir()
d1, err := workdir.Read().Directory("dir1/").ID(ctx)
if err != nil {
return err
}
d2, err := workdir.Read().Directory("dir2/").ID(ctx)
if err != nil {
return err
}
build := client.Container().From("alpine:latest").
WithMountedDirectory("/example/d1", d1).
WithMountedDirectory("/example/d2", d2)
build = build.Exec(dagger.ContainerExecOpts{
Args: []string{"ls", "/example"},
})
_, err = build.ExitCode(ctx)
if err != nil {
return err
}
build = build.Exec(dagger.ContainerExecOpts{
Args: []string{"ls", "/"},
})
_, err = build.ExitCode(ctx)
if err != nil {
return err
}
```
I was able to get the same functionality working fine by using `fs, err := build.FS().WithDirectory(d1, "/example/d1").WithDirectory(d2, "/example/d2").ID(ctx); build = build.WithFS(fs);` so conceptually don't think I'm doing anything wrong.
### Log output
```
#1 resolve image config for docker.io/library/alpine:latest
#1 DONE 0.4s
#2 mkfile /Dockerfile
#2 DONE 0.0s
#3 mkfile /main.go
#3 CACHED
#4 [internal] load metadata for docker.io/library/golang:1.18.2-alpine
#4 DONE 0.1s
#5 local://__dagger_workdir_/home/plaisted/source/OSD.PJI-Temporary/repro
#5 DONE 0.0s
#6 local://__dagger_workdir_/home/plaisted/source/OSD.PJI-Temporary/repro
#6 transferring __dagger_workdir_/home/plaisted/source/OSD.PJI-Temporary/repro: 309B done
#6 DONE 0.0s
#7 [build 1/6] FROM docker.io/library/golang:1.18.2-alpine@sha256:4795c5d21f01e0777707ada02408debe77fe31848be97cf9fa8a1462da78d949
#7 resolve docker.io/library/golang:1.18.2-alpine@sha256:4795c5d21f01e0777707ada02408debe77fe31848be97cf9fa8a1462da78d949 0.0s done
#7 DONE 0.0s
#8 [build 3/6] RUN apk add --no-cache file git
#8 CACHED
#9 [build 4/6] RUN go mod init go.dagger.io/dagger/shim/cmd
#9 CACHED
#10 [build 2/6] WORKDIR /src
#10 CACHED
#11 [build 5/6] COPY . .
#11 CACHED
#12 [build 6/6] RUN CGO_ENABLED=0 go build -o /_shim -ldflags '-s -d -w' .
#12 CACHED
#13 [stage-1 1/1] COPY --from=build /_shim /_shim
#13 CACHED
#14 mkdir /meta
#14 CACHED
#15 copy / /
#15 DONE 0.0s
#16 docker-image://docker.io/library/alpine:latest
#16 resolve docker.io/library/alpine:latest
#16 resolve docker.io/library/alpine:latest 0.1s done
#16 CACHED
#17 copy / /
#17 CACHED
#18 ls /example
#18 0.157 d1
#18 0.157 d2
#18 DONE 0.2s
#1 resolve image config for docker.io/library/alpine:latest
#1 DONE 0.5s
#4 [internal] load metadata for docker.io/library/golang:1.18.2-alpine
#4 DONE 0.4s
#19 ls /example
#19 0.172 d1
#19 DONE 0.2s
#20 ls /
#20 0.105 _shim
#20 0.105 bin
#20 0.105 dagger
#20 0.105 dev
#20 0.105 etc
#20 0.105 example
#20 0.105 home
#20 0.105 lib
#20 0.105 media
#20 0.105 mnt
#20 0.105 opt
#20 0.105 proc
#20 0.105 root
#20 0.105 run
#20 0.105 sbin
#20 0.105 srv
#20 0.105 sys
#20 0.105 tmp
#20 0.105 usr
#20 0.105 var
#20 DONE 0.1s
#0 0.148 d1
#0 0.148 d2
#18 DONE 0.2s
#1 resolve image config for docker.io/library/alpine:latest
#1 DONE 0.4s
#4 [internal] load metadata for docker.io/library/golang:1.18.2-alpine
#4 DONE 0.4s
#19 ls /example
#0 0.135 d1
#19 DONE 0.2s
#20 ls /example
#0 0.104 d1
#0 0.104 d2
#20 DONE 0.1s
```
### Steps to reproduce
* Mount two directories
* Run multiple exec commands and observe logs output
### Dagger version
dagger v0.3.1
### OS version
Ubuntu-20.04
|
https://github.com/dagger/dagger/issues/3551
|
https://github.com/dagger/dagger/pull/3602
|
b734ed35554bbfbc5caf63674eaa9c22692e614e
|
b4bb0b9e06e1edf8b81f9054b7419daabcb5bedb
| 2022-10-26T01:16:16Z |
go
| 2022-10-31T22:13:34Z |
core/integration/container_test.go
|
require.NoError(t, err)
require.Equal(t, res.Container.From.Exec.Out.Contents, "hello\n")
require.Equal(t, res.Container.From.Exec.Err.Contents, "goodbye\n")
err = testutil.Query(
`{
container {
from(address: "alpine:3.16.2") {
exec(
args: ["sh", "-c", "echo hello; echo goodbye >/dev/stderr"],
redirectStdout: "out",
redirectStderr: "err"
) {
stdout {
contents
}
stderr {
contents
}
}
}
}
}`, &res, nil)
require.Error(t, err)
require.Contains(t, err.Error(), "stdout: no such file or directory")
require.Contains(t, err.Error(), "stderr: no such file or directory")
}
func TestContainerNullStdoutStderr(t *testing.T) {
t.Parallel()
res := struct {
Container struct {
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 3,551 |
π Odd container behavior with exec / multiple withMountedDirectory
|
### What is the issue?
The following code executes but provides unexpected logs / output. Other similar use cases error due to missing files due to same issue. This may be something very simple (haven't used golang in many years) but seems like there may be an underlying issue with the execution engine.
I would expect this code to run the `ls` command twice, one time showing the two mounted directories, one time showing the root output. Instead in the logs I see `ls` with d1 and d2 (expected), an `ls` with just d1 (??), and then an `ls` with the root fs. This causes issues if the first ls is changed to `ls /example/d2` as it will error the whole pipeline due to missing path.
```golang
workdir := client.Host().Workdir()
d1, err := workdir.Read().Directory("dir1/").ID(ctx)
if err != nil {
return err
}
d2, err := workdir.Read().Directory("dir2/").ID(ctx)
if err != nil {
return err
}
build := client.Container().From("alpine:latest").
WithMountedDirectory("/example/d1", d1).
WithMountedDirectory("/example/d2", d2)
build = build.Exec(dagger.ContainerExecOpts{
Args: []string{"ls", "/example"},
})
_, err = build.ExitCode(ctx)
if err != nil {
return err
}
build = build.Exec(dagger.ContainerExecOpts{
Args: []string{"ls", "/"},
})
_, err = build.ExitCode(ctx)
if err != nil {
return err
}
```
I was able to get the same functionality working fine by using `fs, err := build.FS().WithDirectory(d1, "/example/d1").WithDirectory(d2, "/example/d2").ID(ctx); build = build.WithFS(fs);` so conceptually don't think I'm doing anything wrong.
### Log output
```
#1 resolve image config for docker.io/library/alpine:latest
#1 DONE 0.4s
#2 mkfile /Dockerfile
#2 DONE 0.0s
#3 mkfile /main.go
#3 CACHED
#4 [internal] load metadata for docker.io/library/golang:1.18.2-alpine
#4 DONE 0.1s
#5 local://__dagger_workdir_/home/plaisted/source/OSD.PJI-Temporary/repro
#5 DONE 0.0s
#6 local://__dagger_workdir_/home/plaisted/source/OSD.PJI-Temporary/repro
#6 transferring __dagger_workdir_/home/plaisted/source/OSD.PJI-Temporary/repro: 309B done
#6 DONE 0.0s
#7 [build 1/6] FROM docker.io/library/golang:1.18.2-alpine@sha256:4795c5d21f01e0777707ada02408debe77fe31848be97cf9fa8a1462da78d949
#7 resolve docker.io/library/golang:1.18.2-alpine@sha256:4795c5d21f01e0777707ada02408debe77fe31848be97cf9fa8a1462da78d949 0.0s done
#7 DONE 0.0s
#8 [build 3/6] RUN apk add --no-cache file git
#8 CACHED
#9 [build 4/6] RUN go mod init go.dagger.io/dagger/shim/cmd
#9 CACHED
#10 [build 2/6] WORKDIR /src
#10 CACHED
#11 [build 5/6] COPY . .
#11 CACHED
#12 [build 6/6] RUN CGO_ENABLED=0 go build -o /_shim -ldflags '-s -d -w' .
#12 CACHED
#13 [stage-1 1/1] COPY --from=build /_shim /_shim
#13 CACHED
#14 mkdir /meta
#14 CACHED
#15 copy / /
#15 DONE 0.0s
#16 docker-image://docker.io/library/alpine:latest
#16 resolve docker.io/library/alpine:latest
#16 resolve docker.io/library/alpine:latest 0.1s done
#16 CACHED
#17 copy / /
#17 CACHED
#18 ls /example
#18 0.157 d1
#18 0.157 d2
#18 DONE 0.2s
#1 resolve image config for docker.io/library/alpine:latest
#1 DONE 0.5s
#4 [internal] load metadata for docker.io/library/golang:1.18.2-alpine
#4 DONE 0.4s
#19 ls /example
#19 0.172 d1
#19 DONE 0.2s
#20 ls /
#20 0.105 _shim
#20 0.105 bin
#20 0.105 dagger
#20 0.105 dev
#20 0.105 etc
#20 0.105 example
#20 0.105 home
#20 0.105 lib
#20 0.105 media
#20 0.105 mnt
#20 0.105 opt
#20 0.105 proc
#20 0.105 root
#20 0.105 run
#20 0.105 sbin
#20 0.105 srv
#20 0.105 sys
#20 0.105 tmp
#20 0.105 usr
#20 0.105 var
#20 DONE 0.1s
#0 0.148 d1
#0 0.148 d2
#18 DONE 0.2s
#1 resolve image config for docker.io/library/alpine:latest
#1 DONE 0.4s
#4 [internal] load metadata for docker.io/library/golang:1.18.2-alpine
#4 DONE 0.4s
#19 ls /example
#0 0.135 d1
#19 DONE 0.2s
#20 ls /example
#0 0.104 d1
#0 0.104 d2
#20 DONE 0.1s
```
### Steps to reproduce
* Mount two directories
* Run multiple exec commands and observe logs output
### Dagger version
dagger v0.3.1
### OS version
Ubuntu-20.04
|
https://github.com/dagger/dagger/issues/3551
|
https://github.com/dagger/dagger/pull/3602
|
b734ed35554bbfbc5caf63674eaa9c22692e614e
|
b4bb0b9e06e1edf8b81f9054b7419daabcb5bedb
| 2022-10-26T01:16:16Z |
go
| 2022-10-31T22:13:34Z |
core/integration/container_test.go
|
From struct {
Stdout, Stderr *struct {
Contents string
}
}
}
}{}
err := testutil.Query(
`{
container {
from(address: "alpine:3.16.2") {
stdout {
contents
}
stderr {
contents
}
}
}
}`, &res, nil)
require.NoError(t, err)
require.Nil(t, res.Container.From.Stdout)
require.Nil(t, res.Container.From.Stderr)
}
func TestContainerExecWithWorkdir(t *testing.T) {
t.Parallel()
res := struct {
Container struct {
From struct {
WithWorkdir struct {
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 3,551 |
π Odd container behavior with exec / multiple withMountedDirectory
|
### What is the issue?
The following code executes but provides unexpected logs / output. Other similar use cases error due to missing files due to same issue. This may be something very simple (haven't used golang in many years) but seems like there may be an underlying issue with the execution engine.
I would expect this code to run the `ls` command twice, one time showing the two mounted directories, one time showing the root output. Instead in the logs I see `ls` with d1 and d2 (expected), an `ls` with just d1 (??), and then an `ls` with the root fs. This causes issues if the first ls is changed to `ls /example/d2` as it will error the whole pipeline due to missing path.
```golang
workdir := client.Host().Workdir()
d1, err := workdir.Read().Directory("dir1/").ID(ctx)
if err != nil {
return err
}
d2, err := workdir.Read().Directory("dir2/").ID(ctx)
if err != nil {
return err
}
build := client.Container().From("alpine:latest").
WithMountedDirectory("/example/d1", d1).
WithMountedDirectory("/example/d2", d2)
build = build.Exec(dagger.ContainerExecOpts{
Args: []string{"ls", "/example"},
})
_, err = build.ExitCode(ctx)
if err != nil {
return err
}
build = build.Exec(dagger.ContainerExecOpts{
Args: []string{"ls", "/"},
})
_, err = build.ExitCode(ctx)
if err != nil {
return err
}
```
I was able to get the same functionality working fine by using `fs, err := build.FS().WithDirectory(d1, "/example/d1").WithDirectory(d2, "/example/d2").ID(ctx); build = build.WithFS(fs);` so conceptually don't think I'm doing anything wrong.
### Log output
```
#1 resolve image config for docker.io/library/alpine:latest
#1 DONE 0.4s
#2 mkfile /Dockerfile
#2 DONE 0.0s
#3 mkfile /main.go
#3 CACHED
#4 [internal] load metadata for docker.io/library/golang:1.18.2-alpine
#4 DONE 0.1s
#5 local://__dagger_workdir_/home/plaisted/source/OSD.PJI-Temporary/repro
#5 DONE 0.0s
#6 local://__dagger_workdir_/home/plaisted/source/OSD.PJI-Temporary/repro
#6 transferring __dagger_workdir_/home/plaisted/source/OSD.PJI-Temporary/repro: 309B done
#6 DONE 0.0s
#7 [build 1/6] FROM docker.io/library/golang:1.18.2-alpine@sha256:4795c5d21f01e0777707ada02408debe77fe31848be97cf9fa8a1462da78d949
#7 resolve docker.io/library/golang:1.18.2-alpine@sha256:4795c5d21f01e0777707ada02408debe77fe31848be97cf9fa8a1462da78d949 0.0s done
#7 DONE 0.0s
#8 [build 3/6] RUN apk add --no-cache file git
#8 CACHED
#9 [build 4/6] RUN go mod init go.dagger.io/dagger/shim/cmd
#9 CACHED
#10 [build 2/6] WORKDIR /src
#10 CACHED
#11 [build 5/6] COPY . .
#11 CACHED
#12 [build 6/6] RUN CGO_ENABLED=0 go build -o /_shim -ldflags '-s -d -w' .
#12 CACHED
#13 [stage-1 1/1] COPY --from=build /_shim /_shim
#13 CACHED
#14 mkdir /meta
#14 CACHED
#15 copy / /
#15 DONE 0.0s
#16 docker-image://docker.io/library/alpine:latest
#16 resolve docker.io/library/alpine:latest
#16 resolve docker.io/library/alpine:latest 0.1s done
#16 CACHED
#17 copy / /
#17 CACHED
#18 ls /example
#18 0.157 d1
#18 0.157 d2
#18 DONE 0.2s
#1 resolve image config for docker.io/library/alpine:latest
#1 DONE 0.5s
#4 [internal] load metadata for docker.io/library/golang:1.18.2-alpine
#4 DONE 0.4s
#19 ls /example
#19 0.172 d1
#19 DONE 0.2s
#20 ls /
#20 0.105 _shim
#20 0.105 bin
#20 0.105 dagger
#20 0.105 dev
#20 0.105 etc
#20 0.105 example
#20 0.105 home
#20 0.105 lib
#20 0.105 media
#20 0.105 mnt
#20 0.105 opt
#20 0.105 proc
#20 0.105 root
#20 0.105 run
#20 0.105 sbin
#20 0.105 srv
#20 0.105 sys
#20 0.105 tmp
#20 0.105 usr
#20 0.105 var
#20 DONE 0.1s
#0 0.148 d1
#0 0.148 d2
#18 DONE 0.2s
#1 resolve image config for docker.io/library/alpine:latest
#1 DONE 0.4s
#4 [internal] load metadata for docker.io/library/golang:1.18.2-alpine
#4 DONE 0.4s
#19 ls /example
#0 0.135 d1
#19 DONE 0.2s
#20 ls /example
#0 0.104 d1
#0 0.104 d2
#20 DONE 0.1s
```
### Steps to reproduce
* Mount two directories
* Run multiple exec commands and observe logs output
### Dagger version
dagger v0.3.1
### OS version
Ubuntu-20.04
|
https://github.com/dagger/dagger/issues/3551
|
https://github.com/dagger/dagger/pull/3602
|
b734ed35554bbfbc5caf63674eaa9c22692e614e
|
b4bb0b9e06e1edf8b81f9054b7419daabcb5bedb
| 2022-10-26T01:16:16Z |
go
| 2022-10-31T22:13:34Z |
core/integration/container_test.go
|
Exec struct {
Stdout struct {
Contents string
}
}
}
}
}
}{}
err := testutil.Query(
`{
container {
from(address: "alpine:3.16.2") {
withWorkdir(path: "/usr") {
exec(args: ["pwd"]) {
stdout {
contents
}
}
}
}
}
}`, &res, nil)
require.NoError(t, err)
require.Equal(t, res.Container.From.WithWorkdir.Exec.Stdout.Contents, "/usr\n")
}
func TestContainerExecWithUser(t *testing.T) {
t.Parallel()
res := struct {
Container struct {
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 3,551 |
π Odd container behavior with exec / multiple withMountedDirectory
|
### What is the issue?
The following code executes but provides unexpected logs / output. Other similar use cases error due to missing files due to same issue. This may be something very simple (haven't used golang in many years) but seems like there may be an underlying issue with the execution engine.
I would expect this code to run the `ls` command twice, one time showing the two mounted directories, one time showing the root output. Instead in the logs I see `ls` with d1 and d2 (expected), an `ls` with just d1 (??), and then an `ls` with the root fs. This causes issues if the first ls is changed to `ls /example/d2` as it will error the whole pipeline due to missing path.
```golang
workdir := client.Host().Workdir()
d1, err := workdir.Read().Directory("dir1/").ID(ctx)
if err != nil {
return err
}
d2, err := workdir.Read().Directory("dir2/").ID(ctx)
if err != nil {
return err
}
build := client.Container().From("alpine:latest").
WithMountedDirectory("/example/d1", d1).
WithMountedDirectory("/example/d2", d2)
build = build.Exec(dagger.ContainerExecOpts{
Args: []string{"ls", "/example"},
})
_, err = build.ExitCode(ctx)
if err != nil {
return err
}
build = build.Exec(dagger.ContainerExecOpts{
Args: []string{"ls", "/"},
})
_, err = build.ExitCode(ctx)
if err != nil {
return err
}
```
I was able to get the same functionality working fine by using `fs, err := build.FS().WithDirectory(d1, "/example/d1").WithDirectory(d2, "/example/d2").ID(ctx); build = build.WithFS(fs);` so conceptually don't think I'm doing anything wrong.
### Log output
```
#1 resolve image config for docker.io/library/alpine:latest
#1 DONE 0.4s
#2 mkfile /Dockerfile
#2 DONE 0.0s
#3 mkfile /main.go
#3 CACHED
#4 [internal] load metadata for docker.io/library/golang:1.18.2-alpine
#4 DONE 0.1s
#5 local://__dagger_workdir_/home/plaisted/source/OSD.PJI-Temporary/repro
#5 DONE 0.0s
#6 local://__dagger_workdir_/home/plaisted/source/OSD.PJI-Temporary/repro
#6 transferring __dagger_workdir_/home/plaisted/source/OSD.PJI-Temporary/repro: 309B done
#6 DONE 0.0s
#7 [build 1/6] FROM docker.io/library/golang:1.18.2-alpine@sha256:4795c5d21f01e0777707ada02408debe77fe31848be97cf9fa8a1462da78d949
#7 resolve docker.io/library/golang:1.18.2-alpine@sha256:4795c5d21f01e0777707ada02408debe77fe31848be97cf9fa8a1462da78d949 0.0s done
#7 DONE 0.0s
#8 [build 3/6] RUN apk add --no-cache file git
#8 CACHED
#9 [build 4/6] RUN go mod init go.dagger.io/dagger/shim/cmd
#9 CACHED
#10 [build 2/6] WORKDIR /src
#10 CACHED
#11 [build 5/6] COPY . .
#11 CACHED
#12 [build 6/6] RUN CGO_ENABLED=0 go build -o /_shim -ldflags '-s -d -w' .
#12 CACHED
#13 [stage-1 1/1] COPY --from=build /_shim /_shim
#13 CACHED
#14 mkdir /meta
#14 CACHED
#15 copy / /
#15 DONE 0.0s
#16 docker-image://docker.io/library/alpine:latest
#16 resolve docker.io/library/alpine:latest
#16 resolve docker.io/library/alpine:latest 0.1s done
#16 CACHED
#17 copy / /
#17 CACHED
#18 ls /example
#18 0.157 d1
#18 0.157 d2
#18 DONE 0.2s
#1 resolve image config for docker.io/library/alpine:latest
#1 DONE 0.5s
#4 [internal] load metadata for docker.io/library/golang:1.18.2-alpine
#4 DONE 0.4s
#19 ls /example
#19 0.172 d1
#19 DONE 0.2s
#20 ls /
#20 0.105 _shim
#20 0.105 bin
#20 0.105 dagger
#20 0.105 dev
#20 0.105 etc
#20 0.105 example
#20 0.105 home
#20 0.105 lib
#20 0.105 media
#20 0.105 mnt
#20 0.105 opt
#20 0.105 proc
#20 0.105 root
#20 0.105 run
#20 0.105 sbin
#20 0.105 srv
#20 0.105 sys
#20 0.105 tmp
#20 0.105 usr
#20 0.105 var
#20 DONE 0.1s
#0 0.148 d1
#0 0.148 d2
#18 DONE 0.2s
#1 resolve image config for docker.io/library/alpine:latest
#1 DONE 0.4s
#4 [internal] load metadata for docker.io/library/golang:1.18.2-alpine
#4 DONE 0.4s
#19 ls /example
#0 0.135 d1
#19 DONE 0.2s
#20 ls /example
#0 0.104 d1
#0 0.104 d2
#20 DONE 0.1s
```
### Steps to reproduce
* Mount two directories
* Run multiple exec commands and observe logs output
### Dagger version
dagger v0.3.1
### OS version
Ubuntu-20.04
|
https://github.com/dagger/dagger/issues/3551
|
https://github.com/dagger/dagger/pull/3602
|
b734ed35554bbfbc5caf63674eaa9c22692e614e
|
b4bb0b9e06e1edf8b81f9054b7419daabcb5bedb
| 2022-10-26T01:16:16Z |
go
| 2022-10-31T22:13:34Z |
core/integration/container_test.go
|
From struct {
User string
WithUser struct {
User string
Exec struct {
Stdout struct {
Contents string
}
}
}
}
}
}{}
t.Run("user name", func(t *testing.T) {
err := testutil.Query(
`{
container {
from(address: "alpine:3.16.2") {
user
withUser(name: "daemon") {
user
exec(args: ["whoami"]) {
stdout {
contents
}
}
}
}
}
}`, &res, nil)
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 3,551 |
π Odd container behavior with exec / multiple withMountedDirectory
|
### What is the issue?
The following code executes but provides unexpected logs / output. Other similar use cases error due to missing files due to same issue. This may be something very simple (haven't used golang in many years) but seems like there may be an underlying issue with the execution engine.
I would expect this code to run the `ls` command twice, one time showing the two mounted directories, one time showing the root output. Instead in the logs I see `ls` with d1 and d2 (expected), an `ls` with just d1 (??), and then an `ls` with the root fs. This causes issues if the first ls is changed to `ls /example/d2` as it will error the whole pipeline due to missing path.
```golang
workdir := client.Host().Workdir()
d1, err := workdir.Read().Directory("dir1/").ID(ctx)
if err != nil {
return err
}
d2, err := workdir.Read().Directory("dir2/").ID(ctx)
if err != nil {
return err
}
build := client.Container().From("alpine:latest").
WithMountedDirectory("/example/d1", d1).
WithMountedDirectory("/example/d2", d2)
build = build.Exec(dagger.ContainerExecOpts{
Args: []string{"ls", "/example"},
})
_, err = build.ExitCode(ctx)
if err != nil {
return err
}
build = build.Exec(dagger.ContainerExecOpts{
Args: []string{"ls", "/"},
})
_, err = build.ExitCode(ctx)
if err != nil {
return err
}
```
I was able to get the same functionality working fine by using `fs, err := build.FS().WithDirectory(d1, "/example/d1").WithDirectory(d2, "/example/d2").ID(ctx); build = build.WithFS(fs);` so conceptually don't think I'm doing anything wrong.
### Log output
```
#1 resolve image config for docker.io/library/alpine:latest
#1 DONE 0.4s
#2 mkfile /Dockerfile
#2 DONE 0.0s
#3 mkfile /main.go
#3 CACHED
#4 [internal] load metadata for docker.io/library/golang:1.18.2-alpine
#4 DONE 0.1s
#5 local://__dagger_workdir_/home/plaisted/source/OSD.PJI-Temporary/repro
#5 DONE 0.0s
#6 local://__dagger_workdir_/home/plaisted/source/OSD.PJI-Temporary/repro
#6 transferring __dagger_workdir_/home/plaisted/source/OSD.PJI-Temporary/repro: 309B done
#6 DONE 0.0s
#7 [build 1/6] FROM docker.io/library/golang:1.18.2-alpine@sha256:4795c5d21f01e0777707ada02408debe77fe31848be97cf9fa8a1462da78d949
#7 resolve docker.io/library/golang:1.18.2-alpine@sha256:4795c5d21f01e0777707ada02408debe77fe31848be97cf9fa8a1462da78d949 0.0s done
#7 DONE 0.0s
#8 [build 3/6] RUN apk add --no-cache file git
#8 CACHED
#9 [build 4/6] RUN go mod init go.dagger.io/dagger/shim/cmd
#9 CACHED
#10 [build 2/6] WORKDIR /src
#10 CACHED
#11 [build 5/6] COPY . .
#11 CACHED
#12 [build 6/6] RUN CGO_ENABLED=0 go build -o /_shim -ldflags '-s -d -w' .
#12 CACHED
#13 [stage-1 1/1] COPY --from=build /_shim /_shim
#13 CACHED
#14 mkdir /meta
#14 CACHED
#15 copy / /
#15 DONE 0.0s
#16 docker-image://docker.io/library/alpine:latest
#16 resolve docker.io/library/alpine:latest
#16 resolve docker.io/library/alpine:latest 0.1s done
#16 CACHED
#17 copy / /
#17 CACHED
#18 ls /example
#18 0.157 d1
#18 0.157 d2
#18 DONE 0.2s
#1 resolve image config for docker.io/library/alpine:latest
#1 DONE 0.5s
#4 [internal] load metadata for docker.io/library/golang:1.18.2-alpine
#4 DONE 0.4s
#19 ls /example
#19 0.172 d1
#19 DONE 0.2s
#20 ls /
#20 0.105 _shim
#20 0.105 bin
#20 0.105 dagger
#20 0.105 dev
#20 0.105 etc
#20 0.105 example
#20 0.105 home
#20 0.105 lib
#20 0.105 media
#20 0.105 mnt
#20 0.105 opt
#20 0.105 proc
#20 0.105 root
#20 0.105 run
#20 0.105 sbin
#20 0.105 srv
#20 0.105 sys
#20 0.105 tmp
#20 0.105 usr
#20 0.105 var
#20 DONE 0.1s
#0 0.148 d1
#0 0.148 d2
#18 DONE 0.2s
#1 resolve image config for docker.io/library/alpine:latest
#1 DONE 0.4s
#4 [internal] load metadata for docker.io/library/golang:1.18.2-alpine
#4 DONE 0.4s
#19 ls /example
#0 0.135 d1
#19 DONE 0.2s
#20 ls /example
#0 0.104 d1
#0 0.104 d2
#20 DONE 0.1s
```
### Steps to reproduce
* Mount two directories
* Run multiple exec commands and observe logs output
### Dagger version
dagger v0.3.1
### OS version
Ubuntu-20.04
|
https://github.com/dagger/dagger/issues/3551
|
https://github.com/dagger/dagger/pull/3602
|
b734ed35554bbfbc5caf63674eaa9c22692e614e
|
b4bb0b9e06e1edf8b81f9054b7419daabcb5bedb
| 2022-10-26T01:16:16Z |
go
| 2022-10-31T22:13:34Z |
core/integration/container_test.go
|
require.NoError(t, err)
require.Equal(t, "", res.Container.From.User)
require.Equal(t, "daemon", res.Container.From.WithUser.User)
require.Equal(t, "daemon\n", res.Container.From.WithUser.Exec.Stdout.Contents)
})
t.Run("user and group name", func(t *testing.T) {
err := testutil.Query(
`{
container {
from(address: "alpine:3.16.2") {
user
withUser(name: "daemon:floppy") {
user
exec(args: ["sh", "-c", "whoami; groups"]) {
stdout {
contents
}
}
}
}
}
}`, &res, nil)
require.NoError(t, err)
require.Equal(t, "", res.Container.From.User)
require.Equal(t, "daemon:floppy", res.Container.From.WithUser.User)
require.Equal(t, "daemon\nfloppy\n", res.Container.From.WithUser.Exec.Stdout.Contents)
})
t.Run("user ID", func(t *testing.T) {
err := testutil.Query(
`{
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 3,551 |
π Odd container behavior with exec / multiple withMountedDirectory
|
### What is the issue?
The following code executes but provides unexpected logs / output. Other similar use cases error due to missing files due to same issue. This may be something very simple (haven't used golang in many years) but seems like there may be an underlying issue with the execution engine.
I would expect this code to run the `ls` command twice, one time showing the two mounted directories, one time showing the root output. Instead in the logs I see `ls` with d1 and d2 (expected), an `ls` with just d1 (??), and then an `ls` with the root fs. This causes issues if the first ls is changed to `ls /example/d2` as it will error the whole pipeline due to missing path.
```golang
workdir := client.Host().Workdir()
d1, err := workdir.Read().Directory("dir1/").ID(ctx)
if err != nil {
return err
}
d2, err := workdir.Read().Directory("dir2/").ID(ctx)
if err != nil {
return err
}
build := client.Container().From("alpine:latest").
WithMountedDirectory("/example/d1", d1).
WithMountedDirectory("/example/d2", d2)
build = build.Exec(dagger.ContainerExecOpts{
Args: []string{"ls", "/example"},
})
_, err = build.ExitCode(ctx)
if err != nil {
return err
}
build = build.Exec(dagger.ContainerExecOpts{
Args: []string{"ls", "/"},
})
_, err = build.ExitCode(ctx)
if err != nil {
return err
}
```
I was able to get the same functionality working fine by using `fs, err := build.FS().WithDirectory(d1, "/example/d1").WithDirectory(d2, "/example/d2").ID(ctx); build = build.WithFS(fs);` so conceptually don't think I'm doing anything wrong.
### Log output
```
#1 resolve image config for docker.io/library/alpine:latest
#1 DONE 0.4s
#2 mkfile /Dockerfile
#2 DONE 0.0s
#3 mkfile /main.go
#3 CACHED
#4 [internal] load metadata for docker.io/library/golang:1.18.2-alpine
#4 DONE 0.1s
#5 local://__dagger_workdir_/home/plaisted/source/OSD.PJI-Temporary/repro
#5 DONE 0.0s
#6 local://__dagger_workdir_/home/plaisted/source/OSD.PJI-Temporary/repro
#6 transferring __dagger_workdir_/home/plaisted/source/OSD.PJI-Temporary/repro: 309B done
#6 DONE 0.0s
#7 [build 1/6] FROM docker.io/library/golang:1.18.2-alpine@sha256:4795c5d21f01e0777707ada02408debe77fe31848be97cf9fa8a1462da78d949
#7 resolve docker.io/library/golang:1.18.2-alpine@sha256:4795c5d21f01e0777707ada02408debe77fe31848be97cf9fa8a1462da78d949 0.0s done
#7 DONE 0.0s
#8 [build 3/6] RUN apk add --no-cache file git
#8 CACHED
#9 [build 4/6] RUN go mod init go.dagger.io/dagger/shim/cmd
#9 CACHED
#10 [build 2/6] WORKDIR /src
#10 CACHED
#11 [build 5/6] COPY . .
#11 CACHED
#12 [build 6/6] RUN CGO_ENABLED=0 go build -o /_shim -ldflags '-s -d -w' .
#12 CACHED
#13 [stage-1 1/1] COPY --from=build /_shim /_shim
#13 CACHED
#14 mkdir /meta
#14 CACHED
#15 copy / /
#15 DONE 0.0s
#16 docker-image://docker.io/library/alpine:latest
#16 resolve docker.io/library/alpine:latest
#16 resolve docker.io/library/alpine:latest 0.1s done
#16 CACHED
#17 copy / /
#17 CACHED
#18 ls /example
#18 0.157 d1
#18 0.157 d2
#18 DONE 0.2s
#1 resolve image config for docker.io/library/alpine:latest
#1 DONE 0.5s
#4 [internal] load metadata for docker.io/library/golang:1.18.2-alpine
#4 DONE 0.4s
#19 ls /example
#19 0.172 d1
#19 DONE 0.2s
#20 ls /
#20 0.105 _shim
#20 0.105 bin
#20 0.105 dagger
#20 0.105 dev
#20 0.105 etc
#20 0.105 example
#20 0.105 home
#20 0.105 lib
#20 0.105 media
#20 0.105 mnt
#20 0.105 opt
#20 0.105 proc
#20 0.105 root
#20 0.105 run
#20 0.105 sbin
#20 0.105 srv
#20 0.105 sys
#20 0.105 tmp
#20 0.105 usr
#20 0.105 var
#20 DONE 0.1s
#0 0.148 d1
#0 0.148 d2
#18 DONE 0.2s
#1 resolve image config for docker.io/library/alpine:latest
#1 DONE 0.4s
#4 [internal] load metadata for docker.io/library/golang:1.18.2-alpine
#4 DONE 0.4s
#19 ls /example
#0 0.135 d1
#19 DONE 0.2s
#20 ls /example
#0 0.104 d1
#0 0.104 d2
#20 DONE 0.1s
```
### Steps to reproduce
* Mount two directories
* Run multiple exec commands and observe logs output
### Dagger version
dagger v0.3.1
### OS version
Ubuntu-20.04
|
https://github.com/dagger/dagger/issues/3551
|
https://github.com/dagger/dagger/pull/3602
|
b734ed35554bbfbc5caf63674eaa9c22692e614e
|
b4bb0b9e06e1edf8b81f9054b7419daabcb5bedb
| 2022-10-26T01:16:16Z |
go
| 2022-10-31T22:13:34Z |
core/integration/container_test.go
|
container {
from(address: "alpine:3.16.2") {
user
withUser(name: "2") {
user
exec(args: ["whoami"]) {
stdout {
contents
}
}
}
}
}
}`, &res, nil)
require.NoError(t, err)
require.Equal(t, "", res.Container.From.User)
require.Equal(t, "2", res.Container.From.WithUser.User)
require.Equal(t, "daemon\n", res.Container.From.WithUser.Exec.Stdout.Contents)
})
t.Run("user and group ID", func(t *testing.T) {
err := testutil.Query(
`{
container {
from(address: "alpine:3.16.2") {
user
withUser(name: "2:11") {
user
exec(args: ["sh", "-c", "whoami; groups"]) {
stdout {
contents
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 3,551 |
π Odd container behavior with exec / multiple withMountedDirectory
|
### What is the issue?
The following code executes but provides unexpected logs / output. Other similar use cases error due to missing files due to same issue. This may be something very simple (haven't used golang in many years) but seems like there may be an underlying issue with the execution engine.
I would expect this code to run the `ls` command twice, one time showing the two mounted directories, one time showing the root output. Instead in the logs I see `ls` with d1 and d2 (expected), an `ls` with just d1 (??), and then an `ls` with the root fs. This causes issues if the first ls is changed to `ls /example/d2` as it will error the whole pipeline due to missing path.
```golang
workdir := client.Host().Workdir()
d1, err := workdir.Read().Directory("dir1/").ID(ctx)
if err != nil {
return err
}
d2, err := workdir.Read().Directory("dir2/").ID(ctx)
if err != nil {
return err
}
build := client.Container().From("alpine:latest").
WithMountedDirectory("/example/d1", d1).
WithMountedDirectory("/example/d2", d2)
build = build.Exec(dagger.ContainerExecOpts{
Args: []string{"ls", "/example"},
})
_, err = build.ExitCode(ctx)
if err != nil {
return err
}
build = build.Exec(dagger.ContainerExecOpts{
Args: []string{"ls", "/"},
})
_, err = build.ExitCode(ctx)
if err != nil {
return err
}
```
I was able to get the same functionality working fine by using `fs, err := build.FS().WithDirectory(d1, "/example/d1").WithDirectory(d2, "/example/d2").ID(ctx); build = build.WithFS(fs);` so conceptually don't think I'm doing anything wrong.
### Log output
```
#1 resolve image config for docker.io/library/alpine:latest
#1 DONE 0.4s
#2 mkfile /Dockerfile
#2 DONE 0.0s
#3 mkfile /main.go
#3 CACHED
#4 [internal] load metadata for docker.io/library/golang:1.18.2-alpine
#4 DONE 0.1s
#5 local://__dagger_workdir_/home/plaisted/source/OSD.PJI-Temporary/repro
#5 DONE 0.0s
#6 local://__dagger_workdir_/home/plaisted/source/OSD.PJI-Temporary/repro
#6 transferring __dagger_workdir_/home/plaisted/source/OSD.PJI-Temporary/repro: 309B done
#6 DONE 0.0s
#7 [build 1/6] FROM docker.io/library/golang:1.18.2-alpine@sha256:4795c5d21f01e0777707ada02408debe77fe31848be97cf9fa8a1462da78d949
#7 resolve docker.io/library/golang:1.18.2-alpine@sha256:4795c5d21f01e0777707ada02408debe77fe31848be97cf9fa8a1462da78d949 0.0s done
#7 DONE 0.0s
#8 [build 3/6] RUN apk add --no-cache file git
#8 CACHED
#9 [build 4/6] RUN go mod init go.dagger.io/dagger/shim/cmd
#9 CACHED
#10 [build 2/6] WORKDIR /src
#10 CACHED
#11 [build 5/6] COPY . .
#11 CACHED
#12 [build 6/6] RUN CGO_ENABLED=0 go build -o /_shim -ldflags '-s -d -w' .
#12 CACHED
#13 [stage-1 1/1] COPY --from=build /_shim /_shim
#13 CACHED
#14 mkdir /meta
#14 CACHED
#15 copy / /
#15 DONE 0.0s
#16 docker-image://docker.io/library/alpine:latest
#16 resolve docker.io/library/alpine:latest
#16 resolve docker.io/library/alpine:latest 0.1s done
#16 CACHED
#17 copy / /
#17 CACHED
#18 ls /example
#18 0.157 d1
#18 0.157 d2
#18 DONE 0.2s
#1 resolve image config for docker.io/library/alpine:latest
#1 DONE 0.5s
#4 [internal] load metadata for docker.io/library/golang:1.18.2-alpine
#4 DONE 0.4s
#19 ls /example
#19 0.172 d1
#19 DONE 0.2s
#20 ls /
#20 0.105 _shim
#20 0.105 bin
#20 0.105 dagger
#20 0.105 dev
#20 0.105 etc
#20 0.105 example
#20 0.105 home
#20 0.105 lib
#20 0.105 media
#20 0.105 mnt
#20 0.105 opt
#20 0.105 proc
#20 0.105 root
#20 0.105 run
#20 0.105 sbin
#20 0.105 srv
#20 0.105 sys
#20 0.105 tmp
#20 0.105 usr
#20 0.105 var
#20 DONE 0.1s
#0 0.148 d1
#0 0.148 d2
#18 DONE 0.2s
#1 resolve image config for docker.io/library/alpine:latest
#1 DONE 0.4s
#4 [internal] load metadata for docker.io/library/golang:1.18.2-alpine
#4 DONE 0.4s
#19 ls /example
#0 0.135 d1
#19 DONE 0.2s
#20 ls /example
#0 0.104 d1
#0 0.104 d2
#20 DONE 0.1s
```
### Steps to reproduce
* Mount two directories
* Run multiple exec commands and observe logs output
### Dagger version
dagger v0.3.1
### OS version
Ubuntu-20.04
|
https://github.com/dagger/dagger/issues/3551
|
https://github.com/dagger/dagger/pull/3602
|
b734ed35554bbfbc5caf63674eaa9c22692e614e
|
b4bb0b9e06e1edf8b81f9054b7419daabcb5bedb
| 2022-10-26T01:16:16Z |
go
| 2022-10-31T22:13:34Z |
core/integration/container_test.go
|
}
}
}
}
}
}`, &res, nil)
require.NoError(t, err)
require.Equal(t, "", res.Container.From.User)
require.Equal(t, "2:11", res.Container.From.WithUser.User)
require.Equal(t, "daemon\nfloppy\n", res.Container.From.WithUser.Exec.Stdout.Contents)
})
}
func TestContainerExecWithEntrypoint(t *testing.T) {
t.Parallel()
res := struct {
Container struct {
From struct {
Entrypoint []string
WithEntrypoint struct {
Entrypoint []string
Exec struct {
Stdout struct {
Contents string
}
}
WithEntrypoint struct {
Entrypoint []string
}
}
}
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 3,551 |
π Odd container behavior with exec / multiple withMountedDirectory
|
### What is the issue?
The following code executes but provides unexpected logs / output. Other similar use cases error due to missing files due to same issue. This may be something very simple (haven't used golang in many years) but seems like there may be an underlying issue with the execution engine.
I would expect this code to run the `ls` command twice, one time showing the two mounted directories, one time showing the root output. Instead in the logs I see `ls` with d1 and d2 (expected), an `ls` with just d1 (??), and then an `ls` with the root fs. This causes issues if the first ls is changed to `ls /example/d2` as it will error the whole pipeline due to missing path.
```golang
workdir := client.Host().Workdir()
d1, err := workdir.Read().Directory("dir1/").ID(ctx)
if err != nil {
return err
}
d2, err := workdir.Read().Directory("dir2/").ID(ctx)
if err != nil {
return err
}
build := client.Container().From("alpine:latest").
WithMountedDirectory("/example/d1", d1).
WithMountedDirectory("/example/d2", d2)
build = build.Exec(dagger.ContainerExecOpts{
Args: []string{"ls", "/example"},
})
_, err = build.ExitCode(ctx)
if err != nil {
return err
}
build = build.Exec(dagger.ContainerExecOpts{
Args: []string{"ls", "/"},
})
_, err = build.ExitCode(ctx)
if err != nil {
return err
}
```
I was able to get the same functionality working fine by using `fs, err := build.FS().WithDirectory(d1, "/example/d1").WithDirectory(d2, "/example/d2").ID(ctx); build = build.WithFS(fs);` so conceptually don't think I'm doing anything wrong.
### Log output
```
#1 resolve image config for docker.io/library/alpine:latest
#1 DONE 0.4s
#2 mkfile /Dockerfile
#2 DONE 0.0s
#3 mkfile /main.go
#3 CACHED
#4 [internal] load metadata for docker.io/library/golang:1.18.2-alpine
#4 DONE 0.1s
#5 local://__dagger_workdir_/home/plaisted/source/OSD.PJI-Temporary/repro
#5 DONE 0.0s
#6 local://__dagger_workdir_/home/plaisted/source/OSD.PJI-Temporary/repro
#6 transferring __dagger_workdir_/home/plaisted/source/OSD.PJI-Temporary/repro: 309B done
#6 DONE 0.0s
#7 [build 1/6] FROM docker.io/library/golang:1.18.2-alpine@sha256:4795c5d21f01e0777707ada02408debe77fe31848be97cf9fa8a1462da78d949
#7 resolve docker.io/library/golang:1.18.2-alpine@sha256:4795c5d21f01e0777707ada02408debe77fe31848be97cf9fa8a1462da78d949 0.0s done
#7 DONE 0.0s
#8 [build 3/6] RUN apk add --no-cache file git
#8 CACHED
#9 [build 4/6] RUN go mod init go.dagger.io/dagger/shim/cmd
#9 CACHED
#10 [build 2/6] WORKDIR /src
#10 CACHED
#11 [build 5/6] COPY . .
#11 CACHED
#12 [build 6/6] RUN CGO_ENABLED=0 go build -o /_shim -ldflags '-s -d -w' .
#12 CACHED
#13 [stage-1 1/1] COPY --from=build /_shim /_shim
#13 CACHED
#14 mkdir /meta
#14 CACHED
#15 copy / /
#15 DONE 0.0s
#16 docker-image://docker.io/library/alpine:latest
#16 resolve docker.io/library/alpine:latest
#16 resolve docker.io/library/alpine:latest 0.1s done
#16 CACHED
#17 copy / /
#17 CACHED
#18 ls /example
#18 0.157 d1
#18 0.157 d2
#18 DONE 0.2s
#1 resolve image config for docker.io/library/alpine:latest
#1 DONE 0.5s
#4 [internal] load metadata for docker.io/library/golang:1.18.2-alpine
#4 DONE 0.4s
#19 ls /example
#19 0.172 d1
#19 DONE 0.2s
#20 ls /
#20 0.105 _shim
#20 0.105 bin
#20 0.105 dagger
#20 0.105 dev
#20 0.105 etc
#20 0.105 example
#20 0.105 home
#20 0.105 lib
#20 0.105 media
#20 0.105 mnt
#20 0.105 opt
#20 0.105 proc
#20 0.105 root
#20 0.105 run
#20 0.105 sbin
#20 0.105 srv
#20 0.105 sys
#20 0.105 tmp
#20 0.105 usr
#20 0.105 var
#20 DONE 0.1s
#0 0.148 d1
#0 0.148 d2
#18 DONE 0.2s
#1 resolve image config for docker.io/library/alpine:latest
#1 DONE 0.4s
#4 [internal] load metadata for docker.io/library/golang:1.18.2-alpine
#4 DONE 0.4s
#19 ls /example
#0 0.135 d1
#19 DONE 0.2s
#20 ls /example
#0 0.104 d1
#0 0.104 d2
#20 DONE 0.1s
```
### Steps to reproduce
* Mount two directories
* Run multiple exec commands and observe logs output
### Dagger version
dagger v0.3.1
### OS version
Ubuntu-20.04
|
https://github.com/dagger/dagger/issues/3551
|
https://github.com/dagger/dagger/pull/3602
|
b734ed35554bbfbc5caf63674eaa9c22692e614e
|
b4bb0b9e06e1edf8b81f9054b7419daabcb5bedb
| 2022-10-26T01:16:16Z |
go
| 2022-10-31T22:13:34Z |
core/integration/container_test.go
|
}
}{}
err := testutil.Query(
`{
container {
from(address: "alpine:3.16.2") {
entrypoint
withEntrypoint(args: ["sh", "-c"]) {
entrypoint
exec(args: ["echo $HOME"]) {
stdout {
contents
}
}
withEntrypoint(args: []) {
entrypoint
}
}
}
}
}`, &res, nil)
require.NoError(t, err)
require.Empty(t, res.Container.From.Entrypoint)
require.Equal(t, []string{"sh", "-c"}, res.Container.From.WithEntrypoint.Entrypoint)
require.Equal(t, "/root\n", res.Container.From.WithEntrypoint.Exec.Stdout.Contents)
require.Empty(t, res.Container.From.WithEntrypoint.WithEntrypoint.Entrypoint)
}
func TestContainerWithDefaultArgs(t *testing.T) {
t.Parallel()
res := struct {
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 3,551 |
π Odd container behavior with exec / multiple withMountedDirectory
|
### What is the issue?
The following code executes but provides unexpected logs / output. Other similar use cases error due to missing files due to same issue. This may be something very simple (haven't used golang in many years) but seems like there may be an underlying issue with the execution engine.
I would expect this code to run the `ls` command twice, one time showing the two mounted directories, one time showing the root output. Instead in the logs I see `ls` with d1 and d2 (expected), an `ls` with just d1 (??), and then an `ls` with the root fs. This causes issues if the first ls is changed to `ls /example/d2` as it will error the whole pipeline due to missing path.
```golang
workdir := client.Host().Workdir()
d1, err := workdir.Read().Directory("dir1/").ID(ctx)
if err != nil {
return err
}
d2, err := workdir.Read().Directory("dir2/").ID(ctx)
if err != nil {
return err
}
build := client.Container().From("alpine:latest").
WithMountedDirectory("/example/d1", d1).
WithMountedDirectory("/example/d2", d2)
build = build.Exec(dagger.ContainerExecOpts{
Args: []string{"ls", "/example"},
})
_, err = build.ExitCode(ctx)
if err != nil {
return err
}
build = build.Exec(dagger.ContainerExecOpts{
Args: []string{"ls", "/"},
})
_, err = build.ExitCode(ctx)
if err != nil {
return err
}
```
I was able to get the same functionality working fine by using `fs, err := build.FS().WithDirectory(d1, "/example/d1").WithDirectory(d2, "/example/d2").ID(ctx); build = build.WithFS(fs);` so conceptually don't think I'm doing anything wrong.
### Log output
```
#1 resolve image config for docker.io/library/alpine:latest
#1 DONE 0.4s
#2 mkfile /Dockerfile
#2 DONE 0.0s
#3 mkfile /main.go
#3 CACHED
#4 [internal] load metadata for docker.io/library/golang:1.18.2-alpine
#4 DONE 0.1s
#5 local://__dagger_workdir_/home/plaisted/source/OSD.PJI-Temporary/repro
#5 DONE 0.0s
#6 local://__dagger_workdir_/home/plaisted/source/OSD.PJI-Temporary/repro
#6 transferring __dagger_workdir_/home/plaisted/source/OSD.PJI-Temporary/repro: 309B done
#6 DONE 0.0s
#7 [build 1/6] FROM docker.io/library/golang:1.18.2-alpine@sha256:4795c5d21f01e0777707ada02408debe77fe31848be97cf9fa8a1462da78d949
#7 resolve docker.io/library/golang:1.18.2-alpine@sha256:4795c5d21f01e0777707ada02408debe77fe31848be97cf9fa8a1462da78d949 0.0s done
#7 DONE 0.0s
#8 [build 3/6] RUN apk add --no-cache file git
#8 CACHED
#9 [build 4/6] RUN go mod init go.dagger.io/dagger/shim/cmd
#9 CACHED
#10 [build 2/6] WORKDIR /src
#10 CACHED
#11 [build 5/6] COPY . .
#11 CACHED
#12 [build 6/6] RUN CGO_ENABLED=0 go build -o /_shim -ldflags '-s -d -w' .
#12 CACHED
#13 [stage-1 1/1] COPY --from=build /_shim /_shim
#13 CACHED
#14 mkdir /meta
#14 CACHED
#15 copy / /
#15 DONE 0.0s
#16 docker-image://docker.io/library/alpine:latest
#16 resolve docker.io/library/alpine:latest
#16 resolve docker.io/library/alpine:latest 0.1s done
#16 CACHED
#17 copy / /
#17 CACHED
#18 ls /example
#18 0.157 d1
#18 0.157 d2
#18 DONE 0.2s
#1 resolve image config for docker.io/library/alpine:latest
#1 DONE 0.5s
#4 [internal] load metadata for docker.io/library/golang:1.18.2-alpine
#4 DONE 0.4s
#19 ls /example
#19 0.172 d1
#19 DONE 0.2s
#20 ls /
#20 0.105 _shim
#20 0.105 bin
#20 0.105 dagger
#20 0.105 dev
#20 0.105 etc
#20 0.105 example
#20 0.105 home
#20 0.105 lib
#20 0.105 media
#20 0.105 mnt
#20 0.105 opt
#20 0.105 proc
#20 0.105 root
#20 0.105 run
#20 0.105 sbin
#20 0.105 srv
#20 0.105 sys
#20 0.105 tmp
#20 0.105 usr
#20 0.105 var
#20 DONE 0.1s
#0 0.148 d1
#0 0.148 d2
#18 DONE 0.2s
#1 resolve image config for docker.io/library/alpine:latest
#1 DONE 0.4s
#4 [internal] load metadata for docker.io/library/golang:1.18.2-alpine
#4 DONE 0.4s
#19 ls /example
#0 0.135 d1
#19 DONE 0.2s
#20 ls /example
#0 0.104 d1
#0 0.104 d2
#20 DONE 0.1s
```
### Steps to reproduce
* Mount two directories
* Run multiple exec commands and observe logs output
### Dagger version
dagger v0.3.1
### OS version
Ubuntu-20.04
|
https://github.com/dagger/dagger/issues/3551
|
https://github.com/dagger/dagger/pull/3602
|
b734ed35554bbfbc5caf63674eaa9c22692e614e
|
b4bb0b9e06e1edf8b81f9054b7419daabcb5bedb
| 2022-10-26T01:16:16Z |
go
| 2022-10-31T22:13:34Z |
core/integration/container_test.go
|
Container struct {
From struct {
Entrypoint []string
DefaultArgs []string
Exec struct {
Stdout struct {
Contents string
}
}
WithDefaultArgs struct {
Entrypoint []string
DefaultArgs []string
}
WithEntrypoint struct {
Entrypoint []string
DefaultArgs []string
Exec struct {
Stdout struct {
Contents string
}
}
WithDefaultArgs struct {
Entrypoint []string
DefaultArgs []string
Exec struct {
Stdout struct {
Contents string
}
}
}
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 3,551 |
π Odd container behavior with exec / multiple withMountedDirectory
|
### What is the issue?
The following code executes but provides unexpected logs / output. Other similar use cases error due to missing files due to same issue. This may be something very simple (haven't used golang in many years) but seems like there may be an underlying issue with the execution engine.
I would expect this code to run the `ls` command twice, one time showing the two mounted directories, one time showing the root output. Instead in the logs I see `ls` with d1 and d2 (expected), an `ls` with just d1 (??), and then an `ls` with the root fs. This causes issues if the first ls is changed to `ls /example/d2` as it will error the whole pipeline due to missing path.
```golang
workdir := client.Host().Workdir()
d1, err := workdir.Read().Directory("dir1/").ID(ctx)
if err != nil {
return err
}
d2, err := workdir.Read().Directory("dir2/").ID(ctx)
if err != nil {
return err
}
build := client.Container().From("alpine:latest").
WithMountedDirectory("/example/d1", d1).
WithMountedDirectory("/example/d2", d2)
build = build.Exec(dagger.ContainerExecOpts{
Args: []string{"ls", "/example"},
})
_, err = build.ExitCode(ctx)
if err != nil {
return err
}
build = build.Exec(dagger.ContainerExecOpts{
Args: []string{"ls", "/"},
})
_, err = build.ExitCode(ctx)
if err != nil {
return err
}
```
I was able to get the same functionality working fine by using `fs, err := build.FS().WithDirectory(d1, "/example/d1").WithDirectory(d2, "/example/d2").ID(ctx); build = build.WithFS(fs);` so conceptually don't think I'm doing anything wrong.
### Log output
```
#1 resolve image config for docker.io/library/alpine:latest
#1 DONE 0.4s
#2 mkfile /Dockerfile
#2 DONE 0.0s
#3 mkfile /main.go
#3 CACHED
#4 [internal] load metadata for docker.io/library/golang:1.18.2-alpine
#4 DONE 0.1s
#5 local://__dagger_workdir_/home/plaisted/source/OSD.PJI-Temporary/repro
#5 DONE 0.0s
#6 local://__dagger_workdir_/home/plaisted/source/OSD.PJI-Temporary/repro
#6 transferring __dagger_workdir_/home/plaisted/source/OSD.PJI-Temporary/repro: 309B done
#6 DONE 0.0s
#7 [build 1/6] FROM docker.io/library/golang:1.18.2-alpine@sha256:4795c5d21f01e0777707ada02408debe77fe31848be97cf9fa8a1462da78d949
#7 resolve docker.io/library/golang:1.18.2-alpine@sha256:4795c5d21f01e0777707ada02408debe77fe31848be97cf9fa8a1462da78d949 0.0s done
#7 DONE 0.0s
#8 [build 3/6] RUN apk add --no-cache file git
#8 CACHED
#9 [build 4/6] RUN go mod init go.dagger.io/dagger/shim/cmd
#9 CACHED
#10 [build 2/6] WORKDIR /src
#10 CACHED
#11 [build 5/6] COPY . .
#11 CACHED
#12 [build 6/6] RUN CGO_ENABLED=0 go build -o /_shim -ldflags '-s -d -w' .
#12 CACHED
#13 [stage-1 1/1] COPY --from=build /_shim /_shim
#13 CACHED
#14 mkdir /meta
#14 CACHED
#15 copy / /
#15 DONE 0.0s
#16 docker-image://docker.io/library/alpine:latest
#16 resolve docker.io/library/alpine:latest
#16 resolve docker.io/library/alpine:latest 0.1s done
#16 CACHED
#17 copy / /
#17 CACHED
#18 ls /example
#18 0.157 d1
#18 0.157 d2
#18 DONE 0.2s
#1 resolve image config for docker.io/library/alpine:latest
#1 DONE 0.5s
#4 [internal] load metadata for docker.io/library/golang:1.18.2-alpine
#4 DONE 0.4s
#19 ls /example
#19 0.172 d1
#19 DONE 0.2s
#20 ls /
#20 0.105 _shim
#20 0.105 bin
#20 0.105 dagger
#20 0.105 dev
#20 0.105 etc
#20 0.105 example
#20 0.105 home
#20 0.105 lib
#20 0.105 media
#20 0.105 mnt
#20 0.105 opt
#20 0.105 proc
#20 0.105 root
#20 0.105 run
#20 0.105 sbin
#20 0.105 srv
#20 0.105 sys
#20 0.105 tmp
#20 0.105 usr
#20 0.105 var
#20 DONE 0.1s
#0 0.148 d1
#0 0.148 d2
#18 DONE 0.2s
#1 resolve image config for docker.io/library/alpine:latest
#1 DONE 0.4s
#4 [internal] load metadata for docker.io/library/golang:1.18.2-alpine
#4 DONE 0.4s
#19 ls /example
#0 0.135 d1
#19 DONE 0.2s
#20 ls /example
#0 0.104 d1
#0 0.104 d2
#20 DONE 0.1s
```
### Steps to reproduce
* Mount two directories
* Run multiple exec commands and observe logs output
### Dagger version
dagger v0.3.1
### OS version
Ubuntu-20.04
|
https://github.com/dagger/dagger/issues/3551
|
https://github.com/dagger/dagger/pull/3602
|
b734ed35554bbfbc5caf63674eaa9c22692e614e
|
b4bb0b9e06e1edf8b81f9054b7419daabcb5bedb
| 2022-10-26T01:16:16Z |
go
| 2022-10-31T22:13:34Z |
core/integration/container_test.go
|
}
}
}
}{}
err := testutil.Query(
`{
container {
from(address: "alpine:3.16.2") {
entrypoint
defaultArgs
withDefaultArgs {
entrypoint
defaultArgs
}
withEntrypoint(args: ["sh", "-c"]) {
entrypoint
defaultArgs
exec(args: ["echo $HOME"]) {
stdout {
contents
}
}
withDefaultArgs(args: ["id"]) {
entrypoint
defaultArgs
exec(args: []) {
stdout {
contents
}
}
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 3,551 |
π Odd container behavior with exec / multiple withMountedDirectory
|
### What is the issue?
The following code executes but provides unexpected logs / output. Other similar use cases error due to missing files due to same issue. This may be something very simple (haven't used golang in many years) but seems like there may be an underlying issue with the execution engine.
I would expect this code to run the `ls` command twice, one time showing the two mounted directories, one time showing the root output. Instead in the logs I see `ls` with d1 and d2 (expected), an `ls` with just d1 (??), and then an `ls` with the root fs. This causes issues if the first ls is changed to `ls /example/d2` as it will error the whole pipeline due to missing path.
```golang
workdir := client.Host().Workdir()
d1, err := workdir.Read().Directory("dir1/").ID(ctx)
if err != nil {
return err
}
d2, err := workdir.Read().Directory("dir2/").ID(ctx)
if err != nil {
return err
}
build := client.Container().From("alpine:latest").
WithMountedDirectory("/example/d1", d1).
WithMountedDirectory("/example/d2", d2)
build = build.Exec(dagger.ContainerExecOpts{
Args: []string{"ls", "/example"},
})
_, err = build.ExitCode(ctx)
if err != nil {
return err
}
build = build.Exec(dagger.ContainerExecOpts{
Args: []string{"ls", "/"},
})
_, err = build.ExitCode(ctx)
if err != nil {
return err
}
```
I was able to get the same functionality working fine by using `fs, err := build.FS().WithDirectory(d1, "/example/d1").WithDirectory(d2, "/example/d2").ID(ctx); build = build.WithFS(fs);` so conceptually don't think I'm doing anything wrong.
### Log output
```
#1 resolve image config for docker.io/library/alpine:latest
#1 DONE 0.4s
#2 mkfile /Dockerfile
#2 DONE 0.0s
#3 mkfile /main.go
#3 CACHED
#4 [internal] load metadata for docker.io/library/golang:1.18.2-alpine
#4 DONE 0.1s
#5 local://__dagger_workdir_/home/plaisted/source/OSD.PJI-Temporary/repro
#5 DONE 0.0s
#6 local://__dagger_workdir_/home/plaisted/source/OSD.PJI-Temporary/repro
#6 transferring __dagger_workdir_/home/plaisted/source/OSD.PJI-Temporary/repro: 309B done
#6 DONE 0.0s
#7 [build 1/6] FROM docker.io/library/golang:1.18.2-alpine@sha256:4795c5d21f01e0777707ada02408debe77fe31848be97cf9fa8a1462da78d949
#7 resolve docker.io/library/golang:1.18.2-alpine@sha256:4795c5d21f01e0777707ada02408debe77fe31848be97cf9fa8a1462da78d949 0.0s done
#7 DONE 0.0s
#8 [build 3/6] RUN apk add --no-cache file git
#8 CACHED
#9 [build 4/6] RUN go mod init go.dagger.io/dagger/shim/cmd
#9 CACHED
#10 [build 2/6] WORKDIR /src
#10 CACHED
#11 [build 5/6] COPY . .
#11 CACHED
#12 [build 6/6] RUN CGO_ENABLED=0 go build -o /_shim -ldflags '-s -d -w' .
#12 CACHED
#13 [stage-1 1/1] COPY --from=build /_shim /_shim
#13 CACHED
#14 mkdir /meta
#14 CACHED
#15 copy / /
#15 DONE 0.0s
#16 docker-image://docker.io/library/alpine:latest
#16 resolve docker.io/library/alpine:latest
#16 resolve docker.io/library/alpine:latest 0.1s done
#16 CACHED
#17 copy / /
#17 CACHED
#18 ls /example
#18 0.157 d1
#18 0.157 d2
#18 DONE 0.2s
#1 resolve image config for docker.io/library/alpine:latest
#1 DONE 0.5s
#4 [internal] load metadata for docker.io/library/golang:1.18.2-alpine
#4 DONE 0.4s
#19 ls /example
#19 0.172 d1
#19 DONE 0.2s
#20 ls /
#20 0.105 _shim
#20 0.105 bin
#20 0.105 dagger
#20 0.105 dev
#20 0.105 etc
#20 0.105 example
#20 0.105 home
#20 0.105 lib
#20 0.105 media
#20 0.105 mnt
#20 0.105 opt
#20 0.105 proc
#20 0.105 root
#20 0.105 run
#20 0.105 sbin
#20 0.105 srv
#20 0.105 sys
#20 0.105 tmp
#20 0.105 usr
#20 0.105 var
#20 DONE 0.1s
#0 0.148 d1
#0 0.148 d2
#18 DONE 0.2s
#1 resolve image config for docker.io/library/alpine:latest
#1 DONE 0.4s
#4 [internal] load metadata for docker.io/library/golang:1.18.2-alpine
#4 DONE 0.4s
#19 ls /example
#0 0.135 d1
#19 DONE 0.2s
#20 ls /example
#0 0.104 d1
#0 0.104 d2
#20 DONE 0.1s
```
### Steps to reproduce
* Mount two directories
* Run multiple exec commands and observe logs output
### Dagger version
dagger v0.3.1
### OS version
Ubuntu-20.04
|
https://github.com/dagger/dagger/issues/3551
|
https://github.com/dagger/dagger/pull/3602
|
b734ed35554bbfbc5caf63674eaa9c22692e614e
|
b4bb0b9e06e1edf8b81f9054b7419daabcb5bedb
| 2022-10-26T01:16:16Z |
go
| 2022-10-31T22:13:34Z |
core/integration/container_test.go
|
}
}
}
}
}`, &res, nil)
t.Run("default alpine (no entrypoint)", func(t *testing.T) {
require.NoError(t, err)
require.Empty(t, res.Container.From.Entrypoint)
require.Equal(t, []string{"/bin/sh"}, res.Container.From.DefaultArgs)
})
t.Run("with nil default args", func(t *testing.T) {
require.Empty(t, res.Container.From.WithDefaultArgs.Entrypoint)
require.Empty(t, res.Container.From.WithDefaultArgs.DefaultArgs)
})
t.Run("with entrypoint set", func(t *testing.T) {
require.Equal(t, []string{"sh", "-c"}, res.Container.From.WithEntrypoint.Entrypoint)
require.Equal(t, []string{"/bin/sh"}, res.Container.From.WithEntrypoint.DefaultArgs)
})
t.Run("with exec args", func(t *testing.T) {
require.Equal(t, "/root\n", res.Container.From.WithEntrypoint.Exec.Stdout.Contents)
})
t.Run("with default args set", func(t *testing.T) {
require.Equal(t, []string{"sh", "-c"}, res.Container.From.WithEntrypoint.WithDefaultArgs.Entrypoint)
require.Equal(t, []string{"id"}, res.Container.From.WithEntrypoint.WithDefaultArgs.DefaultArgs)
require.Equal(t, "uid=0(root) gid=0(root) groups=0(root),1(bin),2(daemon),3(sys),4(adm),6(disk),10(wheel),11(floppy),20(dialout),26(tape),27(video)\n", res.Container.From.WithEntrypoint.WithDefaultArgs.Exec.Stdout.Contents)
})
}
func TestContainerExecWithEnvVariable(t *testing.T) {
t.Parallel()
res := struct {
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 3,551 |
π Odd container behavior with exec / multiple withMountedDirectory
|
### What is the issue?
The following code executes but provides unexpected logs / output. Other similar use cases error due to missing files due to same issue. This may be something very simple (haven't used golang in many years) but seems like there may be an underlying issue with the execution engine.
I would expect this code to run the `ls` command twice, one time showing the two mounted directories, one time showing the root output. Instead in the logs I see `ls` with d1 and d2 (expected), an `ls` with just d1 (??), and then an `ls` with the root fs. This causes issues if the first ls is changed to `ls /example/d2` as it will error the whole pipeline due to missing path.
```golang
workdir := client.Host().Workdir()
d1, err := workdir.Read().Directory("dir1/").ID(ctx)
if err != nil {
return err
}
d2, err := workdir.Read().Directory("dir2/").ID(ctx)
if err != nil {
return err
}
build := client.Container().From("alpine:latest").
WithMountedDirectory("/example/d1", d1).
WithMountedDirectory("/example/d2", d2)
build = build.Exec(dagger.ContainerExecOpts{
Args: []string{"ls", "/example"},
})
_, err = build.ExitCode(ctx)
if err != nil {
return err
}
build = build.Exec(dagger.ContainerExecOpts{
Args: []string{"ls", "/"},
})
_, err = build.ExitCode(ctx)
if err != nil {
return err
}
```
I was able to get the same functionality working fine by using `fs, err := build.FS().WithDirectory(d1, "/example/d1").WithDirectory(d2, "/example/d2").ID(ctx); build = build.WithFS(fs);` so conceptually don't think I'm doing anything wrong.
### Log output
```
#1 resolve image config for docker.io/library/alpine:latest
#1 DONE 0.4s
#2 mkfile /Dockerfile
#2 DONE 0.0s
#3 mkfile /main.go
#3 CACHED
#4 [internal] load metadata for docker.io/library/golang:1.18.2-alpine
#4 DONE 0.1s
#5 local://__dagger_workdir_/home/plaisted/source/OSD.PJI-Temporary/repro
#5 DONE 0.0s
#6 local://__dagger_workdir_/home/plaisted/source/OSD.PJI-Temporary/repro
#6 transferring __dagger_workdir_/home/plaisted/source/OSD.PJI-Temporary/repro: 309B done
#6 DONE 0.0s
#7 [build 1/6] FROM docker.io/library/golang:1.18.2-alpine@sha256:4795c5d21f01e0777707ada02408debe77fe31848be97cf9fa8a1462da78d949
#7 resolve docker.io/library/golang:1.18.2-alpine@sha256:4795c5d21f01e0777707ada02408debe77fe31848be97cf9fa8a1462da78d949 0.0s done
#7 DONE 0.0s
#8 [build 3/6] RUN apk add --no-cache file git
#8 CACHED
#9 [build 4/6] RUN go mod init go.dagger.io/dagger/shim/cmd
#9 CACHED
#10 [build 2/6] WORKDIR /src
#10 CACHED
#11 [build 5/6] COPY . .
#11 CACHED
#12 [build 6/6] RUN CGO_ENABLED=0 go build -o /_shim -ldflags '-s -d -w' .
#12 CACHED
#13 [stage-1 1/1] COPY --from=build /_shim /_shim
#13 CACHED
#14 mkdir /meta
#14 CACHED
#15 copy / /
#15 DONE 0.0s
#16 docker-image://docker.io/library/alpine:latest
#16 resolve docker.io/library/alpine:latest
#16 resolve docker.io/library/alpine:latest 0.1s done
#16 CACHED
#17 copy / /
#17 CACHED
#18 ls /example
#18 0.157 d1
#18 0.157 d2
#18 DONE 0.2s
#1 resolve image config for docker.io/library/alpine:latest
#1 DONE 0.5s
#4 [internal] load metadata for docker.io/library/golang:1.18.2-alpine
#4 DONE 0.4s
#19 ls /example
#19 0.172 d1
#19 DONE 0.2s
#20 ls /
#20 0.105 _shim
#20 0.105 bin
#20 0.105 dagger
#20 0.105 dev
#20 0.105 etc
#20 0.105 example
#20 0.105 home
#20 0.105 lib
#20 0.105 media
#20 0.105 mnt
#20 0.105 opt
#20 0.105 proc
#20 0.105 root
#20 0.105 run
#20 0.105 sbin
#20 0.105 srv
#20 0.105 sys
#20 0.105 tmp
#20 0.105 usr
#20 0.105 var
#20 DONE 0.1s
#0 0.148 d1
#0 0.148 d2
#18 DONE 0.2s
#1 resolve image config for docker.io/library/alpine:latest
#1 DONE 0.4s
#4 [internal] load metadata for docker.io/library/golang:1.18.2-alpine
#4 DONE 0.4s
#19 ls /example
#0 0.135 d1
#19 DONE 0.2s
#20 ls /example
#0 0.104 d1
#0 0.104 d2
#20 DONE 0.1s
```
### Steps to reproduce
* Mount two directories
* Run multiple exec commands and observe logs output
### Dagger version
dagger v0.3.1
### OS version
Ubuntu-20.04
|
https://github.com/dagger/dagger/issues/3551
|
https://github.com/dagger/dagger/pull/3602
|
b734ed35554bbfbc5caf63674eaa9c22692e614e
|
b4bb0b9e06e1edf8b81f9054b7419daabcb5bedb
| 2022-10-26T01:16:16Z |
go
| 2022-10-31T22:13:34Z |
core/integration/container_test.go
|
Container struct {
From struct {
WithEnvVariable struct {
Exec struct {
Stdout struct {
Contents string
}
}
}
}
}
}{}
err := testutil.Query(
`{
container {
from(address: "alpine:3.16.2") {
withEnvVariable(name: "FOO", value: "bar") {
exec(args: ["env"]) {
stdout {
contents
}
}
}
}
}
}`, &res, nil)
require.NoError(t, err)
require.Contains(t, res.Container.From.WithEnvVariable.Exec.Stdout.Contents, "FOO=bar\n")
}
func TestContainerVariables(t *testing.T) {
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 3,551 |
π Odd container behavior with exec / multiple withMountedDirectory
|
### What is the issue?
The following code executes but provides unexpected logs / output. Other similar use cases error due to missing files due to same issue. This may be something very simple (haven't used golang in many years) but seems like there may be an underlying issue with the execution engine.
I would expect this code to run the `ls` command twice, one time showing the two mounted directories, one time showing the root output. Instead in the logs I see `ls` with d1 and d2 (expected), an `ls` with just d1 (??), and then an `ls` with the root fs. This causes issues if the first ls is changed to `ls /example/d2` as it will error the whole pipeline due to missing path.
```golang
workdir := client.Host().Workdir()
d1, err := workdir.Read().Directory("dir1/").ID(ctx)
if err != nil {
return err
}
d2, err := workdir.Read().Directory("dir2/").ID(ctx)
if err != nil {
return err
}
build := client.Container().From("alpine:latest").
WithMountedDirectory("/example/d1", d1).
WithMountedDirectory("/example/d2", d2)
build = build.Exec(dagger.ContainerExecOpts{
Args: []string{"ls", "/example"},
})
_, err = build.ExitCode(ctx)
if err != nil {
return err
}
build = build.Exec(dagger.ContainerExecOpts{
Args: []string{"ls", "/"},
})
_, err = build.ExitCode(ctx)
if err != nil {
return err
}
```
I was able to get the same functionality working fine by using `fs, err := build.FS().WithDirectory(d1, "/example/d1").WithDirectory(d2, "/example/d2").ID(ctx); build = build.WithFS(fs);` so conceptually don't think I'm doing anything wrong.
### Log output
```
#1 resolve image config for docker.io/library/alpine:latest
#1 DONE 0.4s
#2 mkfile /Dockerfile
#2 DONE 0.0s
#3 mkfile /main.go
#3 CACHED
#4 [internal] load metadata for docker.io/library/golang:1.18.2-alpine
#4 DONE 0.1s
#5 local://__dagger_workdir_/home/plaisted/source/OSD.PJI-Temporary/repro
#5 DONE 0.0s
#6 local://__dagger_workdir_/home/plaisted/source/OSD.PJI-Temporary/repro
#6 transferring __dagger_workdir_/home/plaisted/source/OSD.PJI-Temporary/repro: 309B done
#6 DONE 0.0s
#7 [build 1/6] FROM docker.io/library/golang:1.18.2-alpine@sha256:4795c5d21f01e0777707ada02408debe77fe31848be97cf9fa8a1462da78d949
#7 resolve docker.io/library/golang:1.18.2-alpine@sha256:4795c5d21f01e0777707ada02408debe77fe31848be97cf9fa8a1462da78d949 0.0s done
#7 DONE 0.0s
#8 [build 3/6] RUN apk add --no-cache file git
#8 CACHED
#9 [build 4/6] RUN go mod init go.dagger.io/dagger/shim/cmd
#9 CACHED
#10 [build 2/6] WORKDIR /src
#10 CACHED
#11 [build 5/6] COPY . .
#11 CACHED
#12 [build 6/6] RUN CGO_ENABLED=0 go build -o /_shim -ldflags '-s -d -w' .
#12 CACHED
#13 [stage-1 1/1] COPY --from=build /_shim /_shim
#13 CACHED
#14 mkdir /meta
#14 CACHED
#15 copy / /
#15 DONE 0.0s
#16 docker-image://docker.io/library/alpine:latest
#16 resolve docker.io/library/alpine:latest
#16 resolve docker.io/library/alpine:latest 0.1s done
#16 CACHED
#17 copy / /
#17 CACHED
#18 ls /example
#18 0.157 d1
#18 0.157 d2
#18 DONE 0.2s
#1 resolve image config for docker.io/library/alpine:latest
#1 DONE 0.5s
#4 [internal] load metadata for docker.io/library/golang:1.18.2-alpine
#4 DONE 0.4s
#19 ls /example
#19 0.172 d1
#19 DONE 0.2s
#20 ls /
#20 0.105 _shim
#20 0.105 bin
#20 0.105 dagger
#20 0.105 dev
#20 0.105 etc
#20 0.105 example
#20 0.105 home
#20 0.105 lib
#20 0.105 media
#20 0.105 mnt
#20 0.105 opt
#20 0.105 proc
#20 0.105 root
#20 0.105 run
#20 0.105 sbin
#20 0.105 srv
#20 0.105 sys
#20 0.105 tmp
#20 0.105 usr
#20 0.105 var
#20 DONE 0.1s
#0 0.148 d1
#0 0.148 d2
#18 DONE 0.2s
#1 resolve image config for docker.io/library/alpine:latest
#1 DONE 0.4s
#4 [internal] load metadata for docker.io/library/golang:1.18.2-alpine
#4 DONE 0.4s
#19 ls /example
#0 0.135 d1
#19 DONE 0.2s
#20 ls /example
#0 0.104 d1
#0 0.104 d2
#20 DONE 0.1s
```
### Steps to reproduce
* Mount two directories
* Run multiple exec commands and observe logs output
### Dagger version
dagger v0.3.1
### OS version
Ubuntu-20.04
|
https://github.com/dagger/dagger/issues/3551
|
https://github.com/dagger/dagger/pull/3602
|
b734ed35554bbfbc5caf63674eaa9c22692e614e
|
b4bb0b9e06e1edf8b81f9054b7419daabcb5bedb
| 2022-10-26T01:16:16Z |
go
| 2022-10-31T22:13:34Z |
core/integration/container_test.go
|
t.Parallel()
res := struct {
Container struct {
From struct {
EnvVariables []schema.EnvVariable
Exec struct {
Stdout struct {
Contents string
}
}
}
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 3,551 |
π Odd container behavior with exec / multiple withMountedDirectory
|
### What is the issue?
The following code executes but provides unexpected logs / output. Other similar use cases error due to missing files due to same issue. This may be something very simple (haven't used golang in many years) but seems like there may be an underlying issue with the execution engine.
I would expect this code to run the `ls` command twice, one time showing the two mounted directories, one time showing the root output. Instead in the logs I see `ls` with d1 and d2 (expected), an `ls` with just d1 (??), and then an `ls` with the root fs. This causes issues if the first ls is changed to `ls /example/d2` as it will error the whole pipeline due to missing path.
```golang
workdir := client.Host().Workdir()
d1, err := workdir.Read().Directory("dir1/").ID(ctx)
if err != nil {
return err
}
d2, err := workdir.Read().Directory("dir2/").ID(ctx)
if err != nil {
return err
}
build := client.Container().From("alpine:latest").
WithMountedDirectory("/example/d1", d1).
WithMountedDirectory("/example/d2", d2)
build = build.Exec(dagger.ContainerExecOpts{
Args: []string{"ls", "/example"},
})
_, err = build.ExitCode(ctx)
if err != nil {
return err
}
build = build.Exec(dagger.ContainerExecOpts{
Args: []string{"ls", "/"},
})
_, err = build.ExitCode(ctx)
if err != nil {
return err
}
```
I was able to get the same functionality working fine by using `fs, err := build.FS().WithDirectory(d1, "/example/d1").WithDirectory(d2, "/example/d2").ID(ctx); build = build.WithFS(fs);` so conceptually don't think I'm doing anything wrong.
### Log output
```
#1 resolve image config for docker.io/library/alpine:latest
#1 DONE 0.4s
#2 mkfile /Dockerfile
#2 DONE 0.0s
#3 mkfile /main.go
#3 CACHED
#4 [internal] load metadata for docker.io/library/golang:1.18.2-alpine
#4 DONE 0.1s
#5 local://__dagger_workdir_/home/plaisted/source/OSD.PJI-Temporary/repro
#5 DONE 0.0s
#6 local://__dagger_workdir_/home/plaisted/source/OSD.PJI-Temporary/repro
#6 transferring __dagger_workdir_/home/plaisted/source/OSD.PJI-Temporary/repro: 309B done
#6 DONE 0.0s
#7 [build 1/6] FROM docker.io/library/golang:1.18.2-alpine@sha256:4795c5d21f01e0777707ada02408debe77fe31848be97cf9fa8a1462da78d949
#7 resolve docker.io/library/golang:1.18.2-alpine@sha256:4795c5d21f01e0777707ada02408debe77fe31848be97cf9fa8a1462da78d949 0.0s done
#7 DONE 0.0s
#8 [build 3/6] RUN apk add --no-cache file git
#8 CACHED
#9 [build 4/6] RUN go mod init go.dagger.io/dagger/shim/cmd
#9 CACHED
#10 [build 2/6] WORKDIR /src
#10 CACHED
#11 [build 5/6] COPY . .
#11 CACHED
#12 [build 6/6] RUN CGO_ENABLED=0 go build -o /_shim -ldflags '-s -d -w' .
#12 CACHED
#13 [stage-1 1/1] COPY --from=build /_shim /_shim
#13 CACHED
#14 mkdir /meta
#14 CACHED
#15 copy / /
#15 DONE 0.0s
#16 docker-image://docker.io/library/alpine:latest
#16 resolve docker.io/library/alpine:latest
#16 resolve docker.io/library/alpine:latest 0.1s done
#16 CACHED
#17 copy / /
#17 CACHED
#18 ls /example
#18 0.157 d1
#18 0.157 d2
#18 DONE 0.2s
#1 resolve image config for docker.io/library/alpine:latest
#1 DONE 0.5s
#4 [internal] load metadata for docker.io/library/golang:1.18.2-alpine
#4 DONE 0.4s
#19 ls /example
#19 0.172 d1
#19 DONE 0.2s
#20 ls /
#20 0.105 _shim
#20 0.105 bin
#20 0.105 dagger
#20 0.105 dev
#20 0.105 etc
#20 0.105 example
#20 0.105 home
#20 0.105 lib
#20 0.105 media
#20 0.105 mnt
#20 0.105 opt
#20 0.105 proc
#20 0.105 root
#20 0.105 run
#20 0.105 sbin
#20 0.105 srv
#20 0.105 sys
#20 0.105 tmp
#20 0.105 usr
#20 0.105 var
#20 DONE 0.1s
#0 0.148 d1
#0 0.148 d2
#18 DONE 0.2s
#1 resolve image config for docker.io/library/alpine:latest
#1 DONE 0.4s
#4 [internal] load metadata for docker.io/library/golang:1.18.2-alpine
#4 DONE 0.4s
#19 ls /example
#0 0.135 d1
#19 DONE 0.2s
#20 ls /example
#0 0.104 d1
#0 0.104 d2
#20 DONE 0.1s
```
### Steps to reproduce
* Mount two directories
* Run multiple exec commands and observe logs output
### Dagger version
dagger v0.3.1
### OS version
Ubuntu-20.04
|
https://github.com/dagger/dagger/issues/3551
|
https://github.com/dagger/dagger/pull/3602
|
b734ed35554bbfbc5caf63674eaa9c22692e614e
|
b4bb0b9e06e1edf8b81f9054b7419daabcb5bedb
| 2022-10-26T01:16:16Z |
go
| 2022-10-31T22:13:34Z |
core/integration/container_test.go
|
}
}{}
err := testutil.Query(
`{
container {
from(address: "golang:1.18.2-alpine") {
envVariables {
name
value
}
exec(args: ["env"]) {
stdout {
contents
}
}
}
}
}`, &res, nil)
require.NoError(t, err)
require.Equal(t, []schema.EnvVariable{
{Name: "PATH", Value: "/go/bin:/usr/local/go/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"},
{Name: "GOLANG_VERSION", Value: "1.18.2"},
{Name: "GOPATH", Value: "/go"},
}, res.Container.From.EnvVariables)
require.Contains(t, res.Container.From.Exec.Stdout.Contents, "GOPATH=/go\n")
}
func TestContainerVariable(t *testing.T) {
t.Parallel()
res := struct {
Container struct {
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 3,551 |
π Odd container behavior with exec / multiple withMountedDirectory
|
### What is the issue?
The following code executes but provides unexpected logs / output. Other similar use cases error due to missing files due to same issue. This may be something very simple (haven't used golang in many years) but seems like there may be an underlying issue with the execution engine.
I would expect this code to run the `ls` command twice, one time showing the two mounted directories, one time showing the root output. Instead in the logs I see `ls` with d1 and d2 (expected), an `ls` with just d1 (??), and then an `ls` with the root fs. This causes issues if the first ls is changed to `ls /example/d2` as it will error the whole pipeline due to missing path.
```golang
workdir := client.Host().Workdir()
d1, err := workdir.Read().Directory("dir1/").ID(ctx)
if err != nil {
return err
}
d2, err := workdir.Read().Directory("dir2/").ID(ctx)
if err != nil {
return err
}
build := client.Container().From("alpine:latest").
WithMountedDirectory("/example/d1", d1).
WithMountedDirectory("/example/d2", d2)
build = build.Exec(dagger.ContainerExecOpts{
Args: []string{"ls", "/example"},
})
_, err = build.ExitCode(ctx)
if err != nil {
return err
}
build = build.Exec(dagger.ContainerExecOpts{
Args: []string{"ls", "/"},
})
_, err = build.ExitCode(ctx)
if err != nil {
return err
}
```
I was able to get the same functionality working fine by using `fs, err := build.FS().WithDirectory(d1, "/example/d1").WithDirectory(d2, "/example/d2").ID(ctx); build = build.WithFS(fs);` so conceptually don't think I'm doing anything wrong.
### Log output
```
#1 resolve image config for docker.io/library/alpine:latest
#1 DONE 0.4s
#2 mkfile /Dockerfile
#2 DONE 0.0s
#3 mkfile /main.go
#3 CACHED
#4 [internal] load metadata for docker.io/library/golang:1.18.2-alpine
#4 DONE 0.1s
#5 local://__dagger_workdir_/home/plaisted/source/OSD.PJI-Temporary/repro
#5 DONE 0.0s
#6 local://__dagger_workdir_/home/plaisted/source/OSD.PJI-Temporary/repro
#6 transferring __dagger_workdir_/home/plaisted/source/OSD.PJI-Temporary/repro: 309B done
#6 DONE 0.0s
#7 [build 1/6] FROM docker.io/library/golang:1.18.2-alpine@sha256:4795c5d21f01e0777707ada02408debe77fe31848be97cf9fa8a1462da78d949
#7 resolve docker.io/library/golang:1.18.2-alpine@sha256:4795c5d21f01e0777707ada02408debe77fe31848be97cf9fa8a1462da78d949 0.0s done
#7 DONE 0.0s
#8 [build 3/6] RUN apk add --no-cache file git
#8 CACHED
#9 [build 4/6] RUN go mod init go.dagger.io/dagger/shim/cmd
#9 CACHED
#10 [build 2/6] WORKDIR /src
#10 CACHED
#11 [build 5/6] COPY . .
#11 CACHED
#12 [build 6/6] RUN CGO_ENABLED=0 go build -o /_shim -ldflags '-s -d -w' .
#12 CACHED
#13 [stage-1 1/1] COPY --from=build /_shim /_shim
#13 CACHED
#14 mkdir /meta
#14 CACHED
#15 copy / /
#15 DONE 0.0s
#16 docker-image://docker.io/library/alpine:latest
#16 resolve docker.io/library/alpine:latest
#16 resolve docker.io/library/alpine:latest 0.1s done
#16 CACHED
#17 copy / /
#17 CACHED
#18 ls /example
#18 0.157 d1
#18 0.157 d2
#18 DONE 0.2s
#1 resolve image config for docker.io/library/alpine:latest
#1 DONE 0.5s
#4 [internal] load metadata for docker.io/library/golang:1.18.2-alpine
#4 DONE 0.4s
#19 ls /example
#19 0.172 d1
#19 DONE 0.2s
#20 ls /
#20 0.105 _shim
#20 0.105 bin
#20 0.105 dagger
#20 0.105 dev
#20 0.105 etc
#20 0.105 example
#20 0.105 home
#20 0.105 lib
#20 0.105 media
#20 0.105 mnt
#20 0.105 opt
#20 0.105 proc
#20 0.105 root
#20 0.105 run
#20 0.105 sbin
#20 0.105 srv
#20 0.105 sys
#20 0.105 tmp
#20 0.105 usr
#20 0.105 var
#20 DONE 0.1s
#0 0.148 d1
#0 0.148 d2
#18 DONE 0.2s
#1 resolve image config for docker.io/library/alpine:latest
#1 DONE 0.4s
#4 [internal] load metadata for docker.io/library/golang:1.18.2-alpine
#4 DONE 0.4s
#19 ls /example
#0 0.135 d1
#19 DONE 0.2s
#20 ls /example
#0 0.104 d1
#0 0.104 d2
#20 DONE 0.1s
```
### Steps to reproduce
* Mount two directories
* Run multiple exec commands and observe logs output
### Dagger version
dagger v0.3.1
### OS version
Ubuntu-20.04
|
https://github.com/dagger/dagger/issues/3551
|
https://github.com/dagger/dagger/pull/3602
|
b734ed35554bbfbc5caf63674eaa9c22692e614e
|
b4bb0b9e06e1edf8b81f9054b7419daabcb5bedb
| 2022-10-26T01:16:16Z |
go
| 2022-10-31T22:13:34Z |
core/integration/container_test.go
|
From struct {
EnvVariable *string
}
}
}{}
err := testutil.Query(
`{
container {
from(address: "golang:1.18.2-alpine") {
envVariable(name: "GOLANG_VERSION")
}
}
}`, &res, nil)
require.NoError(t, err)
require.NotNil(t, res.Container.From.EnvVariable)
require.Equal(t, "1.18.2", *res.Container.From.EnvVariable)
err = testutil.Query(
`{
container {
from(address: "golang:1.18.2-alpine") {
envVariable(name: "UNKNOWN")
}
}
}`, &res, nil)
require.NoError(t, err)
require.Nil(t, res.Container.From.EnvVariable)
}
func TestContainerWithoutVariable(t *testing.T) {
t.Parallel()
res := struct {
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 3,551 |
π Odd container behavior with exec / multiple withMountedDirectory
|
### What is the issue?
The following code executes but provides unexpected logs / output. Other similar use cases error due to missing files due to same issue. This may be something very simple (haven't used golang in many years) but seems like there may be an underlying issue with the execution engine.
I would expect this code to run the `ls` command twice, one time showing the two mounted directories, one time showing the root output. Instead in the logs I see `ls` with d1 and d2 (expected), an `ls` with just d1 (??), and then an `ls` with the root fs. This causes issues if the first ls is changed to `ls /example/d2` as it will error the whole pipeline due to missing path.
```golang
workdir := client.Host().Workdir()
d1, err := workdir.Read().Directory("dir1/").ID(ctx)
if err != nil {
return err
}
d2, err := workdir.Read().Directory("dir2/").ID(ctx)
if err != nil {
return err
}
build := client.Container().From("alpine:latest").
WithMountedDirectory("/example/d1", d1).
WithMountedDirectory("/example/d2", d2)
build = build.Exec(dagger.ContainerExecOpts{
Args: []string{"ls", "/example"},
})
_, err = build.ExitCode(ctx)
if err != nil {
return err
}
build = build.Exec(dagger.ContainerExecOpts{
Args: []string{"ls", "/"},
})
_, err = build.ExitCode(ctx)
if err != nil {
return err
}
```
I was able to get the same functionality working fine by using `fs, err := build.FS().WithDirectory(d1, "/example/d1").WithDirectory(d2, "/example/d2").ID(ctx); build = build.WithFS(fs);` so conceptually don't think I'm doing anything wrong.
### Log output
```
#1 resolve image config for docker.io/library/alpine:latest
#1 DONE 0.4s
#2 mkfile /Dockerfile
#2 DONE 0.0s
#3 mkfile /main.go
#3 CACHED
#4 [internal] load metadata for docker.io/library/golang:1.18.2-alpine
#4 DONE 0.1s
#5 local://__dagger_workdir_/home/plaisted/source/OSD.PJI-Temporary/repro
#5 DONE 0.0s
#6 local://__dagger_workdir_/home/plaisted/source/OSD.PJI-Temporary/repro
#6 transferring __dagger_workdir_/home/plaisted/source/OSD.PJI-Temporary/repro: 309B done
#6 DONE 0.0s
#7 [build 1/6] FROM docker.io/library/golang:1.18.2-alpine@sha256:4795c5d21f01e0777707ada02408debe77fe31848be97cf9fa8a1462da78d949
#7 resolve docker.io/library/golang:1.18.2-alpine@sha256:4795c5d21f01e0777707ada02408debe77fe31848be97cf9fa8a1462da78d949 0.0s done
#7 DONE 0.0s
#8 [build 3/6] RUN apk add --no-cache file git
#8 CACHED
#9 [build 4/6] RUN go mod init go.dagger.io/dagger/shim/cmd
#9 CACHED
#10 [build 2/6] WORKDIR /src
#10 CACHED
#11 [build 5/6] COPY . .
#11 CACHED
#12 [build 6/6] RUN CGO_ENABLED=0 go build -o /_shim -ldflags '-s -d -w' .
#12 CACHED
#13 [stage-1 1/1] COPY --from=build /_shim /_shim
#13 CACHED
#14 mkdir /meta
#14 CACHED
#15 copy / /
#15 DONE 0.0s
#16 docker-image://docker.io/library/alpine:latest
#16 resolve docker.io/library/alpine:latest
#16 resolve docker.io/library/alpine:latest 0.1s done
#16 CACHED
#17 copy / /
#17 CACHED
#18 ls /example
#18 0.157 d1
#18 0.157 d2
#18 DONE 0.2s
#1 resolve image config for docker.io/library/alpine:latest
#1 DONE 0.5s
#4 [internal] load metadata for docker.io/library/golang:1.18.2-alpine
#4 DONE 0.4s
#19 ls /example
#19 0.172 d1
#19 DONE 0.2s
#20 ls /
#20 0.105 _shim
#20 0.105 bin
#20 0.105 dagger
#20 0.105 dev
#20 0.105 etc
#20 0.105 example
#20 0.105 home
#20 0.105 lib
#20 0.105 media
#20 0.105 mnt
#20 0.105 opt
#20 0.105 proc
#20 0.105 root
#20 0.105 run
#20 0.105 sbin
#20 0.105 srv
#20 0.105 sys
#20 0.105 tmp
#20 0.105 usr
#20 0.105 var
#20 DONE 0.1s
#0 0.148 d1
#0 0.148 d2
#18 DONE 0.2s
#1 resolve image config for docker.io/library/alpine:latest
#1 DONE 0.4s
#4 [internal] load metadata for docker.io/library/golang:1.18.2-alpine
#4 DONE 0.4s
#19 ls /example
#0 0.135 d1
#19 DONE 0.2s
#20 ls /example
#0 0.104 d1
#0 0.104 d2
#20 DONE 0.1s
```
### Steps to reproduce
* Mount two directories
* Run multiple exec commands and observe logs output
### Dagger version
dagger v0.3.1
### OS version
Ubuntu-20.04
|
https://github.com/dagger/dagger/issues/3551
|
https://github.com/dagger/dagger/pull/3602
|
b734ed35554bbfbc5caf63674eaa9c22692e614e
|
b4bb0b9e06e1edf8b81f9054b7419daabcb5bedb
| 2022-10-26T01:16:16Z |
go
| 2022-10-31T22:13:34Z |
core/integration/container_test.go
|
Container struct {
From struct {
WithoutEnvVariable struct {
EnvVariables []schema.EnvVariable
Exec struct {
Stdout struct {
Contents string
}
}
}
}
}
}{}
err := testutil.Query(
`{
container {
from(address: "golang:1.18.2-alpine") {
withoutEnvVariable(name: "GOLANG_VERSION") {
envVariables {
name
value
}
exec(args: ["env"]) {
stdout {
contents
}
}
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 3,551 |
π Odd container behavior with exec / multiple withMountedDirectory
|
### What is the issue?
The following code executes but provides unexpected logs / output. Other similar use cases error due to missing files due to same issue. This may be something very simple (haven't used golang in many years) but seems like there may be an underlying issue with the execution engine.
I would expect this code to run the `ls` command twice, one time showing the two mounted directories, one time showing the root output. Instead in the logs I see `ls` with d1 and d2 (expected), an `ls` with just d1 (??), and then an `ls` with the root fs. This causes issues if the first ls is changed to `ls /example/d2` as it will error the whole pipeline due to missing path.
```golang
workdir := client.Host().Workdir()
d1, err := workdir.Read().Directory("dir1/").ID(ctx)
if err != nil {
return err
}
d2, err := workdir.Read().Directory("dir2/").ID(ctx)
if err != nil {
return err
}
build := client.Container().From("alpine:latest").
WithMountedDirectory("/example/d1", d1).
WithMountedDirectory("/example/d2", d2)
build = build.Exec(dagger.ContainerExecOpts{
Args: []string{"ls", "/example"},
})
_, err = build.ExitCode(ctx)
if err != nil {
return err
}
build = build.Exec(dagger.ContainerExecOpts{
Args: []string{"ls", "/"},
})
_, err = build.ExitCode(ctx)
if err != nil {
return err
}
```
I was able to get the same functionality working fine by using `fs, err := build.FS().WithDirectory(d1, "/example/d1").WithDirectory(d2, "/example/d2").ID(ctx); build = build.WithFS(fs);` so conceptually don't think I'm doing anything wrong.
### Log output
```
#1 resolve image config for docker.io/library/alpine:latest
#1 DONE 0.4s
#2 mkfile /Dockerfile
#2 DONE 0.0s
#3 mkfile /main.go
#3 CACHED
#4 [internal] load metadata for docker.io/library/golang:1.18.2-alpine
#4 DONE 0.1s
#5 local://__dagger_workdir_/home/plaisted/source/OSD.PJI-Temporary/repro
#5 DONE 0.0s
#6 local://__dagger_workdir_/home/plaisted/source/OSD.PJI-Temporary/repro
#6 transferring __dagger_workdir_/home/plaisted/source/OSD.PJI-Temporary/repro: 309B done
#6 DONE 0.0s
#7 [build 1/6] FROM docker.io/library/golang:1.18.2-alpine@sha256:4795c5d21f01e0777707ada02408debe77fe31848be97cf9fa8a1462da78d949
#7 resolve docker.io/library/golang:1.18.2-alpine@sha256:4795c5d21f01e0777707ada02408debe77fe31848be97cf9fa8a1462da78d949 0.0s done
#7 DONE 0.0s
#8 [build 3/6] RUN apk add --no-cache file git
#8 CACHED
#9 [build 4/6] RUN go mod init go.dagger.io/dagger/shim/cmd
#9 CACHED
#10 [build 2/6] WORKDIR /src
#10 CACHED
#11 [build 5/6] COPY . .
#11 CACHED
#12 [build 6/6] RUN CGO_ENABLED=0 go build -o /_shim -ldflags '-s -d -w' .
#12 CACHED
#13 [stage-1 1/1] COPY --from=build /_shim /_shim
#13 CACHED
#14 mkdir /meta
#14 CACHED
#15 copy / /
#15 DONE 0.0s
#16 docker-image://docker.io/library/alpine:latest
#16 resolve docker.io/library/alpine:latest
#16 resolve docker.io/library/alpine:latest 0.1s done
#16 CACHED
#17 copy / /
#17 CACHED
#18 ls /example
#18 0.157 d1
#18 0.157 d2
#18 DONE 0.2s
#1 resolve image config for docker.io/library/alpine:latest
#1 DONE 0.5s
#4 [internal] load metadata for docker.io/library/golang:1.18.2-alpine
#4 DONE 0.4s
#19 ls /example
#19 0.172 d1
#19 DONE 0.2s
#20 ls /
#20 0.105 _shim
#20 0.105 bin
#20 0.105 dagger
#20 0.105 dev
#20 0.105 etc
#20 0.105 example
#20 0.105 home
#20 0.105 lib
#20 0.105 media
#20 0.105 mnt
#20 0.105 opt
#20 0.105 proc
#20 0.105 root
#20 0.105 run
#20 0.105 sbin
#20 0.105 srv
#20 0.105 sys
#20 0.105 tmp
#20 0.105 usr
#20 0.105 var
#20 DONE 0.1s
#0 0.148 d1
#0 0.148 d2
#18 DONE 0.2s
#1 resolve image config for docker.io/library/alpine:latest
#1 DONE 0.4s
#4 [internal] load metadata for docker.io/library/golang:1.18.2-alpine
#4 DONE 0.4s
#19 ls /example
#0 0.135 d1
#19 DONE 0.2s
#20 ls /example
#0 0.104 d1
#0 0.104 d2
#20 DONE 0.1s
```
### Steps to reproduce
* Mount two directories
* Run multiple exec commands and observe logs output
### Dagger version
dagger v0.3.1
### OS version
Ubuntu-20.04
|
https://github.com/dagger/dagger/issues/3551
|
https://github.com/dagger/dagger/pull/3602
|
b734ed35554bbfbc5caf63674eaa9c22692e614e
|
b4bb0b9e06e1edf8b81f9054b7419daabcb5bedb
| 2022-10-26T01:16:16Z |
go
| 2022-10-31T22:13:34Z |
core/integration/container_test.go
|
}
}
}
}`, &res, nil)
require.NoError(t, err)
require.Equal(t, res.Container.From.WithoutEnvVariable.EnvVariables, []schema.EnvVariable{
{Name: "PATH", Value: "/go/bin:/usr/local/go/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"},
{Name: "GOPATH", Value: "/go"},
})
require.NotContains(t, res.Container.From.WithoutEnvVariable.Exec.Stdout.Contents, "GOLANG_VERSION")
}
func TestContainerEnvVariablesReplace(t *testing.T) {
t.Parallel()
res := struct {
Container struct {
From struct {
WithEnvVariable struct {
EnvVariables []schema.EnvVariable
Exec struct {
Stdout struct {
Contents string
}
}
}
}
}
}{}
err := testutil.Query(
`{
container {
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 3,551 |
π Odd container behavior with exec / multiple withMountedDirectory
|
### What is the issue?
The following code executes but provides unexpected logs / output. Other similar use cases error due to missing files due to same issue. This may be something very simple (haven't used golang in many years) but seems like there may be an underlying issue with the execution engine.
I would expect this code to run the `ls` command twice, one time showing the two mounted directories, one time showing the root output. Instead in the logs I see `ls` with d1 and d2 (expected), an `ls` with just d1 (??), and then an `ls` with the root fs. This causes issues if the first ls is changed to `ls /example/d2` as it will error the whole pipeline due to missing path.
```golang
workdir := client.Host().Workdir()
d1, err := workdir.Read().Directory("dir1/").ID(ctx)
if err != nil {
return err
}
d2, err := workdir.Read().Directory("dir2/").ID(ctx)
if err != nil {
return err
}
build := client.Container().From("alpine:latest").
WithMountedDirectory("/example/d1", d1).
WithMountedDirectory("/example/d2", d2)
build = build.Exec(dagger.ContainerExecOpts{
Args: []string{"ls", "/example"},
})
_, err = build.ExitCode(ctx)
if err != nil {
return err
}
build = build.Exec(dagger.ContainerExecOpts{
Args: []string{"ls", "/"},
})
_, err = build.ExitCode(ctx)
if err != nil {
return err
}
```
I was able to get the same functionality working fine by using `fs, err := build.FS().WithDirectory(d1, "/example/d1").WithDirectory(d2, "/example/d2").ID(ctx); build = build.WithFS(fs);` so conceptually don't think I'm doing anything wrong.
### Log output
```
#1 resolve image config for docker.io/library/alpine:latest
#1 DONE 0.4s
#2 mkfile /Dockerfile
#2 DONE 0.0s
#3 mkfile /main.go
#3 CACHED
#4 [internal] load metadata for docker.io/library/golang:1.18.2-alpine
#4 DONE 0.1s
#5 local://__dagger_workdir_/home/plaisted/source/OSD.PJI-Temporary/repro
#5 DONE 0.0s
#6 local://__dagger_workdir_/home/plaisted/source/OSD.PJI-Temporary/repro
#6 transferring __dagger_workdir_/home/plaisted/source/OSD.PJI-Temporary/repro: 309B done
#6 DONE 0.0s
#7 [build 1/6] FROM docker.io/library/golang:1.18.2-alpine@sha256:4795c5d21f01e0777707ada02408debe77fe31848be97cf9fa8a1462da78d949
#7 resolve docker.io/library/golang:1.18.2-alpine@sha256:4795c5d21f01e0777707ada02408debe77fe31848be97cf9fa8a1462da78d949 0.0s done
#7 DONE 0.0s
#8 [build 3/6] RUN apk add --no-cache file git
#8 CACHED
#9 [build 4/6] RUN go mod init go.dagger.io/dagger/shim/cmd
#9 CACHED
#10 [build 2/6] WORKDIR /src
#10 CACHED
#11 [build 5/6] COPY . .
#11 CACHED
#12 [build 6/6] RUN CGO_ENABLED=0 go build -o /_shim -ldflags '-s -d -w' .
#12 CACHED
#13 [stage-1 1/1] COPY --from=build /_shim /_shim
#13 CACHED
#14 mkdir /meta
#14 CACHED
#15 copy / /
#15 DONE 0.0s
#16 docker-image://docker.io/library/alpine:latest
#16 resolve docker.io/library/alpine:latest
#16 resolve docker.io/library/alpine:latest 0.1s done
#16 CACHED
#17 copy / /
#17 CACHED
#18 ls /example
#18 0.157 d1
#18 0.157 d2
#18 DONE 0.2s
#1 resolve image config for docker.io/library/alpine:latest
#1 DONE 0.5s
#4 [internal] load metadata for docker.io/library/golang:1.18.2-alpine
#4 DONE 0.4s
#19 ls /example
#19 0.172 d1
#19 DONE 0.2s
#20 ls /
#20 0.105 _shim
#20 0.105 bin
#20 0.105 dagger
#20 0.105 dev
#20 0.105 etc
#20 0.105 example
#20 0.105 home
#20 0.105 lib
#20 0.105 media
#20 0.105 mnt
#20 0.105 opt
#20 0.105 proc
#20 0.105 root
#20 0.105 run
#20 0.105 sbin
#20 0.105 srv
#20 0.105 sys
#20 0.105 tmp
#20 0.105 usr
#20 0.105 var
#20 DONE 0.1s
#0 0.148 d1
#0 0.148 d2
#18 DONE 0.2s
#1 resolve image config for docker.io/library/alpine:latest
#1 DONE 0.4s
#4 [internal] load metadata for docker.io/library/golang:1.18.2-alpine
#4 DONE 0.4s
#19 ls /example
#0 0.135 d1
#19 DONE 0.2s
#20 ls /example
#0 0.104 d1
#0 0.104 d2
#20 DONE 0.1s
```
### Steps to reproduce
* Mount two directories
* Run multiple exec commands and observe logs output
### Dagger version
dagger v0.3.1
### OS version
Ubuntu-20.04
|
https://github.com/dagger/dagger/issues/3551
|
https://github.com/dagger/dagger/pull/3602
|
b734ed35554bbfbc5caf63674eaa9c22692e614e
|
b4bb0b9e06e1edf8b81f9054b7419daabcb5bedb
| 2022-10-26T01:16:16Z |
go
| 2022-10-31T22:13:34Z |
core/integration/container_test.go
|
from(address: "golang:1.18.2-alpine") {
withEnvVariable(name: "GOPATH", value: "/gone") {
envVariables {
name
value
}
exec(args: ["env"]) {
stdout {
contents
}
}
}
}
}
}`, &res, nil)
require.NoError(t, err)
require.Equal(t, res.Container.From.WithEnvVariable.EnvVariables, []schema.EnvVariable{
{Name: "PATH", Value: "/go/bin:/usr/local/go/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"},
{Name: "GOLANG_VERSION", Value: "1.18.2"},
{Name: "GOPATH", Value: "/gone"},
})
require.Contains(t, res.Container.From.WithEnvVariable.Exec.Stdout.Contents, "GOPATH=/gone\n")
}
func TestContainerWorkdir(t *testing.T) {
t.Parallel()
res := struct {
Container struct {
From struct {
Workdir string
Exec struct {
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 3,551 |
π Odd container behavior with exec / multiple withMountedDirectory
|
### What is the issue?
The following code executes but provides unexpected logs / output. Other similar use cases error due to missing files due to same issue. This may be something very simple (haven't used golang in many years) but seems like there may be an underlying issue with the execution engine.
I would expect this code to run the `ls` command twice, one time showing the two mounted directories, one time showing the root output. Instead in the logs I see `ls` with d1 and d2 (expected), an `ls` with just d1 (??), and then an `ls` with the root fs. This causes issues if the first ls is changed to `ls /example/d2` as it will error the whole pipeline due to missing path.
```golang
workdir := client.Host().Workdir()
d1, err := workdir.Read().Directory("dir1/").ID(ctx)
if err != nil {
return err
}
d2, err := workdir.Read().Directory("dir2/").ID(ctx)
if err != nil {
return err
}
build := client.Container().From("alpine:latest").
WithMountedDirectory("/example/d1", d1).
WithMountedDirectory("/example/d2", d2)
build = build.Exec(dagger.ContainerExecOpts{
Args: []string{"ls", "/example"},
})
_, err = build.ExitCode(ctx)
if err != nil {
return err
}
build = build.Exec(dagger.ContainerExecOpts{
Args: []string{"ls", "/"},
})
_, err = build.ExitCode(ctx)
if err != nil {
return err
}
```
I was able to get the same functionality working fine by using `fs, err := build.FS().WithDirectory(d1, "/example/d1").WithDirectory(d2, "/example/d2").ID(ctx); build = build.WithFS(fs);` so conceptually don't think I'm doing anything wrong.
### Log output
```
#1 resolve image config for docker.io/library/alpine:latest
#1 DONE 0.4s
#2 mkfile /Dockerfile
#2 DONE 0.0s
#3 mkfile /main.go
#3 CACHED
#4 [internal] load metadata for docker.io/library/golang:1.18.2-alpine
#4 DONE 0.1s
#5 local://__dagger_workdir_/home/plaisted/source/OSD.PJI-Temporary/repro
#5 DONE 0.0s
#6 local://__dagger_workdir_/home/plaisted/source/OSD.PJI-Temporary/repro
#6 transferring __dagger_workdir_/home/plaisted/source/OSD.PJI-Temporary/repro: 309B done
#6 DONE 0.0s
#7 [build 1/6] FROM docker.io/library/golang:1.18.2-alpine@sha256:4795c5d21f01e0777707ada02408debe77fe31848be97cf9fa8a1462da78d949
#7 resolve docker.io/library/golang:1.18.2-alpine@sha256:4795c5d21f01e0777707ada02408debe77fe31848be97cf9fa8a1462da78d949 0.0s done
#7 DONE 0.0s
#8 [build 3/6] RUN apk add --no-cache file git
#8 CACHED
#9 [build 4/6] RUN go mod init go.dagger.io/dagger/shim/cmd
#9 CACHED
#10 [build 2/6] WORKDIR /src
#10 CACHED
#11 [build 5/6] COPY . .
#11 CACHED
#12 [build 6/6] RUN CGO_ENABLED=0 go build -o /_shim -ldflags '-s -d -w' .
#12 CACHED
#13 [stage-1 1/1] COPY --from=build /_shim /_shim
#13 CACHED
#14 mkdir /meta
#14 CACHED
#15 copy / /
#15 DONE 0.0s
#16 docker-image://docker.io/library/alpine:latest
#16 resolve docker.io/library/alpine:latest
#16 resolve docker.io/library/alpine:latest 0.1s done
#16 CACHED
#17 copy / /
#17 CACHED
#18 ls /example
#18 0.157 d1
#18 0.157 d2
#18 DONE 0.2s
#1 resolve image config for docker.io/library/alpine:latest
#1 DONE 0.5s
#4 [internal] load metadata for docker.io/library/golang:1.18.2-alpine
#4 DONE 0.4s
#19 ls /example
#19 0.172 d1
#19 DONE 0.2s
#20 ls /
#20 0.105 _shim
#20 0.105 bin
#20 0.105 dagger
#20 0.105 dev
#20 0.105 etc
#20 0.105 example
#20 0.105 home
#20 0.105 lib
#20 0.105 media
#20 0.105 mnt
#20 0.105 opt
#20 0.105 proc
#20 0.105 root
#20 0.105 run
#20 0.105 sbin
#20 0.105 srv
#20 0.105 sys
#20 0.105 tmp
#20 0.105 usr
#20 0.105 var
#20 DONE 0.1s
#0 0.148 d1
#0 0.148 d2
#18 DONE 0.2s
#1 resolve image config for docker.io/library/alpine:latest
#1 DONE 0.4s
#4 [internal] load metadata for docker.io/library/golang:1.18.2-alpine
#4 DONE 0.4s
#19 ls /example
#0 0.135 d1
#19 DONE 0.2s
#20 ls /example
#0 0.104 d1
#0 0.104 d2
#20 DONE 0.1s
```
### Steps to reproduce
* Mount two directories
* Run multiple exec commands and observe logs output
### Dagger version
dagger v0.3.1
### OS version
Ubuntu-20.04
|
https://github.com/dagger/dagger/issues/3551
|
https://github.com/dagger/dagger/pull/3602
|
b734ed35554bbfbc5caf63674eaa9c22692e614e
|
b4bb0b9e06e1edf8b81f9054b7419daabcb5bedb
| 2022-10-26T01:16:16Z |
go
| 2022-10-31T22:13:34Z |
core/integration/container_test.go
|
Stdout struct {
Contents string
}
}
}
}
}{}
err := testutil.Query(
`{
container {
from(address: "golang:1.18.2-alpine") {
workdir
exec(args: ["pwd"]) {
stdout {
contents
}
}
}
}
}`, &res, nil)
require.NoError(t, err)
require.Equal(t, res.Container.From.Workdir, "/go")
require.Equal(t, res.Container.From.Exec.Stdout.Contents, "/go\n")
}
func TestContainerWithWorkdir(t *testing.T) {
t.Parallel()
res := struct {
Container struct {
From struct {
WithWorkdir struct {
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 3,551 |
π Odd container behavior with exec / multiple withMountedDirectory
|
### What is the issue?
The following code executes but provides unexpected logs / output. Other similar use cases error due to missing files due to same issue. This may be something very simple (haven't used golang in many years) but seems like there may be an underlying issue with the execution engine.
I would expect this code to run the `ls` command twice, one time showing the two mounted directories, one time showing the root output. Instead in the logs I see `ls` with d1 and d2 (expected), an `ls` with just d1 (??), and then an `ls` with the root fs. This causes issues if the first ls is changed to `ls /example/d2` as it will error the whole pipeline due to missing path.
```golang
workdir := client.Host().Workdir()
d1, err := workdir.Read().Directory("dir1/").ID(ctx)
if err != nil {
return err
}
d2, err := workdir.Read().Directory("dir2/").ID(ctx)
if err != nil {
return err
}
build := client.Container().From("alpine:latest").
WithMountedDirectory("/example/d1", d1).
WithMountedDirectory("/example/d2", d2)
build = build.Exec(dagger.ContainerExecOpts{
Args: []string{"ls", "/example"},
})
_, err = build.ExitCode(ctx)
if err != nil {
return err
}
build = build.Exec(dagger.ContainerExecOpts{
Args: []string{"ls", "/"},
})
_, err = build.ExitCode(ctx)
if err != nil {
return err
}
```
I was able to get the same functionality working fine by using `fs, err := build.FS().WithDirectory(d1, "/example/d1").WithDirectory(d2, "/example/d2").ID(ctx); build = build.WithFS(fs);` so conceptually don't think I'm doing anything wrong.
### Log output
```
#1 resolve image config for docker.io/library/alpine:latest
#1 DONE 0.4s
#2 mkfile /Dockerfile
#2 DONE 0.0s
#3 mkfile /main.go
#3 CACHED
#4 [internal] load metadata for docker.io/library/golang:1.18.2-alpine
#4 DONE 0.1s
#5 local://__dagger_workdir_/home/plaisted/source/OSD.PJI-Temporary/repro
#5 DONE 0.0s
#6 local://__dagger_workdir_/home/plaisted/source/OSD.PJI-Temporary/repro
#6 transferring __dagger_workdir_/home/plaisted/source/OSD.PJI-Temporary/repro: 309B done
#6 DONE 0.0s
#7 [build 1/6] FROM docker.io/library/golang:1.18.2-alpine@sha256:4795c5d21f01e0777707ada02408debe77fe31848be97cf9fa8a1462da78d949
#7 resolve docker.io/library/golang:1.18.2-alpine@sha256:4795c5d21f01e0777707ada02408debe77fe31848be97cf9fa8a1462da78d949 0.0s done
#7 DONE 0.0s
#8 [build 3/6] RUN apk add --no-cache file git
#8 CACHED
#9 [build 4/6] RUN go mod init go.dagger.io/dagger/shim/cmd
#9 CACHED
#10 [build 2/6] WORKDIR /src
#10 CACHED
#11 [build 5/6] COPY . .
#11 CACHED
#12 [build 6/6] RUN CGO_ENABLED=0 go build -o /_shim -ldflags '-s -d -w' .
#12 CACHED
#13 [stage-1 1/1] COPY --from=build /_shim /_shim
#13 CACHED
#14 mkdir /meta
#14 CACHED
#15 copy / /
#15 DONE 0.0s
#16 docker-image://docker.io/library/alpine:latest
#16 resolve docker.io/library/alpine:latest
#16 resolve docker.io/library/alpine:latest 0.1s done
#16 CACHED
#17 copy / /
#17 CACHED
#18 ls /example
#18 0.157 d1
#18 0.157 d2
#18 DONE 0.2s
#1 resolve image config for docker.io/library/alpine:latest
#1 DONE 0.5s
#4 [internal] load metadata for docker.io/library/golang:1.18.2-alpine
#4 DONE 0.4s
#19 ls /example
#19 0.172 d1
#19 DONE 0.2s
#20 ls /
#20 0.105 _shim
#20 0.105 bin
#20 0.105 dagger
#20 0.105 dev
#20 0.105 etc
#20 0.105 example
#20 0.105 home
#20 0.105 lib
#20 0.105 media
#20 0.105 mnt
#20 0.105 opt
#20 0.105 proc
#20 0.105 root
#20 0.105 run
#20 0.105 sbin
#20 0.105 srv
#20 0.105 sys
#20 0.105 tmp
#20 0.105 usr
#20 0.105 var
#20 DONE 0.1s
#0 0.148 d1
#0 0.148 d2
#18 DONE 0.2s
#1 resolve image config for docker.io/library/alpine:latest
#1 DONE 0.4s
#4 [internal] load metadata for docker.io/library/golang:1.18.2-alpine
#4 DONE 0.4s
#19 ls /example
#0 0.135 d1
#19 DONE 0.2s
#20 ls /example
#0 0.104 d1
#0 0.104 d2
#20 DONE 0.1s
```
### Steps to reproduce
* Mount two directories
* Run multiple exec commands and observe logs output
### Dagger version
dagger v0.3.1
### OS version
Ubuntu-20.04
|
https://github.com/dagger/dagger/issues/3551
|
https://github.com/dagger/dagger/pull/3602
|
b734ed35554bbfbc5caf63674eaa9c22692e614e
|
b4bb0b9e06e1edf8b81f9054b7419daabcb5bedb
| 2022-10-26T01:16:16Z |
go
| 2022-10-31T22:13:34Z |
core/integration/container_test.go
|
Workdir string
Exec struct {
Stdout struct {
Contents string
}
}
}
}
}
}{}
err := testutil.Query(
`{
container {
from(address: "golang:1.18.2-alpine") {
withWorkdir(path: "/usr") {
workdir
exec(args: ["pwd"]) {
stdout {
contents
}
}
}
}
}
}`, &res, nil)
require.NoError(t, err)
require.Equal(t, res.Container.From.WithWorkdir.Workdir, "/usr")
require.Equal(t, res.Container.From.WithWorkdir.Exec.Stdout.Contents, "/usr\n")
}
func TestContainerWithMountedDirectory(t *testing.T) {
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 3,551 |
π Odd container behavior with exec / multiple withMountedDirectory
|
### What is the issue?
The following code executes but provides unexpected logs / output. Other similar use cases error due to missing files due to same issue. This may be something very simple (haven't used golang in many years) but seems like there may be an underlying issue with the execution engine.
I would expect this code to run the `ls` command twice, one time showing the two mounted directories, one time showing the root output. Instead in the logs I see `ls` with d1 and d2 (expected), an `ls` with just d1 (??), and then an `ls` with the root fs. This causes issues if the first ls is changed to `ls /example/d2` as it will error the whole pipeline due to missing path.
```golang
workdir := client.Host().Workdir()
d1, err := workdir.Read().Directory("dir1/").ID(ctx)
if err != nil {
return err
}
d2, err := workdir.Read().Directory("dir2/").ID(ctx)
if err != nil {
return err
}
build := client.Container().From("alpine:latest").
WithMountedDirectory("/example/d1", d1).
WithMountedDirectory("/example/d2", d2)
build = build.Exec(dagger.ContainerExecOpts{
Args: []string{"ls", "/example"},
})
_, err = build.ExitCode(ctx)
if err != nil {
return err
}
build = build.Exec(dagger.ContainerExecOpts{
Args: []string{"ls", "/"},
})
_, err = build.ExitCode(ctx)
if err != nil {
return err
}
```
I was able to get the same functionality working fine by using `fs, err := build.FS().WithDirectory(d1, "/example/d1").WithDirectory(d2, "/example/d2").ID(ctx); build = build.WithFS(fs);` so conceptually don't think I'm doing anything wrong.
### Log output
```
#1 resolve image config for docker.io/library/alpine:latest
#1 DONE 0.4s
#2 mkfile /Dockerfile
#2 DONE 0.0s
#3 mkfile /main.go
#3 CACHED
#4 [internal] load metadata for docker.io/library/golang:1.18.2-alpine
#4 DONE 0.1s
#5 local://__dagger_workdir_/home/plaisted/source/OSD.PJI-Temporary/repro
#5 DONE 0.0s
#6 local://__dagger_workdir_/home/plaisted/source/OSD.PJI-Temporary/repro
#6 transferring __dagger_workdir_/home/plaisted/source/OSD.PJI-Temporary/repro: 309B done
#6 DONE 0.0s
#7 [build 1/6] FROM docker.io/library/golang:1.18.2-alpine@sha256:4795c5d21f01e0777707ada02408debe77fe31848be97cf9fa8a1462da78d949
#7 resolve docker.io/library/golang:1.18.2-alpine@sha256:4795c5d21f01e0777707ada02408debe77fe31848be97cf9fa8a1462da78d949 0.0s done
#7 DONE 0.0s
#8 [build 3/6] RUN apk add --no-cache file git
#8 CACHED
#9 [build 4/6] RUN go mod init go.dagger.io/dagger/shim/cmd
#9 CACHED
#10 [build 2/6] WORKDIR /src
#10 CACHED
#11 [build 5/6] COPY . .
#11 CACHED
#12 [build 6/6] RUN CGO_ENABLED=0 go build -o /_shim -ldflags '-s -d -w' .
#12 CACHED
#13 [stage-1 1/1] COPY --from=build /_shim /_shim
#13 CACHED
#14 mkdir /meta
#14 CACHED
#15 copy / /
#15 DONE 0.0s
#16 docker-image://docker.io/library/alpine:latest
#16 resolve docker.io/library/alpine:latest
#16 resolve docker.io/library/alpine:latest 0.1s done
#16 CACHED
#17 copy / /
#17 CACHED
#18 ls /example
#18 0.157 d1
#18 0.157 d2
#18 DONE 0.2s
#1 resolve image config for docker.io/library/alpine:latest
#1 DONE 0.5s
#4 [internal] load metadata for docker.io/library/golang:1.18.2-alpine
#4 DONE 0.4s
#19 ls /example
#19 0.172 d1
#19 DONE 0.2s
#20 ls /
#20 0.105 _shim
#20 0.105 bin
#20 0.105 dagger
#20 0.105 dev
#20 0.105 etc
#20 0.105 example
#20 0.105 home
#20 0.105 lib
#20 0.105 media
#20 0.105 mnt
#20 0.105 opt
#20 0.105 proc
#20 0.105 root
#20 0.105 run
#20 0.105 sbin
#20 0.105 srv
#20 0.105 sys
#20 0.105 tmp
#20 0.105 usr
#20 0.105 var
#20 DONE 0.1s
#0 0.148 d1
#0 0.148 d2
#18 DONE 0.2s
#1 resolve image config for docker.io/library/alpine:latest
#1 DONE 0.4s
#4 [internal] load metadata for docker.io/library/golang:1.18.2-alpine
#4 DONE 0.4s
#19 ls /example
#0 0.135 d1
#19 DONE 0.2s
#20 ls /example
#0 0.104 d1
#0 0.104 d2
#20 DONE 0.1s
```
### Steps to reproduce
* Mount two directories
* Run multiple exec commands and observe logs output
### Dagger version
dagger v0.3.1
### OS version
Ubuntu-20.04
|
https://github.com/dagger/dagger/issues/3551
|
https://github.com/dagger/dagger/pull/3602
|
b734ed35554bbfbc5caf63674eaa9c22692e614e
|
b4bb0b9e06e1edf8b81f9054b7419daabcb5bedb
| 2022-10-26T01:16:16Z |
go
| 2022-10-31T22:13:34Z |
core/integration/container_test.go
|
t.Parallel()
dirRes := struct {
Directory struct {
WithNewFile struct {
WithNewFile struct {
ID string
}
}
}
}{}
err := testutil.Query(
`{
directory {
withNewFile(path: "some-file", contents: "some-content") {
withNewFile(path: "some-dir/sub-file", contents: "sub-content") {
id
}
}
}
}`, &dirRes, nil)
require.NoError(t, err)
id := dirRes.Directory.WithNewFile.WithNewFile.ID
execRes := struct {
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 3,551 |
π Odd container behavior with exec / multiple withMountedDirectory
|
### What is the issue?
The following code executes but provides unexpected logs / output. Other similar use cases error due to missing files due to same issue. This may be something very simple (haven't used golang in many years) but seems like there may be an underlying issue with the execution engine.
I would expect this code to run the `ls` command twice, one time showing the two mounted directories, one time showing the root output. Instead in the logs I see `ls` with d1 and d2 (expected), an `ls` with just d1 (??), and then an `ls` with the root fs. This causes issues if the first ls is changed to `ls /example/d2` as it will error the whole pipeline due to missing path.
```golang
workdir := client.Host().Workdir()
d1, err := workdir.Read().Directory("dir1/").ID(ctx)
if err != nil {
return err
}
d2, err := workdir.Read().Directory("dir2/").ID(ctx)
if err != nil {
return err
}
build := client.Container().From("alpine:latest").
WithMountedDirectory("/example/d1", d1).
WithMountedDirectory("/example/d2", d2)
build = build.Exec(dagger.ContainerExecOpts{
Args: []string{"ls", "/example"},
})
_, err = build.ExitCode(ctx)
if err != nil {
return err
}
build = build.Exec(dagger.ContainerExecOpts{
Args: []string{"ls", "/"},
})
_, err = build.ExitCode(ctx)
if err != nil {
return err
}
```
I was able to get the same functionality working fine by using `fs, err := build.FS().WithDirectory(d1, "/example/d1").WithDirectory(d2, "/example/d2").ID(ctx); build = build.WithFS(fs);` so conceptually don't think I'm doing anything wrong.
### Log output
```
#1 resolve image config for docker.io/library/alpine:latest
#1 DONE 0.4s
#2 mkfile /Dockerfile
#2 DONE 0.0s
#3 mkfile /main.go
#3 CACHED
#4 [internal] load metadata for docker.io/library/golang:1.18.2-alpine
#4 DONE 0.1s
#5 local://__dagger_workdir_/home/plaisted/source/OSD.PJI-Temporary/repro
#5 DONE 0.0s
#6 local://__dagger_workdir_/home/plaisted/source/OSD.PJI-Temporary/repro
#6 transferring __dagger_workdir_/home/plaisted/source/OSD.PJI-Temporary/repro: 309B done
#6 DONE 0.0s
#7 [build 1/6] FROM docker.io/library/golang:1.18.2-alpine@sha256:4795c5d21f01e0777707ada02408debe77fe31848be97cf9fa8a1462da78d949
#7 resolve docker.io/library/golang:1.18.2-alpine@sha256:4795c5d21f01e0777707ada02408debe77fe31848be97cf9fa8a1462da78d949 0.0s done
#7 DONE 0.0s
#8 [build 3/6] RUN apk add --no-cache file git
#8 CACHED
#9 [build 4/6] RUN go mod init go.dagger.io/dagger/shim/cmd
#9 CACHED
#10 [build 2/6] WORKDIR /src
#10 CACHED
#11 [build 5/6] COPY . .
#11 CACHED
#12 [build 6/6] RUN CGO_ENABLED=0 go build -o /_shim -ldflags '-s -d -w' .
#12 CACHED
#13 [stage-1 1/1] COPY --from=build /_shim /_shim
#13 CACHED
#14 mkdir /meta
#14 CACHED
#15 copy / /
#15 DONE 0.0s
#16 docker-image://docker.io/library/alpine:latest
#16 resolve docker.io/library/alpine:latest
#16 resolve docker.io/library/alpine:latest 0.1s done
#16 CACHED
#17 copy / /
#17 CACHED
#18 ls /example
#18 0.157 d1
#18 0.157 d2
#18 DONE 0.2s
#1 resolve image config for docker.io/library/alpine:latest
#1 DONE 0.5s
#4 [internal] load metadata for docker.io/library/golang:1.18.2-alpine
#4 DONE 0.4s
#19 ls /example
#19 0.172 d1
#19 DONE 0.2s
#20 ls /
#20 0.105 _shim
#20 0.105 bin
#20 0.105 dagger
#20 0.105 dev
#20 0.105 etc
#20 0.105 example
#20 0.105 home
#20 0.105 lib
#20 0.105 media
#20 0.105 mnt
#20 0.105 opt
#20 0.105 proc
#20 0.105 root
#20 0.105 run
#20 0.105 sbin
#20 0.105 srv
#20 0.105 sys
#20 0.105 tmp
#20 0.105 usr
#20 0.105 var
#20 DONE 0.1s
#0 0.148 d1
#0 0.148 d2
#18 DONE 0.2s
#1 resolve image config for docker.io/library/alpine:latest
#1 DONE 0.4s
#4 [internal] load metadata for docker.io/library/golang:1.18.2-alpine
#4 DONE 0.4s
#19 ls /example
#0 0.135 d1
#19 DONE 0.2s
#20 ls /example
#0 0.104 d1
#0 0.104 d2
#20 DONE 0.1s
```
### Steps to reproduce
* Mount two directories
* Run multiple exec commands and observe logs output
### Dagger version
dagger v0.3.1
### OS version
Ubuntu-20.04
|
https://github.com/dagger/dagger/issues/3551
|
https://github.com/dagger/dagger/pull/3602
|
b734ed35554bbfbc5caf63674eaa9c22692e614e
|
b4bb0b9e06e1edf8b81f9054b7419daabcb5bedb
| 2022-10-26T01:16:16Z |
go
| 2022-10-31T22:13:34Z |
core/integration/container_test.go
|
Container struct {
From struct {
WithMountedDirectory struct {
Exec struct {
Stdout struct {
Contents string
}
Exec struct {
Stdout struct {
Contents string
}
}
}
}
}
}
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 3,551 |
π Odd container behavior with exec / multiple withMountedDirectory
|
### What is the issue?
The following code executes but provides unexpected logs / output. Other similar use cases error due to missing files due to same issue. This may be something very simple (haven't used golang in many years) but seems like there may be an underlying issue with the execution engine.
I would expect this code to run the `ls` command twice, one time showing the two mounted directories, one time showing the root output. Instead in the logs I see `ls` with d1 and d2 (expected), an `ls` with just d1 (??), and then an `ls` with the root fs. This causes issues if the first ls is changed to `ls /example/d2` as it will error the whole pipeline due to missing path.
```golang
workdir := client.Host().Workdir()
d1, err := workdir.Read().Directory("dir1/").ID(ctx)
if err != nil {
return err
}
d2, err := workdir.Read().Directory("dir2/").ID(ctx)
if err != nil {
return err
}
build := client.Container().From("alpine:latest").
WithMountedDirectory("/example/d1", d1).
WithMountedDirectory("/example/d2", d2)
build = build.Exec(dagger.ContainerExecOpts{
Args: []string{"ls", "/example"},
})
_, err = build.ExitCode(ctx)
if err != nil {
return err
}
build = build.Exec(dagger.ContainerExecOpts{
Args: []string{"ls", "/"},
})
_, err = build.ExitCode(ctx)
if err != nil {
return err
}
```
I was able to get the same functionality working fine by using `fs, err := build.FS().WithDirectory(d1, "/example/d1").WithDirectory(d2, "/example/d2").ID(ctx); build = build.WithFS(fs);` so conceptually don't think I'm doing anything wrong.
### Log output
```
#1 resolve image config for docker.io/library/alpine:latest
#1 DONE 0.4s
#2 mkfile /Dockerfile
#2 DONE 0.0s
#3 mkfile /main.go
#3 CACHED
#4 [internal] load metadata for docker.io/library/golang:1.18.2-alpine
#4 DONE 0.1s
#5 local://__dagger_workdir_/home/plaisted/source/OSD.PJI-Temporary/repro
#5 DONE 0.0s
#6 local://__dagger_workdir_/home/plaisted/source/OSD.PJI-Temporary/repro
#6 transferring __dagger_workdir_/home/plaisted/source/OSD.PJI-Temporary/repro: 309B done
#6 DONE 0.0s
#7 [build 1/6] FROM docker.io/library/golang:1.18.2-alpine@sha256:4795c5d21f01e0777707ada02408debe77fe31848be97cf9fa8a1462da78d949
#7 resolve docker.io/library/golang:1.18.2-alpine@sha256:4795c5d21f01e0777707ada02408debe77fe31848be97cf9fa8a1462da78d949 0.0s done
#7 DONE 0.0s
#8 [build 3/6] RUN apk add --no-cache file git
#8 CACHED
#9 [build 4/6] RUN go mod init go.dagger.io/dagger/shim/cmd
#9 CACHED
#10 [build 2/6] WORKDIR /src
#10 CACHED
#11 [build 5/6] COPY . .
#11 CACHED
#12 [build 6/6] RUN CGO_ENABLED=0 go build -o /_shim -ldflags '-s -d -w' .
#12 CACHED
#13 [stage-1 1/1] COPY --from=build /_shim /_shim
#13 CACHED
#14 mkdir /meta
#14 CACHED
#15 copy / /
#15 DONE 0.0s
#16 docker-image://docker.io/library/alpine:latest
#16 resolve docker.io/library/alpine:latest
#16 resolve docker.io/library/alpine:latest 0.1s done
#16 CACHED
#17 copy / /
#17 CACHED
#18 ls /example
#18 0.157 d1
#18 0.157 d2
#18 DONE 0.2s
#1 resolve image config for docker.io/library/alpine:latest
#1 DONE 0.5s
#4 [internal] load metadata for docker.io/library/golang:1.18.2-alpine
#4 DONE 0.4s
#19 ls /example
#19 0.172 d1
#19 DONE 0.2s
#20 ls /
#20 0.105 _shim
#20 0.105 bin
#20 0.105 dagger
#20 0.105 dev
#20 0.105 etc
#20 0.105 example
#20 0.105 home
#20 0.105 lib
#20 0.105 media
#20 0.105 mnt
#20 0.105 opt
#20 0.105 proc
#20 0.105 root
#20 0.105 run
#20 0.105 sbin
#20 0.105 srv
#20 0.105 sys
#20 0.105 tmp
#20 0.105 usr
#20 0.105 var
#20 DONE 0.1s
#0 0.148 d1
#0 0.148 d2
#18 DONE 0.2s
#1 resolve image config for docker.io/library/alpine:latest
#1 DONE 0.4s
#4 [internal] load metadata for docker.io/library/golang:1.18.2-alpine
#4 DONE 0.4s
#19 ls /example
#0 0.135 d1
#19 DONE 0.2s
#20 ls /example
#0 0.104 d1
#0 0.104 d2
#20 DONE 0.1s
```
### Steps to reproduce
* Mount two directories
* Run multiple exec commands and observe logs output
### Dagger version
dagger v0.3.1
### OS version
Ubuntu-20.04
|
https://github.com/dagger/dagger/issues/3551
|
https://github.com/dagger/dagger/pull/3602
|
b734ed35554bbfbc5caf63674eaa9c22692e614e
|
b4bb0b9e06e1edf8b81f9054b7419daabcb5bedb
| 2022-10-26T01:16:16Z |
go
| 2022-10-31T22:13:34Z |
core/integration/container_test.go
|
}{}
err = testutil.Query(
`query Test($id: DirectoryID!) {
container {
from(address: "alpine:3.16.2") {
withMountedDirectory(path: "/mnt", source: $id) {
exec(args: ["cat", "/mnt/some-file"]) {
stdout {
contents
}
exec(args: ["cat", "/mnt/some-dir/sub-file"]) {
stdout {
contents
}
}
}
}
}
}
}`, &execRes, &testutil.QueryOptions{Variables: map[string]any{
"id": id,
}})
require.NoError(t, err)
require.Equal(t, "some-content", execRes.Container.From.WithMountedDirectory.Exec.Stdout.Contents)
require.Equal(t, "sub-content", execRes.Container.From.WithMountedDirectory.Exec.Exec.Stdout.Contents)
}
func TestContainerWithMountedDirectorySourcePath(t *testing.T) {
t.Parallel()
dirRes := struct {
Directory struct {
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 3,551 |
π Odd container behavior with exec / multiple withMountedDirectory
|
### What is the issue?
The following code executes but provides unexpected logs / output. Other similar use cases error due to missing files due to same issue. This may be something very simple (haven't used golang in many years) but seems like there may be an underlying issue with the execution engine.
I would expect this code to run the `ls` command twice, one time showing the two mounted directories, one time showing the root output. Instead in the logs I see `ls` with d1 and d2 (expected), an `ls` with just d1 (??), and then an `ls` with the root fs. This causes issues if the first ls is changed to `ls /example/d2` as it will error the whole pipeline due to missing path.
```golang
workdir := client.Host().Workdir()
d1, err := workdir.Read().Directory("dir1/").ID(ctx)
if err != nil {
return err
}
d2, err := workdir.Read().Directory("dir2/").ID(ctx)
if err != nil {
return err
}
build := client.Container().From("alpine:latest").
WithMountedDirectory("/example/d1", d1).
WithMountedDirectory("/example/d2", d2)
build = build.Exec(dagger.ContainerExecOpts{
Args: []string{"ls", "/example"},
})
_, err = build.ExitCode(ctx)
if err != nil {
return err
}
build = build.Exec(dagger.ContainerExecOpts{
Args: []string{"ls", "/"},
})
_, err = build.ExitCode(ctx)
if err != nil {
return err
}
```
I was able to get the same functionality working fine by using `fs, err := build.FS().WithDirectory(d1, "/example/d1").WithDirectory(d2, "/example/d2").ID(ctx); build = build.WithFS(fs);` so conceptually don't think I'm doing anything wrong.
### Log output
```
#1 resolve image config for docker.io/library/alpine:latest
#1 DONE 0.4s
#2 mkfile /Dockerfile
#2 DONE 0.0s
#3 mkfile /main.go
#3 CACHED
#4 [internal] load metadata for docker.io/library/golang:1.18.2-alpine
#4 DONE 0.1s
#5 local://__dagger_workdir_/home/plaisted/source/OSD.PJI-Temporary/repro
#5 DONE 0.0s
#6 local://__dagger_workdir_/home/plaisted/source/OSD.PJI-Temporary/repro
#6 transferring __dagger_workdir_/home/plaisted/source/OSD.PJI-Temporary/repro: 309B done
#6 DONE 0.0s
#7 [build 1/6] FROM docker.io/library/golang:1.18.2-alpine@sha256:4795c5d21f01e0777707ada02408debe77fe31848be97cf9fa8a1462da78d949
#7 resolve docker.io/library/golang:1.18.2-alpine@sha256:4795c5d21f01e0777707ada02408debe77fe31848be97cf9fa8a1462da78d949 0.0s done
#7 DONE 0.0s
#8 [build 3/6] RUN apk add --no-cache file git
#8 CACHED
#9 [build 4/6] RUN go mod init go.dagger.io/dagger/shim/cmd
#9 CACHED
#10 [build 2/6] WORKDIR /src
#10 CACHED
#11 [build 5/6] COPY . .
#11 CACHED
#12 [build 6/6] RUN CGO_ENABLED=0 go build -o /_shim -ldflags '-s -d -w' .
#12 CACHED
#13 [stage-1 1/1] COPY --from=build /_shim /_shim
#13 CACHED
#14 mkdir /meta
#14 CACHED
#15 copy / /
#15 DONE 0.0s
#16 docker-image://docker.io/library/alpine:latest
#16 resolve docker.io/library/alpine:latest
#16 resolve docker.io/library/alpine:latest 0.1s done
#16 CACHED
#17 copy / /
#17 CACHED
#18 ls /example
#18 0.157 d1
#18 0.157 d2
#18 DONE 0.2s
#1 resolve image config for docker.io/library/alpine:latest
#1 DONE 0.5s
#4 [internal] load metadata for docker.io/library/golang:1.18.2-alpine
#4 DONE 0.4s
#19 ls /example
#19 0.172 d1
#19 DONE 0.2s
#20 ls /
#20 0.105 _shim
#20 0.105 bin
#20 0.105 dagger
#20 0.105 dev
#20 0.105 etc
#20 0.105 example
#20 0.105 home
#20 0.105 lib
#20 0.105 media
#20 0.105 mnt
#20 0.105 opt
#20 0.105 proc
#20 0.105 root
#20 0.105 run
#20 0.105 sbin
#20 0.105 srv
#20 0.105 sys
#20 0.105 tmp
#20 0.105 usr
#20 0.105 var
#20 DONE 0.1s
#0 0.148 d1
#0 0.148 d2
#18 DONE 0.2s
#1 resolve image config for docker.io/library/alpine:latest
#1 DONE 0.4s
#4 [internal] load metadata for docker.io/library/golang:1.18.2-alpine
#4 DONE 0.4s
#19 ls /example
#0 0.135 d1
#19 DONE 0.2s
#20 ls /example
#0 0.104 d1
#0 0.104 d2
#20 DONE 0.1s
```
### Steps to reproduce
* Mount two directories
* Run multiple exec commands and observe logs output
### Dagger version
dagger v0.3.1
### OS version
Ubuntu-20.04
|
https://github.com/dagger/dagger/issues/3551
|
https://github.com/dagger/dagger/pull/3602
|
b734ed35554bbfbc5caf63674eaa9c22692e614e
|
b4bb0b9e06e1edf8b81f9054b7419daabcb5bedb
| 2022-10-26T01:16:16Z |
go
| 2022-10-31T22:13:34Z |
core/integration/container_test.go
|
WithNewFile struct {
WithNewFile struct {
Directory struct {
ID string
}
}
}
}
}{}
err := testutil.Query(
`{
directory {
withNewFile(path: "some-file", contents: "some-content") {
withNewFile(path: "some-dir/sub-file", contents: "sub-content") {
directory(path: "some-dir") {
id
}
}
}
}
}`, &dirRes, nil)
require.NoError(t, err)
id := dirRes.Directory.WithNewFile.WithNewFile.Directory.ID
execRes := struct {
Container struct {
From struct {
WithMountedDirectory struct {
Exec struct {
Exec struct {
Stdout struct {
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 3,551 |
π Odd container behavior with exec / multiple withMountedDirectory
|
### What is the issue?
The following code executes but provides unexpected logs / output. Other similar use cases error due to missing files due to same issue. This may be something very simple (haven't used golang in many years) but seems like there may be an underlying issue with the execution engine.
I would expect this code to run the `ls` command twice, one time showing the two mounted directories, one time showing the root output. Instead in the logs I see `ls` with d1 and d2 (expected), an `ls` with just d1 (??), and then an `ls` with the root fs. This causes issues if the first ls is changed to `ls /example/d2` as it will error the whole pipeline due to missing path.
```golang
workdir := client.Host().Workdir()
d1, err := workdir.Read().Directory("dir1/").ID(ctx)
if err != nil {
return err
}
d2, err := workdir.Read().Directory("dir2/").ID(ctx)
if err != nil {
return err
}
build := client.Container().From("alpine:latest").
WithMountedDirectory("/example/d1", d1).
WithMountedDirectory("/example/d2", d2)
build = build.Exec(dagger.ContainerExecOpts{
Args: []string{"ls", "/example"},
})
_, err = build.ExitCode(ctx)
if err != nil {
return err
}
build = build.Exec(dagger.ContainerExecOpts{
Args: []string{"ls", "/"},
})
_, err = build.ExitCode(ctx)
if err != nil {
return err
}
```
I was able to get the same functionality working fine by using `fs, err := build.FS().WithDirectory(d1, "/example/d1").WithDirectory(d2, "/example/d2").ID(ctx); build = build.WithFS(fs);` so conceptually don't think I'm doing anything wrong.
### Log output
```
#1 resolve image config for docker.io/library/alpine:latest
#1 DONE 0.4s
#2 mkfile /Dockerfile
#2 DONE 0.0s
#3 mkfile /main.go
#3 CACHED
#4 [internal] load metadata for docker.io/library/golang:1.18.2-alpine
#4 DONE 0.1s
#5 local://__dagger_workdir_/home/plaisted/source/OSD.PJI-Temporary/repro
#5 DONE 0.0s
#6 local://__dagger_workdir_/home/plaisted/source/OSD.PJI-Temporary/repro
#6 transferring __dagger_workdir_/home/plaisted/source/OSD.PJI-Temporary/repro: 309B done
#6 DONE 0.0s
#7 [build 1/6] FROM docker.io/library/golang:1.18.2-alpine@sha256:4795c5d21f01e0777707ada02408debe77fe31848be97cf9fa8a1462da78d949
#7 resolve docker.io/library/golang:1.18.2-alpine@sha256:4795c5d21f01e0777707ada02408debe77fe31848be97cf9fa8a1462da78d949 0.0s done
#7 DONE 0.0s
#8 [build 3/6] RUN apk add --no-cache file git
#8 CACHED
#9 [build 4/6] RUN go mod init go.dagger.io/dagger/shim/cmd
#9 CACHED
#10 [build 2/6] WORKDIR /src
#10 CACHED
#11 [build 5/6] COPY . .
#11 CACHED
#12 [build 6/6] RUN CGO_ENABLED=0 go build -o /_shim -ldflags '-s -d -w' .
#12 CACHED
#13 [stage-1 1/1] COPY --from=build /_shim /_shim
#13 CACHED
#14 mkdir /meta
#14 CACHED
#15 copy / /
#15 DONE 0.0s
#16 docker-image://docker.io/library/alpine:latest
#16 resolve docker.io/library/alpine:latest
#16 resolve docker.io/library/alpine:latest 0.1s done
#16 CACHED
#17 copy / /
#17 CACHED
#18 ls /example
#18 0.157 d1
#18 0.157 d2
#18 DONE 0.2s
#1 resolve image config for docker.io/library/alpine:latest
#1 DONE 0.5s
#4 [internal] load metadata for docker.io/library/golang:1.18.2-alpine
#4 DONE 0.4s
#19 ls /example
#19 0.172 d1
#19 DONE 0.2s
#20 ls /
#20 0.105 _shim
#20 0.105 bin
#20 0.105 dagger
#20 0.105 dev
#20 0.105 etc
#20 0.105 example
#20 0.105 home
#20 0.105 lib
#20 0.105 media
#20 0.105 mnt
#20 0.105 opt
#20 0.105 proc
#20 0.105 root
#20 0.105 run
#20 0.105 sbin
#20 0.105 srv
#20 0.105 sys
#20 0.105 tmp
#20 0.105 usr
#20 0.105 var
#20 DONE 0.1s
#0 0.148 d1
#0 0.148 d2
#18 DONE 0.2s
#1 resolve image config for docker.io/library/alpine:latest
#1 DONE 0.4s
#4 [internal] load metadata for docker.io/library/golang:1.18.2-alpine
#4 DONE 0.4s
#19 ls /example
#0 0.135 d1
#19 DONE 0.2s
#20 ls /example
#0 0.104 d1
#0 0.104 d2
#20 DONE 0.1s
```
### Steps to reproduce
* Mount two directories
* Run multiple exec commands and observe logs output
### Dagger version
dagger v0.3.1
### OS version
Ubuntu-20.04
|
https://github.com/dagger/dagger/issues/3551
|
https://github.com/dagger/dagger/pull/3602
|
b734ed35554bbfbc5caf63674eaa9c22692e614e
|
b4bb0b9e06e1edf8b81f9054b7419daabcb5bedb
| 2022-10-26T01:16:16Z |
go
| 2022-10-31T22:13:34Z |
core/integration/container_test.go
|
Contents string
}
}
}
}
}
}
}{}
err = testutil.Query(
`query Test($id: DirectoryID!) {
container {
from(address: "alpine:3.16.2") {
withMountedDirectory(path: "/mnt", source: $id) {
exec(args: ["sh", "-c", "echo >> /mnt/sub-file; echo -n more-content >> /mnt/sub-file"]) {
exec(args: ["cat", "/mnt/sub-file"]) {
stdout {
contents
}
}
}
}
}
}
}`, &execRes, &testutil.QueryOptions{Variables: map[string]any{
"id": id,
}})
require.NoError(t, err)
require.Equal(t, "sub-content\nmore-content", execRes.Container.From.WithMountedDirectory.Exec.Exec.Stdout.Contents)
}
func TestContainerWithMountedDirectoryPropagation(t *testing.T) {
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 3,551 |
π Odd container behavior with exec / multiple withMountedDirectory
|
### What is the issue?
The following code executes but provides unexpected logs / output. Other similar use cases error due to missing files due to same issue. This may be something very simple (haven't used golang in many years) but seems like there may be an underlying issue with the execution engine.
I would expect this code to run the `ls` command twice, one time showing the two mounted directories, one time showing the root output. Instead in the logs I see `ls` with d1 and d2 (expected), an `ls` with just d1 (??), and then an `ls` with the root fs. This causes issues if the first ls is changed to `ls /example/d2` as it will error the whole pipeline due to missing path.
```golang
workdir := client.Host().Workdir()
d1, err := workdir.Read().Directory("dir1/").ID(ctx)
if err != nil {
return err
}
d2, err := workdir.Read().Directory("dir2/").ID(ctx)
if err != nil {
return err
}
build := client.Container().From("alpine:latest").
WithMountedDirectory("/example/d1", d1).
WithMountedDirectory("/example/d2", d2)
build = build.Exec(dagger.ContainerExecOpts{
Args: []string{"ls", "/example"},
})
_, err = build.ExitCode(ctx)
if err != nil {
return err
}
build = build.Exec(dagger.ContainerExecOpts{
Args: []string{"ls", "/"},
})
_, err = build.ExitCode(ctx)
if err != nil {
return err
}
```
I was able to get the same functionality working fine by using `fs, err := build.FS().WithDirectory(d1, "/example/d1").WithDirectory(d2, "/example/d2").ID(ctx); build = build.WithFS(fs);` so conceptually don't think I'm doing anything wrong.
### Log output
```
#1 resolve image config for docker.io/library/alpine:latest
#1 DONE 0.4s
#2 mkfile /Dockerfile
#2 DONE 0.0s
#3 mkfile /main.go
#3 CACHED
#4 [internal] load metadata for docker.io/library/golang:1.18.2-alpine
#4 DONE 0.1s
#5 local://__dagger_workdir_/home/plaisted/source/OSD.PJI-Temporary/repro
#5 DONE 0.0s
#6 local://__dagger_workdir_/home/plaisted/source/OSD.PJI-Temporary/repro
#6 transferring __dagger_workdir_/home/plaisted/source/OSD.PJI-Temporary/repro: 309B done
#6 DONE 0.0s
#7 [build 1/6] FROM docker.io/library/golang:1.18.2-alpine@sha256:4795c5d21f01e0777707ada02408debe77fe31848be97cf9fa8a1462da78d949
#7 resolve docker.io/library/golang:1.18.2-alpine@sha256:4795c5d21f01e0777707ada02408debe77fe31848be97cf9fa8a1462da78d949 0.0s done
#7 DONE 0.0s
#8 [build 3/6] RUN apk add --no-cache file git
#8 CACHED
#9 [build 4/6] RUN go mod init go.dagger.io/dagger/shim/cmd
#9 CACHED
#10 [build 2/6] WORKDIR /src
#10 CACHED
#11 [build 5/6] COPY . .
#11 CACHED
#12 [build 6/6] RUN CGO_ENABLED=0 go build -o /_shim -ldflags '-s -d -w' .
#12 CACHED
#13 [stage-1 1/1] COPY --from=build /_shim /_shim
#13 CACHED
#14 mkdir /meta
#14 CACHED
#15 copy / /
#15 DONE 0.0s
#16 docker-image://docker.io/library/alpine:latest
#16 resolve docker.io/library/alpine:latest
#16 resolve docker.io/library/alpine:latest 0.1s done
#16 CACHED
#17 copy / /
#17 CACHED
#18 ls /example
#18 0.157 d1
#18 0.157 d2
#18 DONE 0.2s
#1 resolve image config for docker.io/library/alpine:latest
#1 DONE 0.5s
#4 [internal] load metadata for docker.io/library/golang:1.18.2-alpine
#4 DONE 0.4s
#19 ls /example
#19 0.172 d1
#19 DONE 0.2s
#20 ls /
#20 0.105 _shim
#20 0.105 bin
#20 0.105 dagger
#20 0.105 dev
#20 0.105 etc
#20 0.105 example
#20 0.105 home
#20 0.105 lib
#20 0.105 media
#20 0.105 mnt
#20 0.105 opt
#20 0.105 proc
#20 0.105 root
#20 0.105 run
#20 0.105 sbin
#20 0.105 srv
#20 0.105 sys
#20 0.105 tmp
#20 0.105 usr
#20 0.105 var
#20 DONE 0.1s
#0 0.148 d1
#0 0.148 d2
#18 DONE 0.2s
#1 resolve image config for docker.io/library/alpine:latest
#1 DONE 0.4s
#4 [internal] load metadata for docker.io/library/golang:1.18.2-alpine
#4 DONE 0.4s
#19 ls /example
#0 0.135 d1
#19 DONE 0.2s
#20 ls /example
#0 0.104 d1
#0 0.104 d2
#20 DONE 0.1s
```
### Steps to reproduce
* Mount two directories
* Run multiple exec commands and observe logs output
### Dagger version
dagger v0.3.1
### OS version
Ubuntu-20.04
|
https://github.com/dagger/dagger/issues/3551
|
https://github.com/dagger/dagger/pull/3602
|
b734ed35554bbfbc5caf63674eaa9c22692e614e
|
b4bb0b9e06e1edf8b81f9054b7419daabcb5bedb
| 2022-10-26T01:16:16Z |
go
| 2022-10-31T22:13:34Z |
core/integration/container_test.go
|
t.Parallel()
dirRes := struct {
Directory struct {
WithNewFile struct {
ID core.DirectoryID
}
}
}{}
err := testutil.Query(
`{
directory {
withNewFile(path: "some-file", contents: "some-content") {
id
}
}
}`, &dirRes, nil)
require.NoError(t, err)
id := dirRes.Directory.WithNewFile.ID
execRes := struct {
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 3,551 |
π Odd container behavior with exec / multiple withMountedDirectory
|
### What is the issue?
The following code executes but provides unexpected logs / output. Other similar use cases error due to missing files due to same issue. This may be something very simple (haven't used golang in many years) but seems like there may be an underlying issue with the execution engine.
I would expect this code to run the `ls` command twice, one time showing the two mounted directories, one time showing the root output. Instead in the logs I see `ls` with d1 and d2 (expected), an `ls` with just d1 (??), and then an `ls` with the root fs. This causes issues if the first ls is changed to `ls /example/d2` as it will error the whole pipeline due to missing path.
```golang
workdir := client.Host().Workdir()
d1, err := workdir.Read().Directory("dir1/").ID(ctx)
if err != nil {
return err
}
d2, err := workdir.Read().Directory("dir2/").ID(ctx)
if err != nil {
return err
}
build := client.Container().From("alpine:latest").
WithMountedDirectory("/example/d1", d1).
WithMountedDirectory("/example/d2", d2)
build = build.Exec(dagger.ContainerExecOpts{
Args: []string{"ls", "/example"},
})
_, err = build.ExitCode(ctx)
if err != nil {
return err
}
build = build.Exec(dagger.ContainerExecOpts{
Args: []string{"ls", "/"},
})
_, err = build.ExitCode(ctx)
if err != nil {
return err
}
```
I was able to get the same functionality working fine by using `fs, err := build.FS().WithDirectory(d1, "/example/d1").WithDirectory(d2, "/example/d2").ID(ctx); build = build.WithFS(fs);` so conceptually don't think I'm doing anything wrong.
### Log output
```
#1 resolve image config for docker.io/library/alpine:latest
#1 DONE 0.4s
#2 mkfile /Dockerfile
#2 DONE 0.0s
#3 mkfile /main.go
#3 CACHED
#4 [internal] load metadata for docker.io/library/golang:1.18.2-alpine
#4 DONE 0.1s
#5 local://__dagger_workdir_/home/plaisted/source/OSD.PJI-Temporary/repro
#5 DONE 0.0s
#6 local://__dagger_workdir_/home/plaisted/source/OSD.PJI-Temporary/repro
#6 transferring __dagger_workdir_/home/plaisted/source/OSD.PJI-Temporary/repro: 309B done
#6 DONE 0.0s
#7 [build 1/6] FROM docker.io/library/golang:1.18.2-alpine@sha256:4795c5d21f01e0777707ada02408debe77fe31848be97cf9fa8a1462da78d949
#7 resolve docker.io/library/golang:1.18.2-alpine@sha256:4795c5d21f01e0777707ada02408debe77fe31848be97cf9fa8a1462da78d949 0.0s done
#7 DONE 0.0s
#8 [build 3/6] RUN apk add --no-cache file git
#8 CACHED
#9 [build 4/6] RUN go mod init go.dagger.io/dagger/shim/cmd
#9 CACHED
#10 [build 2/6] WORKDIR /src
#10 CACHED
#11 [build 5/6] COPY . .
#11 CACHED
#12 [build 6/6] RUN CGO_ENABLED=0 go build -o /_shim -ldflags '-s -d -w' .
#12 CACHED
#13 [stage-1 1/1] COPY --from=build /_shim /_shim
#13 CACHED
#14 mkdir /meta
#14 CACHED
#15 copy / /
#15 DONE 0.0s
#16 docker-image://docker.io/library/alpine:latest
#16 resolve docker.io/library/alpine:latest
#16 resolve docker.io/library/alpine:latest 0.1s done
#16 CACHED
#17 copy / /
#17 CACHED
#18 ls /example
#18 0.157 d1
#18 0.157 d2
#18 DONE 0.2s
#1 resolve image config for docker.io/library/alpine:latest
#1 DONE 0.5s
#4 [internal] load metadata for docker.io/library/golang:1.18.2-alpine
#4 DONE 0.4s
#19 ls /example
#19 0.172 d1
#19 DONE 0.2s
#20 ls /
#20 0.105 _shim
#20 0.105 bin
#20 0.105 dagger
#20 0.105 dev
#20 0.105 etc
#20 0.105 example
#20 0.105 home
#20 0.105 lib
#20 0.105 media
#20 0.105 mnt
#20 0.105 opt
#20 0.105 proc
#20 0.105 root
#20 0.105 run
#20 0.105 sbin
#20 0.105 srv
#20 0.105 sys
#20 0.105 tmp
#20 0.105 usr
#20 0.105 var
#20 DONE 0.1s
#0 0.148 d1
#0 0.148 d2
#18 DONE 0.2s
#1 resolve image config for docker.io/library/alpine:latest
#1 DONE 0.4s
#4 [internal] load metadata for docker.io/library/golang:1.18.2-alpine
#4 DONE 0.4s
#19 ls /example
#0 0.135 d1
#19 DONE 0.2s
#20 ls /example
#0 0.104 d1
#0 0.104 d2
#20 DONE 0.1s
```
### Steps to reproduce
* Mount two directories
* Run multiple exec commands and observe logs output
### Dagger version
dagger v0.3.1
### OS version
Ubuntu-20.04
|
https://github.com/dagger/dagger/issues/3551
|
https://github.com/dagger/dagger/pull/3602
|
b734ed35554bbfbc5caf63674eaa9c22692e614e
|
b4bb0b9e06e1edf8b81f9054b7419daabcb5bedb
| 2022-10-26T01:16:16Z |
go
| 2022-10-31T22:13:34Z |
core/integration/container_test.go
|
Container struct {
From struct {
WithMountedDirectory struct {
Exec struct {
Stdout struct {
Contents string
}
Exec struct {
Exec struct {
Stdout struct {
Contents string
}
WithMountedDirectory struct {
Exec struct {
Stdout struct {
Contents string
}
Exec struct {
Stdout struct {
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 3,551 |
π Odd container behavior with exec / multiple withMountedDirectory
|
### What is the issue?
The following code executes but provides unexpected logs / output. Other similar use cases error due to missing files due to same issue. This may be something very simple (haven't used golang in many years) but seems like there may be an underlying issue with the execution engine.
I would expect this code to run the `ls` command twice, one time showing the two mounted directories, one time showing the root output. Instead in the logs I see `ls` with d1 and d2 (expected), an `ls` with just d1 (??), and then an `ls` with the root fs. This causes issues if the first ls is changed to `ls /example/d2` as it will error the whole pipeline due to missing path.
```golang
workdir := client.Host().Workdir()
d1, err := workdir.Read().Directory("dir1/").ID(ctx)
if err != nil {
return err
}
d2, err := workdir.Read().Directory("dir2/").ID(ctx)
if err != nil {
return err
}
build := client.Container().From("alpine:latest").
WithMountedDirectory("/example/d1", d1).
WithMountedDirectory("/example/d2", d2)
build = build.Exec(dagger.ContainerExecOpts{
Args: []string{"ls", "/example"},
})
_, err = build.ExitCode(ctx)
if err != nil {
return err
}
build = build.Exec(dagger.ContainerExecOpts{
Args: []string{"ls", "/"},
})
_, err = build.ExitCode(ctx)
if err != nil {
return err
}
```
I was able to get the same functionality working fine by using `fs, err := build.FS().WithDirectory(d1, "/example/d1").WithDirectory(d2, "/example/d2").ID(ctx); build = build.WithFS(fs);` so conceptually don't think I'm doing anything wrong.
### Log output
```
#1 resolve image config for docker.io/library/alpine:latest
#1 DONE 0.4s
#2 mkfile /Dockerfile
#2 DONE 0.0s
#3 mkfile /main.go
#3 CACHED
#4 [internal] load metadata for docker.io/library/golang:1.18.2-alpine
#4 DONE 0.1s
#5 local://__dagger_workdir_/home/plaisted/source/OSD.PJI-Temporary/repro
#5 DONE 0.0s
#6 local://__dagger_workdir_/home/plaisted/source/OSD.PJI-Temporary/repro
#6 transferring __dagger_workdir_/home/plaisted/source/OSD.PJI-Temporary/repro: 309B done
#6 DONE 0.0s
#7 [build 1/6] FROM docker.io/library/golang:1.18.2-alpine@sha256:4795c5d21f01e0777707ada02408debe77fe31848be97cf9fa8a1462da78d949
#7 resolve docker.io/library/golang:1.18.2-alpine@sha256:4795c5d21f01e0777707ada02408debe77fe31848be97cf9fa8a1462da78d949 0.0s done
#7 DONE 0.0s
#8 [build 3/6] RUN apk add --no-cache file git
#8 CACHED
#9 [build 4/6] RUN go mod init go.dagger.io/dagger/shim/cmd
#9 CACHED
#10 [build 2/6] WORKDIR /src
#10 CACHED
#11 [build 5/6] COPY . .
#11 CACHED
#12 [build 6/6] RUN CGO_ENABLED=0 go build -o /_shim -ldflags '-s -d -w' .
#12 CACHED
#13 [stage-1 1/1] COPY --from=build /_shim /_shim
#13 CACHED
#14 mkdir /meta
#14 CACHED
#15 copy / /
#15 DONE 0.0s
#16 docker-image://docker.io/library/alpine:latest
#16 resolve docker.io/library/alpine:latest
#16 resolve docker.io/library/alpine:latest 0.1s done
#16 CACHED
#17 copy / /
#17 CACHED
#18 ls /example
#18 0.157 d1
#18 0.157 d2
#18 DONE 0.2s
#1 resolve image config for docker.io/library/alpine:latest
#1 DONE 0.5s
#4 [internal] load metadata for docker.io/library/golang:1.18.2-alpine
#4 DONE 0.4s
#19 ls /example
#19 0.172 d1
#19 DONE 0.2s
#20 ls /
#20 0.105 _shim
#20 0.105 bin
#20 0.105 dagger
#20 0.105 dev
#20 0.105 etc
#20 0.105 example
#20 0.105 home
#20 0.105 lib
#20 0.105 media
#20 0.105 mnt
#20 0.105 opt
#20 0.105 proc
#20 0.105 root
#20 0.105 run
#20 0.105 sbin
#20 0.105 srv
#20 0.105 sys
#20 0.105 tmp
#20 0.105 usr
#20 0.105 var
#20 DONE 0.1s
#0 0.148 d1
#0 0.148 d2
#18 DONE 0.2s
#1 resolve image config for docker.io/library/alpine:latest
#1 DONE 0.4s
#4 [internal] load metadata for docker.io/library/golang:1.18.2-alpine
#4 DONE 0.4s
#19 ls /example
#0 0.135 d1
#19 DONE 0.2s
#20 ls /example
#0 0.104 d1
#0 0.104 d2
#20 DONE 0.1s
```
### Steps to reproduce
* Mount two directories
* Run multiple exec commands and observe logs output
### Dagger version
dagger v0.3.1
### OS version
Ubuntu-20.04
|
https://github.com/dagger/dagger/issues/3551
|
https://github.com/dagger/dagger/pull/3602
|
b734ed35554bbfbc5caf63674eaa9c22692e614e
|
b4bb0b9e06e1edf8b81f9054b7419daabcb5bedb
| 2022-10-26T01:16:16Z |
go
| 2022-10-31T22:13:34Z |
core/integration/container_test.go
|
Contents string
}
}
}
}
}
}
}
}
}
}
}{}
err = testutil.Query(
`query Test($id: DirectoryID!) {
container {
from(address: "alpine:3.16.2") {
withMountedDirectory(path: "/mnt", source: $id) {
exec(args: ["cat", "/mnt/some-file"]) {
# original content
stdout { contents }
exec(args: ["sh", "-c", "echo >> /mnt/some-file; echo -n more-content >> /mnt/some-file"]) {
exec(args: ["cat", "/mnt/some-file"]) {
# modified content should propagate
stdout { contents }
withMountedDirectory(path: "/mnt", source: $id) {
exec(args: ["cat", "/mnt/some-file"]) {
# should be back to the original content
stdout { contents }
exec(args: ["cat", "/mnt/some-file"]) {
# original content override should propagate
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 3,551 |
π Odd container behavior with exec / multiple withMountedDirectory
|
### What is the issue?
The following code executes but provides unexpected logs / output. Other similar use cases error due to missing files due to same issue. This may be something very simple (haven't used golang in many years) but seems like there may be an underlying issue with the execution engine.
I would expect this code to run the `ls` command twice, one time showing the two mounted directories, one time showing the root output. Instead in the logs I see `ls` with d1 and d2 (expected), an `ls` with just d1 (??), and then an `ls` with the root fs. This causes issues if the first ls is changed to `ls /example/d2` as it will error the whole pipeline due to missing path.
```golang
workdir := client.Host().Workdir()
d1, err := workdir.Read().Directory("dir1/").ID(ctx)
if err != nil {
return err
}
d2, err := workdir.Read().Directory("dir2/").ID(ctx)
if err != nil {
return err
}
build := client.Container().From("alpine:latest").
WithMountedDirectory("/example/d1", d1).
WithMountedDirectory("/example/d2", d2)
build = build.Exec(dagger.ContainerExecOpts{
Args: []string{"ls", "/example"},
})
_, err = build.ExitCode(ctx)
if err != nil {
return err
}
build = build.Exec(dagger.ContainerExecOpts{
Args: []string{"ls", "/"},
})
_, err = build.ExitCode(ctx)
if err != nil {
return err
}
```
I was able to get the same functionality working fine by using `fs, err := build.FS().WithDirectory(d1, "/example/d1").WithDirectory(d2, "/example/d2").ID(ctx); build = build.WithFS(fs);` so conceptually don't think I'm doing anything wrong.
### Log output
```
#1 resolve image config for docker.io/library/alpine:latest
#1 DONE 0.4s
#2 mkfile /Dockerfile
#2 DONE 0.0s
#3 mkfile /main.go
#3 CACHED
#4 [internal] load metadata for docker.io/library/golang:1.18.2-alpine
#4 DONE 0.1s
#5 local://__dagger_workdir_/home/plaisted/source/OSD.PJI-Temporary/repro
#5 DONE 0.0s
#6 local://__dagger_workdir_/home/plaisted/source/OSD.PJI-Temporary/repro
#6 transferring __dagger_workdir_/home/plaisted/source/OSD.PJI-Temporary/repro: 309B done
#6 DONE 0.0s
#7 [build 1/6] FROM docker.io/library/golang:1.18.2-alpine@sha256:4795c5d21f01e0777707ada02408debe77fe31848be97cf9fa8a1462da78d949
#7 resolve docker.io/library/golang:1.18.2-alpine@sha256:4795c5d21f01e0777707ada02408debe77fe31848be97cf9fa8a1462da78d949 0.0s done
#7 DONE 0.0s
#8 [build 3/6] RUN apk add --no-cache file git
#8 CACHED
#9 [build 4/6] RUN go mod init go.dagger.io/dagger/shim/cmd
#9 CACHED
#10 [build 2/6] WORKDIR /src
#10 CACHED
#11 [build 5/6] COPY . .
#11 CACHED
#12 [build 6/6] RUN CGO_ENABLED=0 go build -o /_shim -ldflags '-s -d -w' .
#12 CACHED
#13 [stage-1 1/1] COPY --from=build /_shim /_shim
#13 CACHED
#14 mkdir /meta
#14 CACHED
#15 copy / /
#15 DONE 0.0s
#16 docker-image://docker.io/library/alpine:latest
#16 resolve docker.io/library/alpine:latest
#16 resolve docker.io/library/alpine:latest 0.1s done
#16 CACHED
#17 copy / /
#17 CACHED
#18 ls /example
#18 0.157 d1
#18 0.157 d2
#18 DONE 0.2s
#1 resolve image config for docker.io/library/alpine:latest
#1 DONE 0.5s
#4 [internal] load metadata for docker.io/library/golang:1.18.2-alpine
#4 DONE 0.4s
#19 ls /example
#19 0.172 d1
#19 DONE 0.2s
#20 ls /
#20 0.105 _shim
#20 0.105 bin
#20 0.105 dagger
#20 0.105 dev
#20 0.105 etc
#20 0.105 example
#20 0.105 home
#20 0.105 lib
#20 0.105 media
#20 0.105 mnt
#20 0.105 opt
#20 0.105 proc
#20 0.105 root
#20 0.105 run
#20 0.105 sbin
#20 0.105 srv
#20 0.105 sys
#20 0.105 tmp
#20 0.105 usr
#20 0.105 var
#20 DONE 0.1s
#0 0.148 d1
#0 0.148 d2
#18 DONE 0.2s
#1 resolve image config for docker.io/library/alpine:latest
#1 DONE 0.4s
#4 [internal] load metadata for docker.io/library/golang:1.18.2-alpine
#4 DONE 0.4s
#19 ls /example
#0 0.135 d1
#19 DONE 0.2s
#20 ls /example
#0 0.104 d1
#0 0.104 d2
#20 DONE 0.1s
```
### Steps to reproduce
* Mount two directories
* Run multiple exec commands and observe logs output
### Dagger version
dagger v0.3.1
### OS version
Ubuntu-20.04
|
https://github.com/dagger/dagger/issues/3551
|
https://github.com/dagger/dagger/pull/3602
|
b734ed35554bbfbc5caf63674eaa9c22692e614e
|
b4bb0b9e06e1edf8b81f9054b7419daabcb5bedb
| 2022-10-26T01:16:16Z |
go
| 2022-10-31T22:13:34Z |
core/integration/container_test.go
|
stdout { contents }
}
}
}
}
}
}
}
}
}
}`, &execRes, &testutil.QueryOptions{Variables: map[string]any{
"id": id,
}})
require.NoError(t, err)
require.Equal(t,
"some-content",
execRes.Container.From.WithMountedDirectory.Exec.Stdout.Contents)
require.Equal(t,
"some-content\nmore-content",
execRes.Container.From.WithMountedDirectory.Exec.Exec.Exec.Stdout.Contents)
require.Equal(t,
"some-content",
execRes.Container.From.WithMountedDirectory.Exec.Exec.Exec.WithMountedDirectory.Exec.Stdout.Contents)
require.Equal(t,
"some-content",
execRes.Container.From.WithMountedDirectory.Exec.Exec.Exec.WithMountedDirectory.Exec.Exec.Stdout.Contents)
}
func TestContainerWithMountedFile(t *testing.T) {
t.Parallel()
dirRes := struct {
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 3,551 |
π Odd container behavior with exec / multiple withMountedDirectory
|
### What is the issue?
The following code executes but provides unexpected logs / output. Other similar use cases error due to missing files due to same issue. This may be something very simple (haven't used golang in many years) but seems like there may be an underlying issue with the execution engine.
I would expect this code to run the `ls` command twice, one time showing the two mounted directories, one time showing the root output. Instead in the logs I see `ls` with d1 and d2 (expected), an `ls` with just d1 (??), and then an `ls` with the root fs. This causes issues if the first ls is changed to `ls /example/d2` as it will error the whole pipeline due to missing path.
```golang
workdir := client.Host().Workdir()
d1, err := workdir.Read().Directory("dir1/").ID(ctx)
if err != nil {
return err
}
d2, err := workdir.Read().Directory("dir2/").ID(ctx)
if err != nil {
return err
}
build := client.Container().From("alpine:latest").
WithMountedDirectory("/example/d1", d1).
WithMountedDirectory("/example/d2", d2)
build = build.Exec(dagger.ContainerExecOpts{
Args: []string{"ls", "/example"},
})
_, err = build.ExitCode(ctx)
if err != nil {
return err
}
build = build.Exec(dagger.ContainerExecOpts{
Args: []string{"ls", "/"},
})
_, err = build.ExitCode(ctx)
if err != nil {
return err
}
```
I was able to get the same functionality working fine by using `fs, err := build.FS().WithDirectory(d1, "/example/d1").WithDirectory(d2, "/example/d2").ID(ctx); build = build.WithFS(fs);` so conceptually don't think I'm doing anything wrong.
### Log output
```
#1 resolve image config for docker.io/library/alpine:latest
#1 DONE 0.4s
#2 mkfile /Dockerfile
#2 DONE 0.0s
#3 mkfile /main.go
#3 CACHED
#4 [internal] load metadata for docker.io/library/golang:1.18.2-alpine
#4 DONE 0.1s
#5 local://__dagger_workdir_/home/plaisted/source/OSD.PJI-Temporary/repro
#5 DONE 0.0s
#6 local://__dagger_workdir_/home/plaisted/source/OSD.PJI-Temporary/repro
#6 transferring __dagger_workdir_/home/plaisted/source/OSD.PJI-Temporary/repro: 309B done
#6 DONE 0.0s
#7 [build 1/6] FROM docker.io/library/golang:1.18.2-alpine@sha256:4795c5d21f01e0777707ada02408debe77fe31848be97cf9fa8a1462da78d949
#7 resolve docker.io/library/golang:1.18.2-alpine@sha256:4795c5d21f01e0777707ada02408debe77fe31848be97cf9fa8a1462da78d949 0.0s done
#7 DONE 0.0s
#8 [build 3/6] RUN apk add --no-cache file git
#8 CACHED
#9 [build 4/6] RUN go mod init go.dagger.io/dagger/shim/cmd
#9 CACHED
#10 [build 2/6] WORKDIR /src
#10 CACHED
#11 [build 5/6] COPY . .
#11 CACHED
#12 [build 6/6] RUN CGO_ENABLED=0 go build -o /_shim -ldflags '-s -d -w' .
#12 CACHED
#13 [stage-1 1/1] COPY --from=build /_shim /_shim
#13 CACHED
#14 mkdir /meta
#14 CACHED
#15 copy / /
#15 DONE 0.0s
#16 docker-image://docker.io/library/alpine:latest
#16 resolve docker.io/library/alpine:latest
#16 resolve docker.io/library/alpine:latest 0.1s done
#16 CACHED
#17 copy / /
#17 CACHED
#18 ls /example
#18 0.157 d1
#18 0.157 d2
#18 DONE 0.2s
#1 resolve image config for docker.io/library/alpine:latest
#1 DONE 0.5s
#4 [internal] load metadata for docker.io/library/golang:1.18.2-alpine
#4 DONE 0.4s
#19 ls /example
#19 0.172 d1
#19 DONE 0.2s
#20 ls /
#20 0.105 _shim
#20 0.105 bin
#20 0.105 dagger
#20 0.105 dev
#20 0.105 etc
#20 0.105 example
#20 0.105 home
#20 0.105 lib
#20 0.105 media
#20 0.105 mnt
#20 0.105 opt
#20 0.105 proc
#20 0.105 root
#20 0.105 run
#20 0.105 sbin
#20 0.105 srv
#20 0.105 sys
#20 0.105 tmp
#20 0.105 usr
#20 0.105 var
#20 DONE 0.1s
#0 0.148 d1
#0 0.148 d2
#18 DONE 0.2s
#1 resolve image config for docker.io/library/alpine:latest
#1 DONE 0.4s
#4 [internal] load metadata for docker.io/library/golang:1.18.2-alpine
#4 DONE 0.4s
#19 ls /example
#0 0.135 d1
#19 DONE 0.2s
#20 ls /example
#0 0.104 d1
#0 0.104 d2
#20 DONE 0.1s
```
### Steps to reproduce
* Mount two directories
* Run multiple exec commands and observe logs output
### Dagger version
dagger v0.3.1
### OS version
Ubuntu-20.04
|
https://github.com/dagger/dagger/issues/3551
|
https://github.com/dagger/dagger/pull/3602
|
b734ed35554bbfbc5caf63674eaa9c22692e614e
|
b4bb0b9e06e1edf8b81f9054b7419daabcb5bedb
| 2022-10-26T01:16:16Z |
go
| 2022-10-31T22:13:34Z |
core/integration/container_test.go
|
Directory struct {
WithNewFile struct {
File struct {
ID core.FileID
}
}
}
}{}
err := testutil.Query(
`{
directory {
withNewFile(path: "some-dir/sub-file", contents: "sub-content") {
file(path: "some-dir/sub-file") {
id
}
}
}
}`, &dirRes, nil)
require.NoError(t, err)
id := dirRes.Directory.WithNewFile.File.ID
execRes := struct {
Container struct {
From struct {
WithMountedFile struct {
Exec struct {
Stdout struct {
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 3,551 |
π Odd container behavior with exec / multiple withMountedDirectory
|
### What is the issue?
The following code executes but provides unexpected logs / output. Other similar use cases error due to missing files due to same issue. This may be something very simple (haven't used golang in many years) but seems like there may be an underlying issue with the execution engine.
I would expect this code to run the `ls` command twice, one time showing the two mounted directories, one time showing the root output. Instead in the logs I see `ls` with d1 and d2 (expected), an `ls` with just d1 (??), and then an `ls` with the root fs. This causes issues if the first ls is changed to `ls /example/d2` as it will error the whole pipeline due to missing path.
```golang
workdir := client.Host().Workdir()
d1, err := workdir.Read().Directory("dir1/").ID(ctx)
if err != nil {
return err
}
d2, err := workdir.Read().Directory("dir2/").ID(ctx)
if err != nil {
return err
}
build := client.Container().From("alpine:latest").
WithMountedDirectory("/example/d1", d1).
WithMountedDirectory("/example/d2", d2)
build = build.Exec(dagger.ContainerExecOpts{
Args: []string{"ls", "/example"},
})
_, err = build.ExitCode(ctx)
if err != nil {
return err
}
build = build.Exec(dagger.ContainerExecOpts{
Args: []string{"ls", "/"},
})
_, err = build.ExitCode(ctx)
if err != nil {
return err
}
```
I was able to get the same functionality working fine by using `fs, err := build.FS().WithDirectory(d1, "/example/d1").WithDirectory(d2, "/example/d2").ID(ctx); build = build.WithFS(fs);` so conceptually don't think I'm doing anything wrong.
### Log output
```
#1 resolve image config for docker.io/library/alpine:latest
#1 DONE 0.4s
#2 mkfile /Dockerfile
#2 DONE 0.0s
#3 mkfile /main.go
#3 CACHED
#4 [internal] load metadata for docker.io/library/golang:1.18.2-alpine
#4 DONE 0.1s
#5 local://__dagger_workdir_/home/plaisted/source/OSD.PJI-Temporary/repro
#5 DONE 0.0s
#6 local://__dagger_workdir_/home/plaisted/source/OSD.PJI-Temporary/repro
#6 transferring __dagger_workdir_/home/plaisted/source/OSD.PJI-Temporary/repro: 309B done
#6 DONE 0.0s
#7 [build 1/6] FROM docker.io/library/golang:1.18.2-alpine@sha256:4795c5d21f01e0777707ada02408debe77fe31848be97cf9fa8a1462da78d949
#7 resolve docker.io/library/golang:1.18.2-alpine@sha256:4795c5d21f01e0777707ada02408debe77fe31848be97cf9fa8a1462da78d949 0.0s done
#7 DONE 0.0s
#8 [build 3/6] RUN apk add --no-cache file git
#8 CACHED
#9 [build 4/6] RUN go mod init go.dagger.io/dagger/shim/cmd
#9 CACHED
#10 [build 2/6] WORKDIR /src
#10 CACHED
#11 [build 5/6] COPY . .
#11 CACHED
#12 [build 6/6] RUN CGO_ENABLED=0 go build -o /_shim -ldflags '-s -d -w' .
#12 CACHED
#13 [stage-1 1/1] COPY --from=build /_shim /_shim
#13 CACHED
#14 mkdir /meta
#14 CACHED
#15 copy / /
#15 DONE 0.0s
#16 docker-image://docker.io/library/alpine:latest
#16 resolve docker.io/library/alpine:latest
#16 resolve docker.io/library/alpine:latest 0.1s done
#16 CACHED
#17 copy / /
#17 CACHED
#18 ls /example
#18 0.157 d1
#18 0.157 d2
#18 DONE 0.2s
#1 resolve image config for docker.io/library/alpine:latest
#1 DONE 0.5s
#4 [internal] load metadata for docker.io/library/golang:1.18.2-alpine
#4 DONE 0.4s
#19 ls /example
#19 0.172 d1
#19 DONE 0.2s
#20 ls /
#20 0.105 _shim
#20 0.105 bin
#20 0.105 dagger
#20 0.105 dev
#20 0.105 etc
#20 0.105 example
#20 0.105 home
#20 0.105 lib
#20 0.105 media
#20 0.105 mnt
#20 0.105 opt
#20 0.105 proc
#20 0.105 root
#20 0.105 run
#20 0.105 sbin
#20 0.105 srv
#20 0.105 sys
#20 0.105 tmp
#20 0.105 usr
#20 0.105 var
#20 DONE 0.1s
#0 0.148 d1
#0 0.148 d2
#18 DONE 0.2s
#1 resolve image config for docker.io/library/alpine:latest
#1 DONE 0.4s
#4 [internal] load metadata for docker.io/library/golang:1.18.2-alpine
#4 DONE 0.4s
#19 ls /example
#0 0.135 d1
#19 DONE 0.2s
#20 ls /example
#0 0.104 d1
#0 0.104 d2
#20 DONE 0.1s
```
### Steps to reproduce
* Mount two directories
* Run multiple exec commands and observe logs output
### Dagger version
dagger v0.3.1
### OS version
Ubuntu-20.04
|
https://github.com/dagger/dagger/issues/3551
|
https://github.com/dagger/dagger/pull/3602
|
b734ed35554bbfbc5caf63674eaa9c22692e614e
|
b4bb0b9e06e1edf8b81f9054b7419daabcb5bedb
| 2022-10-26T01:16:16Z |
go
| 2022-10-31T22:13:34Z |
core/integration/container_test.go
|
Contents string
}
}
}
}
}
}{}
err = testutil.Query(
`query Test($id: FileID!) {
container {
from(address: "alpine:3.16.2") {
withMountedFile(path: "/mnt/file", source: $id) {
exec(args: ["cat", "/mnt/file"]) {
stdout {
contents
}
}
}
}
}
}`, &execRes, &testutil.QueryOptions{Variables: map[string]any{
"id": id,
}})
require.NoError(t, err)
require.Equal(t, "sub-content", execRes.Container.From.WithMountedFile.Exec.Stdout.Contents)
}
func TestContainerWithMountedCache(t *testing.T) {
t.Parallel()
cacheID := newCache(t)
execRes := struct {
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 3,551 |
π Odd container behavior with exec / multiple withMountedDirectory
|
### What is the issue?
The following code executes but provides unexpected logs / output. Other similar use cases error due to missing files due to same issue. This may be something very simple (haven't used golang in many years) but seems like there may be an underlying issue with the execution engine.
I would expect this code to run the `ls` command twice, one time showing the two mounted directories, one time showing the root output. Instead in the logs I see `ls` with d1 and d2 (expected), an `ls` with just d1 (??), and then an `ls` with the root fs. This causes issues if the first ls is changed to `ls /example/d2` as it will error the whole pipeline due to missing path.
```golang
workdir := client.Host().Workdir()
d1, err := workdir.Read().Directory("dir1/").ID(ctx)
if err != nil {
return err
}
d2, err := workdir.Read().Directory("dir2/").ID(ctx)
if err != nil {
return err
}
build := client.Container().From("alpine:latest").
WithMountedDirectory("/example/d1", d1).
WithMountedDirectory("/example/d2", d2)
build = build.Exec(dagger.ContainerExecOpts{
Args: []string{"ls", "/example"},
})
_, err = build.ExitCode(ctx)
if err != nil {
return err
}
build = build.Exec(dagger.ContainerExecOpts{
Args: []string{"ls", "/"},
})
_, err = build.ExitCode(ctx)
if err != nil {
return err
}
```
I was able to get the same functionality working fine by using `fs, err := build.FS().WithDirectory(d1, "/example/d1").WithDirectory(d2, "/example/d2").ID(ctx); build = build.WithFS(fs);` so conceptually don't think I'm doing anything wrong.
### Log output
```
#1 resolve image config for docker.io/library/alpine:latest
#1 DONE 0.4s
#2 mkfile /Dockerfile
#2 DONE 0.0s
#3 mkfile /main.go
#3 CACHED
#4 [internal] load metadata for docker.io/library/golang:1.18.2-alpine
#4 DONE 0.1s
#5 local://__dagger_workdir_/home/plaisted/source/OSD.PJI-Temporary/repro
#5 DONE 0.0s
#6 local://__dagger_workdir_/home/plaisted/source/OSD.PJI-Temporary/repro
#6 transferring __dagger_workdir_/home/plaisted/source/OSD.PJI-Temporary/repro: 309B done
#6 DONE 0.0s
#7 [build 1/6] FROM docker.io/library/golang:1.18.2-alpine@sha256:4795c5d21f01e0777707ada02408debe77fe31848be97cf9fa8a1462da78d949
#7 resolve docker.io/library/golang:1.18.2-alpine@sha256:4795c5d21f01e0777707ada02408debe77fe31848be97cf9fa8a1462da78d949 0.0s done
#7 DONE 0.0s
#8 [build 3/6] RUN apk add --no-cache file git
#8 CACHED
#9 [build 4/6] RUN go mod init go.dagger.io/dagger/shim/cmd
#9 CACHED
#10 [build 2/6] WORKDIR /src
#10 CACHED
#11 [build 5/6] COPY . .
#11 CACHED
#12 [build 6/6] RUN CGO_ENABLED=0 go build -o /_shim -ldflags '-s -d -w' .
#12 CACHED
#13 [stage-1 1/1] COPY --from=build /_shim /_shim
#13 CACHED
#14 mkdir /meta
#14 CACHED
#15 copy / /
#15 DONE 0.0s
#16 docker-image://docker.io/library/alpine:latest
#16 resolve docker.io/library/alpine:latest
#16 resolve docker.io/library/alpine:latest 0.1s done
#16 CACHED
#17 copy / /
#17 CACHED
#18 ls /example
#18 0.157 d1
#18 0.157 d2
#18 DONE 0.2s
#1 resolve image config for docker.io/library/alpine:latest
#1 DONE 0.5s
#4 [internal] load metadata for docker.io/library/golang:1.18.2-alpine
#4 DONE 0.4s
#19 ls /example
#19 0.172 d1
#19 DONE 0.2s
#20 ls /
#20 0.105 _shim
#20 0.105 bin
#20 0.105 dagger
#20 0.105 dev
#20 0.105 etc
#20 0.105 example
#20 0.105 home
#20 0.105 lib
#20 0.105 media
#20 0.105 mnt
#20 0.105 opt
#20 0.105 proc
#20 0.105 root
#20 0.105 run
#20 0.105 sbin
#20 0.105 srv
#20 0.105 sys
#20 0.105 tmp
#20 0.105 usr
#20 0.105 var
#20 DONE 0.1s
#0 0.148 d1
#0 0.148 d2
#18 DONE 0.2s
#1 resolve image config for docker.io/library/alpine:latest
#1 DONE 0.4s
#4 [internal] load metadata for docker.io/library/golang:1.18.2-alpine
#4 DONE 0.4s
#19 ls /example
#0 0.135 d1
#19 DONE 0.2s
#20 ls /example
#0 0.104 d1
#0 0.104 d2
#20 DONE 0.1s
```
### Steps to reproduce
* Mount two directories
* Run multiple exec commands and observe logs output
### Dagger version
dagger v0.3.1
### OS version
Ubuntu-20.04
|
https://github.com/dagger/dagger/issues/3551
|
https://github.com/dagger/dagger/pull/3602
|
b734ed35554bbfbc5caf63674eaa9c22692e614e
|
b4bb0b9e06e1edf8b81f9054b7419daabcb5bedb
| 2022-10-26T01:16:16Z |
go
| 2022-10-31T22:13:34Z |
core/integration/container_test.go
|
Container struct {
From struct {
WithEnvVariable struct {
WithMountedCache struct {
Exec struct {
Stdout struct {
Contents string
}
}
}
}
}
}
}{}
query := `query Test($cache: CacheID!, $rand: String!) {
container {
from(address: "alpine:3.16.2") {
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 3,551 |
π Odd container behavior with exec / multiple withMountedDirectory
|
### What is the issue?
The following code executes but provides unexpected logs / output. Other similar use cases error due to missing files due to same issue. This may be something very simple (haven't used golang in many years) but seems like there may be an underlying issue with the execution engine.
I would expect this code to run the `ls` command twice, one time showing the two mounted directories, one time showing the root output. Instead in the logs I see `ls` with d1 and d2 (expected), an `ls` with just d1 (??), and then an `ls` with the root fs. This causes issues if the first ls is changed to `ls /example/d2` as it will error the whole pipeline due to missing path.
```golang
workdir := client.Host().Workdir()
d1, err := workdir.Read().Directory("dir1/").ID(ctx)
if err != nil {
return err
}
d2, err := workdir.Read().Directory("dir2/").ID(ctx)
if err != nil {
return err
}
build := client.Container().From("alpine:latest").
WithMountedDirectory("/example/d1", d1).
WithMountedDirectory("/example/d2", d2)
build = build.Exec(dagger.ContainerExecOpts{
Args: []string{"ls", "/example"},
})
_, err = build.ExitCode(ctx)
if err != nil {
return err
}
build = build.Exec(dagger.ContainerExecOpts{
Args: []string{"ls", "/"},
})
_, err = build.ExitCode(ctx)
if err != nil {
return err
}
```
I was able to get the same functionality working fine by using `fs, err := build.FS().WithDirectory(d1, "/example/d1").WithDirectory(d2, "/example/d2").ID(ctx); build = build.WithFS(fs);` so conceptually don't think I'm doing anything wrong.
### Log output
```
#1 resolve image config for docker.io/library/alpine:latest
#1 DONE 0.4s
#2 mkfile /Dockerfile
#2 DONE 0.0s
#3 mkfile /main.go
#3 CACHED
#4 [internal] load metadata for docker.io/library/golang:1.18.2-alpine
#4 DONE 0.1s
#5 local://__dagger_workdir_/home/plaisted/source/OSD.PJI-Temporary/repro
#5 DONE 0.0s
#6 local://__dagger_workdir_/home/plaisted/source/OSD.PJI-Temporary/repro
#6 transferring __dagger_workdir_/home/plaisted/source/OSD.PJI-Temporary/repro: 309B done
#6 DONE 0.0s
#7 [build 1/6] FROM docker.io/library/golang:1.18.2-alpine@sha256:4795c5d21f01e0777707ada02408debe77fe31848be97cf9fa8a1462da78d949
#7 resolve docker.io/library/golang:1.18.2-alpine@sha256:4795c5d21f01e0777707ada02408debe77fe31848be97cf9fa8a1462da78d949 0.0s done
#7 DONE 0.0s
#8 [build 3/6] RUN apk add --no-cache file git
#8 CACHED
#9 [build 4/6] RUN go mod init go.dagger.io/dagger/shim/cmd
#9 CACHED
#10 [build 2/6] WORKDIR /src
#10 CACHED
#11 [build 5/6] COPY . .
#11 CACHED
#12 [build 6/6] RUN CGO_ENABLED=0 go build -o /_shim -ldflags '-s -d -w' .
#12 CACHED
#13 [stage-1 1/1] COPY --from=build /_shim /_shim
#13 CACHED
#14 mkdir /meta
#14 CACHED
#15 copy / /
#15 DONE 0.0s
#16 docker-image://docker.io/library/alpine:latest
#16 resolve docker.io/library/alpine:latest
#16 resolve docker.io/library/alpine:latest 0.1s done
#16 CACHED
#17 copy / /
#17 CACHED
#18 ls /example
#18 0.157 d1
#18 0.157 d2
#18 DONE 0.2s
#1 resolve image config for docker.io/library/alpine:latest
#1 DONE 0.5s
#4 [internal] load metadata for docker.io/library/golang:1.18.2-alpine
#4 DONE 0.4s
#19 ls /example
#19 0.172 d1
#19 DONE 0.2s
#20 ls /
#20 0.105 _shim
#20 0.105 bin
#20 0.105 dagger
#20 0.105 dev
#20 0.105 etc
#20 0.105 example
#20 0.105 home
#20 0.105 lib
#20 0.105 media
#20 0.105 mnt
#20 0.105 opt
#20 0.105 proc
#20 0.105 root
#20 0.105 run
#20 0.105 sbin
#20 0.105 srv
#20 0.105 sys
#20 0.105 tmp
#20 0.105 usr
#20 0.105 var
#20 DONE 0.1s
#0 0.148 d1
#0 0.148 d2
#18 DONE 0.2s
#1 resolve image config for docker.io/library/alpine:latest
#1 DONE 0.4s
#4 [internal] load metadata for docker.io/library/golang:1.18.2-alpine
#4 DONE 0.4s
#19 ls /example
#0 0.135 d1
#19 DONE 0.2s
#20 ls /example
#0 0.104 d1
#0 0.104 d2
#20 DONE 0.1s
```
### Steps to reproduce
* Mount two directories
* Run multiple exec commands and observe logs output
### Dagger version
dagger v0.3.1
### OS version
Ubuntu-20.04
|
https://github.com/dagger/dagger/issues/3551
|
https://github.com/dagger/dagger/pull/3602
|
b734ed35554bbfbc5caf63674eaa9c22692e614e
|
b4bb0b9e06e1edf8b81f9054b7419daabcb5bedb
| 2022-10-26T01:16:16Z |
go
| 2022-10-31T22:13:34Z |
core/integration/container_test.go
|
withEnvVariable(name: "RAND", value: $rand) {
withMountedCache(path: "/mnt/cache", cache: $cache) {
exec(args: ["sh", "-c", "echo $RAND >> /mnt/cache/file; cat /mnt/cache/file"]) {
stdout {
contents
}
}
}
}
}
}
}`
rand1 := identity.NewID()
err := testutil.Query(query, &execRes, &testutil.QueryOptions{Variables: map[string]any{
"cache": cacheID,
"rand": rand1,
}})
require.NoError(t, err)
require.Equal(t, rand1+"\n", execRes.Container.From.WithEnvVariable.WithMountedCache.Exec.Stdout.Contents)
rand2 := identity.NewID()
err = testutil.Query(query, &execRes, &testutil.QueryOptions{Variables: map[string]any{
"cache": cacheID,
"rand": rand2,
}})
require.NoError(t, err)
require.Equal(t, rand1+"\n"+rand2+"\n", execRes.Container.From.WithEnvVariable.WithMountedCache.Exec.Stdout.Contents)
}
func TestContainerWithMountedCacheFromDirectory(t *testing.T) {
t.Parallel()
dirRes := struct {
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 3,551 |
π Odd container behavior with exec / multiple withMountedDirectory
|
### What is the issue?
The following code executes but provides unexpected logs / output. Other similar use cases error due to missing files due to same issue. This may be something very simple (haven't used golang in many years) but seems like there may be an underlying issue with the execution engine.
I would expect this code to run the `ls` command twice, one time showing the two mounted directories, one time showing the root output. Instead in the logs I see `ls` with d1 and d2 (expected), an `ls` with just d1 (??), and then an `ls` with the root fs. This causes issues if the first ls is changed to `ls /example/d2` as it will error the whole pipeline due to missing path.
```golang
workdir := client.Host().Workdir()
d1, err := workdir.Read().Directory("dir1/").ID(ctx)
if err != nil {
return err
}
d2, err := workdir.Read().Directory("dir2/").ID(ctx)
if err != nil {
return err
}
build := client.Container().From("alpine:latest").
WithMountedDirectory("/example/d1", d1).
WithMountedDirectory("/example/d2", d2)
build = build.Exec(dagger.ContainerExecOpts{
Args: []string{"ls", "/example"},
})
_, err = build.ExitCode(ctx)
if err != nil {
return err
}
build = build.Exec(dagger.ContainerExecOpts{
Args: []string{"ls", "/"},
})
_, err = build.ExitCode(ctx)
if err != nil {
return err
}
```
I was able to get the same functionality working fine by using `fs, err := build.FS().WithDirectory(d1, "/example/d1").WithDirectory(d2, "/example/d2").ID(ctx); build = build.WithFS(fs);` so conceptually don't think I'm doing anything wrong.
### Log output
```
#1 resolve image config for docker.io/library/alpine:latest
#1 DONE 0.4s
#2 mkfile /Dockerfile
#2 DONE 0.0s
#3 mkfile /main.go
#3 CACHED
#4 [internal] load metadata for docker.io/library/golang:1.18.2-alpine
#4 DONE 0.1s
#5 local://__dagger_workdir_/home/plaisted/source/OSD.PJI-Temporary/repro
#5 DONE 0.0s
#6 local://__dagger_workdir_/home/plaisted/source/OSD.PJI-Temporary/repro
#6 transferring __dagger_workdir_/home/plaisted/source/OSD.PJI-Temporary/repro: 309B done
#6 DONE 0.0s
#7 [build 1/6] FROM docker.io/library/golang:1.18.2-alpine@sha256:4795c5d21f01e0777707ada02408debe77fe31848be97cf9fa8a1462da78d949
#7 resolve docker.io/library/golang:1.18.2-alpine@sha256:4795c5d21f01e0777707ada02408debe77fe31848be97cf9fa8a1462da78d949 0.0s done
#7 DONE 0.0s
#8 [build 3/6] RUN apk add --no-cache file git
#8 CACHED
#9 [build 4/6] RUN go mod init go.dagger.io/dagger/shim/cmd
#9 CACHED
#10 [build 2/6] WORKDIR /src
#10 CACHED
#11 [build 5/6] COPY . .
#11 CACHED
#12 [build 6/6] RUN CGO_ENABLED=0 go build -o /_shim -ldflags '-s -d -w' .
#12 CACHED
#13 [stage-1 1/1] COPY --from=build /_shim /_shim
#13 CACHED
#14 mkdir /meta
#14 CACHED
#15 copy / /
#15 DONE 0.0s
#16 docker-image://docker.io/library/alpine:latest
#16 resolve docker.io/library/alpine:latest
#16 resolve docker.io/library/alpine:latest 0.1s done
#16 CACHED
#17 copy / /
#17 CACHED
#18 ls /example
#18 0.157 d1
#18 0.157 d2
#18 DONE 0.2s
#1 resolve image config for docker.io/library/alpine:latest
#1 DONE 0.5s
#4 [internal] load metadata for docker.io/library/golang:1.18.2-alpine
#4 DONE 0.4s
#19 ls /example
#19 0.172 d1
#19 DONE 0.2s
#20 ls /
#20 0.105 _shim
#20 0.105 bin
#20 0.105 dagger
#20 0.105 dev
#20 0.105 etc
#20 0.105 example
#20 0.105 home
#20 0.105 lib
#20 0.105 media
#20 0.105 mnt
#20 0.105 opt
#20 0.105 proc
#20 0.105 root
#20 0.105 run
#20 0.105 sbin
#20 0.105 srv
#20 0.105 sys
#20 0.105 tmp
#20 0.105 usr
#20 0.105 var
#20 DONE 0.1s
#0 0.148 d1
#0 0.148 d2
#18 DONE 0.2s
#1 resolve image config for docker.io/library/alpine:latest
#1 DONE 0.4s
#4 [internal] load metadata for docker.io/library/golang:1.18.2-alpine
#4 DONE 0.4s
#19 ls /example
#0 0.135 d1
#19 DONE 0.2s
#20 ls /example
#0 0.104 d1
#0 0.104 d2
#20 DONE 0.1s
```
### Steps to reproduce
* Mount two directories
* Run multiple exec commands and observe logs output
### Dagger version
dagger v0.3.1
### OS version
Ubuntu-20.04
|
https://github.com/dagger/dagger/issues/3551
|
https://github.com/dagger/dagger/pull/3602
|
b734ed35554bbfbc5caf63674eaa9c22692e614e
|
b4bb0b9e06e1edf8b81f9054b7419daabcb5bedb
| 2022-10-26T01:16:16Z |
go
| 2022-10-31T22:13:34Z |
core/integration/container_test.go
|
Directory struct {
WithNewFile struct {
Directory struct {
ID core.FileID
}
}
}
}{}
err := testutil.Query(
`{
directory {
withNewFile(path: "some-dir/sub-file", contents: "initial-content\n") {
directory(path: "some-dir") {
id
}
}
}
}`, &dirRes, nil)
require.NoError(t, err)
initialID := dirRes.Directory.WithNewFile.Directory.ID
cacheID := newCache(t)
execRes := struct {
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 3,551 |
π Odd container behavior with exec / multiple withMountedDirectory
|
### What is the issue?
The following code executes but provides unexpected logs / output. Other similar use cases error due to missing files due to same issue. This may be something very simple (haven't used golang in many years) but seems like there may be an underlying issue with the execution engine.
I would expect this code to run the `ls` command twice, one time showing the two mounted directories, one time showing the root output. Instead in the logs I see `ls` with d1 and d2 (expected), an `ls` with just d1 (??), and then an `ls` with the root fs. This causes issues if the first ls is changed to `ls /example/d2` as it will error the whole pipeline due to missing path.
```golang
workdir := client.Host().Workdir()
d1, err := workdir.Read().Directory("dir1/").ID(ctx)
if err != nil {
return err
}
d2, err := workdir.Read().Directory("dir2/").ID(ctx)
if err != nil {
return err
}
build := client.Container().From("alpine:latest").
WithMountedDirectory("/example/d1", d1).
WithMountedDirectory("/example/d2", d2)
build = build.Exec(dagger.ContainerExecOpts{
Args: []string{"ls", "/example"},
})
_, err = build.ExitCode(ctx)
if err != nil {
return err
}
build = build.Exec(dagger.ContainerExecOpts{
Args: []string{"ls", "/"},
})
_, err = build.ExitCode(ctx)
if err != nil {
return err
}
```
I was able to get the same functionality working fine by using `fs, err := build.FS().WithDirectory(d1, "/example/d1").WithDirectory(d2, "/example/d2").ID(ctx); build = build.WithFS(fs);` so conceptually don't think I'm doing anything wrong.
### Log output
```
#1 resolve image config for docker.io/library/alpine:latest
#1 DONE 0.4s
#2 mkfile /Dockerfile
#2 DONE 0.0s
#3 mkfile /main.go
#3 CACHED
#4 [internal] load metadata for docker.io/library/golang:1.18.2-alpine
#4 DONE 0.1s
#5 local://__dagger_workdir_/home/plaisted/source/OSD.PJI-Temporary/repro
#5 DONE 0.0s
#6 local://__dagger_workdir_/home/plaisted/source/OSD.PJI-Temporary/repro
#6 transferring __dagger_workdir_/home/plaisted/source/OSD.PJI-Temporary/repro: 309B done
#6 DONE 0.0s
#7 [build 1/6] FROM docker.io/library/golang:1.18.2-alpine@sha256:4795c5d21f01e0777707ada02408debe77fe31848be97cf9fa8a1462da78d949
#7 resolve docker.io/library/golang:1.18.2-alpine@sha256:4795c5d21f01e0777707ada02408debe77fe31848be97cf9fa8a1462da78d949 0.0s done
#7 DONE 0.0s
#8 [build 3/6] RUN apk add --no-cache file git
#8 CACHED
#9 [build 4/6] RUN go mod init go.dagger.io/dagger/shim/cmd
#9 CACHED
#10 [build 2/6] WORKDIR /src
#10 CACHED
#11 [build 5/6] COPY . .
#11 CACHED
#12 [build 6/6] RUN CGO_ENABLED=0 go build -o /_shim -ldflags '-s -d -w' .
#12 CACHED
#13 [stage-1 1/1] COPY --from=build /_shim /_shim
#13 CACHED
#14 mkdir /meta
#14 CACHED
#15 copy / /
#15 DONE 0.0s
#16 docker-image://docker.io/library/alpine:latest
#16 resolve docker.io/library/alpine:latest
#16 resolve docker.io/library/alpine:latest 0.1s done
#16 CACHED
#17 copy / /
#17 CACHED
#18 ls /example
#18 0.157 d1
#18 0.157 d2
#18 DONE 0.2s
#1 resolve image config for docker.io/library/alpine:latest
#1 DONE 0.5s
#4 [internal] load metadata for docker.io/library/golang:1.18.2-alpine
#4 DONE 0.4s
#19 ls /example
#19 0.172 d1
#19 DONE 0.2s
#20 ls /
#20 0.105 _shim
#20 0.105 bin
#20 0.105 dagger
#20 0.105 dev
#20 0.105 etc
#20 0.105 example
#20 0.105 home
#20 0.105 lib
#20 0.105 media
#20 0.105 mnt
#20 0.105 opt
#20 0.105 proc
#20 0.105 root
#20 0.105 run
#20 0.105 sbin
#20 0.105 srv
#20 0.105 sys
#20 0.105 tmp
#20 0.105 usr
#20 0.105 var
#20 DONE 0.1s
#0 0.148 d1
#0 0.148 d2
#18 DONE 0.2s
#1 resolve image config for docker.io/library/alpine:latest
#1 DONE 0.4s
#4 [internal] load metadata for docker.io/library/golang:1.18.2-alpine
#4 DONE 0.4s
#19 ls /example
#0 0.135 d1
#19 DONE 0.2s
#20 ls /example
#0 0.104 d1
#0 0.104 d2
#20 DONE 0.1s
```
### Steps to reproduce
* Mount two directories
* Run multiple exec commands and observe logs output
### Dagger version
dagger v0.3.1
### OS version
Ubuntu-20.04
|
https://github.com/dagger/dagger/issues/3551
|
https://github.com/dagger/dagger/pull/3602
|
b734ed35554bbfbc5caf63674eaa9c22692e614e
|
b4bb0b9e06e1edf8b81f9054b7419daabcb5bedb
| 2022-10-26T01:16:16Z |
go
| 2022-10-31T22:13:34Z |
core/integration/container_test.go
|
Container struct {
From struct {
WithEnvVariable struct {
WithMountedCache struct {
Exec struct {
Stdout struct {
Contents string
}
}
}
}
}
}
}{}
query := `query Test($cache: CacheID!, $rand: String!, $init: DirectoryID!) {
container {
from(address: "alpine:3.16.2") {
withEnvVariable(name: "RAND", value: $rand) {
withMountedCache(path: "/mnt/cache", cache: $cache, source: $init) {
exec(args: ["sh", "-c", "echo $RAND >> /mnt/cache/sub-file; cat /mnt/cache/sub-file"]) {
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 3,551 |
π Odd container behavior with exec / multiple withMountedDirectory
|
### What is the issue?
The following code executes but provides unexpected logs / output. Other similar use cases error due to missing files due to same issue. This may be something very simple (haven't used golang in many years) but seems like there may be an underlying issue with the execution engine.
I would expect this code to run the `ls` command twice, one time showing the two mounted directories, one time showing the root output. Instead in the logs I see `ls` with d1 and d2 (expected), an `ls` with just d1 (??), and then an `ls` with the root fs. This causes issues if the first ls is changed to `ls /example/d2` as it will error the whole pipeline due to missing path.
```golang
workdir := client.Host().Workdir()
d1, err := workdir.Read().Directory("dir1/").ID(ctx)
if err != nil {
return err
}
d2, err := workdir.Read().Directory("dir2/").ID(ctx)
if err != nil {
return err
}
build := client.Container().From("alpine:latest").
WithMountedDirectory("/example/d1", d1).
WithMountedDirectory("/example/d2", d2)
build = build.Exec(dagger.ContainerExecOpts{
Args: []string{"ls", "/example"},
})
_, err = build.ExitCode(ctx)
if err != nil {
return err
}
build = build.Exec(dagger.ContainerExecOpts{
Args: []string{"ls", "/"},
})
_, err = build.ExitCode(ctx)
if err != nil {
return err
}
```
I was able to get the same functionality working fine by using `fs, err := build.FS().WithDirectory(d1, "/example/d1").WithDirectory(d2, "/example/d2").ID(ctx); build = build.WithFS(fs);` so conceptually don't think I'm doing anything wrong.
### Log output
```
#1 resolve image config for docker.io/library/alpine:latest
#1 DONE 0.4s
#2 mkfile /Dockerfile
#2 DONE 0.0s
#3 mkfile /main.go
#3 CACHED
#4 [internal] load metadata for docker.io/library/golang:1.18.2-alpine
#4 DONE 0.1s
#5 local://__dagger_workdir_/home/plaisted/source/OSD.PJI-Temporary/repro
#5 DONE 0.0s
#6 local://__dagger_workdir_/home/plaisted/source/OSD.PJI-Temporary/repro
#6 transferring __dagger_workdir_/home/plaisted/source/OSD.PJI-Temporary/repro: 309B done
#6 DONE 0.0s
#7 [build 1/6] FROM docker.io/library/golang:1.18.2-alpine@sha256:4795c5d21f01e0777707ada02408debe77fe31848be97cf9fa8a1462da78d949
#7 resolve docker.io/library/golang:1.18.2-alpine@sha256:4795c5d21f01e0777707ada02408debe77fe31848be97cf9fa8a1462da78d949 0.0s done
#7 DONE 0.0s
#8 [build 3/6] RUN apk add --no-cache file git
#8 CACHED
#9 [build 4/6] RUN go mod init go.dagger.io/dagger/shim/cmd
#9 CACHED
#10 [build 2/6] WORKDIR /src
#10 CACHED
#11 [build 5/6] COPY . .
#11 CACHED
#12 [build 6/6] RUN CGO_ENABLED=0 go build -o /_shim -ldflags '-s -d -w' .
#12 CACHED
#13 [stage-1 1/1] COPY --from=build /_shim /_shim
#13 CACHED
#14 mkdir /meta
#14 CACHED
#15 copy / /
#15 DONE 0.0s
#16 docker-image://docker.io/library/alpine:latest
#16 resolve docker.io/library/alpine:latest
#16 resolve docker.io/library/alpine:latest 0.1s done
#16 CACHED
#17 copy / /
#17 CACHED
#18 ls /example
#18 0.157 d1
#18 0.157 d2
#18 DONE 0.2s
#1 resolve image config for docker.io/library/alpine:latest
#1 DONE 0.5s
#4 [internal] load metadata for docker.io/library/golang:1.18.2-alpine
#4 DONE 0.4s
#19 ls /example
#19 0.172 d1
#19 DONE 0.2s
#20 ls /
#20 0.105 _shim
#20 0.105 bin
#20 0.105 dagger
#20 0.105 dev
#20 0.105 etc
#20 0.105 example
#20 0.105 home
#20 0.105 lib
#20 0.105 media
#20 0.105 mnt
#20 0.105 opt
#20 0.105 proc
#20 0.105 root
#20 0.105 run
#20 0.105 sbin
#20 0.105 srv
#20 0.105 sys
#20 0.105 tmp
#20 0.105 usr
#20 0.105 var
#20 DONE 0.1s
#0 0.148 d1
#0 0.148 d2
#18 DONE 0.2s
#1 resolve image config for docker.io/library/alpine:latest
#1 DONE 0.4s
#4 [internal] load metadata for docker.io/library/golang:1.18.2-alpine
#4 DONE 0.4s
#19 ls /example
#0 0.135 d1
#19 DONE 0.2s
#20 ls /example
#0 0.104 d1
#0 0.104 d2
#20 DONE 0.1s
```
### Steps to reproduce
* Mount two directories
* Run multiple exec commands and observe logs output
### Dagger version
dagger v0.3.1
### OS version
Ubuntu-20.04
|
https://github.com/dagger/dagger/issues/3551
|
https://github.com/dagger/dagger/pull/3602
|
b734ed35554bbfbc5caf63674eaa9c22692e614e
|
b4bb0b9e06e1edf8b81f9054b7419daabcb5bedb
| 2022-10-26T01:16:16Z |
go
| 2022-10-31T22:13:34Z |
core/integration/container_test.go
|
stdout {
contents
}
}
}
}
}
}
}`
rand1 := identity.NewID()
err = testutil.Query(query, &execRes, &testutil.QueryOptions{Variables: map[string]any{
"init": initialID,
"rand": rand1,
"cache": cacheID,
}})
require.NoError(t, err)
require.Equal(t, "initial-content\n"+rand1+"\n", execRes.Container.From.WithEnvVariable.WithMountedCache.Exec.Stdout.Contents)
rand2 := identity.NewID()
err = testutil.Query(query, &execRes, &testutil.QueryOptions{Variables: map[string]any{
"init": initialID,
"rand": rand2,
"cache": cacheID,
}})
require.NoError(t, err)
require.Equal(t, "initial-content\n"+rand1+"\n"+rand2+"\n", execRes.Container.From.WithEnvVariable.WithMountedCache.Exec.Stdout.Contents)
}
func TestContainerWithMountedTemp(t *testing.T) {
t.Parallel()
execRes := struct {
Container struct {
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 3,551 |
π Odd container behavior with exec / multiple withMountedDirectory
|
### What is the issue?
The following code executes but provides unexpected logs / output. Other similar use cases error due to missing files due to same issue. This may be something very simple (haven't used golang in many years) but seems like there may be an underlying issue with the execution engine.
I would expect this code to run the `ls` command twice, one time showing the two mounted directories, one time showing the root output. Instead in the logs I see `ls` with d1 and d2 (expected), an `ls` with just d1 (??), and then an `ls` with the root fs. This causes issues if the first ls is changed to `ls /example/d2` as it will error the whole pipeline due to missing path.
```golang
workdir := client.Host().Workdir()
d1, err := workdir.Read().Directory("dir1/").ID(ctx)
if err != nil {
return err
}
d2, err := workdir.Read().Directory("dir2/").ID(ctx)
if err != nil {
return err
}
build := client.Container().From("alpine:latest").
WithMountedDirectory("/example/d1", d1).
WithMountedDirectory("/example/d2", d2)
build = build.Exec(dagger.ContainerExecOpts{
Args: []string{"ls", "/example"},
})
_, err = build.ExitCode(ctx)
if err != nil {
return err
}
build = build.Exec(dagger.ContainerExecOpts{
Args: []string{"ls", "/"},
})
_, err = build.ExitCode(ctx)
if err != nil {
return err
}
```
I was able to get the same functionality working fine by using `fs, err := build.FS().WithDirectory(d1, "/example/d1").WithDirectory(d2, "/example/d2").ID(ctx); build = build.WithFS(fs);` so conceptually don't think I'm doing anything wrong.
### Log output
```
#1 resolve image config for docker.io/library/alpine:latest
#1 DONE 0.4s
#2 mkfile /Dockerfile
#2 DONE 0.0s
#3 mkfile /main.go
#3 CACHED
#4 [internal] load metadata for docker.io/library/golang:1.18.2-alpine
#4 DONE 0.1s
#5 local://__dagger_workdir_/home/plaisted/source/OSD.PJI-Temporary/repro
#5 DONE 0.0s
#6 local://__dagger_workdir_/home/plaisted/source/OSD.PJI-Temporary/repro
#6 transferring __dagger_workdir_/home/plaisted/source/OSD.PJI-Temporary/repro: 309B done
#6 DONE 0.0s
#7 [build 1/6] FROM docker.io/library/golang:1.18.2-alpine@sha256:4795c5d21f01e0777707ada02408debe77fe31848be97cf9fa8a1462da78d949
#7 resolve docker.io/library/golang:1.18.2-alpine@sha256:4795c5d21f01e0777707ada02408debe77fe31848be97cf9fa8a1462da78d949 0.0s done
#7 DONE 0.0s
#8 [build 3/6] RUN apk add --no-cache file git
#8 CACHED
#9 [build 4/6] RUN go mod init go.dagger.io/dagger/shim/cmd
#9 CACHED
#10 [build 2/6] WORKDIR /src
#10 CACHED
#11 [build 5/6] COPY . .
#11 CACHED
#12 [build 6/6] RUN CGO_ENABLED=0 go build -o /_shim -ldflags '-s -d -w' .
#12 CACHED
#13 [stage-1 1/1] COPY --from=build /_shim /_shim
#13 CACHED
#14 mkdir /meta
#14 CACHED
#15 copy / /
#15 DONE 0.0s
#16 docker-image://docker.io/library/alpine:latest
#16 resolve docker.io/library/alpine:latest
#16 resolve docker.io/library/alpine:latest 0.1s done
#16 CACHED
#17 copy / /
#17 CACHED
#18 ls /example
#18 0.157 d1
#18 0.157 d2
#18 DONE 0.2s
#1 resolve image config for docker.io/library/alpine:latest
#1 DONE 0.5s
#4 [internal] load metadata for docker.io/library/golang:1.18.2-alpine
#4 DONE 0.4s
#19 ls /example
#19 0.172 d1
#19 DONE 0.2s
#20 ls /
#20 0.105 _shim
#20 0.105 bin
#20 0.105 dagger
#20 0.105 dev
#20 0.105 etc
#20 0.105 example
#20 0.105 home
#20 0.105 lib
#20 0.105 media
#20 0.105 mnt
#20 0.105 opt
#20 0.105 proc
#20 0.105 root
#20 0.105 run
#20 0.105 sbin
#20 0.105 srv
#20 0.105 sys
#20 0.105 tmp
#20 0.105 usr
#20 0.105 var
#20 DONE 0.1s
#0 0.148 d1
#0 0.148 d2
#18 DONE 0.2s
#1 resolve image config for docker.io/library/alpine:latest
#1 DONE 0.4s
#4 [internal] load metadata for docker.io/library/golang:1.18.2-alpine
#4 DONE 0.4s
#19 ls /example
#0 0.135 d1
#19 DONE 0.2s
#20 ls /example
#0 0.104 d1
#0 0.104 d2
#20 DONE 0.1s
```
### Steps to reproduce
* Mount two directories
* Run multiple exec commands and observe logs output
### Dagger version
dagger v0.3.1
### OS version
Ubuntu-20.04
|
https://github.com/dagger/dagger/issues/3551
|
https://github.com/dagger/dagger/pull/3602
|
b734ed35554bbfbc5caf63674eaa9c22692e614e
|
b4bb0b9e06e1edf8b81f9054b7419daabcb5bedb
| 2022-10-26T01:16:16Z |
go
| 2022-10-31T22:13:34Z |
core/integration/container_test.go
|
From struct {
WithMountedTemp struct {
Exec struct {
Stdout struct {
Contents string
}
}
}
}
}
}{}
err := testutil.Query(`{
container {
from(address: "alpine:3.16.2") {
withMountedTemp(path: "/mnt/tmp") {
exec(args: ["grep", "/mnt/tmp", "/proc/mounts"]) {
stdout {
contents
}
}
}
}
}
}`, &execRes, nil)
require.NoError(t, err)
require.Contains(t, execRes.Container.From.WithMountedTemp.Exec.Stdout.Contents, "tmpfs /mnt/tmp tmpfs")
}
func TestContainerMountsWithoutMount(t *testing.T) {
t.Parallel()
dirRes := struct {
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 3,551 |
π Odd container behavior with exec / multiple withMountedDirectory
|
### What is the issue?
The following code executes but provides unexpected logs / output. Other similar use cases error due to missing files due to same issue. This may be something very simple (haven't used golang in many years) but seems like there may be an underlying issue with the execution engine.
I would expect this code to run the `ls` command twice, one time showing the two mounted directories, one time showing the root output. Instead in the logs I see `ls` with d1 and d2 (expected), an `ls` with just d1 (??), and then an `ls` with the root fs. This causes issues if the first ls is changed to `ls /example/d2` as it will error the whole pipeline due to missing path.
```golang
workdir := client.Host().Workdir()
d1, err := workdir.Read().Directory("dir1/").ID(ctx)
if err != nil {
return err
}
d2, err := workdir.Read().Directory("dir2/").ID(ctx)
if err != nil {
return err
}
build := client.Container().From("alpine:latest").
WithMountedDirectory("/example/d1", d1).
WithMountedDirectory("/example/d2", d2)
build = build.Exec(dagger.ContainerExecOpts{
Args: []string{"ls", "/example"},
})
_, err = build.ExitCode(ctx)
if err != nil {
return err
}
build = build.Exec(dagger.ContainerExecOpts{
Args: []string{"ls", "/"},
})
_, err = build.ExitCode(ctx)
if err != nil {
return err
}
```
I was able to get the same functionality working fine by using `fs, err := build.FS().WithDirectory(d1, "/example/d1").WithDirectory(d2, "/example/d2").ID(ctx); build = build.WithFS(fs);` so conceptually don't think I'm doing anything wrong.
### Log output
```
#1 resolve image config for docker.io/library/alpine:latest
#1 DONE 0.4s
#2 mkfile /Dockerfile
#2 DONE 0.0s
#3 mkfile /main.go
#3 CACHED
#4 [internal] load metadata for docker.io/library/golang:1.18.2-alpine
#4 DONE 0.1s
#5 local://__dagger_workdir_/home/plaisted/source/OSD.PJI-Temporary/repro
#5 DONE 0.0s
#6 local://__dagger_workdir_/home/plaisted/source/OSD.PJI-Temporary/repro
#6 transferring __dagger_workdir_/home/plaisted/source/OSD.PJI-Temporary/repro: 309B done
#6 DONE 0.0s
#7 [build 1/6] FROM docker.io/library/golang:1.18.2-alpine@sha256:4795c5d21f01e0777707ada02408debe77fe31848be97cf9fa8a1462da78d949
#7 resolve docker.io/library/golang:1.18.2-alpine@sha256:4795c5d21f01e0777707ada02408debe77fe31848be97cf9fa8a1462da78d949 0.0s done
#7 DONE 0.0s
#8 [build 3/6] RUN apk add --no-cache file git
#8 CACHED
#9 [build 4/6] RUN go mod init go.dagger.io/dagger/shim/cmd
#9 CACHED
#10 [build 2/6] WORKDIR /src
#10 CACHED
#11 [build 5/6] COPY . .
#11 CACHED
#12 [build 6/6] RUN CGO_ENABLED=0 go build -o /_shim -ldflags '-s -d -w' .
#12 CACHED
#13 [stage-1 1/1] COPY --from=build /_shim /_shim
#13 CACHED
#14 mkdir /meta
#14 CACHED
#15 copy / /
#15 DONE 0.0s
#16 docker-image://docker.io/library/alpine:latest
#16 resolve docker.io/library/alpine:latest
#16 resolve docker.io/library/alpine:latest 0.1s done
#16 CACHED
#17 copy / /
#17 CACHED
#18 ls /example
#18 0.157 d1
#18 0.157 d2
#18 DONE 0.2s
#1 resolve image config for docker.io/library/alpine:latest
#1 DONE 0.5s
#4 [internal] load metadata for docker.io/library/golang:1.18.2-alpine
#4 DONE 0.4s
#19 ls /example
#19 0.172 d1
#19 DONE 0.2s
#20 ls /
#20 0.105 _shim
#20 0.105 bin
#20 0.105 dagger
#20 0.105 dev
#20 0.105 etc
#20 0.105 example
#20 0.105 home
#20 0.105 lib
#20 0.105 media
#20 0.105 mnt
#20 0.105 opt
#20 0.105 proc
#20 0.105 root
#20 0.105 run
#20 0.105 sbin
#20 0.105 srv
#20 0.105 sys
#20 0.105 tmp
#20 0.105 usr
#20 0.105 var
#20 DONE 0.1s
#0 0.148 d1
#0 0.148 d2
#18 DONE 0.2s
#1 resolve image config for docker.io/library/alpine:latest
#1 DONE 0.4s
#4 [internal] load metadata for docker.io/library/golang:1.18.2-alpine
#4 DONE 0.4s
#19 ls /example
#0 0.135 d1
#19 DONE 0.2s
#20 ls /example
#0 0.104 d1
#0 0.104 d2
#20 DONE 0.1s
```
### Steps to reproduce
* Mount two directories
* Run multiple exec commands and observe logs output
### Dagger version
dagger v0.3.1
### OS version
Ubuntu-20.04
|
https://github.com/dagger/dagger/issues/3551
|
https://github.com/dagger/dagger/pull/3602
|
b734ed35554bbfbc5caf63674eaa9c22692e614e
|
b4bb0b9e06e1edf8b81f9054b7419daabcb5bedb
| 2022-10-26T01:16:16Z |
go
| 2022-10-31T22:13:34Z |
core/integration/container_test.go
|
Directory struct {
WithNewFile struct {
WithNewFile struct {
ID string
}
}
}
}{}
err := testutil.Query(
`{
directory {
withNewFile(path: "some-file", contents: "some-content") {
withNewFile(path: "some-dir/sub-file", contents: "sub-content") {
id
}
}
}
}`, &dirRes, nil)
require.NoError(t, err)
id := dirRes.Directory.WithNewFile.WithNewFile.ID
execRes := struct {
Container struct {
From struct {
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 3,551 |
π Odd container behavior with exec / multiple withMountedDirectory
|
### What is the issue?
The following code executes but provides unexpected logs / output. Other similar use cases error due to missing files due to same issue. This may be something very simple (haven't used golang in many years) but seems like there may be an underlying issue with the execution engine.
I would expect this code to run the `ls` command twice, one time showing the two mounted directories, one time showing the root output. Instead in the logs I see `ls` with d1 and d2 (expected), an `ls` with just d1 (??), and then an `ls` with the root fs. This causes issues if the first ls is changed to `ls /example/d2` as it will error the whole pipeline due to missing path.
```golang
workdir := client.Host().Workdir()
d1, err := workdir.Read().Directory("dir1/").ID(ctx)
if err != nil {
return err
}
d2, err := workdir.Read().Directory("dir2/").ID(ctx)
if err != nil {
return err
}
build := client.Container().From("alpine:latest").
WithMountedDirectory("/example/d1", d1).
WithMountedDirectory("/example/d2", d2)
build = build.Exec(dagger.ContainerExecOpts{
Args: []string{"ls", "/example"},
})
_, err = build.ExitCode(ctx)
if err != nil {
return err
}
build = build.Exec(dagger.ContainerExecOpts{
Args: []string{"ls", "/"},
})
_, err = build.ExitCode(ctx)
if err != nil {
return err
}
```
I was able to get the same functionality working fine by using `fs, err := build.FS().WithDirectory(d1, "/example/d1").WithDirectory(d2, "/example/d2").ID(ctx); build = build.WithFS(fs);` so conceptually don't think I'm doing anything wrong.
### Log output
```
#1 resolve image config for docker.io/library/alpine:latest
#1 DONE 0.4s
#2 mkfile /Dockerfile
#2 DONE 0.0s
#3 mkfile /main.go
#3 CACHED
#4 [internal] load metadata for docker.io/library/golang:1.18.2-alpine
#4 DONE 0.1s
#5 local://__dagger_workdir_/home/plaisted/source/OSD.PJI-Temporary/repro
#5 DONE 0.0s
#6 local://__dagger_workdir_/home/plaisted/source/OSD.PJI-Temporary/repro
#6 transferring __dagger_workdir_/home/plaisted/source/OSD.PJI-Temporary/repro: 309B done
#6 DONE 0.0s
#7 [build 1/6] FROM docker.io/library/golang:1.18.2-alpine@sha256:4795c5d21f01e0777707ada02408debe77fe31848be97cf9fa8a1462da78d949
#7 resolve docker.io/library/golang:1.18.2-alpine@sha256:4795c5d21f01e0777707ada02408debe77fe31848be97cf9fa8a1462da78d949 0.0s done
#7 DONE 0.0s
#8 [build 3/6] RUN apk add --no-cache file git
#8 CACHED
#9 [build 4/6] RUN go mod init go.dagger.io/dagger/shim/cmd
#9 CACHED
#10 [build 2/6] WORKDIR /src
#10 CACHED
#11 [build 5/6] COPY . .
#11 CACHED
#12 [build 6/6] RUN CGO_ENABLED=0 go build -o /_shim -ldflags '-s -d -w' .
#12 CACHED
#13 [stage-1 1/1] COPY --from=build /_shim /_shim
#13 CACHED
#14 mkdir /meta
#14 CACHED
#15 copy / /
#15 DONE 0.0s
#16 docker-image://docker.io/library/alpine:latest
#16 resolve docker.io/library/alpine:latest
#16 resolve docker.io/library/alpine:latest 0.1s done
#16 CACHED
#17 copy / /
#17 CACHED
#18 ls /example
#18 0.157 d1
#18 0.157 d2
#18 DONE 0.2s
#1 resolve image config for docker.io/library/alpine:latest
#1 DONE 0.5s
#4 [internal] load metadata for docker.io/library/golang:1.18.2-alpine
#4 DONE 0.4s
#19 ls /example
#19 0.172 d1
#19 DONE 0.2s
#20 ls /
#20 0.105 _shim
#20 0.105 bin
#20 0.105 dagger
#20 0.105 dev
#20 0.105 etc
#20 0.105 example
#20 0.105 home
#20 0.105 lib
#20 0.105 media
#20 0.105 mnt
#20 0.105 opt
#20 0.105 proc
#20 0.105 root
#20 0.105 run
#20 0.105 sbin
#20 0.105 srv
#20 0.105 sys
#20 0.105 tmp
#20 0.105 usr
#20 0.105 var
#20 DONE 0.1s
#0 0.148 d1
#0 0.148 d2
#18 DONE 0.2s
#1 resolve image config for docker.io/library/alpine:latest
#1 DONE 0.4s
#4 [internal] load metadata for docker.io/library/golang:1.18.2-alpine
#4 DONE 0.4s
#19 ls /example
#0 0.135 d1
#19 DONE 0.2s
#20 ls /example
#0 0.104 d1
#0 0.104 d2
#20 DONE 0.1s
```
### Steps to reproduce
* Mount two directories
* Run multiple exec commands and observe logs output
### Dagger version
dagger v0.3.1
### OS version
Ubuntu-20.04
|
https://github.com/dagger/dagger/issues/3551
|
https://github.com/dagger/dagger/pull/3602
|
b734ed35554bbfbc5caf63674eaa9c22692e614e
|
b4bb0b9e06e1edf8b81f9054b7419daabcb5bedb
| 2022-10-26T01:16:16Z |
go
| 2022-10-31T22:13:34Z |
core/integration/container_test.go
|
WithMountedTemp struct {
Mounts []string
WithMountedDirectory struct {
Mounts []string
Exec struct {
Stdout struct {
Contents string
}
WithoutMount struct {
Mounts []string
Exec struct {
Stdout struct {
Contents string
}
}
}
}
}
}
}
}
}{}
err = testutil.Query(
`query Test($id: DirectoryID!) {
container {
from(address: "alpine:3.16.2") {
withMountedTemp(path: "/mnt/tmp") {
mounts
withMountedDirectory(path: "/mnt/dir", source: $id) {
mounts
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 3,551 |
π Odd container behavior with exec / multiple withMountedDirectory
|
### What is the issue?
The following code executes but provides unexpected logs / output. Other similar use cases error due to missing files due to same issue. This may be something very simple (haven't used golang in many years) but seems like there may be an underlying issue with the execution engine.
I would expect this code to run the `ls` command twice, one time showing the two mounted directories, one time showing the root output. Instead in the logs I see `ls` with d1 and d2 (expected), an `ls` with just d1 (??), and then an `ls` with the root fs. This causes issues if the first ls is changed to `ls /example/d2` as it will error the whole pipeline due to missing path.
```golang
workdir := client.Host().Workdir()
d1, err := workdir.Read().Directory("dir1/").ID(ctx)
if err != nil {
return err
}
d2, err := workdir.Read().Directory("dir2/").ID(ctx)
if err != nil {
return err
}
build := client.Container().From("alpine:latest").
WithMountedDirectory("/example/d1", d1).
WithMountedDirectory("/example/d2", d2)
build = build.Exec(dagger.ContainerExecOpts{
Args: []string{"ls", "/example"},
})
_, err = build.ExitCode(ctx)
if err != nil {
return err
}
build = build.Exec(dagger.ContainerExecOpts{
Args: []string{"ls", "/"},
})
_, err = build.ExitCode(ctx)
if err != nil {
return err
}
```
I was able to get the same functionality working fine by using `fs, err := build.FS().WithDirectory(d1, "/example/d1").WithDirectory(d2, "/example/d2").ID(ctx); build = build.WithFS(fs);` so conceptually don't think I'm doing anything wrong.
### Log output
```
#1 resolve image config for docker.io/library/alpine:latest
#1 DONE 0.4s
#2 mkfile /Dockerfile
#2 DONE 0.0s
#3 mkfile /main.go
#3 CACHED
#4 [internal] load metadata for docker.io/library/golang:1.18.2-alpine
#4 DONE 0.1s
#5 local://__dagger_workdir_/home/plaisted/source/OSD.PJI-Temporary/repro
#5 DONE 0.0s
#6 local://__dagger_workdir_/home/plaisted/source/OSD.PJI-Temporary/repro
#6 transferring __dagger_workdir_/home/plaisted/source/OSD.PJI-Temporary/repro: 309B done
#6 DONE 0.0s
#7 [build 1/6] FROM docker.io/library/golang:1.18.2-alpine@sha256:4795c5d21f01e0777707ada02408debe77fe31848be97cf9fa8a1462da78d949
#7 resolve docker.io/library/golang:1.18.2-alpine@sha256:4795c5d21f01e0777707ada02408debe77fe31848be97cf9fa8a1462da78d949 0.0s done
#7 DONE 0.0s
#8 [build 3/6] RUN apk add --no-cache file git
#8 CACHED
#9 [build 4/6] RUN go mod init go.dagger.io/dagger/shim/cmd
#9 CACHED
#10 [build 2/6] WORKDIR /src
#10 CACHED
#11 [build 5/6] COPY . .
#11 CACHED
#12 [build 6/6] RUN CGO_ENABLED=0 go build -o /_shim -ldflags '-s -d -w' .
#12 CACHED
#13 [stage-1 1/1] COPY --from=build /_shim /_shim
#13 CACHED
#14 mkdir /meta
#14 CACHED
#15 copy / /
#15 DONE 0.0s
#16 docker-image://docker.io/library/alpine:latest
#16 resolve docker.io/library/alpine:latest
#16 resolve docker.io/library/alpine:latest 0.1s done
#16 CACHED
#17 copy / /
#17 CACHED
#18 ls /example
#18 0.157 d1
#18 0.157 d2
#18 DONE 0.2s
#1 resolve image config for docker.io/library/alpine:latest
#1 DONE 0.5s
#4 [internal] load metadata for docker.io/library/golang:1.18.2-alpine
#4 DONE 0.4s
#19 ls /example
#19 0.172 d1
#19 DONE 0.2s
#20 ls /
#20 0.105 _shim
#20 0.105 bin
#20 0.105 dagger
#20 0.105 dev
#20 0.105 etc
#20 0.105 example
#20 0.105 home
#20 0.105 lib
#20 0.105 media
#20 0.105 mnt
#20 0.105 opt
#20 0.105 proc
#20 0.105 root
#20 0.105 run
#20 0.105 sbin
#20 0.105 srv
#20 0.105 sys
#20 0.105 tmp
#20 0.105 usr
#20 0.105 var
#20 DONE 0.1s
#0 0.148 d1
#0 0.148 d2
#18 DONE 0.2s
#1 resolve image config for docker.io/library/alpine:latest
#1 DONE 0.4s
#4 [internal] load metadata for docker.io/library/golang:1.18.2-alpine
#4 DONE 0.4s
#19 ls /example
#0 0.135 d1
#19 DONE 0.2s
#20 ls /example
#0 0.104 d1
#0 0.104 d2
#20 DONE 0.1s
```
### Steps to reproduce
* Mount two directories
* Run multiple exec commands and observe logs output
### Dagger version
dagger v0.3.1
### OS version
Ubuntu-20.04
|
https://github.com/dagger/dagger/issues/3551
|
https://github.com/dagger/dagger/pull/3602
|
b734ed35554bbfbc5caf63674eaa9c22692e614e
|
b4bb0b9e06e1edf8b81f9054b7419daabcb5bedb
| 2022-10-26T01:16:16Z |
go
| 2022-10-31T22:13:34Z |
core/integration/container_test.go
|
exec(args: ["ls", "/mnt/dir"]) {
stdout {
contents
}
withoutMount(path: "/mnt/dir") {
mounts
exec(args: ["ls", "/mnt/dir"]) {
stdout {
contents
}
}
}
}
}
}
}
}
}`, &execRes, &testutil.QueryOptions{Variables: map[string]any{
"id": id,
}})
require.NoError(t, err)
require.Equal(t, []string{"/mnt/tmp"}, execRes.Container.From.WithMountedTemp.Mounts)
require.Equal(t, []string{"/mnt/tmp", "/mnt/dir"}, execRes.Container.From.WithMountedTemp.WithMountedDirectory.Mounts)
require.Equal(t, "some-dir\nsome-file\n", execRes.Container.From.WithMountedTemp.WithMountedDirectory.Exec.Stdout.Contents)
require.Equal(t, "", execRes.Container.From.WithMountedTemp.WithMountedDirectory.Exec.WithoutMount.Exec.Stdout.Contents)
require.Equal(t, []string{"/mnt/tmp"}, execRes.Container.From.WithMountedTemp.WithMountedDirectory.Exec.WithoutMount.Mounts)
}
func TestContainerStackedMounts(t *testing.T) {
t.Parallel()
dirRes := struct {
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 3,551 |
π Odd container behavior with exec / multiple withMountedDirectory
|
### What is the issue?
The following code executes but provides unexpected logs / output. Other similar use cases error due to missing files due to same issue. This may be something very simple (haven't used golang in many years) but seems like there may be an underlying issue with the execution engine.
I would expect this code to run the `ls` command twice, one time showing the two mounted directories, one time showing the root output. Instead in the logs I see `ls` with d1 and d2 (expected), an `ls` with just d1 (??), and then an `ls` with the root fs. This causes issues if the first ls is changed to `ls /example/d2` as it will error the whole pipeline due to missing path.
```golang
workdir := client.Host().Workdir()
d1, err := workdir.Read().Directory("dir1/").ID(ctx)
if err != nil {
return err
}
d2, err := workdir.Read().Directory("dir2/").ID(ctx)
if err != nil {
return err
}
build := client.Container().From("alpine:latest").
WithMountedDirectory("/example/d1", d1).
WithMountedDirectory("/example/d2", d2)
build = build.Exec(dagger.ContainerExecOpts{
Args: []string{"ls", "/example"},
})
_, err = build.ExitCode(ctx)
if err != nil {
return err
}
build = build.Exec(dagger.ContainerExecOpts{
Args: []string{"ls", "/"},
})
_, err = build.ExitCode(ctx)
if err != nil {
return err
}
```
I was able to get the same functionality working fine by using `fs, err := build.FS().WithDirectory(d1, "/example/d1").WithDirectory(d2, "/example/d2").ID(ctx); build = build.WithFS(fs);` so conceptually don't think I'm doing anything wrong.
### Log output
```
#1 resolve image config for docker.io/library/alpine:latest
#1 DONE 0.4s
#2 mkfile /Dockerfile
#2 DONE 0.0s
#3 mkfile /main.go
#3 CACHED
#4 [internal] load metadata for docker.io/library/golang:1.18.2-alpine
#4 DONE 0.1s
#5 local://__dagger_workdir_/home/plaisted/source/OSD.PJI-Temporary/repro
#5 DONE 0.0s
#6 local://__dagger_workdir_/home/plaisted/source/OSD.PJI-Temporary/repro
#6 transferring __dagger_workdir_/home/plaisted/source/OSD.PJI-Temporary/repro: 309B done
#6 DONE 0.0s
#7 [build 1/6] FROM docker.io/library/golang:1.18.2-alpine@sha256:4795c5d21f01e0777707ada02408debe77fe31848be97cf9fa8a1462da78d949
#7 resolve docker.io/library/golang:1.18.2-alpine@sha256:4795c5d21f01e0777707ada02408debe77fe31848be97cf9fa8a1462da78d949 0.0s done
#7 DONE 0.0s
#8 [build 3/6] RUN apk add --no-cache file git
#8 CACHED
#9 [build 4/6] RUN go mod init go.dagger.io/dagger/shim/cmd
#9 CACHED
#10 [build 2/6] WORKDIR /src
#10 CACHED
#11 [build 5/6] COPY . .
#11 CACHED
#12 [build 6/6] RUN CGO_ENABLED=0 go build -o /_shim -ldflags '-s -d -w' .
#12 CACHED
#13 [stage-1 1/1] COPY --from=build /_shim /_shim
#13 CACHED
#14 mkdir /meta
#14 CACHED
#15 copy / /
#15 DONE 0.0s
#16 docker-image://docker.io/library/alpine:latest
#16 resolve docker.io/library/alpine:latest
#16 resolve docker.io/library/alpine:latest 0.1s done
#16 CACHED
#17 copy / /
#17 CACHED
#18 ls /example
#18 0.157 d1
#18 0.157 d2
#18 DONE 0.2s
#1 resolve image config for docker.io/library/alpine:latest
#1 DONE 0.5s
#4 [internal] load metadata for docker.io/library/golang:1.18.2-alpine
#4 DONE 0.4s
#19 ls /example
#19 0.172 d1
#19 DONE 0.2s
#20 ls /
#20 0.105 _shim
#20 0.105 bin
#20 0.105 dagger
#20 0.105 dev
#20 0.105 etc
#20 0.105 example
#20 0.105 home
#20 0.105 lib
#20 0.105 media
#20 0.105 mnt
#20 0.105 opt
#20 0.105 proc
#20 0.105 root
#20 0.105 run
#20 0.105 sbin
#20 0.105 srv
#20 0.105 sys
#20 0.105 tmp
#20 0.105 usr
#20 0.105 var
#20 DONE 0.1s
#0 0.148 d1
#0 0.148 d2
#18 DONE 0.2s
#1 resolve image config for docker.io/library/alpine:latest
#1 DONE 0.4s
#4 [internal] load metadata for docker.io/library/golang:1.18.2-alpine
#4 DONE 0.4s
#19 ls /example
#0 0.135 d1
#19 DONE 0.2s
#20 ls /example
#0 0.104 d1
#0 0.104 d2
#20 DONE 0.1s
```
### Steps to reproduce
* Mount two directories
* Run multiple exec commands and observe logs output
### Dagger version
dagger v0.3.1
### OS version
Ubuntu-20.04
|
https://github.com/dagger/dagger/issues/3551
|
https://github.com/dagger/dagger/pull/3602
|
b734ed35554bbfbc5caf63674eaa9c22692e614e
|
b4bb0b9e06e1edf8b81f9054b7419daabcb5bedb
| 2022-10-26T01:16:16Z |
go
| 2022-10-31T22:13:34Z |
core/integration/container_test.go
|
Directory struct {
WithNewFile struct {
ID string
}
}
}{}
err := testutil.Query(
`{
directory {
withNewFile(path: "some-file", contents: "lower-content") {
id
}
}
}`, &dirRes, nil)
require.NoError(t, err)
lowerID := dirRes.Directory.WithNewFile.ID
err = testutil.Query(
`{
directory {
withNewFile(path: "some-file", contents: "upper-content") {
id
}
}
}`, &dirRes, nil)
require.NoError(t, err)
upperID := dirRes.Directory.WithNewFile.ID
execRes := struct {
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 3,551 |
π Odd container behavior with exec / multiple withMountedDirectory
|
### What is the issue?
The following code executes but provides unexpected logs / output. Other similar use cases error due to missing files due to same issue. This may be something very simple (haven't used golang in many years) but seems like there may be an underlying issue with the execution engine.
I would expect this code to run the `ls` command twice, one time showing the two mounted directories, one time showing the root output. Instead in the logs I see `ls` with d1 and d2 (expected), an `ls` with just d1 (??), and then an `ls` with the root fs. This causes issues if the first ls is changed to `ls /example/d2` as it will error the whole pipeline due to missing path.
```golang
workdir := client.Host().Workdir()
d1, err := workdir.Read().Directory("dir1/").ID(ctx)
if err != nil {
return err
}
d2, err := workdir.Read().Directory("dir2/").ID(ctx)
if err != nil {
return err
}
build := client.Container().From("alpine:latest").
WithMountedDirectory("/example/d1", d1).
WithMountedDirectory("/example/d2", d2)
build = build.Exec(dagger.ContainerExecOpts{
Args: []string{"ls", "/example"},
})
_, err = build.ExitCode(ctx)
if err != nil {
return err
}
build = build.Exec(dagger.ContainerExecOpts{
Args: []string{"ls", "/"},
})
_, err = build.ExitCode(ctx)
if err != nil {
return err
}
```
I was able to get the same functionality working fine by using `fs, err := build.FS().WithDirectory(d1, "/example/d1").WithDirectory(d2, "/example/d2").ID(ctx); build = build.WithFS(fs);` so conceptually don't think I'm doing anything wrong.
### Log output
```
#1 resolve image config for docker.io/library/alpine:latest
#1 DONE 0.4s
#2 mkfile /Dockerfile
#2 DONE 0.0s
#3 mkfile /main.go
#3 CACHED
#4 [internal] load metadata for docker.io/library/golang:1.18.2-alpine
#4 DONE 0.1s
#5 local://__dagger_workdir_/home/plaisted/source/OSD.PJI-Temporary/repro
#5 DONE 0.0s
#6 local://__dagger_workdir_/home/plaisted/source/OSD.PJI-Temporary/repro
#6 transferring __dagger_workdir_/home/plaisted/source/OSD.PJI-Temporary/repro: 309B done
#6 DONE 0.0s
#7 [build 1/6] FROM docker.io/library/golang:1.18.2-alpine@sha256:4795c5d21f01e0777707ada02408debe77fe31848be97cf9fa8a1462da78d949
#7 resolve docker.io/library/golang:1.18.2-alpine@sha256:4795c5d21f01e0777707ada02408debe77fe31848be97cf9fa8a1462da78d949 0.0s done
#7 DONE 0.0s
#8 [build 3/6] RUN apk add --no-cache file git
#8 CACHED
#9 [build 4/6] RUN go mod init go.dagger.io/dagger/shim/cmd
#9 CACHED
#10 [build 2/6] WORKDIR /src
#10 CACHED
#11 [build 5/6] COPY . .
#11 CACHED
#12 [build 6/6] RUN CGO_ENABLED=0 go build -o /_shim -ldflags '-s -d -w' .
#12 CACHED
#13 [stage-1 1/1] COPY --from=build /_shim /_shim
#13 CACHED
#14 mkdir /meta
#14 CACHED
#15 copy / /
#15 DONE 0.0s
#16 docker-image://docker.io/library/alpine:latest
#16 resolve docker.io/library/alpine:latest
#16 resolve docker.io/library/alpine:latest 0.1s done
#16 CACHED
#17 copy / /
#17 CACHED
#18 ls /example
#18 0.157 d1
#18 0.157 d2
#18 DONE 0.2s
#1 resolve image config for docker.io/library/alpine:latest
#1 DONE 0.5s
#4 [internal] load metadata for docker.io/library/golang:1.18.2-alpine
#4 DONE 0.4s
#19 ls /example
#19 0.172 d1
#19 DONE 0.2s
#20 ls /
#20 0.105 _shim
#20 0.105 bin
#20 0.105 dagger
#20 0.105 dev
#20 0.105 etc
#20 0.105 example
#20 0.105 home
#20 0.105 lib
#20 0.105 media
#20 0.105 mnt
#20 0.105 opt
#20 0.105 proc
#20 0.105 root
#20 0.105 run
#20 0.105 sbin
#20 0.105 srv
#20 0.105 sys
#20 0.105 tmp
#20 0.105 usr
#20 0.105 var
#20 DONE 0.1s
#0 0.148 d1
#0 0.148 d2
#18 DONE 0.2s
#1 resolve image config for docker.io/library/alpine:latest
#1 DONE 0.4s
#4 [internal] load metadata for docker.io/library/golang:1.18.2-alpine
#4 DONE 0.4s
#19 ls /example
#0 0.135 d1
#19 DONE 0.2s
#20 ls /example
#0 0.104 d1
#0 0.104 d2
#20 DONE 0.1s
```
### Steps to reproduce
* Mount two directories
* Run multiple exec commands and observe logs output
### Dagger version
dagger v0.3.1
### OS version
Ubuntu-20.04
|
https://github.com/dagger/dagger/issues/3551
|
https://github.com/dagger/dagger/pull/3602
|
b734ed35554bbfbc5caf63674eaa9c22692e614e
|
b4bb0b9e06e1edf8b81f9054b7419daabcb5bedb
| 2022-10-26T01:16:16Z |
go
| 2022-10-31T22:13:34Z |
core/integration/container_test.go
|
Container struct {
From struct {
WithMountedDirectory struct {
Mounts []string
Exec struct {
Stdout struct {
Contents string
}
WithMountedDirectory struct {
Mounts []string
Exec struct {
Stdout struct {
Contents string
}
WithoutMount struct {
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 3,551 |
π Odd container behavior with exec / multiple withMountedDirectory
|
### What is the issue?
The following code executes but provides unexpected logs / output. Other similar use cases error due to missing files due to same issue. This may be something very simple (haven't used golang in many years) but seems like there may be an underlying issue with the execution engine.
I would expect this code to run the `ls` command twice, one time showing the two mounted directories, one time showing the root output. Instead in the logs I see `ls` with d1 and d2 (expected), an `ls` with just d1 (??), and then an `ls` with the root fs. This causes issues if the first ls is changed to `ls /example/d2` as it will error the whole pipeline due to missing path.
```golang
workdir := client.Host().Workdir()
d1, err := workdir.Read().Directory("dir1/").ID(ctx)
if err != nil {
return err
}
d2, err := workdir.Read().Directory("dir2/").ID(ctx)
if err != nil {
return err
}
build := client.Container().From("alpine:latest").
WithMountedDirectory("/example/d1", d1).
WithMountedDirectory("/example/d2", d2)
build = build.Exec(dagger.ContainerExecOpts{
Args: []string{"ls", "/example"},
})
_, err = build.ExitCode(ctx)
if err != nil {
return err
}
build = build.Exec(dagger.ContainerExecOpts{
Args: []string{"ls", "/"},
})
_, err = build.ExitCode(ctx)
if err != nil {
return err
}
```
I was able to get the same functionality working fine by using `fs, err := build.FS().WithDirectory(d1, "/example/d1").WithDirectory(d2, "/example/d2").ID(ctx); build = build.WithFS(fs);` so conceptually don't think I'm doing anything wrong.
### Log output
```
#1 resolve image config for docker.io/library/alpine:latest
#1 DONE 0.4s
#2 mkfile /Dockerfile
#2 DONE 0.0s
#3 mkfile /main.go
#3 CACHED
#4 [internal] load metadata for docker.io/library/golang:1.18.2-alpine
#4 DONE 0.1s
#5 local://__dagger_workdir_/home/plaisted/source/OSD.PJI-Temporary/repro
#5 DONE 0.0s
#6 local://__dagger_workdir_/home/plaisted/source/OSD.PJI-Temporary/repro
#6 transferring __dagger_workdir_/home/plaisted/source/OSD.PJI-Temporary/repro: 309B done
#6 DONE 0.0s
#7 [build 1/6] FROM docker.io/library/golang:1.18.2-alpine@sha256:4795c5d21f01e0777707ada02408debe77fe31848be97cf9fa8a1462da78d949
#7 resolve docker.io/library/golang:1.18.2-alpine@sha256:4795c5d21f01e0777707ada02408debe77fe31848be97cf9fa8a1462da78d949 0.0s done
#7 DONE 0.0s
#8 [build 3/6] RUN apk add --no-cache file git
#8 CACHED
#9 [build 4/6] RUN go mod init go.dagger.io/dagger/shim/cmd
#9 CACHED
#10 [build 2/6] WORKDIR /src
#10 CACHED
#11 [build 5/6] COPY . .
#11 CACHED
#12 [build 6/6] RUN CGO_ENABLED=0 go build -o /_shim -ldflags '-s -d -w' .
#12 CACHED
#13 [stage-1 1/1] COPY --from=build /_shim /_shim
#13 CACHED
#14 mkdir /meta
#14 CACHED
#15 copy / /
#15 DONE 0.0s
#16 docker-image://docker.io/library/alpine:latest
#16 resolve docker.io/library/alpine:latest
#16 resolve docker.io/library/alpine:latest 0.1s done
#16 CACHED
#17 copy / /
#17 CACHED
#18 ls /example
#18 0.157 d1
#18 0.157 d2
#18 DONE 0.2s
#1 resolve image config for docker.io/library/alpine:latest
#1 DONE 0.5s
#4 [internal] load metadata for docker.io/library/golang:1.18.2-alpine
#4 DONE 0.4s
#19 ls /example
#19 0.172 d1
#19 DONE 0.2s
#20 ls /
#20 0.105 _shim
#20 0.105 bin
#20 0.105 dagger
#20 0.105 dev
#20 0.105 etc
#20 0.105 example
#20 0.105 home
#20 0.105 lib
#20 0.105 media
#20 0.105 mnt
#20 0.105 opt
#20 0.105 proc
#20 0.105 root
#20 0.105 run
#20 0.105 sbin
#20 0.105 srv
#20 0.105 sys
#20 0.105 tmp
#20 0.105 usr
#20 0.105 var
#20 DONE 0.1s
#0 0.148 d1
#0 0.148 d2
#18 DONE 0.2s
#1 resolve image config for docker.io/library/alpine:latest
#1 DONE 0.4s
#4 [internal] load metadata for docker.io/library/golang:1.18.2-alpine
#4 DONE 0.4s
#19 ls /example
#0 0.135 d1
#19 DONE 0.2s
#20 ls /example
#0 0.104 d1
#0 0.104 d2
#20 DONE 0.1s
```
### Steps to reproduce
* Mount two directories
* Run multiple exec commands and observe logs output
### Dagger version
dagger v0.3.1
### OS version
Ubuntu-20.04
|
https://github.com/dagger/dagger/issues/3551
|
https://github.com/dagger/dagger/pull/3602
|
b734ed35554bbfbc5caf63674eaa9c22692e614e
|
b4bb0b9e06e1edf8b81f9054b7419daabcb5bedb
| 2022-10-26T01:16:16Z |
go
| 2022-10-31T22:13:34Z |
core/integration/container_test.go
|
Mounts []string
Exec struct {
Stdout struct {
Contents string
}
}
}
}
}
}
}
}
}
}{}
err = testutil.Query(
`query Test($lower: DirectoryID!, $upper: DirectoryID!) {
container {
from(address: "alpine:3.16.2") {
withMountedDirectory(path: "/mnt/dir", source: $lower) {
mounts
exec(args: ["cat", "/mnt/dir/some-file"]) {
stdout {
contents
}
withMountedDirectory(path: "/mnt/dir", source: $upper) {
mounts
exec(args: ["cat", "/mnt/dir/some-file"]) {
stdout {
contents
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 3,551 |
π Odd container behavior with exec / multiple withMountedDirectory
|
### What is the issue?
The following code executes but provides unexpected logs / output. Other similar use cases error due to missing files due to same issue. This may be something very simple (haven't used golang in many years) but seems like there may be an underlying issue with the execution engine.
I would expect this code to run the `ls` command twice, one time showing the two mounted directories, one time showing the root output. Instead in the logs I see `ls` with d1 and d2 (expected), an `ls` with just d1 (??), and then an `ls` with the root fs. This causes issues if the first ls is changed to `ls /example/d2` as it will error the whole pipeline due to missing path.
```golang
workdir := client.Host().Workdir()
d1, err := workdir.Read().Directory("dir1/").ID(ctx)
if err != nil {
return err
}
d2, err := workdir.Read().Directory("dir2/").ID(ctx)
if err != nil {
return err
}
build := client.Container().From("alpine:latest").
WithMountedDirectory("/example/d1", d1).
WithMountedDirectory("/example/d2", d2)
build = build.Exec(dagger.ContainerExecOpts{
Args: []string{"ls", "/example"},
})
_, err = build.ExitCode(ctx)
if err != nil {
return err
}
build = build.Exec(dagger.ContainerExecOpts{
Args: []string{"ls", "/"},
})
_, err = build.ExitCode(ctx)
if err != nil {
return err
}
```
I was able to get the same functionality working fine by using `fs, err := build.FS().WithDirectory(d1, "/example/d1").WithDirectory(d2, "/example/d2").ID(ctx); build = build.WithFS(fs);` so conceptually don't think I'm doing anything wrong.
### Log output
```
#1 resolve image config for docker.io/library/alpine:latest
#1 DONE 0.4s
#2 mkfile /Dockerfile
#2 DONE 0.0s
#3 mkfile /main.go
#3 CACHED
#4 [internal] load metadata for docker.io/library/golang:1.18.2-alpine
#4 DONE 0.1s
#5 local://__dagger_workdir_/home/plaisted/source/OSD.PJI-Temporary/repro
#5 DONE 0.0s
#6 local://__dagger_workdir_/home/plaisted/source/OSD.PJI-Temporary/repro
#6 transferring __dagger_workdir_/home/plaisted/source/OSD.PJI-Temporary/repro: 309B done
#6 DONE 0.0s
#7 [build 1/6] FROM docker.io/library/golang:1.18.2-alpine@sha256:4795c5d21f01e0777707ada02408debe77fe31848be97cf9fa8a1462da78d949
#7 resolve docker.io/library/golang:1.18.2-alpine@sha256:4795c5d21f01e0777707ada02408debe77fe31848be97cf9fa8a1462da78d949 0.0s done
#7 DONE 0.0s
#8 [build 3/6] RUN apk add --no-cache file git
#8 CACHED
#9 [build 4/6] RUN go mod init go.dagger.io/dagger/shim/cmd
#9 CACHED
#10 [build 2/6] WORKDIR /src
#10 CACHED
#11 [build 5/6] COPY . .
#11 CACHED
#12 [build 6/6] RUN CGO_ENABLED=0 go build -o /_shim -ldflags '-s -d -w' .
#12 CACHED
#13 [stage-1 1/1] COPY --from=build /_shim /_shim
#13 CACHED
#14 mkdir /meta
#14 CACHED
#15 copy / /
#15 DONE 0.0s
#16 docker-image://docker.io/library/alpine:latest
#16 resolve docker.io/library/alpine:latest
#16 resolve docker.io/library/alpine:latest 0.1s done
#16 CACHED
#17 copy / /
#17 CACHED
#18 ls /example
#18 0.157 d1
#18 0.157 d2
#18 DONE 0.2s
#1 resolve image config for docker.io/library/alpine:latest
#1 DONE 0.5s
#4 [internal] load metadata for docker.io/library/golang:1.18.2-alpine
#4 DONE 0.4s
#19 ls /example
#19 0.172 d1
#19 DONE 0.2s
#20 ls /
#20 0.105 _shim
#20 0.105 bin
#20 0.105 dagger
#20 0.105 dev
#20 0.105 etc
#20 0.105 example
#20 0.105 home
#20 0.105 lib
#20 0.105 media
#20 0.105 mnt
#20 0.105 opt
#20 0.105 proc
#20 0.105 root
#20 0.105 run
#20 0.105 sbin
#20 0.105 srv
#20 0.105 sys
#20 0.105 tmp
#20 0.105 usr
#20 0.105 var
#20 DONE 0.1s
#0 0.148 d1
#0 0.148 d2
#18 DONE 0.2s
#1 resolve image config for docker.io/library/alpine:latest
#1 DONE 0.4s
#4 [internal] load metadata for docker.io/library/golang:1.18.2-alpine
#4 DONE 0.4s
#19 ls /example
#0 0.135 d1
#19 DONE 0.2s
#20 ls /example
#0 0.104 d1
#0 0.104 d2
#20 DONE 0.1s
```
### Steps to reproduce
* Mount two directories
* Run multiple exec commands and observe logs output
### Dagger version
dagger v0.3.1
### OS version
Ubuntu-20.04
|
https://github.com/dagger/dagger/issues/3551
|
https://github.com/dagger/dagger/pull/3602
|
b734ed35554bbfbc5caf63674eaa9c22692e614e
|
b4bb0b9e06e1edf8b81f9054b7419daabcb5bedb
| 2022-10-26T01:16:16Z |
go
| 2022-10-31T22:13:34Z |
core/integration/container_test.go
|
}
withoutMount(path: "/mnt/dir") {
mounts
exec(args: ["cat", "/mnt/dir/some-file"]) {
stdout {
contents
}
}
}
}
}
}
}
}
}
}`, &execRes, &testutil.QueryOptions{Variables: map[string]any{
"lower": lowerID,
"upper": upperID,
}})
require.NoError(t, err)
require.Equal(t, []string{"/mnt/dir"}, execRes.Container.From.WithMountedDirectory.Mounts)
require.Equal(t, "lower-content", execRes.Container.From.WithMountedDirectory.Exec.Stdout.Contents)
require.Equal(t, []string{"/mnt/dir", "/mnt/dir"}, execRes.Container.From.WithMountedDirectory.Exec.WithMountedDirectory.Mounts)
require.Equal(t, "upper-content", execRes.Container.From.WithMountedDirectory.Exec.WithMountedDirectory.Exec.Stdout.Contents)
require.Equal(t, []string{"/mnt/dir"}, execRes.Container.From.WithMountedDirectory.Exec.WithMountedDirectory.Exec.WithoutMount.Mounts)
require.Equal(t, "lower-content", execRes.Container.From.WithMountedDirectory.Exec.WithMountedDirectory.Exec.WithoutMount.Exec.Stdout.Contents)
}
func TestContainerDirectory(t *testing.T) {
t.Parallel()
dirRes := struct {
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 3,551 |
π Odd container behavior with exec / multiple withMountedDirectory
|
### What is the issue?
The following code executes but provides unexpected logs / output. Other similar use cases error due to missing files due to same issue. This may be something very simple (haven't used golang in many years) but seems like there may be an underlying issue with the execution engine.
I would expect this code to run the `ls` command twice, one time showing the two mounted directories, one time showing the root output. Instead in the logs I see `ls` with d1 and d2 (expected), an `ls` with just d1 (??), and then an `ls` with the root fs. This causes issues if the first ls is changed to `ls /example/d2` as it will error the whole pipeline due to missing path.
```golang
workdir := client.Host().Workdir()
d1, err := workdir.Read().Directory("dir1/").ID(ctx)
if err != nil {
return err
}
d2, err := workdir.Read().Directory("dir2/").ID(ctx)
if err != nil {
return err
}
build := client.Container().From("alpine:latest").
WithMountedDirectory("/example/d1", d1).
WithMountedDirectory("/example/d2", d2)
build = build.Exec(dagger.ContainerExecOpts{
Args: []string{"ls", "/example"},
})
_, err = build.ExitCode(ctx)
if err != nil {
return err
}
build = build.Exec(dagger.ContainerExecOpts{
Args: []string{"ls", "/"},
})
_, err = build.ExitCode(ctx)
if err != nil {
return err
}
```
I was able to get the same functionality working fine by using `fs, err := build.FS().WithDirectory(d1, "/example/d1").WithDirectory(d2, "/example/d2").ID(ctx); build = build.WithFS(fs);` so conceptually don't think I'm doing anything wrong.
### Log output
```
#1 resolve image config for docker.io/library/alpine:latest
#1 DONE 0.4s
#2 mkfile /Dockerfile
#2 DONE 0.0s
#3 mkfile /main.go
#3 CACHED
#4 [internal] load metadata for docker.io/library/golang:1.18.2-alpine
#4 DONE 0.1s
#5 local://__dagger_workdir_/home/plaisted/source/OSD.PJI-Temporary/repro
#5 DONE 0.0s
#6 local://__dagger_workdir_/home/plaisted/source/OSD.PJI-Temporary/repro
#6 transferring __dagger_workdir_/home/plaisted/source/OSD.PJI-Temporary/repro: 309B done
#6 DONE 0.0s
#7 [build 1/6] FROM docker.io/library/golang:1.18.2-alpine@sha256:4795c5d21f01e0777707ada02408debe77fe31848be97cf9fa8a1462da78d949
#7 resolve docker.io/library/golang:1.18.2-alpine@sha256:4795c5d21f01e0777707ada02408debe77fe31848be97cf9fa8a1462da78d949 0.0s done
#7 DONE 0.0s
#8 [build 3/6] RUN apk add --no-cache file git
#8 CACHED
#9 [build 4/6] RUN go mod init go.dagger.io/dagger/shim/cmd
#9 CACHED
#10 [build 2/6] WORKDIR /src
#10 CACHED
#11 [build 5/6] COPY . .
#11 CACHED
#12 [build 6/6] RUN CGO_ENABLED=0 go build -o /_shim -ldflags '-s -d -w' .
#12 CACHED
#13 [stage-1 1/1] COPY --from=build /_shim /_shim
#13 CACHED
#14 mkdir /meta
#14 CACHED
#15 copy / /
#15 DONE 0.0s
#16 docker-image://docker.io/library/alpine:latest
#16 resolve docker.io/library/alpine:latest
#16 resolve docker.io/library/alpine:latest 0.1s done
#16 CACHED
#17 copy / /
#17 CACHED
#18 ls /example
#18 0.157 d1
#18 0.157 d2
#18 DONE 0.2s
#1 resolve image config for docker.io/library/alpine:latest
#1 DONE 0.5s
#4 [internal] load metadata for docker.io/library/golang:1.18.2-alpine
#4 DONE 0.4s
#19 ls /example
#19 0.172 d1
#19 DONE 0.2s
#20 ls /
#20 0.105 _shim
#20 0.105 bin
#20 0.105 dagger
#20 0.105 dev
#20 0.105 etc
#20 0.105 example
#20 0.105 home
#20 0.105 lib
#20 0.105 media
#20 0.105 mnt
#20 0.105 opt
#20 0.105 proc
#20 0.105 root
#20 0.105 run
#20 0.105 sbin
#20 0.105 srv
#20 0.105 sys
#20 0.105 tmp
#20 0.105 usr
#20 0.105 var
#20 DONE 0.1s
#0 0.148 d1
#0 0.148 d2
#18 DONE 0.2s
#1 resolve image config for docker.io/library/alpine:latest
#1 DONE 0.4s
#4 [internal] load metadata for docker.io/library/golang:1.18.2-alpine
#4 DONE 0.4s
#19 ls /example
#0 0.135 d1
#19 DONE 0.2s
#20 ls /example
#0 0.104 d1
#0 0.104 d2
#20 DONE 0.1s
```
### Steps to reproduce
* Mount two directories
* Run multiple exec commands and observe logs output
### Dagger version
dagger v0.3.1
### OS version
Ubuntu-20.04
|
https://github.com/dagger/dagger/issues/3551
|
https://github.com/dagger/dagger/pull/3602
|
b734ed35554bbfbc5caf63674eaa9c22692e614e
|
b4bb0b9e06e1edf8b81f9054b7419daabcb5bedb
| 2022-10-26T01:16:16Z |
go
| 2022-10-31T22:13:34Z |
core/integration/container_test.go
|
Directory struct {
WithNewFile struct {
WithNewFile struct {
ID core.DirectoryID
}
}
}
}{}
err := testutil.Query(
`{
directory {
withNewFile(path: "some-file", contents: "some-content") {
withNewFile(path: "some-dir/sub-file", contents: "sub-content") {
id
}
}
}
}`, &dirRes, nil)
require.NoError(t, err)
id := dirRes.Directory.WithNewFile.WithNewFile.ID
writeRes := struct {
Container struct {
From struct {
WithMountedDirectory struct {
WithMountedDirectory struct {
Exec struct {
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 3,551 |
π Odd container behavior with exec / multiple withMountedDirectory
|
### What is the issue?
The following code executes but provides unexpected logs / output. Other similar use cases error due to missing files due to same issue. This may be something very simple (haven't used golang in many years) but seems like there may be an underlying issue with the execution engine.
I would expect this code to run the `ls` command twice, one time showing the two mounted directories, one time showing the root output. Instead in the logs I see `ls` with d1 and d2 (expected), an `ls` with just d1 (??), and then an `ls` with the root fs. This causes issues if the first ls is changed to `ls /example/d2` as it will error the whole pipeline due to missing path.
```golang
workdir := client.Host().Workdir()
d1, err := workdir.Read().Directory("dir1/").ID(ctx)
if err != nil {
return err
}
d2, err := workdir.Read().Directory("dir2/").ID(ctx)
if err != nil {
return err
}
build := client.Container().From("alpine:latest").
WithMountedDirectory("/example/d1", d1).
WithMountedDirectory("/example/d2", d2)
build = build.Exec(dagger.ContainerExecOpts{
Args: []string{"ls", "/example"},
})
_, err = build.ExitCode(ctx)
if err != nil {
return err
}
build = build.Exec(dagger.ContainerExecOpts{
Args: []string{"ls", "/"},
})
_, err = build.ExitCode(ctx)
if err != nil {
return err
}
```
I was able to get the same functionality working fine by using `fs, err := build.FS().WithDirectory(d1, "/example/d1").WithDirectory(d2, "/example/d2").ID(ctx); build = build.WithFS(fs);` so conceptually don't think I'm doing anything wrong.
### Log output
```
#1 resolve image config for docker.io/library/alpine:latest
#1 DONE 0.4s
#2 mkfile /Dockerfile
#2 DONE 0.0s
#3 mkfile /main.go
#3 CACHED
#4 [internal] load metadata for docker.io/library/golang:1.18.2-alpine
#4 DONE 0.1s
#5 local://__dagger_workdir_/home/plaisted/source/OSD.PJI-Temporary/repro
#5 DONE 0.0s
#6 local://__dagger_workdir_/home/plaisted/source/OSD.PJI-Temporary/repro
#6 transferring __dagger_workdir_/home/plaisted/source/OSD.PJI-Temporary/repro: 309B done
#6 DONE 0.0s
#7 [build 1/6] FROM docker.io/library/golang:1.18.2-alpine@sha256:4795c5d21f01e0777707ada02408debe77fe31848be97cf9fa8a1462da78d949
#7 resolve docker.io/library/golang:1.18.2-alpine@sha256:4795c5d21f01e0777707ada02408debe77fe31848be97cf9fa8a1462da78d949 0.0s done
#7 DONE 0.0s
#8 [build 3/6] RUN apk add --no-cache file git
#8 CACHED
#9 [build 4/6] RUN go mod init go.dagger.io/dagger/shim/cmd
#9 CACHED
#10 [build 2/6] WORKDIR /src
#10 CACHED
#11 [build 5/6] COPY . .
#11 CACHED
#12 [build 6/6] RUN CGO_ENABLED=0 go build -o /_shim -ldflags '-s -d -w' .
#12 CACHED
#13 [stage-1 1/1] COPY --from=build /_shim /_shim
#13 CACHED
#14 mkdir /meta
#14 CACHED
#15 copy / /
#15 DONE 0.0s
#16 docker-image://docker.io/library/alpine:latest
#16 resolve docker.io/library/alpine:latest
#16 resolve docker.io/library/alpine:latest 0.1s done
#16 CACHED
#17 copy / /
#17 CACHED
#18 ls /example
#18 0.157 d1
#18 0.157 d2
#18 DONE 0.2s
#1 resolve image config for docker.io/library/alpine:latest
#1 DONE 0.5s
#4 [internal] load metadata for docker.io/library/golang:1.18.2-alpine
#4 DONE 0.4s
#19 ls /example
#19 0.172 d1
#19 DONE 0.2s
#20 ls /
#20 0.105 _shim
#20 0.105 bin
#20 0.105 dagger
#20 0.105 dev
#20 0.105 etc
#20 0.105 example
#20 0.105 home
#20 0.105 lib
#20 0.105 media
#20 0.105 mnt
#20 0.105 opt
#20 0.105 proc
#20 0.105 root
#20 0.105 run
#20 0.105 sbin
#20 0.105 srv
#20 0.105 sys
#20 0.105 tmp
#20 0.105 usr
#20 0.105 var
#20 DONE 0.1s
#0 0.148 d1
#0 0.148 d2
#18 DONE 0.2s
#1 resolve image config for docker.io/library/alpine:latest
#1 DONE 0.4s
#4 [internal] load metadata for docker.io/library/golang:1.18.2-alpine
#4 DONE 0.4s
#19 ls /example
#0 0.135 d1
#19 DONE 0.2s
#20 ls /example
#0 0.104 d1
#0 0.104 d2
#20 DONE 0.1s
```
### Steps to reproduce
* Mount two directories
* Run multiple exec commands and observe logs output
### Dagger version
dagger v0.3.1
### OS version
Ubuntu-20.04
|
https://github.com/dagger/dagger/issues/3551
|
https://github.com/dagger/dagger/pull/3602
|
b734ed35554bbfbc5caf63674eaa9c22692e614e
|
b4bb0b9e06e1edf8b81f9054b7419daabcb5bedb
| 2022-10-26T01:16:16Z |
go
| 2022-10-31T22:13:34Z |
core/integration/container_test.go
|
Directory struct {
ID core.DirectoryID
}
}
}
}
}
}
}{}
err = testutil.Query(
`query Test($id: DirectoryID!) {
container {
from(address: "alpine:3.16.2") {
withMountedDirectory(path: "/mnt/dir", source: $id) {
withMountedDirectory(path: "/mnt/dir/overlap", source: $id) {
exec(args: ["sh", "-c", "echo hello >> /mnt/dir/overlap/another-file"]) {
directory(path: "/mnt/dir/overlap") {
id
}
}
}
}
}
}
}`, &writeRes, &testutil.QueryOptions{Variables: map[string]any{
"id": id,
}})
require.NoError(t, err)
writtenID := writeRes.Container.From.WithMountedDirectory.WithMountedDirectory.Exec.Directory.ID
execRes := struct {
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 3,551 |
π Odd container behavior with exec / multiple withMountedDirectory
|
### What is the issue?
The following code executes but provides unexpected logs / output. Other similar use cases error due to missing files due to same issue. This may be something very simple (haven't used golang in many years) but seems like there may be an underlying issue with the execution engine.
I would expect this code to run the `ls` command twice, one time showing the two mounted directories, one time showing the root output. Instead in the logs I see `ls` with d1 and d2 (expected), an `ls` with just d1 (??), and then an `ls` with the root fs. This causes issues if the first ls is changed to `ls /example/d2` as it will error the whole pipeline due to missing path.
```golang
workdir := client.Host().Workdir()
d1, err := workdir.Read().Directory("dir1/").ID(ctx)
if err != nil {
return err
}
d2, err := workdir.Read().Directory("dir2/").ID(ctx)
if err != nil {
return err
}
build := client.Container().From("alpine:latest").
WithMountedDirectory("/example/d1", d1).
WithMountedDirectory("/example/d2", d2)
build = build.Exec(dagger.ContainerExecOpts{
Args: []string{"ls", "/example"},
})
_, err = build.ExitCode(ctx)
if err != nil {
return err
}
build = build.Exec(dagger.ContainerExecOpts{
Args: []string{"ls", "/"},
})
_, err = build.ExitCode(ctx)
if err != nil {
return err
}
```
I was able to get the same functionality working fine by using `fs, err := build.FS().WithDirectory(d1, "/example/d1").WithDirectory(d2, "/example/d2").ID(ctx); build = build.WithFS(fs);` so conceptually don't think I'm doing anything wrong.
### Log output
```
#1 resolve image config for docker.io/library/alpine:latest
#1 DONE 0.4s
#2 mkfile /Dockerfile
#2 DONE 0.0s
#3 mkfile /main.go
#3 CACHED
#4 [internal] load metadata for docker.io/library/golang:1.18.2-alpine
#4 DONE 0.1s
#5 local://__dagger_workdir_/home/plaisted/source/OSD.PJI-Temporary/repro
#5 DONE 0.0s
#6 local://__dagger_workdir_/home/plaisted/source/OSD.PJI-Temporary/repro
#6 transferring __dagger_workdir_/home/plaisted/source/OSD.PJI-Temporary/repro: 309B done
#6 DONE 0.0s
#7 [build 1/6] FROM docker.io/library/golang:1.18.2-alpine@sha256:4795c5d21f01e0777707ada02408debe77fe31848be97cf9fa8a1462da78d949
#7 resolve docker.io/library/golang:1.18.2-alpine@sha256:4795c5d21f01e0777707ada02408debe77fe31848be97cf9fa8a1462da78d949 0.0s done
#7 DONE 0.0s
#8 [build 3/6] RUN apk add --no-cache file git
#8 CACHED
#9 [build 4/6] RUN go mod init go.dagger.io/dagger/shim/cmd
#9 CACHED
#10 [build 2/6] WORKDIR /src
#10 CACHED
#11 [build 5/6] COPY . .
#11 CACHED
#12 [build 6/6] RUN CGO_ENABLED=0 go build -o /_shim -ldflags '-s -d -w' .
#12 CACHED
#13 [stage-1 1/1] COPY --from=build /_shim /_shim
#13 CACHED
#14 mkdir /meta
#14 CACHED
#15 copy / /
#15 DONE 0.0s
#16 docker-image://docker.io/library/alpine:latest
#16 resolve docker.io/library/alpine:latest
#16 resolve docker.io/library/alpine:latest 0.1s done
#16 CACHED
#17 copy / /
#17 CACHED
#18 ls /example
#18 0.157 d1
#18 0.157 d2
#18 DONE 0.2s
#1 resolve image config for docker.io/library/alpine:latest
#1 DONE 0.5s
#4 [internal] load metadata for docker.io/library/golang:1.18.2-alpine
#4 DONE 0.4s
#19 ls /example
#19 0.172 d1
#19 DONE 0.2s
#20 ls /
#20 0.105 _shim
#20 0.105 bin
#20 0.105 dagger
#20 0.105 dev
#20 0.105 etc
#20 0.105 example
#20 0.105 home
#20 0.105 lib
#20 0.105 media
#20 0.105 mnt
#20 0.105 opt
#20 0.105 proc
#20 0.105 root
#20 0.105 run
#20 0.105 sbin
#20 0.105 srv
#20 0.105 sys
#20 0.105 tmp
#20 0.105 usr
#20 0.105 var
#20 DONE 0.1s
#0 0.148 d1
#0 0.148 d2
#18 DONE 0.2s
#1 resolve image config for docker.io/library/alpine:latest
#1 DONE 0.4s
#4 [internal] load metadata for docker.io/library/golang:1.18.2-alpine
#4 DONE 0.4s
#19 ls /example
#0 0.135 d1
#19 DONE 0.2s
#20 ls /example
#0 0.104 d1
#0 0.104 d2
#20 DONE 0.1s
```
### Steps to reproduce
* Mount two directories
* Run multiple exec commands and observe logs output
### Dagger version
dagger v0.3.1
### OS version
Ubuntu-20.04
|
https://github.com/dagger/dagger/issues/3551
|
https://github.com/dagger/dagger/pull/3602
|
b734ed35554bbfbc5caf63674eaa9c22692e614e
|
b4bb0b9e06e1edf8b81f9054b7419daabcb5bedb
| 2022-10-26T01:16:16Z |
go
| 2022-10-31T22:13:34Z |
core/integration/container_test.go
|
Container struct {
From struct {
WithMountedDirectory struct {
Exec struct {
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 3,551 |
π Odd container behavior with exec / multiple withMountedDirectory
|
### What is the issue?
The following code executes but provides unexpected logs / output. Other similar use cases error due to missing files due to same issue. This may be something very simple (haven't used golang in many years) but seems like there may be an underlying issue with the execution engine.
I would expect this code to run the `ls` command twice, one time showing the two mounted directories, one time showing the root output. Instead in the logs I see `ls` with d1 and d2 (expected), an `ls` with just d1 (??), and then an `ls` with the root fs. This causes issues if the first ls is changed to `ls /example/d2` as it will error the whole pipeline due to missing path.
```golang
workdir := client.Host().Workdir()
d1, err := workdir.Read().Directory("dir1/").ID(ctx)
if err != nil {
return err
}
d2, err := workdir.Read().Directory("dir2/").ID(ctx)
if err != nil {
return err
}
build := client.Container().From("alpine:latest").
WithMountedDirectory("/example/d1", d1).
WithMountedDirectory("/example/d2", d2)
build = build.Exec(dagger.ContainerExecOpts{
Args: []string{"ls", "/example"},
})
_, err = build.ExitCode(ctx)
if err != nil {
return err
}
build = build.Exec(dagger.ContainerExecOpts{
Args: []string{"ls", "/"},
})
_, err = build.ExitCode(ctx)
if err != nil {
return err
}
```
I was able to get the same functionality working fine by using `fs, err := build.FS().WithDirectory(d1, "/example/d1").WithDirectory(d2, "/example/d2").ID(ctx); build = build.WithFS(fs);` so conceptually don't think I'm doing anything wrong.
### Log output
```
#1 resolve image config for docker.io/library/alpine:latest
#1 DONE 0.4s
#2 mkfile /Dockerfile
#2 DONE 0.0s
#3 mkfile /main.go
#3 CACHED
#4 [internal] load metadata for docker.io/library/golang:1.18.2-alpine
#4 DONE 0.1s
#5 local://__dagger_workdir_/home/plaisted/source/OSD.PJI-Temporary/repro
#5 DONE 0.0s
#6 local://__dagger_workdir_/home/plaisted/source/OSD.PJI-Temporary/repro
#6 transferring __dagger_workdir_/home/plaisted/source/OSD.PJI-Temporary/repro: 309B done
#6 DONE 0.0s
#7 [build 1/6] FROM docker.io/library/golang:1.18.2-alpine@sha256:4795c5d21f01e0777707ada02408debe77fe31848be97cf9fa8a1462da78d949
#7 resolve docker.io/library/golang:1.18.2-alpine@sha256:4795c5d21f01e0777707ada02408debe77fe31848be97cf9fa8a1462da78d949 0.0s done
#7 DONE 0.0s
#8 [build 3/6] RUN apk add --no-cache file git
#8 CACHED
#9 [build 4/6] RUN go mod init go.dagger.io/dagger/shim/cmd
#9 CACHED
#10 [build 2/6] WORKDIR /src
#10 CACHED
#11 [build 5/6] COPY . .
#11 CACHED
#12 [build 6/6] RUN CGO_ENABLED=0 go build -o /_shim -ldflags '-s -d -w' .
#12 CACHED
#13 [stage-1 1/1] COPY --from=build /_shim /_shim
#13 CACHED
#14 mkdir /meta
#14 CACHED
#15 copy / /
#15 DONE 0.0s
#16 docker-image://docker.io/library/alpine:latest
#16 resolve docker.io/library/alpine:latest
#16 resolve docker.io/library/alpine:latest 0.1s done
#16 CACHED
#17 copy / /
#17 CACHED
#18 ls /example
#18 0.157 d1
#18 0.157 d2
#18 DONE 0.2s
#1 resolve image config for docker.io/library/alpine:latest
#1 DONE 0.5s
#4 [internal] load metadata for docker.io/library/golang:1.18.2-alpine
#4 DONE 0.4s
#19 ls /example
#19 0.172 d1
#19 DONE 0.2s
#20 ls /
#20 0.105 _shim
#20 0.105 bin
#20 0.105 dagger
#20 0.105 dev
#20 0.105 etc
#20 0.105 example
#20 0.105 home
#20 0.105 lib
#20 0.105 media
#20 0.105 mnt
#20 0.105 opt
#20 0.105 proc
#20 0.105 root
#20 0.105 run
#20 0.105 sbin
#20 0.105 srv
#20 0.105 sys
#20 0.105 tmp
#20 0.105 usr
#20 0.105 var
#20 DONE 0.1s
#0 0.148 d1
#0 0.148 d2
#18 DONE 0.2s
#1 resolve image config for docker.io/library/alpine:latest
#1 DONE 0.4s
#4 [internal] load metadata for docker.io/library/golang:1.18.2-alpine
#4 DONE 0.4s
#19 ls /example
#0 0.135 d1
#19 DONE 0.2s
#20 ls /example
#0 0.104 d1
#0 0.104 d2
#20 DONE 0.1s
```
### Steps to reproduce
* Mount two directories
* Run multiple exec commands and observe logs output
### Dagger version
dagger v0.3.1
### OS version
Ubuntu-20.04
|
https://github.com/dagger/dagger/issues/3551
|
https://github.com/dagger/dagger/pull/3602
|
b734ed35554bbfbc5caf63674eaa9c22692e614e
|
b4bb0b9e06e1edf8b81f9054b7419daabcb5bedb
| 2022-10-26T01:16:16Z |
go
| 2022-10-31T22:13:34Z |
core/integration/container_test.go
|
Stdout struct {
Contents string
}
}
}
}
}
}{}
err = testutil.Query(
`query Test($id: DirectoryID!) {
container {
from(address: "alpine:3.16.2") {
withMountedDirectory(path: "/mnt/dir", source: $id) {
exec(args: ["cat", "/mnt/dir/another-file"]) {
stdout {
contents
}
}
}
}
}
}`, &execRes, &testutil.QueryOptions{Variables: map[string]any{
"id": writtenID,
}})
require.NoError(t, err)
require.Equal(t, "hello\n", execRes.Container.From.WithMountedDirectory.Exec.Stdout.Contents)
}
func TestContainerDirectoryErrors(t *testing.T) {
t.Parallel()
dirRes := struct {
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 3,551 |
π Odd container behavior with exec / multiple withMountedDirectory
|
### What is the issue?
The following code executes but provides unexpected logs / output. Other similar use cases error due to missing files due to same issue. This may be something very simple (haven't used golang in many years) but seems like there may be an underlying issue with the execution engine.
I would expect this code to run the `ls` command twice, one time showing the two mounted directories, one time showing the root output. Instead in the logs I see `ls` with d1 and d2 (expected), an `ls` with just d1 (??), and then an `ls` with the root fs. This causes issues if the first ls is changed to `ls /example/d2` as it will error the whole pipeline due to missing path.
```golang
workdir := client.Host().Workdir()
d1, err := workdir.Read().Directory("dir1/").ID(ctx)
if err != nil {
return err
}
d2, err := workdir.Read().Directory("dir2/").ID(ctx)
if err != nil {
return err
}
build := client.Container().From("alpine:latest").
WithMountedDirectory("/example/d1", d1).
WithMountedDirectory("/example/d2", d2)
build = build.Exec(dagger.ContainerExecOpts{
Args: []string{"ls", "/example"},
})
_, err = build.ExitCode(ctx)
if err != nil {
return err
}
build = build.Exec(dagger.ContainerExecOpts{
Args: []string{"ls", "/"},
})
_, err = build.ExitCode(ctx)
if err != nil {
return err
}
```
I was able to get the same functionality working fine by using `fs, err := build.FS().WithDirectory(d1, "/example/d1").WithDirectory(d2, "/example/d2").ID(ctx); build = build.WithFS(fs);` so conceptually don't think I'm doing anything wrong.
### Log output
```
#1 resolve image config for docker.io/library/alpine:latest
#1 DONE 0.4s
#2 mkfile /Dockerfile
#2 DONE 0.0s
#3 mkfile /main.go
#3 CACHED
#4 [internal] load metadata for docker.io/library/golang:1.18.2-alpine
#4 DONE 0.1s
#5 local://__dagger_workdir_/home/plaisted/source/OSD.PJI-Temporary/repro
#5 DONE 0.0s
#6 local://__dagger_workdir_/home/plaisted/source/OSD.PJI-Temporary/repro
#6 transferring __dagger_workdir_/home/plaisted/source/OSD.PJI-Temporary/repro: 309B done
#6 DONE 0.0s
#7 [build 1/6] FROM docker.io/library/golang:1.18.2-alpine@sha256:4795c5d21f01e0777707ada02408debe77fe31848be97cf9fa8a1462da78d949
#7 resolve docker.io/library/golang:1.18.2-alpine@sha256:4795c5d21f01e0777707ada02408debe77fe31848be97cf9fa8a1462da78d949 0.0s done
#7 DONE 0.0s
#8 [build 3/6] RUN apk add --no-cache file git
#8 CACHED
#9 [build 4/6] RUN go mod init go.dagger.io/dagger/shim/cmd
#9 CACHED
#10 [build 2/6] WORKDIR /src
#10 CACHED
#11 [build 5/6] COPY . .
#11 CACHED
#12 [build 6/6] RUN CGO_ENABLED=0 go build -o /_shim -ldflags '-s -d -w' .
#12 CACHED
#13 [stage-1 1/1] COPY --from=build /_shim /_shim
#13 CACHED
#14 mkdir /meta
#14 CACHED
#15 copy / /
#15 DONE 0.0s
#16 docker-image://docker.io/library/alpine:latest
#16 resolve docker.io/library/alpine:latest
#16 resolve docker.io/library/alpine:latest 0.1s done
#16 CACHED
#17 copy / /
#17 CACHED
#18 ls /example
#18 0.157 d1
#18 0.157 d2
#18 DONE 0.2s
#1 resolve image config for docker.io/library/alpine:latest
#1 DONE 0.5s
#4 [internal] load metadata for docker.io/library/golang:1.18.2-alpine
#4 DONE 0.4s
#19 ls /example
#19 0.172 d1
#19 DONE 0.2s
#20 ls /
#20 0.105 _shim
#20 0.105 bin
#20 0.105 dagger
#20 0.105 dev
#20 0.105 etc
#20 0.105 example
#20 0.105 home
#20 0.105 lib
#20 0.105 media
#20 0.105 mnt
#20 0.105 opt
#20 0.105 proc
#20 0.105 root
#20 0.105 run
#20 0.105 sbin
#20 0.105 srv
#20 0.105 sys
#20 0.105 tmp
#20 0.105 usr
#20 0.105 var
#20 DONE 0.1s
#0 0.148 d1
#0 0.148 d2
#18 DONE 0.2s
#1 resolve image config for docker.io/library/alpine:latest
#1 DONE 0.4s
#4 [internal] load metadata for docker.io/library/golang:1.18.2-alpine
#4 DONE 0.4s
#19 ls /example
#0 0.135 d1
#19 DONE 0.2s
#20 ls /example
#0 0.104 d1
#0 0.104 d2
#20 DONE 0.1s
```
### Steps to reproduce
* Mount two directories
* Run multiple exec commands and observe logs output
### Dagger version
dagger v0.3.1
### OS version
Ubuntu-20.04
|
https://github.com/dagger/dagger/issues/3551
|
https://github.com/dagger/dagger/pull/3602
|
b734ed35554bbfbc5caf63674eaa9c22692e614e
|
b4bb0b9e06e1edf8b81f9054b7419daabcb5bedb
| 2022-10-26T01:16:16Z |
go
| 2022-10-31T22:13:34Z |
core/integration/container_test.go
|
Directory struct {
WithNewFile struct {
WithNewFile struct {
ID core.DirectoryID
}
}
}
}{}
err := testutil.Query(
`{
directory {
withNewFile(path: "some-file", contents: "some-content") {
withNewFile(path: "some-dir/sub-file", contents: "sub-content") {
id
}
}
}
}`, &dirRes, nil)
require.NoError(t, err)
id := dirRes.Directory.WithNewFile.WithNewFile.ID
err = testutil.Query(
`query Test($id: DirectoryID!) {
container {
from(address: "alpine:3.16.2") {
withMountedDirectory(path: "/mnt/dir", source: $id) {
directory(path: "/mnt/dir/some-file") {
id
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 3,551 |
π Odd container behavior with exec / multiple withMountedDirectory
|
### What is the issue?
The following code executes but provides unexpected logs / output. Other similar use cases error due to missing files due to same issue. This may be something very simple (haven't used golang in many years) but seems like there may be an underlying issue with the execution engine.
I would expect this code to run the `ls` command twice, one time showing the two mounted directories, one time showing the root output. Instead in the logs I see `ls` with d1 and d2 (expected), an `ls` with just d1 (??), and then an `ls` with the root fs. This causes issues if the first ls is changed to `ls /example/d2` as it will error the whole pipeline due to missing path.
```golang
workdir := client.Host().Workdir()
d1, err := workdir.Read().Directory("dir1/").ID(ctx)
if err != nil {
return err
}
d2, err := workdir.Read().Directory("dir2/").ID(ctx)
if err != nil {
return err
}
build := client.Container().From("alpine:latest").
WithMountedDirectory("/example/d1", d1).
WithMountedDirectory("/example/d2", d2)
build = build.Exec(dagger.ContainerExecOpts{
Args: []string{"ls", "/example"},
})
_, err = build.ExitCode(ctx)
if err != nil {
return err
}
build = build.Exec(dagger.ContainerExecOpts{
Args: []string{"ls", "/"},
})
_, err = build.ExitCode(ctx)
if err != nil {
return err
}
```
I was able to get the same functionality working fine by using `fs, err := build.FS().WithDirectory(d1, "/example/d1").WithDirectory(d2, "/example/d2").ID(ctx); build = build.WithFS(fs);` so conceptually don't think I'm doing anything wrong.
### Log output
```
#1 resolve image config for docker.io/library/alpine:latest
#1 DONE 0.4s
#2 mkfile /Dockerfile
#2 DONE 0.0s
#3 mkfile /main.go
#3 CACHED
#4 [internal] load metadata for docker.io/library/golang:1.18.2-alpine
#4 DONE 0.1s
#5 local://__dagger_workdir_/home/plaisted/source/OSD.PJI-Temporary/repro
#5 DONE 0.0s
#6 local://__dagger_workdir_/home/plaisted/source/OSD.PJI-Temporary/repro
#6 transferring __dagger_workdir_/home/plaisted/source/OSD.PJI-Temporary/repro: 309B done
#6 DONE 0.0s
#7 [build 1/6] FROM docker.io/library/golang:1.18.2-alpine@sha256:4795c5d21f01e0777707ada02408debe77fe31848be97cf9fa8a1462da78d949
#7 resolve docker.io/library/golang:1.18.2-alpine@sha256:4795c5d21f01e0777707ada02408debe77fe31848be97cf9fa8a1462da78d949 0.0s done
#7 DONE 0.0s
#8 [build 3/6] RUN apk add --no-cache file git
#8 CACHED
#9 [build 4/6] RUN go mod init go.dagger.io/dagger/shim/cmd
#9 CACHED
#10 [build 2/6] WORKDIR /src
#10 CACHED
#11 [build 5/6] COPY . .
#11 CACHED
#12 [build 6/6] RUN CGO_ENABLED=0 go build -o /_shim -ldflags '-s -d -w' .
#12 CACHED
#13 [stage-1 1/1] COPY --from=build /_shim /_shim
#13 CACHED
#14 mkdir /meta
#14 CACHED
#15 copy / /
#15 DONE 0.0s
#16 docker-image://docker.io/library/alpine:latest
#16 resolve docker.io/library/alpine:latest
#16 resolve docker.io/library/alpine:latest 0.1s done
#16 CACHED
#17 copy / /
#17 CACHED
#18 ls /example
#18 0.157 d1
#18 0.157 d2
#18 DONE 0.2s
#1 resolve image config for docker.io/library/alpine:latest
#1 DONE 0.5s
#4 [internal] load metadata for docker.io/library/golang:1.18.2-alpine
#4 DONE 0.4s
#19 ls /example
#19 0.172 d1
#19 DONE 0.2s
#20 ls /
#20 0.105 _shim
#20 0.105 bin
#20 0.105 dagger
#20 0.105 dev
#20 0.105 etc
#20 0.105 example
#20 0.105 home
#20 0.105 lib
#20 0.105 media
#20 0.105 mnt
#20 0.105 opt
#20 0.105 proc
#20 0.105 root
#20 0.105 run
#20 0.105 sbin
#20 0.105 srv
#20 0.105 sys
#20 0.105 tmp
#20 0.105 usr
#20 0.105 var
#20 DONE 0.1s
#0 0.148 d1
#0 0.148 d2
#18 DONE 0.2s
#1 resolve image config for docker.io/library/alpine:latest
#1 DONE 0.4s
#4 [internal] load metadata for docker.io/library/golang:1.18.2-alpine
#4 DONE 0.4s
#19 ls /example
#0 0.135 d1
#19 DONE 0.2s
#20 ls /example
#0 0.104 d1
#0 0.104 d2
#20 DONE 0.1s
```
### Steps to reproduce
* Mount two directories
* Run multiple exec commands and observe logs output
### Dagger version
dagger v0.3.1
### OS version
Ubuntu-20.04
|
https://github.com/dagger/dagger/issues/3551
|
https://github.com/dagger/dagger/pull/3602
|
b734ed35554bbfbc5caf63674eaa9c22692e614e
|
b4bb0b9e06e1edf8b81f9054b7419daabcb5bedb
| 2022-10-26T01:16:16Z |
go
| 2022-10-31T22:13:34Z |
core/integration/container_test.go
|
}
}
}
}
}`, nil, &testutil.QueryOptions{Variables: map[string]any{
"id": id,
}})
require.Error(t, err)
require.Contains(t, err.Error(), "path /mnt/dir/some-file is a file, not a directory")
err = testutil.Query(
`query Test($id: DirectoryID!) {
container {
from(address: "alpine:3.16.2") {
withMountedDirectory(path: "/mnt/dir", source: $id) {
directory(path: "/mnt/dir/bogus") {
id
}
}
}
}
}`, nil, &testutil.QueryOptions{Variables: map[string]any{
"id": id,
}})
require.Error(t, err)
require.Contains(t, err.Error(), "bogus: no such file or directory")
err = testutil.Query(
`{
container {
from(address: "alpine:3.16.2") {
withMountedTemp(path: "/mnt/tmp") {
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 3,551 |
π Odd container behavior with exec / multiple withMountedDirectory
|
### What is the issue?
The following code executes but provides unexpected logs / output. Other similar use cases error due to missing files due to same issue. This may be something very simple (haven't used golang in many years) but seems like there may be an underlying issue with the execution engine.
I would expect this code to run the `ls` command twice, one time showing the two mounted directories, one time showing the root output. Instead in the logs I see `ls` with d1 and d2 (expected), an `ls` with just d1 (??), and then an `ls` with the root fs. This causes issues if the first ls is changed to `ls /example/d2` as it will error the whole pipeline due to missing path.
```golang
workdir := client.Host().Workdir()
d1, err := workdir.Read().Directory("dir1/").ID(ctx)
if err != nil {
return err
}
d2, err := workdir.Read().Directory("dir2/").ID(ctx)
if err != nil {
return err
}
build := client.Container().From("alpine:latest").
WithMountedDirectory("/example/d1", d1).
WithMountedDirectory("/example/d2", d2)
build = build.Exec(dagger.ContainerExecOpts{
Args: []string{"ls", "/example"},
})
_, err = build.ExitCode(ctx)
if err != nil {
return err
}
build = build.Exec(dagger.ContainerExecOpts{
Args: []string{"ls", "/"},
})
_, err = build.ExitCode(ctx)
if err != nil {
return err
}
```
I was able to get the same functionality working fine by using `fs, err := build.FS().WithDirectory(d1, "/example/d1").WithDirectory(d2, "/example/d2").ID(ctx); build = build.WithFS(fs);` so conceptually don't think I'm doing anything wrong.
### Log output
```
#1 resolve image config for docker.io/library/alpine:latest
#1 DONE 0.4s
#2 mkfile /Dockerfile
#2 DONE 0.0s
#3 mkfile /main.go
#3 CACHED
#4 [internal] load metadata for docker.io/library/golang:1.18.2-alpine
#4 DONE 0.1s
#5 local://__dagger_workdir_/home/plaisted/source/OSD.PJI-Temporary/repro
#5 DONE 0.0s
#6 local://__dagger_workdir_/home/plaisted/source/OSD.PJI-Temporary/repro
#6 transferring __dagger_workdir_/home/plaisted/source/OSD.PJI-Temporary/repro: 309B done
#6 DONE 0.0s
#7 [build 1/6] FROM docker.io/library/golang:1.18.2-alpine@sha256:4795c5d21f01e0777707ada02408debe77fe31848be97cf9fa8a1462da78d949
#7 resolve docker.io/library/golang:1.18.2-alpine@sha256:4795c5d21f01e0777707ada02408debe77fe31848be97cf9fa8a1462da78d949 0.0s done
#7 DONE 0.0s
#8 [build 3/6] RUN apk add --no-cache file git
#8 CACHED
#9 [build 4/6] RUN go mod init go.dagger.io/dagger/shim/cmd
#9 CACHED
#10 [build 2/6] WORKDIR /src
#10 CACHED
#11 [build 5/6] COPY . .
#11 CACHED
#12 [build 6/6] RUN CGO_ENABLED=0 go build -o /_shim -ldflags '-s -d -w' .
#12 CACHED
#13 [stage-1 1/1] COPY --from=build /_shim /_shim
#13 CACHED
#14 mkdir /meta
#14 CACHED
#15 copy / /
#15 DONE 0.0s
#16 docker-image://docker.io/library/alpine:latest
#16 resolve docker.io/library/alpine:latest
#16 resolve docker.io/library/alpine:latest 0.1s done
#16 CACHED
#17 copy / /
#17 CACHED
#18 ls /example
#18 0.157 d1
#18 0.157 d2
#18 DONE 0.2s
#1 resolve image config for docker.io/library/alpine:latest
#1 DONE 0.5s
#4 [internal] load metadata for docker.io/library/golang:1.18.2-alpine
#4 DONE 0.4s
#19 ls /example
#19 0.172 d1
#19 DONE 0.2s
#20 ls /
#20 0.105 _shim
#20 0.105 bin
#20 0.105 dagger
#20 0.105 dev
#20 0.105 etc
#20 0.105 example
#20 0.105 home
#20 0.105 lib
#20 0.105 media
#20 0.105 mnt
#20 0.105 opt
#20 0.105 proc
#20 0.105 root
#20 0.105 run
#20 0.105 sbin
#20 0.105 srv
#20 0.105 sys
#20 0.105 tmp
#20 0.105 usr
#20 0.105 var
#20 DONE 0.1s
#0 0.148 d1
#0 0.148 d2
#18 DONE 0.2s
#1 resolve image config for docker.io/library/alpine:latest
#1 DONE 0.4s
#4 [internal] load metadata for docker.io/library/golang:1.18.2-alpine
#4 DONE 0.4s
#19 ls /example
#0 0.135 d1
#19 DONE 0.2s
#20 ls /example
#0 0.104 d1
#0 0.104 d2
#20 DONE 0.1s
```
### Steps to reproduce
* Mount two directories
* Run multiple exec commands and observe logs output
### Dagger version
dagger v0.3.1
### OS version
Ubuntu-20.04
|
https://github.com/dagger/dagger/issues/3551
|
https://github.com/dagger/dagger/pull/3602
|
b734ed35554bbfbc5caf63674eaa9c22692e614e
|
b4bb0b9e06e1edf8b81f9054b7419daabcb5bedb
| 2022-10-26T01:16:16Z |
go
| 2022-10-31T22:13:34Z |
core/integration/container_test.go
|
directory(path: "/mnt/tmp/bogus") {
id
}
}
}
}
}`, nil, nil)
require.Error(t, err)
require.Contains(t, err.Error(), "bogus: cannot retrieve path from tmpfs")
cacheID := newCache(t)
err = testutil.Query(
`query Test($cache: CacheID!) {
container {
from(address: "alpine:3.16.2") {
withMountedCache(path: "/mnt/cache", cache: $cache) {
directory(path: "/mnt/cache/bogus") {
id
}
}
}
}
}`, nil, &testutil.QueryOptions{Variables: map[string]any{
"cache": cacheID,
}})
require.Error(t, err)
require.Contains(t, err.Error(), "bogus: cannot retrieve path from cache")
}
func TestContainerDirectorySourcePath(t *testing.T) {
t.Parallel()
dirRes := struct {
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 3,551 |
π Odd container behavior with exec / multiple withMountedDirectory
|
### What is the issue?
The following code executes but provides unexpected logs / output. Other similar use cases error due to missing files due to same issue. This may be something very simple (haven't used golang in many years) but seems like there may be an underlying issue with the execution engine.
I would expect this code to run the `ls` command twice, one time showing the two mounted directories, one time showing the root output. Instead in the logs I see `ls` with d1 and d2 (expected), an `ls` with just d1 (??), and then an `ls` with the root fs. This causes issues if the first ls is changed to `ls /example/d2` as it will error the whole pipeline due to missing path.
```golang
workdir := client.Host().Workdir()
d1, err := workdir.Read().Directory("dir1/").ID(ctx)
if err != nil {
return err
}
d2, err := workdir.Read().Directory("dir2/").ID(ctx)
if err != nil {
return err
}
build := client.Container().From("alpine:latest").
WithMountedDirectory("/example/d1", d1).
WithMountedDirectory("/example/d2", d2)
build = build.Exec(dagger.ContainerExecOpts{
Args: []string{"ls", "/example"},
})
_, err = build.ExitCode(ctx)
if err != nil {
return err
}
build = build.Exec(dagger.ContainerExecOpts{
Args: []string{"ls", "/"},
})
_, err = build.ExitCode(ctx)
if err != nil {
return err
}
```
I was able to get the same functionality working fine by using `fs, err := build.FS().WithDirectory(d1, "/example/d1").WithDirectory(d2, "/example/d2").ID(ctx); build = build.WithFS(fs);` so conceptually don't think I'm doing anything wrong.
### Log output
```
#1 resolve image config for docker.io/library/alpine:latest
#1 DONE 0.4s
#2 mkfile /Dockerfile
#2 DONE 0.0s
#3 mkfile /main.go
#3 CACHED
#4 [internal] load metadata for docker.io/library/golang:1.18.2-alpine
#4 DONE 0.1s
#5 local://__dagger_workdir_/home/plaisted/source/OSD.PJI-Temporary/repro
#5 DONE 0.0s
#6 local://__dagger_workdir_/home/plaisted/source/OSD.PJI-Temporary/repro
#6 transferring __dagger_workdir_/home/plaisted/source/OSD.PJI-Temporary/repro: 309B done
#6 DONE 0.0s
#7 [build 1/6] FROM docker.io/library/golang:1.18.2-alpine@sha256:4795c5d21f01e0777707ada02408debe77fe31848be97cf9fa8a1462da78d949
#7 resolve docker.io/library/golang:1.18.2-alpine@sha256:4795c5d21f01e0777707ada02408debe77fe31848be97cf9fa8a1462da78d949 0.0s done
#7 DONE 0.0s
#8 [build 3/6] RUN apk add --no-cache file git
#8 CACHED
#9 [build 4/6] RUN go mod init go.dagger.io/dagger/shim/cmd
#9 CACHED
#10 [build 2/6] WORKDIR /src
#10 CACHED
#11 [build 5/6] COPY . .
#11 CACHED
#12 [build 6/6] RUN CGO_ENABLED=0 go build -o /_shim -ldflags '-s -d -w' .
#12 CACHED
#13 [stage-1 1/1] COPY --from=build /_shim /_shim
#13 CACHED
#14 mkdir /meta
#14 CACHED
#15 copy / /
#15 DONE 0.0s
#16 docker-image://docker.io/library/alpine:latest
#16 resolve docker.io/library/alpine:latest
#16 resolve docker.io/library/alpine:latest 0.1s done
#16 CACHED
#17 copy / /
#17 CACHED
#18 ls /example
#18 0.157 d1
#18 0.157 d2
#18 DONE 0.2s
#1 resolve image config for docker.io/library/alpine:latest
#1 DONE 0.5s
#4 [internal] load metadata for docker.io/library/golang:1.18.2-alpine
#4 DONE 0.4s
#19 ls /example
#19 0.172 d1
#19 DONE 0.2s
#20 ls /
#20 0.105 _shim
#20 0.105 bin
#20 0.105 dagger
#20 0.105 dev
#20 0.105 etc
#20 0.105 example
#20 0.105 home
#20 0.105 lib
#20 0.105 media
#20 0.105 mnt
#20 0.105 opt
#20 0.105 proc
#20 0.105 root
#20 0.105 run
#20 0.105 sbin
#20 0.105 srv
#20 0.105 sys
#20 0.105 tmp
#20 0.105 usr
#20 0.105 var
#20 DONE 0.1s
#0 0.148 d1
#0 0.148 d2
#18 DONE 0.2s
#1 resolve image config for docker.io/library/alpine:latest
#1 DONE 0.4s
#4 [internal] load metadata for docker.io/library/golang:1.18.2-alpine
#4 DONE 0.4s
#19 ls /example
#0 0.135 d1
#19 DONE 0.2s
#20 ls /example
#0 0.104 d1
#0 0.104 d2
#20 DONE 0.1s
```
### Steps to reproduce
* Mount two directories
* Run multiple exec commands and observe logs output
### Dagger version
dagger v0.3.1
### OS version
Ubuntu-20.04
|
https://github.com/dagger/dagger/issues/3551
|
https://github.com/dagger/dagger/pull/3602
|
b734ed35554bbfbc5caf63674eaa9c22692e614e
|
b4bb0b9e06e1edf8b81f9054b7419daabcb5bedb
| 2022-10-26T01:16:16Z |
go
| 2022-10-31T22:13:34Z |
core/integration/container_test.go
|
Directory struct {
WithNewFile struct {
Directory struct {
ID core.DirectoryID
}
}
}
}{}
err := testutil.Query(
`{
directory {
withNewFile(path: "some-dir/sub-dir/sub-file", contents: "sub-content\n") {
directory(path: "some-dir") {
id
}
}
}
}`, &dirRes, nil)
require.NoError(t, err)
id := dirRes.Directory.WithNewFile.Directory.ID
writeRes := struct {
Container struct {
From struct {
WithMountedDirectory struct {
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 3,551 |
π Odd container behavior with exec / multiple withMountedDirectory
|
### What is the issue?
The following code executes but provides unexpected logs / output. Other similar use cases error due to missing files due to same issue. This may be something very simple (haven't used golang in many years) but seems like there may be an underlying issue with the execution engine.
I would expect this code to run the `ls` command twice, one time showing the two mounted directories, one time showing the root output. Instead in the logs I see `ls` with d1 and d2 (expected), an `ls` with just d1 (??), and then an `ls` with the root fs. This causes issues if the first ls is changed to `ls /example/d2` as it will error the whole pipeline due to missing path.
```golang
workdir := client.Host().Workdir()
d1, err := workdir.Read().Directory("dir1/").ID(ctx)
if err != nil {
return err
}
d2, err := workdir.Read().Directory("dir2/").ID(ctx)
if err != nil {
return err
}
build := client.Container().From("alpine:latest").
WithMountedDirectory("/example/d1", d1).
WithMountedDirectory("/example/d2", d2)
build = build.Exec(dagger.ContainerExecOpts{
Args: []string{"ls", "/example"},
})
_, err = build.ExitCode(ctx)
if err != nil {
return err
}
build = build.Exec(dagger.ContainerExecOpts{
Args: []string{"ls", "/"},
})
_, err = build.ExitCode(ctx)
if err != nil {
return err
}
```
I was able to get the same functionality working fine by using `fs, err := build.FS().WithDirectory(d1, "/example/d1").WithDirectory(d2, "/example/d2").ID(ctx); build = build.WithFS(fs);` so conceptually don't think I'm doing anything wrong.
### Log output
```
#1 resolve image config for docker.io/library/alpine:latest
#1 DONE 0.4s
#2 mkfile /Dockerfile
#2 DONE 0.0s
#3 mkfile /main.go
#3 CACHED
#4 [internal] load metadata for docker.io/library/golang:1.18.2-alpine
#4 DONE 0.1s
#5 local://__dagger_workdir_/home/plaisted/source/OSD.PJI-Temporary/repro
#5 DONE 0.0s
#6 local://__dagger_workdir_/home/plaisted/source/OSD.PJI-Temporary/repro
#6 transferring __dagger_workdir_/home/plaisted/source/OSD.PJI-Temporary/repro: 309B done
#6 DONE 0.0s
#7 [build 1/6] FROM docker.io/library/golang:1.18.2-alpine@sha256:4795c5d21f01e0777707ada02408debe77fe31848be97cf9fa8a1462da78d949
#7 resolve docker.io/library/golang:1.18.2-alpine@sha256:4795c5d21f01e0777707ada02408debe77fe31848be97cf9fa8a1462da78d949 0.0s done
#7 DONE 0.0s
#8 [build 3/6] RUN apk add --no-cache file git
#8 CACHED
#9 [build 4/6] RUN go mod init go.dagger.io/dagger/shim/cmd
#9 CACHED
#10 [build 2/6] WORKDIR /src
#10 CACHED
#11 [build 5/6] COPY . .
#11 CACHED
#12 [build 6/6] RUN CGO_ENABLED=0 go build -o /_shim -ldflags '-s -d -w' .
#12 CACHED
#13 [stage-1 1/1] COPY --from=build /_shim /_shim
#13 CACHED
#14 mkdir /meta
#14 CACHED
#15 copy / /
#15 DONE 0.0s
#16 docker-image://docker.io/library/alpine:latest
#16 resolve docker.io/library/alpine:latest
#16 resolve docker.io/library/alpine:latest 0.1s done
#16 CACHED
#17 copy / /
#17 CACHED
#18 ls /example
#18 0.157 d1
#18 0.157 d2
#18 DONE 0.2s
#1 resolve image config for docker.io/library/alpine:latest
#1 DONE 0.5s
#4 [internal] load metadata for docker.io/library/golang:1.18.2-alpine
#4 DONE 0.4s
#19 ls /example
#19 0.172 d1
#19 DONE 0.2s
#20 ls /
#20 0.105 _shim
#20 0.105 bin
#20 0.105 dagger
#20 0.105 dev
#20 0.105 etc
#20 0.105 example
#20 0.105 home
#20 0.105 lib
#20 0.105 media
#20 0.105 mnt
#20 0.105 opt
#20 0.105 proc
#20 0.105 root
#20 0.105 run
#20 0.105 sbin
#20 0.105 srv
#20 0.105 sys
#20 0.105 tmp
#20 0.105 usr
#20 0.105 var
#20 DONE 0.1s
#0 0.148 d1
#0 0.148 d2
#18 DONE 0.2s
#1 resolve image config for docker.io/library/alpine:latest
#1 DONE 0.4s
#4 [internal] load metadata for docker.io/library/golang:1.18.2-alpine
#4 DONE 0.4s
#19 ls /example
#0 0.135 d1
#19 DONE 0.2s
#20 ls /example
#0 0.104 d1
#0 0.104 d2
#20 DONE 0.1s
```
### Steps to reproduce
* Mount two directories
* Run multiple exec commands and observe logs output
### Dagger version
dagger v0.3.1
### OS version
Ubuntu-20.04
|
https://github.com/dagger/dagger/issues/3551
|
https://github.com/dagger/dagger/pull/3602
|
b734ed35554bbfbc5caf63674eaa9c22692e614e
|
b4bb0b9e06e1edf8b81f9054b7419daabcb5bedb
| 2022-10-26T01:16:16Z |
go
| 2022-10-31T22:13:34Z |
core/integration/container_test.go
|
Exec struct {
Directory struct {
ID core.DirectoryID
}
}
}
}
}
}{}
err = testutil.Query(
`query Test($id: DirectoryID!) {
container {
from(address: "alpine:3.16.2") {
withMountedDirectory(path: "/mnt/dir", source: $id) {
exec(args: ["sh", "-c", "echo more-content >> /mnt/dir/sub-dir/sub-file"]) {
directory(path: "/mnt/dir/sub-dir") {
id
}
}
}
}
}
}`, &writeRes, &testutil.QueryOptions{Variables: map[string]any{
"id": id,
}})
require.NoError(t, err)
writtenID := writeRes.Container.From.WithMountedDirectory.Exec.Directory.ID
execRes := struct {
Container struct {
From struct {
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 3,551 |
π Odd container behavior with exec / multiple withMountedDirectory
|
### What is the issue?
The following code executes but provides unexpected logs / output. Other similar use cases error due to missing files due to same issue. This may be something very simple (haven't used golang in many years) but seems like there may be an underlying issue with the execution engine.
I would expect this code to run the `ls` command twice, one time showing the two mounted directories, one time showing the root output. Instead in the logs I see `ls` with d1 and d2 (expected), an `ls` with just d1 (??), and then an `ls` with the root fs. This causes issues if the first ls is changed to `ls /example/d2` as it will error the whole pipeline due to missing path.
```golang
workdir := client.Host().Workdir()
d1, err := workdir.Read().Directory("dir1/").ID(ctx)
if err != nil {
return err
}
d2, err := workdir.Read().Directory("dir2/").ID(ctx)
if err != nil {
return err
}
build := client.Container().From("alpine:latest").
WithMountedDirectory("/example/d1", d1).
WithMountedDirectory("/example/d2", d2)
build = build.Exec(dagger.ContainerExecOpts{
Args: []string{"ls", "/example"},
})
_, err = build.ExitCode(ctx)
if err != nil {
return err
}
build = build.Exec(dagger.ContainerExecOpts{
Args: []string{"ls", "/"},
})
_, err = build.ExitCode(ctx)
if err != nil {
return err
}
```
I was able to get the same functionality working fine by using `fs, err := build.FS().WithDirectory(d1, "/example/d1").WithDirectory(d2, "/example/d2").ID(ctx); build = build.WithFS(fs);` so conceptually don't think I'm doing anything wrong.
### Log output
```
#1 resolve image config for docker.io/library/alpine:latest
#1 DONE 0.4s
#2 mkfile /Dockerfile
#2 DONE 0.0s
#3 mkfile /main.go
#3 CACHED
#4 [internal] load metadata for docker.io/library/golang:1.18.2-alpine
#4 DONE 0.1s
#5 local://__dagger_workdir_/home/plaisted/source/OSD.PJI-Temporary/repro
#5 DONE 0.0s
#6 local://__dagger_workdir_/home/plaisted/source/OSD.PJI-Temporary/repro
#6 transferring __dagger_workdir_/home/plaisted/source/OSD.PJI-Temporary/repro: 309B done
#6 DONE 0.0s
#7 [build 1/6] FROM docker.io/library/golang:1.18.2-alpine@sha256:4795c5d21f01e0777707ada02408debe77fe31848be97cf9fa8a1462da78d949
#7 resolve docker.io/library/golang:1.18.2-alpine@sha256:4795c5d21f01e0777707ada02408debe77fe31848be97cf9fa8a1462da78d949 0.0s done
#7 DONE 0.0s
#8 [build 3/6] RUN apk add --no-cache file git
#8 CACHED
#9 [build 4/6] RUN go mod init go.dagger.io/dagger/shim/cmd
#9 CACHED
#10 [build 2/6] WORKDIR /src
#10 CACHED
#11 [build 5/6] COPY . .
#11 CACHED
#12 [build 6/6] RUN CGO_ENABLED=0 go build -o /_shim -ldflags '-s -d -w' .
#12 CACHED
#13 [stage-1 1/1] COPY --from=build /_shim /_shim
#13 CACHED
#14 mkdir /meta
#14 CACHED
#15 copy / /
#15 DONE 0.0s
#16 docker-image://docker.io/library/alpine:latest
#16 resolve docker.io/library/alpine:latest
#16 resolve docker.io/library/alpine:latest 0.1s done
#16 CACHED
#17 copy / /
#17 CACHED
#18 ls /example
#18 0.157 d1
#18 0.157 d2
#18 DONE 0.2s
#1 resolve image config for docker.io/library/alpine:latest
#1 DONE 0.5s
#4 [internal] load metadata for docker.io/library/golang:1.18.2-alpine
#4 DONE 0.4s
#19 ls /example
#19 0.172 d1
#19 DONE 0.2s
#20 ls /
#20 0.105 _shim
#20 0.105 bin
#20 0.105 dagger
#20 0.105 dev
#20 0.105 etc
#20 0.105 example
#20 0.105 home
#20 0.105 lib
#20 0.105 media
#20 0.105 mnt
#20 0.105 opt
#20 0.105 proc
#20 0.105 root
#20 0.105 run
#20 0.105 sbin
#20 0.105 srv
#20 0.105 sys
#20 0.105 tmp
#20 0.105 usr
#20 0.105 var
#20 DONE 0.1s
#0 0.148 d1
#0 0.148 d2
#18 DONE 0.2s
#1 resolve image config for docker.io/library/alpine:latest
#1 DONE 0.4s
#4 [internal] load metadata for docker.io/library/golang:1.18.2-alpine
#4 DONE 0.4s
#19 ls /example
#0 0.135 d1
#19 DONE 0.2s
#20 ls /example
#0 0.104 d1
#0 0.104 d2
#20 DONE 0.1s
```
### Steps to reproduce
* Mount two directories
* Run multiple exec commands and observe logs output
### Dagger version
dagger v0.3.1
### OS version
Ubuntu-20.04
|
https://github.com/dagger/dagger/issues/3551
|
https://github.com/dagger/dagger/pull/3602
|
b734ed35554bbfbc5caf63674eaa9c22692e614e
|
b4bb0b9e06e1edf8b81f9054b7419daabcb5bedb
| 2022-10-26T01:16:16Z |
go
| 2022-10-31T22:13:34Z |
core/integration/container_test.go
|
WithMountedDirectory struct {
Exec struct {
Stdout struct {
Contents string
}
}
}
}
}
}{}
err = testutil.Query(
`query Test($id: DirectoryID!) {
container {
from(address: "alpine:3.16.2") {
withMountedDirectory(path: "/mnt/dir", source: $id) {
exec(args: ["cat", "/mnt/dir/sub-file"]) {
stdout {
contents
}
}
}
}
}
}`, &execRes, &testutil.QueryOptions{Variables: map[string]any{
"id": writtenID,
}})
require.NoError(t, err)
require.Equal(t, "sub-content\nmore-content\n", execRes.Container.From.WithMountedDirectory.Exec.Stdout.Contents)
}
func TestContainerFile(t *testing.T) {
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 3,551 |
π Odd container behavior with exec / multiple withMountedDirectory
|
### What is the issue?
The following code executes but provides unexpected logs / output. Other similar use cases error due to missing files due to same issue. This may be something very simple (haven't used golang in many years) but seems like there may be an underlying issue with the execution engine.
I would expect this code to run the `ls` command twice, one time showing the two mounted directories, one time showing the root output. Instead in the logs I see `ls` with d1 and d2 (expected), an `ls` with just d1 (??), and then an `ls` with the root fs. This causes issues if the first ls is changed to `ls /example/d2` as it will error the whole pipeline due to missing path.
```golang
workdir := client.Host().Workdir()
d1, err := workdir.Read().Directory("dir1/").ID(ctx)
if err != nil {
return err
}
d2, err := workdir.Read().Directory("dir2/").ID(ctx)
if err != nil {
return err
}
build := client.Container().From("alpine:latest").
WithMountedDirectory("/example/d1", d1).
WithMountedDirectory("/example/d2", d2)
build = build.Exec(dagger.ContainerExecOpts{
Args: []string{"ls", "/example"},
})
_, err = build.ExitCode(ctx)
if err != nil {
return err
}
build = build.Exec(dagger.ContainerExecOpts{
Args: []string{"ls", "/"},
})
_, err = build.ExitCode(ctx)
if err != nil {
return err
}
```
I was able to get the same functionality working fine by using `fs, err := build.FS().WithDirectory(d1, "/example/d1").WithDirectory(d2, "/example/d2").ID(ctx); build = build.WithFS(fs);` so conceptually don't think I'm doing anything wrong.
### Log output
```
#1 resolve image config for docker.io/library/alpine:latest
#1 DONE 0.4s
#2 mkfile /Dockerfile
#2 DONE 0.0s
#3 mkfile /main.go
#3 CACHED
#4 [internal] load metadata for docker.io/library/golang:1.18.2-alpine
#4 DONE 0.1s
#5 local://__dagger_workdir_/home/plaisted/source/OSD.PJI-Temporary/repro
#5 DONE 0.0s
#6 local://__dagger_workdir_/home/plaisted/source/OSD.PJI-Temporary/repro
#6 transferring __dagger_workdir_/home/plaisted/source/OSD.PJI-Temporary/repro: 309B done
#6 DONE 0.0s
#7 [build 1/6] FROM docker.io/library/golang:1.18.2-alpine@sha256:4795c5d21f01e0777707ada02408debe77fe31848be97cf9fa8a1462da78d949
#7 resolve docker.io/library/golang:1.18.2-alpine@sha256:4795c5d21f01e0777707ada02408debe77fe31848be97cf9fa8a1462da78d949 0.0s done
#7 DONE 0.0s
#8 [build 3/6] RUN apk add --no-cache file git
#8 CACHED
#9 [build 4/6] RUN go mod init go.dagger.io/dagger/shim/cmd
#9 CACHED
#10 [build 2/6] WORKDIR /src
#10 CACHED
#11 [build 5/6] COPY . .
#11 CACHED
#12 [build 6/6] RUN CGO_ENABLED=0 go build -o /_shim -ldflags '-s -d -w' .
#12 CACHED
#13 [stage-1 1/1] COPY --from=build /_shim /_shim
#13 CACHED
#14 mkdir /meta
#14 CACHED
#15 copy / /
#15 DONE 0.0s
#16 docker-image://docker.io/library/alpine:latest
#16 resolve docker.io/library/alpine:latest
#16 resolve docker.io/library/alpine:latest 0.1s done
#16 CACHED
#17 copy / /
#17 CACHED
#18 ls /example
#18 0.157 d1
#18 0.157 d2
#18 DONE 0.2s
#1 resolve image config for docker.io/library/alpine:latest
#1 DONE 0.5s
#4 [internal] load metadata for docker.io/library/golang:1.18.2-alpine
#4 DONE 0.4s
#19 ls /example
#19 0.172 d1
#19 DONE 0.2s
#20 ls /
#20 0.105 _shim
#20 0.105 bin
#20 0.105 dagger
#20 0.105 dev
#20 0.105 etc
#20 0.105 example
#20 0.105 home
#20 0.105 lib
#20 0.105 media
#20 0.105 mnt
#20 0.105 opt
#20 0.105 proc
#20 0.105 root
#20 0.105 run
#20 0.105 sbin
#20 0.105 srv
#20 0.105 sys
#20 0.105 tmp
#20 0.105 usr
#20 0.105 var
#20 DONE 0.1s
#0 0.148 d1
#0 0.148 d2
#18 DONE 0.2s
#1 resolve image config for docker.io/library/alpine:latest
#1 DONE 0.4s
#4 [internal] load metadata for docker.io/library/golang:1.18.2-alpine
#4 DONE 0.4s
#19 ls /example
#0 0.135 d1
#19 DONE 0.2s
#20 ls /example
#0 0.104 d1
#0 0.104 d2
#20 DONE 0.1s
```
### Steps to reproduce
* Mount two directories
* Run multiple exec commands and observe logs output
### Dagger version
dagger v0.3.1
### OS version
Ubuntu-20.04
|
https://github.com/dagger/dagger/issues/3551
|
https://github.com/dagger/dagger/pull/3602
|
b734ed35554bbfbc5caf63674eaa9c22692e614e
|
b4bb0b9e06e1edf8b81f9054b7419daabcb5bedb
| 2022-10-26T01:16:16Z |
go
| 2022-10-31T22:13:34Z |
core/integration/container_test.go
|
t.Parallel()
id := newDirWithFile(t, "some-file", "some-content-")
writeRes := struct {
Container struct {
From struct {
WithMountedDirectory struct {
WithMountedDirectory struct {
Exec struct {
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 3,551 |
π Odd container behavior with exec / multiple withMountedDirectory
|
### What is the issue?
The following code executes but provides unexpected logs / output. Other similar use cases error due to missing files due to same issue. This may be something very simple (haven't used golang in many years) but seems like there may be an underlying issue with the execution engine.
I would expect this code to run the `ls` command twice, one time showing the two mounted directories, one time showing the root output. Instead in the logs I see `ls` with d1 and d2 (expected), an `ls` with just d1 (??), and then an `ls` with the root fs. This causes issues if the first ls is changed to `ls /example/d2` as it will error the whole pipeline due to missing path.
```golang
workdir := client.Host().Workdir()
d1, err := workdir.Read().Directory("dir1/").ID(ctx)
if err != nil {
return err
}
d2, err := workdir.Read().Directory("dir2/").ID(ctx)
if err != nil {
return err
}
build := client.Container().From("alpine:latest").
WithMountedDirectory("/example/d1", d1).
WithMountedDirectory("/example/d2", d2)
build = build.Exec(dagger.ContainerExecOpts{
Args: []string{"ls", "/example"},
})
_, err = build.ExitCode(ctx)
if err != nil {
return err
}
build = build.Exec(dagger.ContainerExecOpts{
Args: []string{"ls", "/"},
})
_, err = build.ExitCode(ctx)
if err != nil {
return err
}
```
I was able to get the same functionality working fine by using `fs, err := build.FS().WithDirectory(d1, "/example/d1").WithDirectory(d2, "/example/d2").ID(ctx); build = build.WithFS(fs);` so conceptually don't think I'm doing anything wrong.
### Log output
```
#1 resolve image config for docker.io/library/alpine:latest
#1 DONE 0.4s
#2 mkfile /Dockerfile
#2 DONE 0.0s
#3 mkfile /main.go
#3 CACHED
#4 [internal] load metadata for docker.io/library/golang:1.18.2-alpine
#4 DONE 0.1s
#5 local://__dagger_workdir_/home/plaisted/source/OSD.PJI-Temporary/repro
#5 DONE 0.0s
#6 local://__dagger_workdir_/home/plaisted/source/OSD.PJI-Temporary/repro
#6 transferring __dagger_workdir_/home/plaisted/source/OSD.PJI-Temporary/repro: 309B done
#6 DONE 0.0s
#7 [build 1/6] FROM docker.io/library/golang:1.18.2-alpine@sha256:4795c5d21f01e0777707ada02408debe77fe31848be97cf9fa8a1462da78d949
#7 resolve docker.io/library/golang:1.18.2-alpine@sha256:4795c5d21f01e0777707ada02408debe77fe31848be97cf9fa8a1462da78d949 0.0s done
#7 DONE 0.0s
#8 [build 3/6] RUN apk add --no-cache file git
#8 CACHED
#9 [build 4/6] RUN go mod init go.dagger.io/dagger/shim/cmd
#9 CACHED
#10 [build 2/6] WORKDIR /src
#10 CACHED
#11 [build 5/6] COPY . .
#11 CACHED
#12 [build 6/6] RUN CGO_ENABLED=0 go build -o /_shim -ldflags '-s -d -w' .
#12 CACHED
#13 [stage-1 1/1] COPY --from=build /_shim /_shim
#13 CACHED
#14 mkdir /meta
#14 CACHED
#15 copy / /
#15 DONE 0.0s
#16 docker-image://docker.io/library/alpine:latest
#16 resolve docker.io/library/alpine:latest
#16 resolve docker.io/library/alpine:latest 0.1s done
#16 CACHED
#17 copy / /
#17 CACHED
#18 ls /example
#18 0.157 d1
#18 0.157 d2
#18 DONE 0.2s
#1 resolve image config for docker.io/library/alpine:latest
#1 DONE 0.5s
#4 [internal] load metadata for docker.io/library/golang:1.18.2-alpine
#4 DONE 0.4s
#19 ls /example
#19 0.172 d1
#19 DONE 0.2s
#20 ls /
#20 0.105 _shim
#20 0.105 bin
#20 0.105 dagger
#20 0.105 dev
#20 0.105 etc
#20 0.105 example
#20 0.105 home
#20 0.105 lib
#20 0.105 media
#20 0.105 mnt
#20 0.105 opt
#20 0.105 proc
#20 0.105 root
#20 0.105 run
#20 0.105 sbin
#20 0.105 srv
#20 0.105 sys
#20 0.105 tmp
#20 0.105 usr
#20 0.105 var
#20 DONE 0.1s
#0 0.148 d1
#0 0.148 d2
#18 DONE 0.2s
#1 resolve image config for docker.io/library/alpine:latest
#1 DONE 0.4s
#4 [internal] load metadata for docker.io/library/golang:1.18.2-alpine
#4 DONE 0.4s
#19 ls /example
#0 0.135 d1
#19 DONE 0.2s
#20 ls /example
#0 0.104 d1
#0 0.104 d2
#20 DONE 0.1s
```
### Steps to reproduce
* Mount two directories
* Run multiple exec commands and observe logs output
### Dagger version
dagger v0.3.1
### OS version
Ubuntu-20.04
|
https://github.com/dagger/dagger/issues/3551
|
https://github.com/dagger/dagger/pull/3602
|
b734ed35554bbfbc5caf63674eaa9c22692e614e
|
b4bb0b9e06e1edf8b81f9054b7419daabcb5bedb
| 2022-10-26T01:16:16Z |
go
| 2022-10-31T22:13:34Z |
core/integration/container_test.go
|
File struct {
ID core.FileID
}
}
}
}
}
}
}{}
err := testutil.Query(
`query Test($id: DirectoryID!) {
container {
from(address: "alpine:3.16.2") {
withMountedDirectory(path: "/mnt/dir", source: $id) {
withMountedDirectory(path: "/mnt/dir/overlap", source: $id) {
exec(args: ["sh", "-c", "echo -n appended >> /mnt/dir/overlap/some-file"]) {
file(path: "/mnt/dir/overlap/some-file") {
id
}
}
}
}
}
}
}`, &writeRes, &testutil.QueryOptions{Variables: map[string]any{
"id": id,
}})
require.NoError(t, err)
writtenID := writeRes.Container.From.WithMountedDirectory.WithMountedDirectory.Exec.File.ID
execRes := struct {
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 3,551 |
π Odd container behavior with exec / multiple withMountedDirectory
|
### What is the issue?
The following code executes but provides unexpected logs / output. Other similar use cases error due to missing files due to same issue. This may be something very simple (haven't used golang in many years) but seems like there may be an underlying issue with the execution engine.
I would expect this code to run the `ls` command twice, one time showing the two mounted directories, one time showing the root output. Instead in the logs I see `ls` with d1 and d2 (expected), an `ls` with just d1 (??), and then an `ls` with the root fs. This causes issues if the first ls is changed to `ls /example/d2` as it will error the whole pipeline due to missing path.
```golang
workdir := client.Host().Workdir()
d1, err := workdir.Read().Directory("dir1/").ID(ctx)
if err != nil {
return err
}
d2, err := workdir.Read().Directory("dir2/").ID(ctx)
if err != nil {
return err
}
build := client.Container().From("alpine:latest").
WithMountedDirectory("/example/d1", d1).
WithMountedDirectory("/example/d2", d2)
build = build.Exec(dagger.ContainerExecOpts{
Args: []string{"ls", "/example"},
})
_, err = build.ExitCode(ctx)
if err != nil {
return err
}
build = build.Exec(dagger.ContainerExecOpts{
Args: []string{"ls", "/"},
})
_, err = build.ExitCode(ctx)
if err != nil {
return err
}
```
I was able to get the same functionality working fine by using `fs, err := build.FS().WithDirectory(d1, "/example/d1").WithDirectory(d2, "/example/d2").ID(ctx); build = build.WithFS(fs);` so conceptually don't think I'm doing anything wrong.
### Log output
```
#1 resolve image config for docker.io/library/alpine:latest
#1 DONE 0.4s
#2 mkfile /Dockerfile
#2 DONE 0.0s
#3 mkfile /main.go
#3 CACHED
#4 [internal] load metadata for docker.io/library/golang:1.18.2-alpine
#4 DONE 0.1s
#5 local://__dagger_workdir_/home/plaisted/source/OSD.PJI-Temporary/repro
#5 DONE 0.0s
#6 local://__dagger_workdir_/home/plaisted/source/OSD.PJI-Temporary/repro
#6 transferring __dagger_workdir_/home/plaisted/source/OSD.PJI-Temporary/repro: 309B done
#6 DONE 0.0s
#7 [build 1/6] FROM docker.io/library/golang:1.18.2-alpine@sha256:4795c5d21f01e0777707ada02408debe77fe31848be97cf9fa8a1462da78d949
#7 resolve docker.io/library/golang:1.18.2-alpine@sha256:4795c5d21f01e0777707ada02408debe77fe31848be97cf9fa8a1462da78d949 0.0s done
#7 DONE 0.0s
#8 [build 3/6] RUN apk add --no-cache file git
#8 CACHED
#9 [build 4/6] RUN go mod init go.dagger.io/dagger/shim/cmd
#9 CACHED
#10 [build 2/6] WORKDIR /src
#10 CACHED
#11 [build 5/6] COPY . .
#11 CACHED
#12 [build 6/6] RUN CGO_ENABLED=0 go build -o /_shim -ldflags '-s -d -w' .
#12 CACHED
#13 [stage-1 1/1] COPY --from=build /_shim /_shim
#13 CACHED
#14 mkdir /meta
#14 CACHED
#15 copy / /
#15 DONE 0.0s
#16 docker-image://docker.io/library/alpine:latest
#16 resolve docker.io/library/alpine:latest
#16 resolve docker.io/library/alpine:latest 0.1s done
#16 CACHED
#17 copy / /
#17 CACHED
#18 ls /example
#18 0.157 d1
#18 0.157 d2
#18 DONE 0.2s
#1 resolve image config for docker.io/library/alpine:latest
#1 DONE 0.5s
#4 [internal] load metadata for docker.io/library/golang:1.18.2-alpine
#4 DONE 0.4s
#19 ls /example
#19 0.172 d1
#19 DONE 0.2s
#20 ls /
#20 0.105 _shim
#20 0.105 bin
#20 0.105 dagger
#20 0.105 dev
#20 0.105 etc
#20 0.105 example
#20 0.105 home
#20 0.105 lib
#20 0.105 media
#20 0.105 mnt
#20 0.105 opt
#20 0.105 proc
#20 0.105 root
#20 0.105 run
#20 0.105 sbin
#20 0.105 srv
#20 0.105 sys
#20 0.105 tmp
#20 0.105 usr
#20 0.105 var
#20 DONE 0.1s
#0 0.148 d1
#0 0.148 d2
#18 DONE 0.2s
#1 resolve image config for docker.io/library/alpine:latest
#1 DONE 0.4s
#4 [internal] load metadata for docker.io/library/golang:1.18.2-alpine
#4 DONE 0.4s
#19 ls /example
#0 0.135 d1
#19 DONE 0.2s
#20 ls /example
#0 0.104 d1
#0 0.104 d2
#20 DONE 0.1s
```
### Steps to reproduce
* Mount two directories
* Run multiple exec commands and observe logs output
### Dagger version
dagger v0.3.1
### OS version
Ubuntu-20.04
|
https://github.com/dagger/dagger/issues/3551
|
https://github.com/dagger/dagger/pull/3602
|
b734ed35554bbfbc5caf63674eaa9c22692e614e
|
b4bb0b9e06e1edf8b81f9054b7419daabcb5bedb
| 2022-10-26T01:16:16Z |
go
| 2022-10-31T22:13:34Z |
core/integration/container_test.go
|
Container struct {
From struct {
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 3,551 |
π Odd container behavior with exec / multiple withMountedDirectory
|
### What is the issue?
The following code executes but provides unexpected logs / output. Other similar use cases error due to missing files due to same issue. This may be something very simple (haven't used golang in many years) but seems like there may be an underlying issue with the execution engine.
I would expect this code to run the `ls` command twice, one time showing the two mounted directories, one time showing the root output. Instead in the logs I see `ls` with d1 and d2 (expected), an `ls` with just d1 (??), and then an `ls` with the root fs. This causes issues if the first ls is changed to `ls /example/d2` as it will error the whole pipeline due to missing path.
```golang
workdir := client.Host().Workdir()
d1, err := workdir.Read().Directory("dir1/").ID(ctx)
if err != nil {
return err
}
d2, err := workdir.Read().Directory("dir2/").ID(ctx)
if err != nil {
return err
}
build := client.Container().From("alpine:latest").
WithMountedDirectory("/example/d1", d1).
WithMountedDirectory("/example/d2", d2)
build = build.Exec(dagger.ContainerExecOpts{
Args: []string{"ls", "/example"},
})
_, err = build.ExitCode(ctx)
if err != nil {
return err
}
build = build.Exec(dagger.ContainerExecOpts{
Args: []string{"ls", "/"},
})
_, err = build.ExitCode(ctx)
if err != nil {
return err
}
```
I was able to get the same functionality working fine by using `fs, err := build.FS().WithDirectory(d1, "/example/d1").WithDirectory(d2, "/example/d2").ID(ctx); build = build.WithFS(fs);` so conceptually don't think I'm doing anything wrong.
### Log output
```
#1 resolve image config for docker.io/library/alpine:latest
#1 DONE 0.4s
#2 mkfile /Dockerfile
#2 DONE 0.0s
#3 mkfile /main.go
#3 CACHED
#4 [internal] load metadata for docker.io/library/golang:1.18.2-alpine
#4 DONE 0.1s
#5 local://__dagger_workdir_/home/plaisted/source/OSD.PJI-Temporary/repro
#5 DONE 0.0s
#6 local://__dagger_workdir_/home/plaisted/source/OSD.PJI-Temporary/repro
#6 transferring __dagger_workdir_/home/plaisted/source/OSD.PJI-Temporary/repro: 309B done
#6 DONE 0.0s
#7 [build 1/6] FROM docker.io/library/golang:1.18.2-alpine@sha256:4795c5d21f01e0777707ada02408debe77fe31848be97cf9fa8a1462da78d949
#7 resolve docker.io/library/golang:1.18.2-alpine@sha256:4795c5d21f01e0777707ada02408debe77fe31848be97cf9fa8a1462da78d949 0.0s done
#7 DONE 0.0s
#8 [build 3/6] RUN apk add --no-cache file git
#8 CACHED
#9 [build 4/6] RUN go mod init go.dagger.io/dagger/shim/cmd
#9 CACHED
#10 [build 2/6] WORKDIR /src
#10 CACHED
#11 [build 5/6] COPY . .
#11 CACHED
#12 [build 6/6] RUN CGO_ENABLED=0 go build -o /_shim -ldflags '-s -d -w' .
#12 CACHED
#13 [stage-1 1/1] COPY --from=build /_shim /_shim
#13 CACHED
#14 mkdir /meta
#14 CACHED
#15 copy / /
#15 DONE 0.0s
#16 docker-image://docker.io/library/alpine:latest
#16 resolve docker.io/library/alpine:latest
#16 resolve docker.io/library/alpine:latest 0.1s done
#16 CACHED
#17 copy / /
#17 CACHED
#18 ls /example
#18 0.157 d1
#18 0.157 d2
#18 DONE 0.2s
#1 resolve image config for docker.io/library/alpine:latest
#1 DONE 0.5s
#4 [internal] load metadata for docker.io/library/golang:1.18.2-alpine
#4 DONE 0.4s
#19 ls /example
#19 0.172 d1
#19 DONE 0.2s
#20 ls /
#20 0.105 _shim
#20 0.105 bin
#20 0.105 dagger
#20 0.105 dev
#20 0.105 etc
#20 0.105 example
#20 0.105 home
#20 0.105 lib
#20 0.105 media
#20 0.105 mnt
#20 0.105 opt
#20 0.105 proc
#20 0.105 root
#20 0.105 run
#20 0.105 sbin
#20 0.105 srv
#20 0.105 sys
#20 0.105 tmp
#20 0.105 usr
#20 0.105 var
#20 DONE 0.1s
#0 0.148 d1
#0 0.148 d2
#18 DONE 0.2s
#1 resolve image config for docker.io/library/alpine:latest
#1 DONE 0.4s
#4 [internal] load metadata for docker.io/library/golang:1.18.2-alpine
#4 DONE 0.4s
#19 ls /example
#0 0.135 d1
#19 DONE 0.2s
#20 ls /example
#0 0.104 d1
#0 0.104 d2
#20 DONE 0.1s
```
### Steps to reproduce
* Mount two directories
* Run multiple exec commands and observe logs output
### Dagger version
dagger v0.3.1
### OS version
Ubuntu-20.04
|
https://github.com/dagger/dagger/issues/3551
|
https://github.com/dagger/dagger/pull/3602
|
b734ed35554bbfbc5caf63674eaa9c22692e614e
|
b4bb0b9e06e1edf8b81f9054b7419daabcb5bedb
| 2022-10-26T01:16:16Z |
go
| 2022-10-31T22:13:34Z |
core/integration/container_test.go
|
WithMountedFile struct {
Exec struct {
Stdout struct {
Contents string
}
}
}
}
}
}{}
err = testutil.Query(
`query Test($id: FileID!) {
container {
from(address: "alpine:3.16.2") {
withMountedFile(path: "/mnt/file", source: $id) {
exec(args: ["cat", "/mnt/file"]) {
stdout {
contents
}
}
}
}
}
}`, &execRes, &testutil.QueryOptions{Variables: map[string]any{
"id": writtenID,
}})
require.NoError(t, err)
require.Equal(t, "some-content-appended", execRes.Container.From.WithMountedFile.Exec.Stdout.Contents)
}
func TestContainerFileErrors(t *testing.T) {
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 3,551 |
π Odd container behavior with exec / multiple withMountedDirectory
|
### What is the issue?
The following code executes but provides unexpected logs / output. Other similar use cases error due to missing files due to same issue. This may be something very simple (haven't used golang in many years) but seems like there may be an underlying issue with the execution engine.
I would expect this code to run the `ls` command twice, one time showing the two mounted directories, one time showing the root output. Instead in the logs I see `ls` with d1 and d2 (expected), an `ls` with just d1 (??), and then an `ls` with the root fs. This causes issues if the first ls is changed to `ls /example/d2` as it will error the whole pipeline due to missing path.
```golang
workdir := client.Host().Workdir()
d1, err := workdir.Read().Directory("dir1/").ID(ctx)
if err != nil {
return err
}
d2, err := workdir.Read().Directory("dir2/").ID(ctx)
if err != nil {
return err
}
build := client.Container().From("alpine:latest").
WithMountedDirectory("/example/d1", d1).
WithMountedDirectory("/example/d2", d2)
build = build.Exec(dagger.ContainerExecOpts{
Args: []string{"ls", "/example"},
})
_, err = build.ExitCode(ctx)
if err != nil {
return err
}
build = build.Exec(dagger.ContainerExecOpts{
Args: []string{"ls", "/"},
})
_, err = build.ExitCode(ctx)
if err != nil {
return err
}
```
I was able to get the same functionality working fine by using `fs, err := build.FS().WithDirectory(d1, "/example/d1").WithDirectory(d2, "/example/d2").ID(ctx); build = build.WithFS(fs);` so conceptually don't think I'm doing anything wrong.
### Log output
```
#1 resolve image config for docker.io/library/alpine:latest
#1 DONE 0.4s
#2 mkfile /Dockerfile
#2 DONE 0.0s
#3 mkfile /main.go
#3 CACHED
#4 [internal] load metadata for docker.io/library/golang:1.18.2-alpine
#4 DONE 0.1s
#5 local://__dagger_workdir_/home/plaisted/source/OSD.PJI-Temporary/repro
#5 DONE 0.0s
#6 local://__dagger_workdir_/home/plaisted/source/OSD.PJI-Temporary/repro
#6 transferring __dagger_workdir_/home/plaisted/source/OSD.PJI-Temporary/repro: 309B done
#6 DONE 0.0s
#7 [build 1/6] FROM docker.io/library/golang:1.18.2-alpine@sha256:4795c5d21f01e0777707ada02408debe77fe31848be97cf9fa8a1462da78d949
#7 resolve docker.io/library/golang:1.18.2-alpine@sha256:4795c5d21f01e0777707ada02408debe77fe31848be97cf9fa8a1462da78d949 0.0s done
#7 DONE 0.0s
#8 [build 3/6] RUN apk add --no-cache file git
#8 CACHED
#9 [build 4/6] RUN go mod init go.dagger.io/dagger/shim/cmd
#9 CACHED
#10 [build 2/6] WORKDIR /src
#10 CACHED
#11 [build 5/6] COPY . .
#11 CACHED
#12 [build 6/6] RUN CGO_ENABLED=0 go build -o /_shim -ldflags '-s -d -w' .
#12 CACHED
#13 [stage-1 1/1] COPY --from=build /_shim /_shim
#13 CACHED
#14 mkdir /meta
#14 CACHED
#15 copy / /
#15 DONE 0.0s
#16 docker-image://docker.io/library/alpine:latest
#16 resolve docker.io/library/alpine:latest
#16 resolve docker.io/library/alpine:latest 0.1s done
#16 CACHED
#17 copy / /
#17 CACHED
#18 ls /example
#18 0.157 d1
#18 0.157 d2
#18 DONE 0.2s
#1 resolve image config for docker.io/library/alpine:latest
#1 DONE 0.5s
#4 [internal] load metadata for docker.io/library/golang:1.18.2-alpine
#4 DONE 0.4s
#19 ls /example
#19 0.172 d1
#19 DONE 0.2s
#20 ls /
#20 0.105 _shim
#20 0.105 bin
#20 0.105 dagger
#20 0.105 dev
#20 0.105 etc
#20 0.105 example
#20 0.105 home
#20 0.105 lib
#20 0.105 media
#20 0.105 mnt
#20 0.105 opt
#20 0.105 proc
#20 0.105 root
#20 0.105 run
#20 0.105 sbin
#20 0.105 srv
#20 0.105 sys
#20 0.105 tmp
#20 0.105 usr
#20 0.105 var
#20 DONE 0.1s
#0 0.148 d1
#0 0.148 d2
#18 DONE 0.2s
#1 resolve image config for docker.io/library/alpine:latest
#1 DONE 0.4s
#4 [internal] load metadata for docker.io/library/golang:1.18.2-alpine
#4 DONE 0.4s
#19 ls /example
#0 0.135 d1
#19 DONE 0.2s
#20 ls /example
#0 0.104 d1
#0 0.104 d2
#20 DONE 0.1s
```
### Steps to reproduce
* Mount two directories
* Run multiple exec commands and observe logs output
### Dagger version
dagger v0.3.1
### OS version
Ubuntu-20.04
|
https://github.com/dagger/dagger/issues/3551
|
https://github.com/dagger/dagger/pull/3602
|
b734ed35554bbfbc5caf63674eaa9c22692e614e
|
b4bb0b9e06e1edf8b81f9054b7419daabcb5bedb
| 2022-10-26T01:16:16Z |
go
| 2022-10-31T22:13:34Z |
core/integration/container_test.go
|
t.Parallel()
id := newDirWithFile(t, "some-file", "some-content")
err := testutil.Query(
`query Test($id: DirectoryID!) {
container {
from(address: "alpine:3.16.2") {
withMountedDirectory(path: "/mnt/dir", source: $id) {
file(path: "/mnt/dir/bogus") {
id
}
}
}
}
}`, nil, &testutil.QueryOptions{Variables: map[string]any{
"id": id,
}})
require.Error(t, err)
require.Contains(t, err.Error(), "bogus: no such file or directory")
err = testutil.Query(
`query Test($id: DirectoryID!) {
container {
from(address: "alpine:3.16.2") {
withMountedDirectory(path: "/mnt/dir", source: $id) {
file(path: "/mnt/dir") {
id
}
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 3,551 |
π Odd container behavior with exec / multiple withMountedDirectory
|
### What is the issue?
The following code executes but provides unexpected logs / output. Other similar use cases error due to missing files due to same issue. This may be something very simple (haven't used golang in many years) but seems like there may be an underlying issue with the execution engine.
I would expect this code to run the `ls` command twice, one time showing the two mounted directories, one time showing the root output. Instead in the logs I see `ls` with d1 and d2 (expected), an `ls` with just d1 (??), and then an `ls` with the root fs. This causes issues if the first ls is changed to `ls /example/d2` as it will error the whole pipeline due to missing path.
```golang
workdir := client.Host().Workdir()
d1, err := workdir.Read().Directory("dir1/").ID(ctx)
if err != nil {
return err
}
d2, err := workdir.Read().Directory("dir2/").ID(ctx)
if err != nil {
return err
}
build := client.Container().From("alpine:latest").
WithMountedDirectory("/example/d1", d1).
WithMountedDirectory("/example/d2", d2)
build = build.Exec(dagger.ContainerExecOpts{
Args: []string{"ls", "/example"},
})
_, err = build.ExitCode(ctx)
if err != nil {
return err
}
build = build.Exec(dagger.ContainerExecOpts{
Args: []string{"ls", "/"},
})
_, err = build.ExitCode(ctx)
if err != nil {
return err
}
```
I was able to get the same functionality working fine by using `fs, err := build.FS().WithDirectory(d1, "/example/d1").WithDirectory(d2, "/example/d2").ID(ctx); build = build.WithFS(fs);` so conceptually don't think I'm doing anything wrong.
### Log output
```
#1 resolve image config for docker.io/library/alpine:latest
#1 DONE 0.4s
#2 mkfile /Dockerfile
#2 DONE 0.0s
#3 mkfile /main.go
#3 CACHED
#4 [internal] load metadata for docker.io/library/golang:1.18.2-alpine
#4 DONE 0.1s
#5 local://__dagger_workdir_/home/plaisted/source/OSD.PJI-Temporary/repro
#5 DONE 0.0s
#6 local://__dagger_workdir_/home/plaisted/source/OSD.PJI-Temporary/repro
#6 transferring __dagger_workdir_/home/plaisted/source/OSD.PJI-Temporary/repro: 309B done
#6 DONE 0.0s
#7 [build 1/6] FROM docker.io/library/golang:1.18.2-alpine@sha256:4795c5d21f01e0777707ada02408debe77fe31848be97cf9fa8a1462da78d949
#7 resolve docker.io/library/golang:1.18.2-alpine@sha256:4795c5d21f01e0777707ada02408debe77fe31848be97cf9fa8a1462da78d949 0.0s done
#7 DONE 0.0s
#8 [build 3/6] RUN apk add --no-cache file git
#8 CACHED
#9 [build 4/6] RUN go mod init go.dagger.io/dagger/shim/cmd
#9 CACHED
#10 [build 2/6] WORKDIR /src
#10 CACHED
#11 [build 5/6] COPY . .
#11 CACHED
#12 [build 6/6] RUN CGO_ENABLED=0 go build -o /_shim -ldflags '-s -d -w' .
#12 CACHED
#13 [stage-1 1/1] COPY --from=build /_shim /_shim
#13 CACHED
#14 mkdir /meta
#14 CACHED
#15 copy / /
#15 DONE 0.0s
#16 docker-image://docker.io/library/alpine:latest
#16 resolve docker.io/library/alpine:latest
#16 resolve docker.io/library/alpine:latest 0.1s done
#16 CACHED
#17 copy / /
#17 CACHED
#18 ls /example
#18 0.157 d1
#18 0.157 d2
#18 DONE 0.2s
#1 resolve image config for docker.io/library/alpine:latest
#1 DONE 0.5s
#4 [internal] load metadata for docker.io/library/golang:1.18.2-alpine
#4 DONE 0.4s
#19 ls /example
#19 0.172 d1
#19 DONE 0.2s
#20 ls /
#20 0.105 _shim
#20 0.105 bin
#20 0.105 dagger
#20 0.105 dev
#20 0.105 etc
#20 0.105 example
#20 0.105 home
#20 0.105 lib
#20 0.105 media
#20 0.105 mnt
#20 0.105 opt
#20 0.105 proc
#20 0.105 root
#20 0.105 run
#20 0.105 sbin
#20 0.105 srv
#20 0.105 sys
#20 0.105 tmp
#20 0.105 usr
#20 0.105 var
#20 DONE 0.1s
#0 0.148 d1
#0 0.148 d2
#18 DONE 0.2s
#1 resolve image config for docker.io/library/alpine:latest
#1 DONE 0.4s
#4 [internal] load metadata for docker.io/library/golang:1.18.2-alpine
#4 DONE 0.4s
#19 ls /example
#0 0.135 d1
#19 DONE 0.2s
#20 ls /example
#0 0.104 d1
#0 0.104 d2
#20 DONE 0.1s
```
### Steps to reproduce
* Mount two directories
* Run multiple exec commands and observe logs output
### Dagger version
dagger v0.3.1
### OS version
Ubuntu-20.04
|
https://github.com/dagger/dagger/issues/3551
|
https://github.com/dagger/dagger/pull/3602
|
b734ed35554bbfbc5caf63674eaa9c22692e614e
|
b4bb0b9e06e1edf8b81f9054b7419daabcb5bedb
| 2022-10-26T01:16:16Z |
go
| 2022-10-31T22:13:34Z |
core/integration/container_test.go
|
}
}
}
}`, nil, &testutil.QueryOptions{Variables: map[string]any{
"id": id,
}})
require.Error(t, err)
require.Contains(t, err.Error(), "path /mnt/dir is a directory, not a file")
err = testutil.Query(
`{
container {
from(address: "alpine:3.16.2") {
withMountedTemp(path: "/mnt/tmp") {
file(path: "/mnt/tmp/bogus") {
id
}
}
}
}
}`, nil, nil)
require.Error(t, err)
require.Contains(t, err.Error(), "bogus: cannot retrieve path from tmpfs")
cacheID := newCache(t)
err = testutil.Query(
`query Test($cache: CacheID!) {
container {
from(address: "alpine:3.16.2") {
withMountedCache(path: "/mnt/cache", cache: $cache) {
file(path: "/mnt/cache/bogus") {
id
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 3,551 |
π Odd container behavior with exec / multiple withMountedDirectory
|
### What is the issue?
The following code executes but provides unexpected logs / output. Other similar use cases error due to missing files due to same issue. This may be something very simple (haven't used golang in many years) but seems like there may be an underlying issue with the execution engine.
I would expect this code to run the `ls` command twice, one time showing the two mounted directories, one time showing the root output. Instead in the logs I see `ls` with d1 and d2 (expected), an `ls` with just d1 (??), and then an `ls` with the root fs. This causes issues if the first ls is changed to `ls /example/d2` as it will error the whole pipeline due to missing path.
```golang
workdir := client.Host().Workdir()
d1, err := workdir.Read().Directory("dir1/").ID(ctx)
if err != nil {
return err
}
d2, err := workdir.Read().Directory("dir2/").ID(ctx)
if err != nil {
return err
}
build := client.Container().From("alpine:latest").
WithMountedDirectory("/example/d1", d1).
WithMountedDirectory("/example/d2", d2)
build = build.Exec(dagger.ContainerExecOpts{
Args: []string{"ls", "/example"},
})
_, err = build.ExitCode(ctx)
if err != nil {
return err
}
build = build.Exec(dagger.ContainerExecOpts{
Args: []string{"ls", "/"},
})
_, err = build.ExitCode(ctx)
if err != nil {
return err
}
```
I was able to get the same functionality working fine by using `fs, err := build.FS().WithDirectory(d1, "/example/d1").WithDirectory(d2, "/example/d2").ID(ctx); build = build.WithFS(fs);` so conceptually don't think I'm doing anything wrong.
### Log output
```
#1 resolve image config for docker.io/library/alpine:latest
#1 DONE 0.4s
#2 mkfile /Dockerfile
#2 DONE 0.0s
#3 mkfile /main.go
#3 CACHED
#4 [internal] load metadata for docker.io/library/golang:1.18.2-alpine
#4 DONE 0.1s
#5 local://__dagger_workdir_/home/plaisted/source/OSD.PJI-Temporary/repro
#5 DONE 0.0s
#6 local://__dagger_workdir_/home/plaisted/source/OSD.PJI-Temporary/repro
#6 transferring __dagger_workdir_/home/plaisted/source/OSD.PJI-Temporary/repro: 309B done
#6 DONE 0.0s
#7 [build 1/6] FROM docker.io/library/golang:1.18.2-alpine@sha256:4795c5d21f01e0777707ada02408debe77fe31848be97cf9fa8a1462da78d949
#7 resolve docker.io/library/golang:1.18.2-alpine@sha256:4795c5d21f01e0777707ada02408debe77fe31848be97cf9fa8a1462da78d949 0.0s done
#7 DONE 0.0s
#8 [build 3/6] RUN apk add --no-cache file git
#8 CACHED
#9 [build 4/6] RUN go mod init go.dagger.io/dagger/shim/cmd
#9 CACHED
#10 [build 2/6] WORKDIR /src
#10 CACHED
#11 [build 5/6] COPY . .
#11 CACHED
#12 [build 6/6] RUN CGO_ENABLED=0 go build -o /_shim -ldflags '-s -d -w' .
#12 CACHED
#13 [stage-1 1/1] COPY --from=build /_shim /_shim
#13 CACHED
#14 mkdir /meta
#14 CACHED
#15 copy / /
#15 DONE 0.0s
#16 docker-image://docker.io/library/alpine:latest
#16 resolve docker.io/library/alpine:latest
#16 resolve docker.io/library/alpine:latest 0.1s done
#16 CACHED
#17 copy / /
#17 CACHED
#18 ls /example
#18 0.157 d1
#18 0.157 d2
#18 DONE 0.2s
#1 resolve image config for docker.io/library/alpine:latest
#1 DONE 0.5s
#4 [internal] load metadata for docker.io/library/golang:1.18.2-alpine
#4 DONE 0.4s
#19 ls /example
#19 0.172 d1
#19 DONE 0.2s
#20 ls /
#20 0.105 _shim
#20 0.105 bin
#20 0.105 dagger
#20 0.105 dev
#20 0.105 etc
#20 0.105 example
#20 0.105 home
#20 0.105 lib
#20 0.105 media
#20 0.105 mnt
#20 0.105 opt
#20 0.105 proc
#20 0.105 root
#20 0.105 run
#20 0.105 sbin
#20 0.105 srv
#20 0.105 sys
#20 0.105 tmp
#20 0.105 usr
#20 0.105 var
#20 DONE 0.1s
#0 0.148 d1
#0 0.148 d2
#18 DONE 0.2s
#1 resolve image config for docker.io/library/alpine:latest
#1 DONE 0.4s
#4 [internal] load metadata for docker.io/library/golang:1.18.2-alpine
#4 DONE 0.4s
#19 ls /example
#0 0.135 d1
#19 DONE 0.2s
#20 ls /example
#0 0.104 d1
#0 0.104 d2
#20 DONE 0.1s
```
### Steps to reproduce
* Mount two directories
* Run multiple exec commands and observe logs output
### Dagger version
dagger v0.3.1
### OS version
Ubuntu-20.04
|
https://github.com/dagger/dagger/issues/3551
|
https://github.com/dagger/dagger/pull/3602
|
b734ed35554bbfbc5caf63674eaa9c22692e614e
|
b4bb0b9e06e1edf8b81f9054b7419daabcb5bedb
| 2022-10-26T01:16:16Z |
go
| 2022-10-31T22:13:34Z |
core/integration/container_test.go
|
}
}
}
}
}`, nil, &testutil.QueryOptions{Variables: map[string]any{
"cache": cacheID,
}})
require.Error(t, err)
require.Contains(t, err.Error(), "bogus: cannot retrieve path from cache")
secretID := newSecret(t, "some-secret")
err = testutil.Query(
`query Test($secret: SecretID!) {
container {
from(address: "alpine:3.16.2") {
withMountedSecret(path: "/sekret", source: $secret) {
file(path: "/sekret") {
contents
}
}
}
}
}`, nil, &testutil.QueryOptions{Variables: map[string]any{
"secret": secretID,
}})
require.Error(t, err)
require.Contains(t, err.Error(), "sekret: no such file or directory")
}
func TestContainerFSDirectory(t *testing.T) {
t.Parallel()
dirRes := struct {
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 3,551 |
π Odd container behavior with exec / multiple withMountedDirectory
|
### What is the issue?
The following code executes but provides unexpected logs / output. Other similar use cases error due to missing files due to same issue. This may be something very simple (haven't used golang in many years) but seems like there may be an underlying issue with the execution engine.
I would expect this code to run the `ls` command twice, one time showing the two mounted directories, one time showing the root output. Instead in the logs I see `ls` with d1 and d2 (expected), an `ls` with just d1 (??), and then an `ls` with the root fs. This causes issues if the first ls is changed to `ls /example/d2` as it will error the whole pipeline due to missing path.
```golang
workdir := client.Host().Workdir()
d1, err := workdir.Read().Directory("dir1/").ID(ctx)
if err != nil {
return err
}
d2, err := workdir.Read().Directory("dir2/").ID(ctx)
if err != nil {
return err
}
build := client.Container().From("alpine:latest").
WithMountedDirectory("/example/d1", d1).
WithMountedDirectory("/example/d2", d2)
build = build.Exec(dagger.ContainerExecOpts{
Args: []string{"ls", "/example"},
})
_, err = build.ExitCode(ctx)
if err != nil {
return err
}
build = build.Exec(dagger.ContainerExecOpts{
Args: []string{"ls", "/"},
})
_, err = build.ExitCode(ctx)
if err != nil {
return err
}
```
I was able to get the same functionality working fine by using `fs, err := build.FS().WithDirectory(d1, "/example/d1").WithDirectory(d2, "/example/d2").ID(ctx); build = build.WithFS(fs);` so conceptually don't think I'm doing anything wrong.
### Log output
```
#1 resolve image config for docker.io/library/alpine:latest
#1 DONE 0.4s
#2 mkfile /Dockerfile
#2 DONE 0.0s
#3 mkfile /main.go
#3 CACHED
#4 [internal] load metadata for docker.io/library/golang:1.18.2-alpine
#4 DONE 0.1s
#5 local://__dagger_workdir_/home/plaisted/source/OSD.PJI-Temporary/repro
#5 DONE 0.0s
#6 local://__dagger_workdir_/home/plaisted/source/OSD.PJI-Temporary/repro
#6 transferring __dagger_workdir_/home/plaisted/source/OSD.PJI-Temporary/repro: 309B done
#6 DONE 0.0s
#7 [build 1/6] FROM docker.io/library/golang:1.18.2-alpine@sha256:4795c5d21f01e0777707ada02408debe77fe31848be97cf9fa8a1462da78d949
#7 resolve docker.io/library/golang:1.18.2-alpine@sha256:4795c5d21f01e0777707ada02408debe77fe31848be97cf9fa8a1462da78d949 0.0s done
#7 DONE 0.0s
#8 [build 3/6] RUN apk add --no-cache file git
#8 CACHED
#9 [build 4/6] RUN go mod init go.dagger.io/dagger/shim/cmd
#9 CACHED
#10 [build 2/6] WORKDIR /src
#10 CACHED
#11 [build 5/6] COPY . .
#11 CACHED
#12 [build 6/6] RUN CGO_ENABLED=0 go build -o /_shim -ldflags '-s -d -w' .
#12 CACHED
#13 [stage-1 1/1] COPY --from=build /_shim /_shim
#13 CACHED
#14 mkdir /meta
#14 CACHED
#15 copy / /
#15 DONE 0.0s
#16 docker-image://docker.io/library/alpine:latest
#16 resolve docker.io/library/alpine:latest
#16 resolve docker.io/library/alpine:latest 0.1s done
#16 CACHED
#17 copy / /
#17 CACHED
#18 ls /example
#18 0.157 d1
#18 0.157 d2
#18 DONE 0.2s
#1 resolve image config for docker.io/library/alpine:latest
#1 DONE 0.5s
#4 [internal] load metadata for docker.io/library/golang:1.18.2-alpine
#4 DONE 0.4s
#19 ls /example
#19 0.172 d1
#19 DONE 0.2s
#20 ls /
#20 0.105 _shim
#20 0.105 bin
#20 0.105 dagger
#20 0.105 dev
#20 0.105 etc
#20 0.105 example
#20 0.105 home
#20 0.105 lib
#20 0.105 media
#20 0.105 mnt
#20 0.105 opt
#20 0.105 proc
#20 0.105 root
#20 0.105 run
#20 0.105 sbin
#20 0.105 srv
#20 0.105 sys
#20 0.105 tmp
#20 0.105 usr
#20 0.105 var
#20 DONE 0.1s
#0 0.148 d1
#0 0.148 d2
#18 DONE 0.2s
#1 resolve image config for docker.io/library/alpine:latest
#1 DONE 0.4s
#4 [internal] load metadata for docker.io/library/golang:1.18.2-alpine
#4 DONE 0.4s
#19 ls /example
#0 0.135 d1
#19 DONE 0.2s
#20 ls /example
#0 0.104 d1
#0 0.104 d2
#20 DONE 0.1s
```
### Steps to reproduce
* Mount two directories
* Run multiple exec commands and observe logs output
### Dagger version
dagger v0.3.1
### OS version
Ubuntu-20.04
|
https://github.com/dagger/dagger/issues/3551
|
https://github.com/dagger/dagger/pull/3602
|
b734ed35554bbfbc5caf63674eaa9c22692e614e
|
b4bb0b9e06e1edf8b81f9054b7419daabcb5bedb
| 2022-10-26T01:16:16Z |
go
| 2022-10-31T22:13:34Z |
core/integration/container_test.go
|
Container struct {
From struct {
Directory struct {
ID core.DirectoryID
}
}
}
}{}
err := testutil.Query(
`{
container {
from(address: "alpine:3.16.2") {
directory(path: "/etc") {
id
}
}
}
}`, &dirRes, nil)
require.NoError(t, err)
etcID := dirRes.Container.From.Directory.ID
execRes := struct {
Container struct {
From struct {
WithMountedDirectory struct {
Exec struct {
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.