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,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/etc", source: $id) {
exec(args: ["cat", "/mnt/etc/alpine-release"]) {
stdout {
contents
}
}
}
}
}
}`, &execRes, &testutil.QueryOptions{Variables: map[string]any{
"id": etcID,
}})
require.NoError(t, err)
require.Equal(t, "3.16.2\n", execRes.Container.From.WithMountedDirectory.Exec.Stdout.Contents)
}
func TestContainerRelativePaths(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 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
writeRes := struct {
Container struct {
From struct {
Exec struct {
WithWorkdir struct {
WithWorkdir struct {
Workdir string
WithMountedDirectory struct {
WithMountedTemp struct {
WithMountedCache struct {
Mounts []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
|
Directory struct {
ID core.DirectoryID
}
}
WithoutMount struct {
Mounts []string
}
}
}
}
}
}
}
}
}
}{}
cacheID := newCache(t)
err = testutil.Query(
`query Test($id: DirectoryID!, $cache: CacheID!) {
container {
from(address: "alpine:3.16.2") {
exec(args: ["mkdir", "-p", "/mnt/sub"]) {
withWorkdir(path: "/mnt") {
withWorkdir(path: "sub") {
workdir
withMountedDirectory(path: "dir", source: $id) {
withMountedTemp(path: "tmp") {
withMountedCache(path: "cache", cache: $cache) {
mounts
exec(args: ["touch", "dir/another-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
|
directory(path: "dir") {
id
}
}
withoutMount(path: "cache") {
mounts
}
}
}
}
}
}
}
}
}
}`, &writeRes, &testutil.QueryOptions{Variables: map[string]any{
"id": id,
"cache": cacheID,
}})
require.NoError(t, err)
require.Equal(t,
[]string{"/mnt/sub/dir", "/mnt/sub/tmp", "/mnt/sub/cache"},
writeRes.Container.From.Exec.WithWorkdir.WithWorkdir.WithMountedDirectory.WithMountedTemp.WithMountedCache.Mounts)
require.Equal(t,
[]string{"/mnt/sub/dir", "/mnt/sub/tmp"},
writeRes.Container.From.Exec.WithWorkdir.WithWorkdir.WithMountedDirectory.WithMountedTemp.WithMountedCache.WithoutMount.Mounts)
writtenID := writeRes.Container.From.Exec.WithWorkdir.WithWorkdir.WithMountedDirectory.WithMountedTemp.WithMountedCache.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: ["ls", "/mnt/dir"]) {
stdout {
contents
}
}
}
}
}
}`, &execRes, &testutil.QueryOptions{Variables: map[string]any{
"id": writtenID,
}})
require.NoError(t, err)
require.Equal(t, "another-file\nsome-file\n", execRes.Container.From.WithMountedDirectory.Exec.Stdout.Contents)
}
func TestContainerMultiFrom(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 {
ID core.DirectoryID
}
}{}
err := testutil.Query(
`{
directory {
id
}
}`, &dirRes, nil)
require.NoError(t, err)
id := dirRes.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 {
From struct {
Exec struct {
Exec struct {
Stdout struct {
Contents string
}
}
}
}
}
}
}
}
}{}
err = testutil.Query(
`query Test($id: DirectoryID!) {
container {
from(address: "node:18.10.0-alpine") {
withMountedDirectory(path: "/mnt", source: $id) {
exec(args: ["sh", "-c", "node --version >> /mnt/versions"]) {
|
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") {
exec(args: ["sh", "-c", "go version >> /mnt/versions"]) {
exec(args: ["cat", "/mnt/versions"]) {
stdout {
contents
}
}
}
}
}
}
}
}
}`, &execRes, &testutil.QueryOptions{Variables: map[string]any{
"id": id,
}})
require.NoError(t, err)
require.Contains(t, execRes.Container.From.WithMountedDirectory.Exec.From.Exec.Exec.Stdout.Contents, "v18.10.0\n")
require.Contains(t, execRes.Container.From.WithMountedDirectory.Exec.From.Exec.Exec.Stdout.Contents, "go version go1.18.2")
}
func TestContainerPublish(t *testing.T) {
ctx := context.Background()
c, err := dagger.Connect(ctx)
require.NoError(t, err)
defer c.Close()
randomID := identity.NewID()
go func() {
|
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 := c.Container().
From("registry:2").
WithEnvVariable("RANDOM", randomID).
Exec().
ExitCode(ctx)
if err != nil {
t.Logf("error running registry: %v", err)
}
}()
_, err = c.Container().
From("alpine:3.16.2").
WithEnvVariable("RANDOM", randomID).
Exec(dagger.ContainerExecOpts{
Args: []string{"sh", "-c", "for i in $(seq 1 60); do nc -zv 127.0.0.1 5000 && exit 0; sleep 1; done; exit 1"},
}).
ExitCode(ctx)
require.NoError(t, err)
testRef := "127.0.0.1:5000/testimagepush:latest"
pushedRef, err := c.Container().
From("alpine:3.16.2").
Publish(ctx, testRef)
require.NoError(t, err)
require.NotEqual(t, testRef, pushedRef)
require.Contains(t, pushedRef, "@sha256:")
contents, err := c.Container().
From(pushedRef).FS().File("/etc/alpine-release").Contents(ctx)
require.NoError(t, err)
require.Equal(t, contents, "3.16.2\n")
}
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 3,588 |
Directory: rename `withCopiedFile` to `withFile`
|
See https://github.com/dagger/dagger/issues/3567#issuecomment-1294368392
|
https://github.com/dagger/dagger/issues/3588
|
https://github.com/dagger/dagger/pull/3590
|
530446113eeeeffb2aa0388641ba30d9a1435158
|
027d0c09d20c3900da341686699b4da3525034d7
| 2022-10-28T20:36:31Z |
go
| 2022-11-01T20:14:00Z |
core/directory.go
|
package core
import (
"context"
"fmt"
"path"
"reflect"
bkclient "github.com/moby/buildkit/client"
"github.com/moby/buildkit/client/llb"
bkgw "github.com/moby/buildkit/frontend/gateway/client"
"github.com/moby/buildkit/solver/pb"
specs "github.com/opencontainers/image-spec/specs-go/v1"
fstypes "github.com/tonistiigi/fsutil/types"
)
type Directory struct {
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 3,588 |
Directory: rename `withCopiedFile` to `withFile`
|
See https://github.com/dagger/dagger/issues/3567#issuecomment-1294368392
|
https://github.com/dagger/dagger/issues/3588
|
https://github.com/dagger/dagger/pull/3590
|
530446113eeeeffb2aa0388641ba30d9a1435158
|
027d0c09d20c3900da341686699b4da3525034d7
| 2022-10-28T20:36:31Z |
go
| 2022-11-01T20:14:00Z |
core/directory.go
|
ID DirectoryID `json:"id"`
}
type DirectoryID string
type directoryIDPayload struct {
LLB *pb.Definition `json:"llb"`
Dir string `json:"dir"`
Platform specs.Platform `json:"platform"`
}
func (id DirectoryID) Decode() (*directoryIDPayload, error) {
if id == "" {
return &directoryIDPayload{}, nil
}
var payload directoryIDPayload
if err := decodeID(&payload, id); err != nil {
return nil, err
}
return &payload, nil
}
func (payload *directoryIDPayload) State() (llb.State, error) {
if payload.LLB == nil {
return llb.Scratch(), nil
}
return defToState(payload.LLB)
}
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 3,588 |
Directory: rename `withCopiedFile` to `withFile`
|
See https://github.com/dagger/dagger/issues/3567#issuecomment-1294368392
|
https://github.com/dagger/dagger/issues/3588
|
https://github.com/dagger/dagger/pull/3590
|
530446113eeeeffb2aa0388641ba30d9a1435158
|
027d0c09d20c3900da341686699b4da3525034d7
| 2022-10-28T20:36:31Z |
go
| 2022-11-01T20:14:00Z |
core/directory.go
|
func (payload *directoryIDPayload) SetState(ctx context.Context, st llb.State) error {
def, err := st.Marshal(ctx, llb.Platform(payload.Platform))
if err != nil {
return nil
}
payload.LLB = def.ToPB()
return nil
}
func (payload *directoryIDPayload) ToDirectory() (*Directory, error) {
id, err := encodeID(payload)
if err != nil {
return nil, err
}
return &Directory{
ID: DirectoryID(id),
}, nil
}
func NewDirectory(ctx context.Context, st llb.State, cwd string, platform specs.Platform) (*Directory, error) {
payload := directoryIDPayload{
Dir: cwd,
Platform: platform,
}
def, err := st.Marshal(ctx, llb.Platform(platform))
if err != nil {
return nil, err
}
payload.LLB = def.ToPB()
return payload.ToDirectory()
}
func (dir *Directory) Stat(ctx context.Context, gw bkgw.Client, src string) (*fstypes.Stat, error) {
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 3,588 |
Directory: rename `withCopiedFile` to `withFile`
|
See https://github.com/dagger/dagger/issues/3567#issuecomment-1294368392
|
https://github.com/dagger/dagger/issues/3588
|
https://github.com/dagger/dagger/pull/3590
|
530446113eeeeffb2aa0388641ba30d9a1435158
|
027d0c09d20c3900da341686699b4da3525034d7
| 2022-10-28T20:36:31Z |
go
| 2022-11-01T20:14:00Z |
core/directory.go
|
payload, err := dir.ID.Decode()
if err != nil {
return nil, err
}
src = path.Join(payload.Dir, src)
if payload.LLB == nil {
if path.Clean(src) == "." {
return &fstypes.Stat{Path: src}, nil
}
return nil, fmt.Errorf("%s: no such file or directory", src)
}
res, err := gw.Solve(ctx, bkgw.SolveRequest{
Definition: payload.LLB,
})
if err != nil {
return nil, err
}
ref, err := res.SingleRef()
if err != nil {
return nil, err
}
stat, err := ref.StatFile(ctx, bkgw.StatRequest{
Path: src,
})
if err != nil {
return nil, err
}
return stat, nil
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 3,588 |
Directory: rename `withCopiedFile` to `withFile`
|
See https://github.com/dagger/dagger/issues/3567#issuecomment-1294368392
|
https://github.com/dagger/dagger/issues/3588
|
https://github.com/dagger/dagger/pull/3590
|
530446113eeeeffb2aa0388641ba30d9a1435158
|
027d0c09d20c3900da341686699b4da3525034d7
| 2022-10-28T20:36:31Z |
go
| 2022-11-01T20:14:00Z |
core/directory.go
|
}
func (dir *Directory) Entries(ctx context.Context, gw bkgw.Client, src string) ([]string, error) {
payload, err := dir.ID.Decode()
if err != nil {
return nil, err
}
src = path.Join(payload.Dir, src)
if payload.LLB == nil {
if path.Clean(src) == "." {
return []string{}, nil
}
return nil, fmt.Errorf("%s: no such file or directory", src)
}
res, err := gw.Solve(ctx, bkgw.SolveRequest{
Definition: payload.LLB,
})
if err != nil {
return nil, err
}
ref, err := res.SingleRef()
if err != nil {
return nil, err
}
entries, err := ref.ReadDir(ctx, bkgw.ReadDirRequest{
Path: src,
})
if err != nil {
return nil, err
}
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 3,588 |
Directory: rename `withCopiedFile` to `withFile`
|
See https://github.com/dagger/dagger/issues/3567#issuecomment-1294368392
|
https://github.com/dagger/dagger/issues/3588
|
https://github.com/dagger/dagger/pull/3590
|
530446113eeeeffb2aa0388641ba30d9a1435158
|
027d0c09d20c3900da341686699b4da3525034d7
| 2022-10-28T20:36:31Z |
go
| 2022-11-01T20:14:00Z |
core/directory.go
|
paths := []string{}
for _, entry := range entries {
paths = append(paths, entry.GetPath())
}
return paths, nil
}
func (dir *Directory) WithNewFile(ctx context.Context, gw bkgw.Client, dest string, content []byte) (*Directory, error) {
payload, err := dir.ID.Decode()
if err != nil {
return nil, err
}
dest = path.Join(payload.Dir, dest)
st, err := payload.State()
if err != nil {
return nil, err
}
parent, _ := path.Split(dest)
if parent != "" {
st = st.File(llb.Mkdir(parent, 0755, llb.WithParents(true)))
}
st = st.File(
llb.Mkfile(
dest,
0644,
content,
),
)
err = payload.SetState(ctx, st)
if err != nil {
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 3,588 |
Directory: rename `withCopiedFile` to `withFile`
|
See https://github.com/dagger/dagger/issues/3567#issuecomment-1294368392
|
https://github.com/dagger/dagger/issues/3588
|
https://github.com/dagger/dagger/pull/3590
|
530446113eeeeffb2aa0388641ba30d9a1435158
|
027d0c09d20c3900da341686699b4da3525034d7
| 2022-10-28T20:36:31Z |
go
| 2022-11-01T20:14:00Z |
core/directory.go
|
return nil, err
}
return payload.ToDirectory()
}
func (dir *Directory) Directory(ctx context.Context, subdir string) (*Directory, error) {
payload, err := dir.ID.Decode()
if err != nil {
return nil, err
}
payload.Dir = path.Join(payload.Dir, subdir)
return payload.ToDirectory()
}
func (dir *Directory) File(ctx context.Context, file string) (*File, error) {
payload, err := dir.ID.Decode()
if err != nil {
return nil, err
}
return (&fileIDPayload{
LLB: payload.LLB,
File: path.Join(payload.Dir, file),
Platform: payload.Platform,
}).ToFile()
}
func (dir *Directory) WithDirectory(ctx context.Context, subdir string, src *Directory, filter CopyFilter) (*Directory, error) {
destPayload, err := dir.ID.Decode()
if err != nil {
return nil, err
}
srcPayload, err := src.ID.Decode()
if err != nil {
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 3,588 |
Directory: rename `withCopiedFile` to `withFile`
|
See https://github.com/dagger/dagger/issues/3567#issuecomment-1294368392
|
https://github.com/dagger/dagger/issues/3588
|
https://github.com/dagger/dagger/pull/3590
|
530446113eeeeffb2aa0388641ba30d9a1435158
|
027d0c09d20c3900da341686699b4da3525034d7
| 2022-10-28T20:36:31Z |
go
| 2022-11-01T20:14:00Z |
core/directory.go
|
return nil, err
}
st, err := destPayload.State()
if err != nil {
return nil, err
}
srcSt, err := srcPayload.State()
if err != nil {
return nil, err
}
st = st.File(llb.Copy(srcSt, srcPayload.Dir, path.Join(destPayload.Dir, subdir), &llb.CopyInfo{
CreateDestPath: true,
CopyDirContentsOnly: true,
IncludePatterns: filter.Include,
ExcludePatterns: filter.Exclude,
}))
err = destPayload.SetState(ctx, st)
if err != nil {
return nil, err
}
return destPayload.ToDirectory()
}
func (dir *Directory) WithCopiedFile(ctx context.Context, subdir string, src *File) (*Directory, error) {
destPayload, err := dir.ID.Decode()
if err != nil {
return nil, err
}
srcPayload, err := src.ID.decode()
if err != nil {
return nil, err
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 3,588 |
Directory: rename `withCopiedFile` to `withFile`
|
See https://github.com/dagger/dagger/issues/3567#issuecomment-1294368392
|
https://github.com/dagger/dagger/issues/3588
|
https://github.com/dagger/dagger/pull/3590
|
530446113eeeeffb2aa0388641ba30d9a1435158
|
027d0c09d20c3900da341686699b4da3525034d7
| 2022-10-28T20:36:31Z |
go
| 2022-11-01T20:14:00Z |
core/directory.go
|
}
st, err := destPayload.State()
if err != nil {
return nil, err
}
srcSt, err := srcPayload.State()
if err != nil {
return nil, err
}
st = st.File(llb.Copy(srcSt, srcPayload.File, path.Join(destPayload.Dir, subdir), &llb.CopyInfo{
CreateDestPath: true,
}))
err = destPayload.SetState(ctx, st)
if err != nil {
return nil, err
}
return destPayload.ToDirectory()
}
func MergeDirectories(ctx context.Context, dirs []*Directory, platform specs.Platform) (*Directory, error) {
states := make([]llb.State, 0, len(dirs))
for _, fs := range dirs {
payload, err := fs.ID.Decode()
if err != nil {
return nil, err
}
if !reflect.DeepEqual(platform, payload.Platform) {
return nil, fmt.Errorf("TODO: cannot merge across platforms: %+v != %+v", platform, payload.Platform)
}
state, err := payload.State()
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 3,588 |
Directory: rename `withCopiedFile` to `withFile`
|
See https://github.com/dagger/dagger/issues/3567#issuecomment-1294368392
|
https://github.com/dagger/dagger/issues/3588
|
https://github.com/dagger/dagger/pull/3590
|
530446113eeeeffb2aa0388641ba30d9a1435158
|
027d0c09d20c3900da341686699b4da3525034d7
| 2022-10-28T20:36:31Z |
go
| 2022-11-01T20:14:00Z |
core/directory.go
|
if err != nil {
return nil, err
}
states = append(states, state)
}
return NewDirectory(ctx, llb.Merge(states), "", platform)
}
func (dir *Directory) Diff(ctx context.Context, other *Directory) (*Directory, error) {
lowerPayload, err := dir.ID.Decode()
if err != nil {
return nil, err
}
upperPayload, err := other.ID.Decode()
if err != nil {
return nil, err
}
if lowerPayload.Dir != upperPayload.Dir {
return nil, fmt.Errorf("TODO: cannot diff with different relative paths: %q != %q", lowerPayload.Dir, upperPayload.Dir)
}
if !reflect.DeepEqual(lowerPayload.Platform, upperPayload.Platform) {
return nil, fmt.Errorf("TODO: cannot diff across platforms: %+v != %+v", lowerPayload.Platform, upperPayload.Platform)
}
lowerSt, err := lowerPayload.State()
if err != nil {
return nil, err
}
upperSt, err := upperPayload.State()
if err != nil {
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 3,588 |
Directory: rename `withCopiedFile` to `withFile`
|
See https://github.com/dagger/dagger/issues/3567#issuecomment-1294368392
|
https://github.com/dagger/dagger/issues/3588
|
https://github.com/dagger/dagger/pull/3590
|
530446113eeeeffb2aa0388641ba30d9a1435158
|
027d0c09d20c3900da341686699b4da3525034d7
| 2022-10-28T20:36:31Z |
go
| 2022-11-01T20:14:00Z |
core/directory.go
|
return nil, err
}
err = lowerPayload.SetState(ctx, llb.Diff(lowerSt, upperSt))
if err != nil {
return nil, err
}
return lowerPayload.ToDirectory()
}
func (dir *Directory) Without(ctx context.Context, path string) (*Directory, error) {
payload, err := dir.ID.Decode()
if err != nil {
return nil, err
}
st, err := payload.State()
if err != nil {
return nil, err
}
err = payload.SetState(ctx, st.File(llb.Rm(path)))
if err != nil {
return nil, err
}
return payload.ToDirectory()
}
func (dir *Directory) Export(
ctx context.Context,
host *Host,
dest string,
bkClient *bkclient.Client,
solveOpts bkclient.SolveOpt,
solveCh chan<- *bkclient.SolveStatus,
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 3,588 |
Directory: rename `withCopiedFile` to `withFile`
|
See https://github.com/dagger/dagger/issues/3567#issuecomment-1294368392
|
https://github.com/dagger/dagger/issues/3588
|
https://github.com/dagger/dagger/pull/3590
|
530446113eeeeffb2aa0388641ba30d9a1435158
|
027d0c09d20c3900da341686699b4da3525034d7
| 2022-10-28T20:36:31Z |
go
| 2022-11-01T20:14:00Z |
core/directory.go
|
) error {
srcPayload, err := dir.ID.Decode()
if err != nil {
return err
}
return host.Export(ctx, dest, bkClient, solveOpts, solveCh, func(ctx context.Context, gw bkgw.Client) (*bkgw.Result, error) {
src, err := srcPayload.State()
if err != nil {
return nil, err
}
var defPB *pb.Definition
if srcPayload.Dir != "" {
src = llb.Scratch().File(llb.Copy(src, srcPayload.Dir, ".", &llb.CopyInfo{
CopyDirContentsOnly: true,
}))
def, err := src.Marshal(ctx, llb.Platform(srcPayload.Platform))
if err != nil {
return nil, err
}
defPB = def.ToPB()
} else {
defPB = srcPayload.LLB
}
return gw.Solve(ctx, bkgw.SolveRequest{
Evaluate: true,
Definition: defPB,
})
})
}
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 3,588 |
Directory: rename `withCopiedFile` to `withFile`
|
See https://github.com/dagger/dagger/issues/3567#issuecomment-1294368392
|
https://github.com/dagger/dagger/issues/3588
|
https://github.com/dagger/dagger/pull/3590
|
530446113eeeeffb2aa0388641ba30d9a1435158
|
027d0c09d20c3900da341686699b4da3525034d7
| 2022-10-28T20:36:31Z |
go
| 2022-11-01T20:14:00Z |
core/integration/directory_test.go
|
package core
import (
"testing"
"dagger.io/dagger"
"github.com/dagger/dagger/core"
"github.com/dagger/dagger/internal/testutil"
"github.com/stretchr/testify/require"
)
func TestEmptyDirectory(t *testing.T) {
t.Parallel()
var res struct {
Directory struct {
ID core.DirectoryID
Entries []string
}
}
err := testutil.Query(
`{
directory {
id
entries
}
}`, &res, nil)
require.NoError(t, err)
require.Empty(t, res.Directory.ID)
require.Empty(t, res.Directory.Entries)
}
func TestDirectoryWithNewFile(t *testing.T) {
t.Parallel()
var res struct {
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 3,588 |
Directory: rename `withCopiedFile` to `withFile`
|
See https://github.com/dagger/dagger/issues/3567#issuecomment-1294368392
|
https://github.com/dagger/dagger/issues/3588
|
https://github.com/dagger/dagger/pull/3590
|
530446113eeeeffb2aa0388641ba30d9a1435158
|
027d0c09d20c3900da341686699b4da3525034d7
| 2022-10-28T20:36:31Z |
go
| 2022-11-01T20:14:00Z |
core/integration/directory_test.go
|
Directory struct {
WithNewFile struct {
ID core.DirectoryID
Entries []string
}
}
}
err := testutil.Query(
`{
directory {
withNewFile(path: "some-file", contents: "some-content") {
id
entries
}
}
}`, &res, nil)
require.NoError(t, err)
require.NotEmpty(t, res.Directory.WithNewFile.ID)
require.Equal(t, []string{"some-file"}, res.Directory.WithNewFile.Entries)
}
func TestDirectoryEntries(t *testing.T) {
t.Parallel()
var res struct {
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 3,588 |
Directory: rename `withCopiedFile` to `withFile`
|
See https://github.com/dagger/dagger/issues/3567#issuecomment-1294368392
|
https://github.com/dagger/dagger/issues/3588
|
https://github.com/dagger/dagger/pull/3590
|
530446113eeeeffb2aa0388641ba30d9a1435158
|
027d0c09d20c3900da341686699b4da3525034d7
| 2022-10-28T20:36:31Z |
go
| 2022-11-01T20:14:00Z |
core/integration/directory_test.go
|
Directory struct {
WithNewFile struct {
WithNewFile struct {
Entries []string
}
}
}
}
err := testutil.Query(
`{
directory {
withNewFile(path: "some-file", contents: "some-content") {
withNewFile(path: "some-dir/sub-file", contents: "some-content") {
entries
}
}
}
}`, &res, nil)
require.NoError(t, err)
require.ElementsMatch(t, []string{"some-file", "some-dir"}, res.Directory.WithNewFile.WithNewFile.Entries)
}
func TestDirectoryEntriesOfPath(t *testing.T) {
t.Parallel()
var res struct {
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 3,588 |
Directory: rename `withCopiedFile` to `withFile`
|
See https://github.com/dagger/dagger/issues/3567#issuecomment-1294368392
|
https://github.com/dagger/dagger/issues/3588
|
https://github.com/dagger/dagger/pull/3590
|
530446113eeeeffb2aa0388641ba30d9a1435158
|
027d0c09d20c3900da341686699b4da3525034d7
| 2022-10-28T20:36:31Z |
go
| 2022-11-01T20:14:00Z |
core/integration/directory_test.go
|
Directory struct {
WithNewFile struct {
WithNewFile struct {
Entries []string
}
}
}
}
err := testutil.Query(
`{
directory {
withNewFile(path: "some-file", contents: "some-content") {
withNewFile(path: "some-dir/sub-file", contents: "some-content") {
entries(path: "some-dir")
}
}
}
}`, &res, nil)
require.NoError(t, err)
require.Equal(t, []string{"sub-file"}, res.Directory.WithNewFile.WithNewFile.Entries)
}
func TestDirectoryDirectory(t *testing.T) {
t.Parallel()
var res struct {
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 3,588 |
Directory: rename `withCopiedFile` to `withFile`
|
See https://github.com/dagger/dagger/issues/3567#issuecomment-1294368392
|
https://github.com/dagger/dagger/issues/3588
|
https://github.com/dagger/dagger/pull/3590
|
530446113eeeeffb2aa0388641ba30d9a1435158
|
027d0c09d20c3900da341686699b4da3525034d7
| 2022-10-28T20:36:31Z |
go
| 2022-11-01T20:14:00Z |
core/integration/directory_test.go
|
Directory struct {
WithNewFile struct {
WithNewFile struct {
Directory struct {
Entries []string
}
}
}
}
}
err := testutil.Query(
`{
directory {
withNewFile(path: "some-file", contents: "some-content") {
withNewFile(path: "some-dir/sub-file", contents: "some-content") {
directory(path: "some-dir") {
entries
}
}
}
}
}`, &res, nil)
require.NoError(t, err)
require.Equal(t, []string{"sub-file"}, res.Directory.WithNewFile.WithNewFile.Directory.Entries)
}
func TestDirectoryDirectoryWithNewFile(t *testing.T) {
t.Parallel()
var res struct {
Directory struct {
WithNewFile struct {
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 3,588 |
Directory: rename `withCopiedFile` to `withFile`
|
See https://github.com/dagger/dagger/issues/3567#issuecomment-1294368392
|
https://github.com/dagger/dagger/issues/3588
|
https://github.com/dagger/dagger/pull/3590
|
530446113eeeeffb2aa0388641ba30d9a1435158
|
027d0c09d20c3900da341686699b4da3525034d7
| 2022-10-28T20:36:31Z |
go
| 2022-11-01T20:14:00Z |
core/integration/directory_test.go
|
WithNewFile struct {
Directory struct {
WithNewFile struct {
Entries []string
}
}
}
}
}
}
err := testutil.Query(
`{
directory {
withNewFile(path: "some-file", contents: "some-content") {
withNewFile(path: "some-dir/sub-file", contents: "some-content") {
directory(path: "some-dir") {
withNewFile(path: "another-file", contents: "more-content") {
entries
}
}
}
}
}
}`, &res, nil)
require.NoError(t, err)
require.ElementsMatch(t,
[]string{"sub-file", "another-file"},
res.Directory.WithNewFile.WithNewFile.Directory.WithNewFile.Entries)
}
func TestDirectoryWithDirectory(t *testing.T) {
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 3,588 |
Directory: rename `withCopiedFile` to `withFile`
|
See https://github.com/dagger/dagger/issues/3567#issuecomment-1294368392
|
https://github.com/dagger/dagger/issues/3588
|
https://github.com/dagger/dagger/pull/3590
|
530446113eeeeffb2aa0388641ba30d9a1435158
|
027d0c09d20c3900da341686699b4da3525034d7
| 2022-10-28T20:36:31Z |
go
| 2022-11-01T20:14:00Z |
core/integration/directory_test.go
|
t.Parallel()
c, ctx := connect(t)
defer c.Close()
dirID, err := c.Directory().
WithNewFile("some-file", dagger.DirectoryWithNewFileOpts{
Contents: "some-content",
}).
WithNewFile("some-dir/sub-file", dagger.DirectoryWithNewFileOpts{
Contents: "sub-content",
}).
Directory("some-dir").ID(ctx)
require.NoError(t, err)
entries, err := c.Directory().WithDirectory(dirID, "with-dir").Entries(ctx, dagger.DirectoryEntriesOpts{
Path: "with-dir",
})
require.NoError(t, err)
require.Equal(t, []string{"sub-file"}, entries)
entries, err = c.Directory().WithDirectory(dirID, "sub-dir/sub-sub-dir/with-dir").Entries(ctx, dagger.DirectoryEntriesOpts{
Path: "sub-dir/sub-sub-dir/with-dir",
})
require.NoError(t, err)
require.Equal(t, []string{"sub-file"}, entries)
t.Run("copies directory contents to .", func(t *testing.T) {
entries, err := c.Directory().WithDirectory(dirID, ".").Entries(ctx)
require.NoError(t, err)
require.Equal(t, []string{"sub-file"}, entries)
})
}
func TestDirectoryWithDirectoryIncludeExclude(t *testing.T) {
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 3,588 |
Directory: rename `withCopiedFile` to `withFile`
|
See https://github.com/dagger/dagger/issues/3567#issuecomment-1294368392
|
https://github.com/dagger/dagger/issues/3588
|
https://github.com/dagger/dagger/pull/3590
|
530446113eeeeffb2aa0388641ba30d9a1435158
|
027d0c09d20c3900da341686699b4da3525034d7
| 2022-10-28T20:36:31Z |
go
| 2022-11-01T20:14:00Z |
core/integration/directory_test.go
|
t.Parallel()
c, ctx := connect(t)
defer c.Close()
dir := c.Directory().
WithNewFile("a.txt").
WithNewFile("b.txt").
WithNewFile("c.txt.rar").
WithNewFile("subdir/d.txt").
WithNewFile("subdir/e.txt").
WithNewFile("subdir/f.txt.rar")
dirID, err := dir.ID(ctx)
require.NoError(t, err)
t.Run("exclude", func(t *testing.T) {
entries, err := c.Directory().WithDirectory(dirID, ".", dagger.DirectoryWithDirectoryOpts{
Exclude: []string{"*.rar"},
}).Entries(ctx)
require.NoError(t, err)
require.Equal(t, []string{"a.txt", "b.txt", "subdir"}, entries)
})
t.Run("include", func(t *testing.T) {
entries, err := c.Directory().WithDirectory(dirID, ".", dagger.DirectoryWithDirectoryOpts{
Include: []string{"*.rar"},
}).Entries(ctx)
require.NoError(t, err)
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 3,588 |
Directory: rename `withCopiedFile` to `withFile`
|
See https://github.com/dagger/dagger/issues/3567#issuecomment-1294368392
|
https://github.com/dagger/dagger/issues/3588
|
https://github.com/dagger/dagger/pull/3590
|
530446113eeeeffb2aa0388641ba30d9a1435158
|
027d0c09d20c3900da341686699b4da3525034d7
| 2022-10-28T20:36:31Z |
go
| 2022-11-01T20:14:00Z |
core/integration/directory_test.go
|
require.Equal(t, []string{"c.txt.rar"}, entries)
})
t.Run("exclude overrides include", func(t *testing.T) {
entries, err := c.Directory().WithDirectory(dirID, ".", dagger.DirectoryWithDirectoryOpts{
Include: []string{"*.txt"},
Exclude: []string{"b.txt"},
}).Entries(ctx)
require.NoError(t, err)
require.Equal(t, []string{"a.txt"}, entries)
})
t.Run("include does not override exclude", func(t *testing.T) {
entries, err := c.Directory().WithDirectory(dirID, ".", dagger.DirectoryWithDirectoryOpts{
Include: []string{"a.txt"},
Exclude: []string{"*.txt"},
}).Entries(ctx)
require.NoError(t, err)
require.Equal(t, []string{}, entries)
})
subdirID, err := dir.Directory("subdir").ID(ctx)
require.NoError(t, err)
t.Run("exclude respects subdir", func(t *testing.T) {
entries, err := c.Directory().WithDirectory(subdirID, ".", dagger.DirectoryWithDirectoryOpts{
Exclude: []string{"*.rar"},
}).Entries(ctx)
require.NoError(t, err)
require.Equal(t, []string{"d.txt", "e.txt"}, entries)
})
}
func TestDirectoryWithCopiedFile(t *testing.T) {
var fileRes struct {
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 3,588 |
Directory: rename `withCopiedFile` to `withFile`
|
See https://github.com/dagger/dagger/issues/3567#issuecomment-1294368392
|
https://github.com/dagger/dagger/issues/3588
|
https://github.com/dagger/dagger/pull/3590
|
530446113eeeeffb2aa0388641ba30d9a1435158
|
027d0c09d20c3900da341686699b4da3525034d7
| 2022-10-28T20:36:31Z |
go
| 2022-11-01T20:14:00Z |
core/integration/directory_test.go
|
Directory struct {
WithNewFile struct {
File struct {
ID core.DirectoryID
}
}
}
}
err := testutil.Query(
`{
directory {
withNewFile(path: "some-file", contents: "some-content") {
file(path: "some-file") {
id
}
}
}
}`, &fileRes, nil)
require.NoError(t, err)
require.NotEmpty(t, fileRes.Directory.WithNewFile.File.ID)
var res struct {
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 3,588 |
Directory: rename `withCopiedFile` to `withFile`
|
See https://github.com/dagger/dagger/issues/3567#issuecomment-1294368392
|
https://github.com/dagger/dagger/issues/3588
|
https://github.com/dagger/dagger/pull/3590
|
530446113eeeeffb2aa0388641ba30d9a1435158
|
027d0c09d20c3900da341686699b4da3525034d7
| 2022-10-28T20:36:31Z |
go
| 2022-11-01T20:14:00Z |
core/integration/directory_test.go
|
Directory struct {
WithCopiedFile struct {
File struct {
ID core.DirectoryID
Contents string
}
}
}
}
err = testutil.Query(
`query Test($src: FileID!) {
directory {
withCopiedFile(path: "target-file", source: $src) {
file(path: "target-file") {
id
contents
}
}
}
}`, &res, &testutil.QueryOptions{
Variables: map[string]any{
"src": fileRes.Directory.WithNewFile.File.ID,
},
})
require.NoError(t, err)
require.NotEmpty(t, res.Directory.WithCopiedFile.File.ID)
require.Equal(t, "some-content", res.Directory.WithCopiedFile.File.Contents)
}
func TestDirectoryWithoutDirectory(t *testing.T) {
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 3,588 |
Directory: rename `withCopiedFile` to `withFile`
|
See https://github.com/dagger/dagger/issues/3567#issuecomment-1294368392
|
https://github.com/dagger/dagger/issues/3588
|
https://github.com/dagger/dagger/pull/3590
|
530446113eeeeffb2aa0388641ba30d9a1435158
|
027d0c09d20c3900da341686699b4da3525034d7
| 2022-10-28T20:36:31Z |
go
| 2022-11-01T20:14:00Z |
core/integration/directory_test.go
|
t.Parallel()
dirID := newDirWithFiles(t,
"some-file", "some-content",
"some-dir/sub-file", "sub-content")
var res2 struct {
Directory struct {
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 3,588 |
Directory: rename `withCopiedFile` to `withFile`
|
See https://github.com/dagger/dagger/issues/3567#issuecomment-1294368392
|
https://github.com/dagger/dagger/issues/3588
|
https://github.com/dagger/dagger/pull/3590
|
530446113eeeeffb2aa0388641ba30d9a1435158
|
027d0c09d20c3900da341686699b4da3525034d7
| 2022-10-28T20:36:31Z |
go
| 2022-11-01T20:14:00Z |
core/integration/directory_test.go
|
WithDirectory struct {
WithoutDirectory struct {
Entries []string
}
}
}
}
err := testutil.Query(
`query Test($src: DirectoryID!) {
directory {
withDirectory(path: "with-dir", directory: $src) {
withoutDirectory(path: "with-dir/some-dir") {
entries(path: "with-dir")
}
}
}
}`, &res2, &testutil.QueryOptions{
Variables: map[string]any{
"src": dirID,
},
})
require.NoError(t, err)
require.Equal(t, []string{"some-file"}, res2.Directory.WithDirectory.WithoutDirectory.Entries)
}
func TestDirectoryWithoutFile(t *testing.T) {
t.Parallel()
dirID := newDirWithFiles(t,
"some-file", "some-content",
"some-dir/sub-file", "sub-content")
var res2 struct {
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 3,588 |
Directory: rename `withCopiedFile` to `withFile`
|
See https://github.com/dagger/dagger/issues/3567#issuecomment-1294368392
|
https://github.com/dagger/dagger/issues/3588
|
https://github.com/dagger/dagger/pull/3590
|
530446113eeeeffb2aa0388641ba30d9a1435158
|
027d0c09d20c3900da341686699b4da3525034d7
| 2022-10-28T20:36:31Z |
go
| 2022-11-01T20:14:00Z |
core/integration/directory_test.go
|
Directory struct {
WithDirectory struct {
WithoutFile struct {
Entries []string
}
}
}
}
err := testutil.Query(
`query Test($src: DirectoryID!) {
directory {
withDirectory(path: "with-dir", directory: $src) {
withoutFile(path: "with-dir/some-file") {
entries(path: "with-dir")
}
}
}
}`, &res2, &testutil.QueryOptions{
Variables: map[string]any{
"src": dirID,
},
})
require.NoError(t, err)
require.Equal(t, []string{"some-dir"}, res2.Directory.WithDirectory.WithoutFile.Entries)
}
func TestDirectoryDiff(t *testing.T) {
t.Parallel()
aID := newDirWithFile(t, "a-file", "a-content")
bID := newDirWithFile(t, "b-file", "b-content")
var res struct {
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 3,588 |
Directory: rename `withCopiedFile` to `withFile`
|
See https://github.com/dagger/dagger/issues/3567#issuecomment-1294368392
|
https://github.com/dagger/dagger/issues/3588
|
https://github.com/dagger/dagger/pull/3590
|
530446113eeeeffb2aa0388641ba30d9a1435158
|
027d0c09d20c3900da341686699b4da3525034d7
| 2022-10-28T20:36:31Z |
go
| 2022-11-01T20:14:00Z |
core/integration/directory_test.go
|
Directory struct {
Diff struct {
Entries []string
}
}
}
diff := `query Diff($id: DirectoryID!, $other: DirectoryID!) {
directory(id: $id) {
diff(other: $other) {
entries
}
}
}`
err := testutil.Query(diff, &res, &testutil.QueryOptions{
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 3,588 |
Directory: rename `withCopiedFile` to `withFile`
|
See https://github.com/dagger/dagger/issues/3567#issuecomment-1294368392
|
https://github.com/dagger/dagger/issues/3588
|
https://github.com/dagger/dagger/pull/3590
|
530446113eeeeffb2aa0388641ba30d9a1435158
|
027d0c09d20c3900da341686699b4da3525034d7
| 2022-10-28T20:36:31Z |
go
| 2022-11-01T20:14:00Z |
core/integration/directory_test.go
|
Variables: map[string]any{
"id": aID,
"other": bID,
},
})
require.NoError(t, err)
require.Equal(t, []string{"b-file"}, res.Directory.Diff.Entries)
err = testutil.Query(diff, &res, &testutil.QueryOptions{
Variables: map[string]any{
"id": bID,
"other": aID,
},
})
require.NoError(t, err)
require.Equal(t, []string{"a-file"}, res.Directory.Diff.Entries)
/*
This triggers a nil panic in Buildkit!
Issue: https://github.com/dagger/dagger/issues/3337
This might be fixed once we update Buildkit.
err = testutil.Query(diff, &res, &testutil.QueryOptions{
Variables: map[string]any{
"id": aID,
"other": aID,
},
})
require.NoError(t, err)
require.Empty(t, res.Directory.Diff.Entries)
*/
}
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 3,588 |
Directory: rename `withCopiedFile` to `withFile`
|
See https://github.com/dagger/dagger/issues/3567#issuecomment-1294368392
|
https://github.com/dagger/dagger/issues/3588
|
https://github.com/dagger/dagger/pull/3590
|
530446113eeeeffb2aa0388641ba30d9a1435158
|
027d0c09d20c3900da341686699b4da3525034d7
| 2022-10-28T20:36:31Z |
go
| 2022-11-01T20:14:00Z |
core/schema/directory.go
|
package schema
import (
"github.com/dagger/dagger/core"
"github.com/dagger/dagger/router"
)
type directorySchema struct {
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 3,588 |
Directory: rename `withCopiedFile` to `withFile`
|
See https://github.com/dagger/dagger/issues/3567#issuecomment-1294368392
|
https://github.com/dagger/dagger/issues/3588
|
https://github.com/dagger/dagger/pull/3590
|
530446113eeeeffb2aa0388641ba30d9a1435158
|
027d0c09d20c3900da341686699b4da3525034d7
| 2022-10-28T20:36:31Z |
go
| 2022-11-01T20:14:00Z |
core/schema/directory.go
|
*baseSchema
host *core.Host
}
var _ router.ExecutableSchema = &directorySchema{}
func (s *directorySchema) Name() string {
return "directory"
}
func (s *directorySchema) Schema() string {
return Directory
}
var directoryIDResolver = stringResolver(core.DirectoryID(""))
func (s *directorySchema) Resolvers() router.Resolvers {
return router.Resolvers{
"DirectoryID": directoryIDResolver,
"Query": router.ObjectResolver{
"directory": router.ToResolver(s.directory),
},
"Directory": router.ObjectResolver{
"entries": router.ToResolver(s.entries),
"file": router.ToResolver(s.file),
"withNewFile": router.ToResolver(s.withNewFile),
"withCopiedFile": router.ToResolver(s.withCopiedFile),
"withoutFile": router.ToResolver(s.withoutFile),
"directory": router.ToResolver(s.subdirectory),
"withDirectory": router.ToResolver(s.withDirectory),
"withoutDirectory": router.ToResolver(s.withoutDirectory),
"diff": router.ToResolver(s.diff),
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 3,588 |
Directory: rename `withCopiedFile` to `withFile`
|
See https://github.com/dagger/dagger/issues/3567#issuecomment-1294368392
|
https://github.com/dagger/dagger/issues/3588
|
https://github.com/dagger/dagger/pull/3590
|
530446113eeeeffb2aa0388641ba30d9a1435158
|
027d0c09d20c3900da341686699b4da3525034d7
| 2022-10-28T20:36:31Z |
go
| 2022-11-01T20:14:00Z |
core/schema/directory.go
|
"export": router.ToResolver(s.export),
},
}
}
func (s *directorySchema) Dependencies() []router.ExecutableSchema {
return nil
}
type directoryArgs struct {
ID core.DirectoryID
}
func (s *directorySchema) directory(ctx *router.Context, parent any, args directoryArgs) (*core.Directory, error) {
return &core.Directory{
ID: args.ID,
}, nil
}
type subdirectoryArgs struct {
Path string
}
func (s *directorySchema) subdirectory(ctx *router.Context, parent *core.Directory, args subdirectoryArgs) (*core.Directory, error) {
return parent.Directory(ctx, args.Path)
}
type withDirectoryArgs struct {
Path string
Directory core.DirectoryID
core.CopyFilter
}
func (s *directorySchema) withDirectory(ctx *router.Context, parent *core.Directory, args withDirectoryArgs) (*core.Directory, error) {
return parent.WithDirectory(ctx, args.Path, &core.Directory{ID: args.Directory}, args.CopyFilter)
}
type entriesArgs struct {
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 3,588 |
Directory: rename `withCopiedFile` to `withFile`
|
See https://github.com/dagger/dagger/issues/3567#issuecomment-1294368392
|
https://github.com/dagger/dagger/issues/3588
|
https://github.com/dagger/dagger/pull/3590
|
530446113eeeeffb2aa0388641ba30d9a1435158
|
027d0c09d20c3900da341686699b4da3525034d7
| 2022-10-28T20:36:31Z |
go
| 2022-11-01T20:14:00Z |
core/schema/directory.go
|
Path string
}
func (s *directorySchema) entries(ctx *router.Context, parent *core.Directory, args entriesArgs) ([]string, error) {
return parent.Entries(ctx, s.gw, args.Path)
}
type dirFileArgs struct {
Path string
}
func (s *directorySchema) file(ctx *router.Context, parent *core.Directory, args dirFileArgs) (*core.File, error) {
return parent.File(ctx, args.Path)
}
type withNewFileArgs struct {
Path string
Contents string
}
func (s *directorySchema) withNewFile(ctx *router.Context, parent *core.Directory, args withNewFileArgs) (*core.Directory, error) {
return parent.WithNewFile(ctx, s.gw, args.Path, []byte(args.Contents))
}
type withCopiedFileArgs struct {
Path string
Source core.FileID
}
func (s *directorySchema) withCopiedFile(ctx *router.Context, parent *core.Directory, args withCopiedFileArgs) (*core.Directory, error) {
return parent.WithCopiedFile(ctx, args.Path, &core.File{ID: args.Source})
}
type withoutDirectoryArgs struct {
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 3,588 |
Directory: rename `withCopiedFile` to `withFile`
|
See https://github.com/dagger/dagger/issues/3567#issuecomment-1294368392
|
https://github.com/dagger/dagger/issues/3588
|
https://github.com/dagger/dagger/pull/3590
|
530446113eeeeffb2aa0388641ba30d9a1435158
|
027d0c09d20c3900da341686699b4da3525034d7
| 2022-10-28T20:36:31Z |
go
| 2022-11-01T20:14:00Z |
core/schema/directory.go
|
Path string
}
func (s *directorySchema) withoutDirectory(ctx *router.Context, parent *core.Directory, args withoutDirectoryArgs) (*core.Directory, error) {
return parent.Without(ctx, args.Path)
}
type withoutFileArgs struct {
Path string
}
func (s *directorySchema) withoutFile(ctx *router.Context, parent *core.Directory, args withoutFileArgs) (*core.Directory, error) {
return parent.Without(ctx, args.Path)
}
type diffArgs struct {
Other core.DirectoryID
}
func (s *directorySchema) diff(ctx *router.Context, parent *core.Directory, args diffArgs) (*core.Directory, error) {
return parent.Diff(ctx, &core.Directory{ID: args.Other})
}
type exportArgs struct {
Path string
}
func (s *directorySchema) export(ctx *router.Context, parent *core.Directory, args exportArgs) (bool, error) {
err := parent.Export(ctx, s.host, args.Path, s.bkClient, s.solveOpts, s.solveCh)
if err != nil {
return false, err
}
return true, nil
}
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 3,588 |
Directory: rename `withCopiedFile` to `withFile`
|
See https://github.com/dagger/dagger/issues/3567#issuecomment-1294368392
|
https://github.com/dagger/dagger/issues/3588
|
https://github.com/dagger/dagger/pull/3590
|
530446113eeeeffb2aa0388641ba30d9a1435158
|
027d0c09d20c3900da341686699b4da3525034d7
| 2022-10-28T20:36:31Z |
go
| 2022-11-01T20:14:00Z |
magefile.go
|
package main
import (
"context"
"errors"
"fmt"
"os"
"runtime"
"dagger.io/dagger"
"github.com/dagger/dagger/codegen/generator"
"github.com/google/go-cmp/cmp"
"github.com/magefile/mage/mg"
)
type Lint mg.Namespace
func (t Lint) All(ctx context.Context) error {
mg.Deps(
t.Codegen,
t.Markdown,
)
return nil
}
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 3,588 |
Directory: rename `withCopiedFile` to `withFile`
|
See https://github.com/dagger/dagger/issues/3567#issuecomment-1294368392
|
https://github.com/dagger/dagger/issues/3588
|
https://github.com/dagger/dagger/pull/3590
|
530446113eeeeffb2aa0388641ba30d9a1435158
|
027d0c09d20c3900da341686699b4da3525034d7
| 2022-10-28T20:36:31Z |
go
| 2022-11-01T20:14:00Z |
magefile.go
|
func (Lint) Markdown(ctx context.Context) error {
c, err := dagger.Connect(ctx, dagger.WithLogOutput(os.Stderr))
if err != nil {
return err
}
defer c.Close()
workdir := c.Host().Workdir()
src, err := workdir.ID(ctx)
if err != nil {
return err
}
cfg, err := workdir.File(".markdownlint.yaml").ID(ctx)
if err != nil {
return err
}
_, err = c.Container().
From("tmknom/markdownlint:0.31.1").
WithMountedDirectory("/src", src).
WithMountedFile("/src/.markdownlint.yaml", cfg).
WithWorkdir("/src").
Exec(dagger.ContainerExecOpts{
Args: []string{
"-c",
".markdownlint.yaml",
"--",
"./docs",
"README.md",
},
}).ExitCode(ctx)
return err
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 3,588 |
Directory: rename `withCopiedFile` to `withFile`
|
See https://github.com/dagger/dagger/issues/3567#issuecomment-1294368392
|
https://github.com/dagger/dagger/issues/3588
|
https://github.com/dagger/dagger/pull/3590
|
530446113eeeeffb2aa0388641ba30d9a1435158
|
027d0c09d20c3900da341686699b4da3525034d7
| 2022-10-28T20:36:31Z |
go
| 2022-11-01T20:14:00Z |
magefile.go
|
}
func (Lint) Codegen(ctx context.Context) error {
c, err := dagger.Connect(ctx, dagger.WithLogOutput(os.Stderr))
if err != nil {
return err
}
defer c.Close()
generated, err := generator.IntrospectAndGenerate(ctx, c, generator.Config{
Package: "dagger",
})
if err != nil {
return err
}
src, err := c.
Host().
Workdir().
File("sdk/go/api.gen.go").
Contents(ctx)
if err != nil {
return err
}
diff := cmp.Diff(string(generated), src)
if diff != "" {
return fmt.Errorf("generated api mismatch. please run `go generate ./...`:\n%s", diff)
}
return nil
}
func Build(ctx context.Context) error {
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 3,588 |
Directory: rename `withCopiedFile` to `withFile`
|
See https://github.com/dagger/dagger/issues/3567#issuecomment-1294368392
|
https://github.com/dagger/dagger/issues/3588
|
https://github.com/dagger/dagger/pull/3590
|
530446113eeeeffb2aa0388641ba30d9a1435158
|
027d0c09d20c3900da341686699b4da3525034d7
| 2022-10-28T20:36:31Z |
go
| 2022-11-01T20:14:00Z |
magefile.go
|
c, err := dagger.Connect(ctx, dagger.WithLogOutput(os.Stderr))
if err != nil {
return err
}
defer c.Close()
workdir := c.Host().Workdir()
builder := c.Container().
From("golang:1.19-alpine").
WithEnvVariable("CGO_ENABLED", "0").
WithEnvVariable("GOOS", runtime.GOOS).
WithEnvVariable("GOARCH", runtime.GOARCH).
WithWorkdir("/app")
modules := c.Directory()
for _, f := range []string{"go.mod", "go.sum", "sdk/go/go.mod", "sdk/go/go.sum"} {
fileID, err := workdir.File(f).ID(ctx)
if err != nil {
return err
}
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 3,588 |
Directory: rename `withCopiedFile` to `withFile`
|
See https://github.com/dagger/dagger/issues/3567#issuecomment-1294368392
|
https://github.com/dagger/dagger/issues/3588
|
https://github.com/dagger/dagger/pull/3590
|
530446113eeeeffb2aa0388641ba30d9a1435158
|
027d0c09d20c3900da341686699b4da3525034d7
| 2022-10-28T20:36:31Z |
go
| 2022-11-01T20:14:00Z |
magefile.go
|
modules = modules.WithCopiedFile(f, fileID)
}
modID, err := modules.ID(ctx)
if err != nil {
return err
}
builder = builder.
WithMountedDirectory("/app", modID).
Exec(dagger.ContainerExecOpts{
Args: []string{"go", "mod", "download"},
})
src, err := workdir.ID(ctx)
if err != nil {
return err
}
builder = builder.
WithMountedDirectory("/app", src).WithWorkdir("/app").
Exec(dagger.ContainerExecOpts{
Args: []string{"go", "build", "-o", "./bin/cloak", "-ldflags", "-s -w", "/app/cmd/cloak"},
})
ok, err := builder.Directory("./bin").Export(ctx, "./bin")
if err != nil {
return err
}
if !ok {
return errors.New("HostDirectoryWrite not ok")
}
return nil
}
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 3,588 |
Directory: rename `withCopiedFile` to `withFile`
|
See https://github.com/dagger/dagger/issues/3567#issuecomment-1294368392
|
https://github.com/dagger/dagger/issues/3588
|
https://github.com/dagger/dagger/pull/3590
|
530446113eeeeffb2aa0388641ba30d9a1435158
|
027d0c09d20c3900da341686699b4da3525034d7
| 2022-10-28T20:36:31Z |
go
| 2022-11-01T20:14:00Z |
sdk/go/api.gen.go
|
package dagger
import (
"context"
"dagger.io/dagger/internal/querybuilder"
"github.com/Khan/genqlient/graphql"
)
type graphqlMarshaller interface {
graphqlType() string
graphqlMarshal(ctx context.Context) (any, error)
}
type CacheID string
func (s CacheID) graphqlType() string {
return "CacheID"
}
func (s CacheID) graphqlMarshal(ctx context.Context) (any, error) {
return string(s), nil
}
type ContainerID string
func (s ContainerID) graphqlType() string {
return "ContainerID"
}
func (s ContainerID) graphqlMarshal(ctx context.Context) (any, error) {
return string(s), nil
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 3,588 |
Directory: rename `withCopiedFile` to `withFile`
|
See https://github.com/dagger/dagger/issues/3567#issuecomment-1294368392
|
https://github.com/dagger/dagger/issues/3588
|
https://github.com/dagger/dagger/pull/3590
|
530446113eeeeffb2aa0388641ba30d9a1435158
|
027d0c09d20c3900da341686699b4da3525034d7
| 2022-10-28T20:36:31Z |
go
| 2022-11-01T20:14:00Z |
sdk/go/api.gen.go
|
}
type DirectoryID string
func (s DirectoryID) graphqlType() string {
return "DirectoryID"
}
func (s DirectoryID) graphqlMarshal(ctx context.Context) (any, error) {
return string(s), nil
}
type FileID string
func (s FileID) graphqlType() string {
return "FileID"
}
func (s FileID) graphqlMarshal(ctx context.Context) (any, error) {
return string(s), nil
}
type Platform string
func (s Platform) graphqlType() string {
return "Platform"
}
func (s Platform) graphqlMarshal(ctx context.Context) (any, error) {
return string(s), nil
}
type SecretID string
func (s SecretID) graphqlType() string {
return "SecretID"
}
func (s SecretID) graphqlMarshal(ctx context.Context) (any, error) {
return string(s), nil
}
type CacheVolume struct {
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 3,588 |
Directory: rename `withCopiedFile` to `withFile`
|
See https://github.com/dagger/dagger/issues/3567#issuecomment-1294368392
|
https://github.com/dagger/dagger/issues/3588
|
https://github.com/dagger/dagger/pull/3590
|
530446113eeeeffb2aa0388641ba30d9a1435158
|
027d0c09d20c3900da341686699b4da3525034d7
| 2022-10-28T20:36:31Z |
go
| 2022-11-01T20:14:00Z |
sdk/go/api.gen.go
|
q *querybuilder.Selection
c graphql.Client
}
func (r *CacheVolume) ID(ctx context.Context) (CacheID, error) {
q := r.q.Select("id")
var response CacheID
q = q.Bind(&response)
return response, q.Execute(ctx, r.c)
}
func (r *CacheVolume) graphqlType() string {
return "CacheVolume"
}
func (r *CacheVolume) graphqlMarshal(ctx context.Context) (any, error) {
id, err := r.ID(ctx)
if err != nil {
return nil, err
}
return map[string]any{"id": id}, nil
}
type Container struct {
q *querybuilder.Selection
c graphql.Client
}
type ContainerBuildOpts struct {
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 3,588 |
Directory: rename `withCopiedFile` to `withFile`
|
See https://github.com/dagger/dagger/issues/3567#issuecomment-1294368392
|
https://github.com/dagger/dagger/issues/3588
|
https://github.com/dagger/dagger/pull/3590
|
530446113eeeeffb2aa0388641ba30d9a1435158
|
027d0c09d20c3900da341686699b4da3525034d7
| 2022-10-28T20:36:31Z |
go
| 2022-11-01T20:14:00Z |
sdk/go/api.gen.go
|
Dockerfile string
}
func (r *Container) Build(context DirectoryID, opts ...ContainerBuildOpts) *Container {
q := r.q.Select("build")
q = q.Arg("context", context)
for i := len(opts) - 1; i >= 0; i-- {
if !querybuilder.IsZeroValue(opts[i].Dockerfile) {
q = q.Arg("dockerfile", opts[i].Dockerfile)
break
}
}
return &Container{
q: q,
c: r.c,
}
}
func (r *Container) DefaultArgs(ctx context.Context) ([]string, error) {
q := r.q.Select("defaultArgs")
var response []string
q = q.Bind(&response)
return response, q.Execute(ctx, r.c)
}
func (r *Container) Directory(path string) *Directory {
q := r.q.Select("directory")
q = q.Arg("path", path)
return &Directory{
q: q,
c: r.c,
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 3,588 |
Directory: rename `withCopiedFile` to `withFile`
|
See https://github.com/dagger/dagger/issues/3567#issuecomment-1294368392
|
https://github.com/dagger/dagger/issues/3588
|
https://github.com/dagger/dagger/pull/3590
|
530446113eeeeffb2aa0388641ba30d9a1435158
|
027d0c09d20c3900da341686699b4da3525034d7
| 2022-10-28T20:36:31Z |
go
| 2022-11-01T20:14:00Z |
sdk/go/api.gen.go
|
}
}
func (r *Container) Entrypoint(ctx context.Context) ([]string, error) {
q := r.q.Select("entrypoint")
var response []string
q = q.Bind(&response)
return response, q.Execute(ctx, r.c)
}
func (r *Container) EnvVariable(ctx context.Context, name string) (string, error) {
q := r.q.Select("envVariable")
q = q.Arg("name", name)
var response string
q = q.Bind(&response)
return response, q.Execute(ctx, r.c)
}
func (r *Container) EnvVariables(ctx context.Context) ([]EnvVariable, error) {
q := r.q.Select("envVariables")
var response []EnvVariable
q = q.Bind(&response)
return response, q.Execute(ctx, r.c)
}
type ContainerExecOpts struct {
Args []string
RedirectStderr string
RedirectStdout string
Stdin string
}
func (r *Container) Exec(opts ...ContainerExecOpts) *Container {
q := r.q.Select("exec")
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 3,588 |
Directory: rename `withCopiedFile` to `withFile`
|
See https://github.com/dagger/dagger/issues/3567#issuecomment-1294368392
|
https://github.com/dagger/dagger/issues/3588
|
https://github.com/dagger/dagger/pull/3590
|
530446113eeeeffb2aa0388641ba30d9a1435158
|
027d0c09d20c3900da341686699b4da3525034d7
| 2022-10-28T20:36:31Z |
go
| 2022-11-01T20:14:00Z |
sdk/go/api.gen.go
|
for i := len(opts) - 1; i >= 0; i-- {
if !querybuilder.IsZeroValue(opts[i].Args) {
q = q.Arg("args", opts[i].Args)
break
}
}
for i := len(opts) - 1; i >= 0; i-- {
if !querybuilder.IsZeroValue(opts[i].RedirectStderr) {
q = q.Arg("redirectStderr", opts[i].RedirectStderr)
break
}
}
for i := len(opts) - 1; i >= 0; i-- {
if !querybuilder.IsZeroValue(opts[i].RedirectStdout) {
q = q.Arg("redirectStdout", opts[i].RedirectStdout)
break
}
}
for i := len(opts) - 1; i >= 0; i-- {
if !querybuilder.IsZeroValue(opts[i].Stdin) {
q = q.Arg("stdin", opts[i].Stdin)
break
}
}
return &Container{
q: q,
c: r.c,
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 3,588 |
Directory: rename `withCopiedFile` to `withFile`
|
See https://github.com/dagger/dagger/issues/3567#issuecomment-1294368392
|
https://github.com/dagger/dagger/issues/3588
|
https://github.com/dagger/dagger/pull/3590
|
530446113eeeeffb2aa0388641ba30d9a1435158
|
027d0c09d20c3900da341686699b4da3525034d7
| 2022-10-28T20:36:31Z |
go
| 2022-11-01T20:14:00Z |
sdk/go/api.gen.go
|
}
}
func (r *Container) ExitCode(ctx context.Context) (int, error) {
q := r.q.Select("exitCode")
var response int
q = q.Bind(&response)
return response, q.Execute(ctx, r.c)
}
func (r *Container) File(path string) *File {
q := r.q.Select("file")
q = q.Arg("path", path)
return &File{
q: q,
c: r.c,
}
}
func (r *Container) From(address string) *Container {
q := r.q.Select("from")
q = q.Arg("address", address)
return &Container{
q: q,
c: r.c,
}
}
func (r *Container) FS() *Directory {
q := r.q.Select("fs")
return &Directory{
q: q,
c: r.c,
}
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 3,588 |
Directory: rename `withCopiedFile` to `withFile`
|
See https://github.com/dagger/dagger/issues/3567#issuecomment-1294368392
|
https://github.com/dagger/dagger/issues/3588
|
https://github.com/dagger/dagger/pull/3590
|
530446113eeeeffb2aa0388641ba30d9a1435158
|
027d0c09d20c3900da341686699b4da3525034d7
| 2022-10-28T20:36:31Z |
go
| 2022-11-01T20:14:00Z |
sdk/go/api.gen.go
|
}
func (r *Container) ID(ctx context.Context) (ContainerID, error) {
q := r.q.Select("id")
var response ContainerID
q = q.Bind(&response)
return response, q.Execute(ctx, r.c)
}
func (r *Container) graphqlType() string {
return "Container"
}
func (r *Container) graphqlMarshal(ctx context.Context) (any, error) {
id, err := r.ID(ctx)
if err != nil {
return nil, err
}
return map[string]any{"id": id}, nil
}
func (r *Container) Mounts(ctx context.Context) ([]string, error) {
q := r.q.Select("mounts")
var response []string
q = q.Bind(&response)
return response, q.Execute(ctx, r.c)
}
func (r *Container) Platform(ctx context.Context) (Platform, error) {
q := r.q.Select("platform")
var response Platform
q = q.Bind(&response)
return response, q.Execute(ctx, r.c)
}
type ContainerPublishOpts struct {
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 3,588 |
Directory: rename `withCopiedFile` to `withFile`
|
See https://github.com/dagger/dagger/issues/3567#issuecomment-1294368392
|
https://github.com/dagger/dagger/issues/3588
|
https://github.com/dagger/dagger/pull/3590
|
530446113eeeeffb2aa0388641ba30d9a1435158
|
027d0c09d20c3900da341686699b4da3525034d7
| 2022-10-28T20:36:31Z |
go
| 2022-11-01T20:14:00Z |
sdk/go/api.gen.go
|
PlatformVariants []ContainerID
}
func (r *Container) Publish(ctx context.Context, address string, opts ...ContainerPublishOpts) (string, error) {
q := r.q.Select("publish")
q = q.Arg("address", address)
for i := len(opts) - 1; i >= 0; i-- {
if !querybuilder.IsZeroValue(opts[i].PlatformVariants) {
q = q.Arg("platformVariants", opts[i].PlatformVariants)
break
}
}
var response string
q = q.Bind(&response)
return response, q.Execute(ctx, r.c)
}
func (r *Container) Stderr() *File {
q := r.q.Select("stderr")
return &File{
q: q,
c: r.c,
}
}
func (r *Container) Stdout() *File {
q := r.q.Select("stdout")
return &File{
q: q,
c: r.c,
}
}
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 3,588 |
Directory: rename `withCopiedFile` to `withFile`
|
See https://github.com/dagger/dagger/issues/3567#issuecomment-1294368392
|
https://github.com/dagger/dagger/issues/3588
|
https://github.com/dagger/dagger/pull/3590
|
530446113eeeeffb2aa0388641ba30d9a1435158
|
027d0c09d20c3900da341686699b4da3525034d7
| 2022-10-28T20:36:31Z |
go
| 2022-11-01T20:14:00Z |
sdk/go/api.gen.go
|
func (r *Container) User(ctx context.Context) (string, error) {
q := r.q.Select("user")
var response string
q = q.Bind(&response)
return response, q.Execute(ctx, r.c)
}
type ContainerWithDefaultArgsOpts struct {
Args []string
}
func (r *Container) WithDefaultArgs(opts ...ContainerWithDefaultArgsOpts) *Container {
q := r.q.Select("withDefaultArgs")
for i := len(opts) - 1; i >= 0; i-- {
if !querybuilder.IsZeroValue(opts[i].Args) {
q = q.Arg("args", opts[i].Args)
break
}
}
return &Container{
q: q,
c: r.c,
}
}
func (r *Container) WithEntrypoint(args []string) *Container {
q := r.q.Select("withEntrypoint")
q = q.Arg("args", args)
return &Container{
q: q,
c: r.c,
}
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 3,588 |
Directory: rename `withCopiedFile` to `withFile`
|
See https://github.com/dagger/dagger/issues/3567#issuecomment-1294368392
|
https://github.com/dagger/dagger/issues/3588
|
https://github.com/dagger/dagger/pull/3590
|
530446113eeeeffb2aa0388641ba30d9a1435158
|
027d0c09d20c3900da341686699b4da3525034d7
| 2022-10-28T20:36:31Z |
go
| 2022-11-01T20:14:00Z |
sdk/go/api.gen.go
|
}
func (r *Container) WithEnvVariable(name string, value string) *Container {
q := r.q.Select("withEnvVariable")
q = q.Arg("name", name)
q = q.Arg("value", value)
return &Container{
q: q,
c: r.c,
}
}
func (r *Container) WithFS(id DirectoryID) *Container {
q := r.q.Select("withFS")
q = q.Arg("id", id)
return &Container{
q: q,
c: r.c,
}
}
type ContainerWithMountedCacheOpts struct {
Source DirectoryID
}
func (r *Container) WithMountedCache(cache CacheID, path string, opts ...ContainerWithMountedCacheOpts) *Container {
q := r.q.Select("withMountedCache")
q = q.Arg("cache", cache)
q = q.Arg("path", path)
for i := len(opts) - 1; i >= 0; i-- {
if !querybuilder.IsZeroValue(opts[i].Source) {
q = q.Arg("source", opts[i].Source)
break
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 3,588 |
Directory: rename `withCopiedFile` to `withFile`
|
See https://github.com/dagger/dagger/issues/3567#issuecomment-1294368392
|
https://github.com/dagger/dagger/issues/3588
|
https://github.com/dagger/dagger/pull/3590
|
530446113eeeeffb2aa0388641ba30d9a1435158
|
027d0c09d20c3900da341686699b4da3525034d7
| 2022-10-28T20:36:31Z |
go
| 2022-11-01T20:14:00Z |
sdk/go/api.gen.go
|
}
}
return &Container{
q: q,
c: r.c,
}
}
func (r *Container) WithMountedDirectory(path string, source DirectoryID) *Container {
q := r.q.Select("withMountedDirectory")
q = q.Arg("path", path)
q = q.Arg("source", source)
return &Container{
q: q,
c: r.c,
}
}
func (r *Container) WithMountedFile(path string, source FileID) *Container {
q := r.q.Select("withMountedFile")
q = q.Arg("path", path)
q = q.Arg("source", source)
return &Container{
q: q,
c: r.c,
}
}
func (r *Container) WithMountedSecret(path string, source SecretID) *Container {
q := r.q.Select("withMountedSecret")
q = q.Arg("path", path)
q = q.Arg("source", source)
return &Container{
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 3,588 |
Directory: rename `withCopiedFile` to `withFile`
|
See https://github.com/dagger/dagger/issues/3567#issuecomment-1294368392
|
https://github.com/dagger/dagger/issues/3588
|
https://github.com/dagger/dagger/pull/3590
|
530446113eeeeffb2aa0388641ba30d9a1435158
|
027d0c09d20c3900da341686699b4da3525034d7
| 2022-10-28T20:36:31Z |
go
| 2022-11-01T20:14:00Z |
sdk/go/api.gen.go
|
q: q,
c: r.c,
}
}
func (r *Container) WithMountedTemp(path string) *Container {
q := r.q.Select("withMountedTemp")
q = q.Arg("path", path)
return &Container{
q: q,
c: r.c,
}
}
func (r *Container) WithSecretVariable(name string, secret SecretID) *Container {
q := r.q.Select("withSecretVariable")
q = q.Arg("name", name)
q = q.Arg("secret", secret)
return &Container{
q: q,
c: r.c,
}
}
func (r *Container) WithUser(name string) *Container {
q := r.q.Select("withUser")
q = q.Arg("name", name)
return &Container{
q: q,
c: r.c,
}
}
func (r *Container) WithWorkdir(path string) *Container {
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 3,588 |
Directory: rename `withCopiedFile` to `withFile`
|
See https://github.com/dagger/dagger/issues/3567#issuecomment-1294368392
|
https://github.com/dagger/dagger/issues/3588
|
https://github.com/dagger/dagger/pull/3590
|
530446113eeeeffb2aa0388641ba30d9a1435158
|
027d0c09d20c3900da341686699b4da3525034d7
| 2022-10-28T20:36:31Z |
go
| 2022-11-01T20:14:00Z |
sdk/go/api.gen.go
|
q := r.q.Select("withWorkdir")
q = q.Arg("path", path)
return &Container{
q: q,
c: r.c,
}
}
func (r *Container) WithoutEnvVariable(name string) *Container {
q := r.q.Select("withoutEnvVariable")
q = q.Arg("name", name)
return &Container{
q: q,
c: r.c,
}
}
func (r *Container) WithoutMount(path string) *Container {
q := r.q.Select("withoutMount")
q = q.Arg("path", path)
return &Container{
q: q,
c: r.c,
}
}
func (r *Container) Workdir(ctx context.Context) (string, error) {
q := r.q.Select("workdir")
var response string
q = q.Bind(&response)
return response, q.Execute(ctx, r.c)
}
type Directory struct {
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 3,588 |
Directory: rename `withCopiedFile` to `withFile`
|
See https://github.com/dagger/dagger/issues/3567#issuecomment-1294368392
|
https://github.com/dagger/dagger/issues/3588
|
https://github.com/dagger/dagger/pull/3590
|
530446113eeeeffb2aa0388641ba30d9a1435158
|
027d0c09d20c3900da341686699b4da3525034d7
| 2022-10-28T20:36:31Z |
go
| 2022-11-01T20:14:00Z |
sdk/go/api.gen.go
|
q *querybuilder.Selection
c graphql.Client
}
func (r *Directory) Diff(other DirectoryID) *Directory {
q := r.q.Select("diff")
q = q.Arg("other", other)
return &Directory{
q: q,
c: r.c,
}
}
func (r *Directory) Directory(path string) *Directory {
q := r.q.Select("directory")
q = q.Arg("path", path)
return &Directory{
q: q,
c: r.c,
}
}
type DirectoryEntriesOpts struct {
Path string
}
func (r *Directory) Entries(ctx context.Context, opts ...DirectoryEntriesOpts) ([]string, error) {
q := r.q.Select("entries")
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 3,588 |
Directory: rename `withCopiedFile` to `withFile`
|
See https://github.com/dagger/dagger/issues/3567#issuecomment-1294368392
|
https://github.com/dagger/dagger/issues/3588
|
https://github.com/dagger/dagger/pull/3590
|
530446113eeeeffb2aa0388641ba30d9a1435158
|
027d0c09d20c3900da341686699b4da3525034d7
| 2022-10-28T20:36:31Z |
go
| 2022-11-01T20:14:00Z |
sdk/go/api.gen.go
|
for i := len(opts) - 1; i >= 0; i-- {
if !querybuilder.IsZeroValue(opts[i].Path) {
q = q.Arg("path", opts[i].Path)
break
}
}
var response []string
q = q.Bind(&response)
return response, q.Execute(ctx, r.c)
}
func (r *Directory) Export(ctx context.Context, path string) (bool, error) {
q := r.q.Select("export")
q = q.Arg("path", path)
var response bool
q = q.Bind(&response)
return response, q.Execute(ctx, r.c)
}
func (r *Directory) File(path string) *File {
q := r.q.Select("file")
q = q.Arg("path", path)
return &File{
q: q,
c: r.c,
}
}
func (r *Directory) ID(ctx context.Context) (DirectoryID, error) {
q := r.q.Select("id")
var response DirectoryID
q = q.Bind(&response)
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 3,588 |
Directory: rename `withCopiedFile` to `withFile`
|
See https://github.com/dagger/dagger/issues/3567#issuecomment-1294368392
|
https://github.com/dagger/dagger/issues/3588
|
https://github.com/dagger/dagger/pull/3590
|
530446113eeeeffb2aa0388641ba30d9a1435158
|
027d0c09d20c3900da341686699b4da3525034d7
| 2022-10-28T20:36:31Z |
go
| 2022-11-01T20:14:00Z |
sdk/go/api.gen.go
|
return response, q.Execute(ctx, r.c)
}
func (r *Directory) graphqlType() string {
return "Directory"
}
func (r *Directory) graphqlMarshal(ctx context.Context) (any, error) {
id, err := r.ID(ctx)
if err != nil {
return nil, err
}
return map[string]any{"id": id}, nil
}
func (r *Directory) LoadProject(configPath string) *Project {
q := r.q.Select("loadProject")
q = q.Arg("configPath", configPath)
return &Project{
q: q,
c: r.c,
}
}
func (r *Directory) WithCopiedFile(path string, source FileID) *Directory {
q := r.q.Select("withCopiedFile")
q = q.Arg("path", path)
q = q.Arg("source", source)
return &Directory{
q: q,
c: r.c,
}
}
type DirectoryWithDirectoryOpts struct {
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 3,588 |
Directory: rename `withCopiedFile` to `withFile`
|
See https://github.com/dagger/dagger/issues/3567#issuecomment-1294368392
|
https://github.com/dagger/dagger/issues/3588
|
https://github.com/dagger/dagger/pull/3590
|
530446113eeeeffb2aa0388641ba30d9a1435158
|
027d0c09d20c3900da341686699b4da3525034d7
| 2022-10-28T20:36:31Z |
go
| 2022-11-01T20:14:00Z |
sdk/go/api.gen.go
|
Exclude []string
Include []string
}
func (r *Directory) WithDirectory(directory DirectoryID, path string, opts ...DirectoryWithDirectoryOpts) *Directory {
q := r.q.Select("withDirectory")
q = q.Arg("directory", directory)
for i := len(opts) - 1; i >= 0; i-- {
if !querybuilder.IsZeroValue(opts[i].Exclude) {
q = q.Arg("exclude", opts[i].Exclude)
break
}
}
for i := len(opts) - 1; i >= 0; i-- {
if !querybuilder.IsZeroValue(opts[i].Include) {
q = q.Arg("include", opts[i].Include)
break
}
}
q = q.Arg("path", path)
return &Directory{
q: q,
c: r.c,
}
}
type DirectoryWithNewFileOpts struct {
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 3,588 |
Directory: rename `withCopiedFile` to `withFile`
|
See https://github.com/dagger/dagger/issues/3567#issuecomment-1294368392
|
https://github.com/dagger/dagger/issues/3588
|
https://github.com/dagger/dagger/pull/3590
|
530446113eeeeffb2aa0388641ba30d9a1435158
|
027d0c09d20c3900da341686699b4da3525034d7
| 2022-10-28T20:36:31Z |
go
| 2022-11-01T20:14:00Z |
sdk/go/api.gen.go
|
Contents string
}
func (r *Directory) WithNewFile(path string, opts ...DirectoryWithNewFileOpts) *Directory {
q := r.q.Select("withNewFile")
for i := len(opts) - 1; i >= 0; i-- {
if !querybuilder.IsZeroValue(opts[i].Contents) {
q = q.Arg("contents", opts[i].Contents)
break
}
}
q = q.Arg("path", path)
return &Directory{
q: q,
c: r.c,
}
}
func (r *Directory) WithoutDirectory(path string) *Directory {
q := r.q.Select("withoutDirectory")
q = q.Arg("path", path)
return &Directory{
q: q,
c: r.c,
}
}
func (r *Directory) WithoutFile(path string) *Directory {
q := r.q.Select("withoutFile")
q = q.Arg("path", path)
return &Directory{
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 3,588 |
Directory: rename `withCopiedFile` to `withFile`
|
See https://github.com/dagger/dagger/issues/3567#issuecomment-1294368392
|
https://github.com/dagger/dagger/issues/3588
|
https://github.com/dagger/dagger/pull/3590
|
530446113eeeeffb2aa0388641ba30d9a1435158
|
027d0c09d20c3900da341686699b4da3525034d7
| 2022-10-28T20:36:31Z |
go
| 2022-11-01T20:14:00Z |
sdk/go/api.gen.go
|
q: q,
c: r.c,
}
}
type EnvVariable struct {
q *querybuilder.Selection
c graphql.Client
}
func (r *EnvVariable) Name(ctx context.Context) (string, error) {
q := r.q.Select("name")
var response string
q = q.Bind(&response)
return response, q.Execute(ctx, r.c)
}
func (r *EnvVariable) Value(ctx context.Context) (string, error) {
q := r.q.Select("value")
var response string
q = q.Bind(&response)
return response, q.Execute(ctx, r.c)
}
type File struct {
q *querybuilder.Selection
c graphql.Client
}
func (r *File) Contents(ctx context.Context) (string, error) {
q := r.q.Select("contents")
var response string
q = q.Bind(&response)
return response, q.Execute(ctx, r.c)
}
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 3,588 |
Directory: rename `withCopiedFile` to `withFile`
|
See https://github.com/dagger/dagger/issues/3567#issuecomment-1294368392
|
https://github.com/dagger/dagger/issues/3588
|
https://github.com/dagger/dagger/pull/3590
|
530446113eeeeffb2aa0388641ba30d9a1435158
|
027d0c09d20c3900da341686699b4da3525034d7
| 2022-10-28T20:36:31Z |
go
| 2022-11-01T20:14:00Z |
sdk/go/api.gen.go
|
func (r *File) ID(ctx context.Context) (FileID, error) {
q := r.q.Select("id")
var response FileID
q = q.Bind(&response)
return response, q.Execute(ctx, r.c)
}
func (r *File) graphqlType() string {
return "File"
}
func (r *File) graphqlMarshal(ctx context.Context) (any, error) {
id, err := r.ID(ctx)
if err != nil {
return nil, err
}
return map[string]any{"id": id}, nil
}
func (r *File) Secret() *Secret {
q := r.q.Select("secret")
return &Secret{
q: q,
c: r.c,
}
}
func (r *File) Size(ctx context.Context) (int, error) {
q := r.q.Select("size")
var response int
q = q.Bind(&response)
return response, q.Execute(ctx, r.c)
}
type GitRef struct {
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 3,588 |
Directory: rename `withCopiedFile` to `withFile`
|
See https://github.com/dagger/dagger/issues/3567#issuecomment-1294368392
|
https://github.com/dagger/dagger/issues/3588
|
https://github.com/dagger/dagger/pull/3590
|
530446113eeeeffb2aa0388641ba30d9a1435158
|
027d0c09d20c3900da341686699b4da3525034d7
| 2022-10-28T20:36:31Z |
go
| 2022-11-01T20:14:00Z |
sdk/go/api.gen.go
|
q *querybuilder.Selection
c graphql.Client
}
func (r *GitRef) Digest(ctx context.Context) (string, error) {
q := r.q.Select("digest")
var response string
q = q.Bind(&response)
return response, q.Execute(ctx, r.c)
}
func (r *GitRef) Tree() *Directory {
q := r.q.Select("tree")
return &Directory{
q: q,
c: r.c,
}
}
type GitRepository struct {
q *querybuilder.Selection
c graphql.Client
}
func (r *GitRepository) Branch(name string) *GitRef {
q := r.q.Select("branch")
q = q.Arg("name", name)
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 3,588 |
Directory: rename `withCopiedFile` to `withFile`
|
See https://github.com/dagger/dagger/issues/3567#issuecomment-1294368392
|
https://github.com/dagger/dagger/issues/3588
|
https://github.com/dagger/dagger/pull/3590
|
530446113eeeeffb2aa0388641ba30d9a1435158
|
027d0c09d20c3900da341686699b4da3525034d7
| 2022-10-28T20:36:31Z |
go
| 2022-11-01T20:14:00Z |
sdk/go/api.gen.go
|
return &GitRef{
q: q,
c: r.c,
}
}
func (r *GitRepository) Branches(ctx context.Context) ([]string, error) {
q := r.q.Select("branches")
var response []string
q = q.Bind(&response)
return response, q.Execute(ctx, r.c)
}
func (r *GitRepository) Tag(name string) *GitRef {
q := r.q.Select("tag")
q = q.Arg("name", name)
return &GitRef{
q: q,
c: r.c,
}
}
func (r *GitRepository) Tags(ctx context.Context) ([]string, error) {
q := r.q.Select("tags")
var response []string
q = q.Bind(&response)
return response, q.Execute(ctx, r.c)
}
type Host struct {
q *querybuilder.Selection
c graphql.Client
}
type HostDirectoryOpts struct {
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 3,588 |
Directory: rename `withCopiedFile` to `withFile`
|
See https://github.com/dagger/dagger/issues/3567#issuecomment-1294368392
|
https://github.com/dagger/dagger/issues/3588
|
https://github.com/dagger/dagger/pull/3590
|
530446113eeeeffb2aa0388641ba30d9a1435158
|
027d0c09d20c3900da341686699b4da3525034d7
| 2022-10-28T20:36:31Z |
go
| 2022-11-01T20:14:00Z |
sdk/go/api.gen.go
|
Exclude []string
Include []string
}
func (r *Host) Directory(path string, opts ...HostDirectoryOpts) *Directory {
q := r.q.Select("directory")
for i := len(opts) - 1; i >= 0; i-- {
if !querybuilder.IsZeroValue(opts[i].Exclude) {
q = q.Arg("exclude", opts[i].Exclude)
break
}
}
for i := len(opts) - 1; i >= 0; i-- {
if !querybuilder.IsZeroValue(opts[i].Include) {
q = q.Arg("include", opts[i].Include)
break
}
}
q = q.Arg("path", path)
return &Directory{
q: q,
c: r.c,
}
}
func (r *Host) EnvVariable(name string) *HostVariable {
q := r.q.Select("envVariable")
q = q.Arg("name", name)
return &HostVariable{
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 3,588 |
Directory: rename `withCopiedFile` to `withFile`
|
See https://github.com/dagger/dagger/issues/3567#issuecomment-1294368392
|
https://github.com/dagger/dagger/issues/3588
|
https://github.com/dagger/dagger/pull/3590
|
530446113eeeeffb2aa0388641ba30d9a1435158
|
027d0c09d20c3900da341686699b4da3525034d7
| 2022-10-28T20:36:31Z |
go
| 2022-11-01T20:14:00Z |
sdk/go/api.gen.go
|
q: q,
c: r.c,
}
}
type HostWorkdirOpts struct {
Exclude []string
Include []string
}
func (r *Host) Workdir(opts ...HostWorkdirOpts) *Directory {
q := r.q.Select("workdir")
for i := len(opts) - 1; i >= 0; i-- {
if !querybuilder.IsZeroValue(opts[i].Exclude) {
q = q.Arg("exclude", opts[i].Exclude)
break
}
}
for i := len(opts) - 1; i >= 0; i-- {
if !querybuilder.IsZeroValue(opts[i].Include) {
q = q.Arg("include", opts[i].Include)
break
}
}
return &Directory{
q: q,
c: r.c,
}
}
type HostVariable struct {
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 3,588 |
Directory: rename `withCopiedFile` to `withFile`
|
See https://github.com/dagger/dagger/issues/3567#issuecomment-1294368392
|
https://github.com/dagger/dagger/issues/3588
|
https://github.com/dagger/dagger/pull/3590
|
530446113eeeeffb2aa0388641ba30d9a1435158
|
027d0c09d20c3900da341686699b4da3525034d7
| 2022-10-28T20:36:31Z |
go
| 2022-11-01T20:14:00Z |
sdk/go/api.gen.go
|
q *querybuilder.Selection
c graphql.Client
}
func (r *HostVariable) Secret() *Secret {
q := r.q.Select("secret")
return &Secret{
q: q,
c: r.c,
}
}
func (r *HostVariable) Value(ctx context.Context) (string, error) {
q := r.q.Select("value")
var response string
q = q.Bind(&response)
return response, q.Execute(ctx, r.c)
}
type Project struct {
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 3,588 |
Directory: rename `withCopiedFile` to `withFile`
|
See https://github.com/dagger/dagger/issues/3567#issuecomment-1294368392
|
https://github.com/dagger/dagger/issues/3588
|
https://github.com/dagger/dagger/pull/3590
|
530446113eeeeffb2aa0388641ba30d9a1435158
|
027d0c09d20c3900da341686699b4da3525034d7
| 2022-10-28T20:36:31Z |
go
| 2022-11-01T20:14:00Z |
sdk/go/api.gen.go
|
q *querybuilder.Selection
c graphql.Client
}
func (r *Project) Extensions(ctx context.Context) ([]Project, error) {
q := r.q.Select("extensions")
var response []Project
q = q.Bind(&response)
return response, q.Execute(ctx, r.c)
}
func (r *Project) GeneratedCode() *Directory {
q := r.q.Select("generatedCode")
return &Directory{
q: q,
c: r.c,
}
}
func (r *Project) Install(ctx context.Context) (bool, error) {
q := r.q.Select("install")
var response bool
q = q.Bind(&response)
return response, q.Execute(ctx, r.c)
}
func (r *Project) Name(ctx context.Context) (string, error) {
q := r.q.Select("name")
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 3,588 |
Directory: rename `withCopiedFile` to `withFile`
|
See https://github.com/dagger/dagger/issues/3567#issuecomment-1294368392
|
https://github.com/dagger/dagger/issues/3588
|
https://github.com/dagger/dagger/pull/3590
|
530446113eeeeffb2aa0388641ba30d9a1435158
|
027d0c09d20c3900da341686699b4da3525034d7
| 2022-10-28T20:36:31Z |
go
| 2022-11-01T20:14:00Z |
sdk/go/api.gen.go
|
var response string
q = q.Bind(&response)
return response, q.Execute(ctx, r.c)
}
func (r *Project) Schema(ctx context.Context) (string, error) {
q := r.q.Select("schema")
var response string
q = q.Bind(&response)
return response, q.Execute(ctx, r.c)
}
func (r *Project) SDK(ctx context.Context) (string, error) {
q := r.q.Select("sdk")
var response string
q = q.Bind(&response)
return response, q.Execute(ctx, r.c)
}
type Query struct {
q *querybuilder.Selection
c graphql.Client
}
func (r *Query) CacheVolume(key string) *CacheVolume {
q := r.q.Select("cacheVolume")
q = q.Arg("key", key)
return &CacheVolume{
q: q,
c: r.c,
}
}
type ContainerOpts struct {
ID ContainerID
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 3,588 |
Directory: rename `withCopiedFile` to `withFile`
|
See https://github.com/dagger/dagger/issues/3567#issuecomment-1294368392
|
https://github.com/dagger/dagger/issues/3588
|
https://github.com/dagger/dagger/pull/3590
|
530446113eeeeffb2aa0388641ba30d9a1435158
|
027d0c09d20c3900da341686699b4da3525034d7
| 2022-10-28T20:36:31Z |
go
| 2022-11-01T20:14:00Z |
sdk/go/api.gen.go
|
Platform Platform
}
func (r *Query) Container(opts ...ContainerOpts) *Container {
q := r.q.Select("container")
for i := len(opts) - 1; i >= 0; i-- {
if !querybuilder.IsZeroValue(opts[i].ID) {
q = q.Arg("id", opts[i].ID)
break
}
}
for i := len(opts) - 1; i >= 0; i-- {
if !querybuilder.IsZeroValue(opts[i].Platform) {
q = q.Arg("platform", opts[i].Platform)
break
}
}
return &Container{
q: q,
c: r.c,
}
}
func (r *Query) DefaultPlatform(ctx context.Context) (Platform, error) {
q := r.q.Select("defaultPlatform")
var response Platform
q = q.Bind(&response)
return response, q.Execute(ctx, r.c)
}
type DirectoryOpts struct {
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 3,588 |
Directory: rename `withCopiedFile` to `withFile`
|
See https://github.com/dagger/dagger/issues/3567#issuecomment-1294368392
|
https://github.com/dagger/dagger/issues/3588
|
https://github.com/dagger/dagger/pull/3590
|
530446113eeeeffb2aa0388641ba30d9a1435158
|
027d0c09d20c3900da341686699b4da3525034d7
| 2022-10-28T20:36:31Z |
go
| 2022-11-01T20:14:00Z |
sdk/go/api.gen.go
|
ID DirectoryID
}
func (r *Query) Directory(opts ...DirectoryOpts) *Directory {
q := r.q.Select("directory")
for i := len(opts) - 1; i >= 0; i-- {
if !querybuilder.IsZeroValue(opts[i].ID) {
q = q.Arg("id", opts[i].ID)
break
}
}
return &Directory{
q: q,
c: r.c,
}
}
func (r *Query) File(id FileID) *File {
q := r.q.Select("file")
q = q.Arg("id", id)
return &File{
q: q,
c: r.c,
}
}
func (r *Query) Git(url string) *GitRepository {
q := r.q.Select("git")
q = q.Arg("url", url)
return &GitRepository{
q: q,
c: r.c,
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 3,588 |
Directory: rename `withCopiedFile` to `withFile`
|
See https://github.com/dagger/dagger/issues/3567#issuecomment-1294368392
|
https://github.com/dagger/dagger/issues/3588
|
https://github.com/dagger/dagger/pull/3590
|
530446113eeeeffb2aa0388641ba30d9a1435158
|
027d0c09d20c3900da341686699b4da3525034d7
| 2022-10-28T20:36:31Z |
go
| 2022-11-01T20:14:00Z |
sdk/go/api.gen.go
|
}
}
func (r *Query) Host() *Host {
q := r.q.Select("host")
return &Host{
q: q,
c: r.c,
}
}
func (r *Query) HTTP(url string) *File {
q := r.q.Select("http")
q = q.Arg("url", url)
return &File{
q: q,
c: r.c,
}
}
func (r *Query) Project(name string) *Project {
q := r.q.Select("project")
q = q.Arg("name", name)
return &Project{
q: q,
c: r.c,
}
}
func (r *Query) Secret(id SecretID) *Secret {
q := r.q.Select("secret")
q = q.Arg("id", id)
return &Secret{
q: q,
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 3,588 |
Directory: rename `withCopiedFile` to `withFile`
|
See https://github.com/dagger/dagger/issues/3567#issuecomment-1294368392
|
https://github.com/dagger/dagger/issues/3588
|
https://github.com/dagger/dagger/pull/3590
|
530446113eeeeffb2aa0388641ba30d9a1435158
|
027d0c09d20c3900da341686699b4da3525034d7
| 2022-10-28T20:36:31Z |
go
| 2022-11-01T20:14:00Z |
sdk/go/api.gen.go
|
c: r.c,
}
}
type Secret struct {
q *querybuilder.Selection
c graphql.Client
}
func (r *Secret) ID(ctx context.Context) (SecretID, error) {
q := r.q.Select("id")
var response SecretID
q = q.Bind(&response)
return response, q.Execute(ctx, r.c)
}
func (r *Secret) graphqlType() string {
return "Secret"
}
func (r *Secret) graphqlMarshal(ctx context.Context) (any, error) {
id, err := r.ID(ctx)
if err != nil {
return nil, err
}
return map[string]any{"id": id}, nil
}
func (r *Secret) Plaintext(ctx context.Context) (string, error) {
q := r.q.Select("plaintext")
var response string
q = q.Bind(&response)
return response, q.Execute(ctx, r.c)
}
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 3,567 |
Directory: add `withNewDirectory` for creating an empty dir
|
New naming scheme for copying files/dirs vs creating files/dirs: https://github.com/dagger/dagger/issues/3567#issuecomment-1294368392
> * `withDirectory`, `withFile`: copy a directory/file (source always required)
>
> * `withNewDirectory`, `withNewFile`: create a new directory/file
This issue is for adding `withNewDirectory` since `withNewFile` already exists.
|
https://github.com/dagger/dagger/issues/3567
|
https://github.com/dagger/dagger/pull/3590
|
530446113eeeeffb2aa0388641ba30d9a1435158
|
027d0c09d20c3900da341686699b4da3525034d7
| 2022-10-26T22:43:16Z |
go
| 2022-11-01T20:14:00Z |
core/directory.go
|
package core
import (
"context"
"fmt"
"path"
"reflect"
bkclient "github.com/moby/buildkit/client"
"github.com/moby/buildkit/client/llb"
bkgw "github.com/moby/buildkit/frontend/gateway/client"
"github.com/moby/buildkit/solver/pb"
specs "github.com/opencontainers/image-spec/specs-go/v1"
fstypes "github.com/tonistiigi/fsutil/types"
)
type Directory struct {
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 3,567 |
Directory: add `withNewDirectory` for creating an empty dir
|
New naming scheme for copying files/dirs vs creating files/dirs: https://github.com/dagger/dagger/issues/3567#issuecomment-1294368392
> * `withDirectory`, `withFile`: copy a directory/file (source always required)
>
> * `withNewDirectory`, `withNewFile`: create a new directory/file
This issue is for adding `withNewDirectory` since `withNewFile` already exists.
|
https://github.com/dagger/dagger/issues/3567
|
https://github.com/dagger/dagger/pull/3590
|
530446113eeeeffb2aa0388641ba30d9a1435158
|
027d0c09d20c3900da341686699b4da3525034d7
| 2022-10-26T22:43:16Z |
go
| 2022-11-01T20:14:00Z |
core/directory.go
|
ID DirectoryID `json:"id"`
}
type DirectoryID string
type directoryIDPayload struct {
LLB *pb.Definition `json:"llb"`
Dir string `json:"dir"`
Platform specs.Platform `json:"platform"`
}
func (id DirectoryID) Decode() (*directoryIDPayload, error) {
if id == "" {
return &directoryIDPayload{}, nil
}
var payload directoryIDPayload
if err := decodeID(&payload, id); err != nil {
return nil, err
}
return &payload, nil
}
func (payload *directoryIDPayload) State() (llb.State, error) {
if payload.LLB == nil {
return llb.Scratch(), nil
}
return defToState(payload.LLB)
}
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 3,567 |
Directory: add `withNewDirectory` for creating an empty dir
|
New naming scheme for copying files/dirs vs creating files/dirs: https://github.com/dagger/dagger/issues/3567#issuecomment-1294368392
> * `withDirectory`, `withFile`: copy a directory/file (source always required)
>
> * `withNewDirectory`, `withNewFile`: create a new directory/file
This issue is for adding `withNewDirectory` since `withNewFile` already exists.
|
https://github.com/dagger/dagger/issues/3567
|
https://github.com/dagger/dagger/pull/3590
|
530446113eeeeffb2aa0388641ba30d9a1435158
|
027d0c09d20c3900da341686699b4da3525034d7
| 2022-10-26T22:43:16Z |
go
| 2022-11-01T20:14:00Z |
core/directory.go
|
func (payload *directoryIDPayload) SetState(ctx context.Context, st llb.State) error {
def, err := st.Marshal(ctx, llb.Platform(payload.Platform))
if err != nil {
return nil
}
payload.LLB = def.ToPB()
return nil
}
func (payload *directoryIDPayload) ToDirectory() (*Directory, error) {
id, err := encodeID(payload)
if err != nil {
return nil, err
}
return &Directory{
ID: DirectoryID(id),
}, nil
}
func NewDirectory(ctx context.Context, st llb.State, cwd string, platform specs.Platform) (*Directory, error) {
payload := directoryIDPayload{
Dir: cwd,
Platform: platform,
}
def, err := st.Marshal(ctx, llb.Platform(platform))
if err != nil {
return nil, err
}
payload.LLB = def.ToPB()
return payload.ToDirectory()
}
func (dir *Directory) Stat(ctx context.Context, gw bkgw.Client, src string) (*fstypes.Stat, error) {
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 3,567 |
Directory: add `withNewDirectory` for creating an empty dir
|
New naming scheme for copying files/dirs vs creating files/dirs: https://github.com/dagger/dagger/issues/3567#issuecomment-1294368392
> * `withDirectory`, `withFile`: copy a directory/file (source always required)
>
> * `withNewDirectory`, `withNewFile`: create a new directory/file
This issue is for adding `withNewDirectory` since `withNewFile` already exists.
|
https://github.com/dagger/dagger/issues/3567
|
https://github.com/dagger/dagger/pull/3590
|
530446113eeeeffb2aa0388641ba30d9a1435158
|
027d0c09d20c3900da341686699b4da3525034d7
| 2022-10-26T22:43:16Z |
go
| 2022-11-01T20:14:00Z |
core/directory.go
|
payload, err := dir.ID.Decode()
if err != nil {
return nil, err
}
src = path.Join(payload.Dir, src)
if payload.LLB == nil {
if path.Clean(src) == "." {
return &fstypes.Stat{Path: src}, nil
}
return nil, fmt.Errorf("%s: no such file or directory", src)
}
res, err := gw.Solve(ctx, bkgw.SolveRequest{
Definition: payload.LLB,
})
if err != nil {
return nil, err
}
ref, err := res.SingleRef()
if err != nil {
return nil, err
}
stat, err := ref.StatFile(ctx, bkgw.StatRequest{
Path: src,
})
if err != nil {
return nil, err
}
return stat, nil
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 3,567 |
Directory: add `withNewDirectory` for creating an empty dir
|
New naming scheme for copying files/dirs vs creating files/dirs: https://github.com/dagger/dagger/issues/3567#issuecomment-1294368392
> * `withDirectory`, `withFile`: copy a directory/file (source always required)
>
> * `withNewDirectory`, `withNewFile`: create a new directory/file
This issue is for adding `withNewDirectory` since `withNewFile` already exists.
|
https://github.com/dagger/dagger/issues/3567
|
https://github.com/dagger/dagger/pull/3590
|
530446113eeeeffb2aa0388641ba30d9a1435158
|
027d0c09d20c3900da341686699b4da3525034d7
| 2022-10-26T22:43:16Z |
go
| 2022-11-01T20:14:00Z |
core/directory.go
|
}
func (dir *Directory) Entries(ctx context.Context, gw bkgw.Client, src string) ([]string, error) {
payload, err := dir.ID.Decode()
if err != nil {
return nil, err
}
src = path.Join(payload.Dir, src)
if payload.LLB == nil {
if path.Clean(src) == "." {
return []string{}, nil
}
return nil, fmt.Errorf("%s: no such file or directory", src)
}
res, err := gw.Solve(ctx, bkgw.SolveRequest{
Definition: payload.LLB,
})
if err != nil {
return nil, err
}
ref, err := res.SingleRef()
if err != nil {
return nil, err
}
entries, err := ref.ReadDir(ctx, bkgw.ReadDirRequest{
Path: src,
})
if err != nil {
return nil, err
}
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 3,567 |
Directory: add `withNewDirectory` for creating an empty dir
|
New naming scheme for copying files/dirs vs creating files/dirs: https://github.com/dagger/dagger/issues/3567#issuecomment-1294368392
> * `withDirectory`, `withFile`: copy a directory/file (source always required)
>
> * `withNewDirectory`, `withNewFile`: create a new directory/file
This issue is for adding `withNewDirectory` since `withNewFile` already exists.
|
https://github.com/dagger/dagger/issues/3567
|
https://github.com/dagger/dagger/pull/3590
|
530446113eeeeffb2aa0388641ba30d9a1435158
|
027d0c09d20c3900da341686699b4da3525034d7
| 2022-10-26T22:43:16Z |
go
| 2022-11-01T20:14:00Z |
core/directory.go
|
paths := []string{}
for _, entry := range entries {
paths = append(paths, entry.GetPath())
}
return paths, nil
}
func (dir *Directory) WithNewFile(ctx context.Context, gw bkgw.Client, dest string, content []byte) (*Directory, error) {
payload, err := dir.ID.Decode()
if err != nil {
return nil, err
}
dest = path.Join(payload.Dir, dest)
st, err := payload.State()
if err != nil {
return nil, err
}
parent, _ := path.Split(dest)
if parent != "" {
st = st.File(llb.Mkdir(parent, 0755, llb.WithParents(true)))
}
st = st.File(
llb.Mkfile(
dest,
0644,
content,
),
)
err = payload.SetState(ctx, st)
if err != nil {
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 3,567 |
Directory: add `withNewDirectory` for creating an empty dir
|
New naming scheme for copying files/dirs vs creating files/dirs: https://github.com/dagger/dagger/issues/3567#issuecomment-1294368392
> * `withDirectory`, `withFile`: copy a directory/file (source always required)
>
> * `withNewDirectory`, `withNewFile`: create a new directory/file
This issue is for adding `withNewDirectory` since `withNewFile` already exists.
|
https://github.com/dagger/dagger/issues/3567
|
https://github.com/dagger/dagger/pull/3590
|
530446113eeeeffb2aa0388641ba30d9a1435158
|
027d0c09d20c3900da341686699b4da3525034d7
| 2022-10-26T22:43:16Z |
go
| 2022-11-01T20:14:00Z |
core/directory.go
|
return nil, err
}
return payload.ToDirectory()
}
func (dir *Directory) Directory(ctx context.Context, subdir string) (*Directory, error) {
payload, err := dir.ID.Decode()
if err != nil {
return nil, err
}
payload.Dir = path.Join(payload.Dir, subdir)
return payload.ToDirectory()
}
func (dir *Directory) File(ctx context.Context, file string) (*File, error) {
payload, err := dir.ID.Decode()
if err != nil {
return nil, err
}
return (&fileIDPayload{
LLB: payload.LLB,
File: path.Join(payload.Dir, file),
Platform: payload.Platform,
}).ToFile()
}
func (dir *Directory) WithDirectory(ctx context.Context, subdir string, src *Directory, filter CopyFilter) (*Directory, error) {
destPayload, err := dir.ID.Decode()
if err != nil {
return nil, err
}
srcPayload, err := src.ID.Decode()
if err != nil {
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 3,567 |
Directory: add `withNewDirectory` for creating an empty dir
|
New naming scheme for copying files/dirs vs creating files/dirs: https://github.com/dagger/dagger/issues/3567#issuecomment-1294368392
> * `withDirectory`, `withFile`: copy a directory/file (source always required)
>
> * `withNewDirectory`, `withNewFile`: create a new directory/file
This issue is for adding `withNewDirectory` since `withNewFile` already exists.
|
https://github.com/dagger/dagger/issues/3567
|
https://github.com/dagger/dagger/pull/3590
|
530446113eeeeffb2aa0388641ba30d9a1435158
|
027d0c09d20c3900da341686699b4da3525034d7
| 2022-10-26T22:43:16Z |
go
| 2022-11-01T20:14:00Z |
core/directory.go
|
return nil, err
}
st, err := destPayload.State()
if err != nil {
return nil, err
}
srcSt, err := srcPayload.State()
if err != nil {
return nil, err
}
st = st.File(llb.Copy(srcSt, srcPayload.Dir, path.Join(destPayload.Dir, subdir), &llb.CopyInfo{
CreateDestPath: true,
CopyDirContentsOnly: true,
IncludePatterns: filter.Include,
ExcludePatterns: filter.Exclude,
}))
err = destPayload.SetState(ctx, st)
if err != nil {
return nil, err
}
return destPayload.ToDirectory()
}
func (dir *Directory) WithCopiedFile(ctx context.Context, subdir string, src *File) (*Directory, error) {
destPayload, err := dir.ID.Decode()
if err != nil {
return nil, err
}
srcPayload, err := src.ID.decode()
if err != nil {
return nil, err
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 3,567 |
Directory: add `withNewDirectory` for creating an empty dir
|
New naming scheme for copying files/dirs vs creating files/dirs: https://github.com/dagger/dagger/issues/3567#issuecomment-1294368392
> * `withDirectory`, `withFile`: copy a directory/file (source always required)
>
> * `withNewDirectory`, `withNewFile`: create a new directory/file
This issue is for adding `withNewDirectory` since `withNewFile` already exists.
|
https://github.com/dagger/dagger/issues/3567
|
https://github.com/dagger/dagger/pull/3590
|
530446113eeeeffb2aa0388641ba30d9a1435158
|
027d0c09d20c3900da341686699b4da3525034d7
| 2022-10-26T22:43:16Z |
go
| 2022-11-01T20:14:00Z |
core/directory.go
|
}
st, err := destPayload.State()
if err != nil {
return nil, err
}
srcSt, err := srcPayload.State()
if err != nil {
return nil, err
}
st = st.File(llb.Copy(srcSt, srcPayload.File, path.Join(destPayload.Dir, subdir), &llb.CopyInfo{
CreateDestPath: true,
}))
err = destPayload.SetState(ctx, st)
if err != nil {
return nil, err
}
return destPayload.ToDirectory()
}
func MergeDirectories(ctx context.Context, dirs []*Directory, platform specs.Platform) (*Directory, error) {
states := make([]llb.State, 0, len(dirs))
for _, fs := range dirs {
payload, err := fs.ID.Decode()
if err != nil {
return nil, err
}
if !reflect.DeepEqual(platform, payload.Platform) {
return nil, fmt.Errorf("TODO: cannot merge across platforms: %+v != %+v", platform, payload.Platform)
}
state, err := payload.State()
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 3,567 |
Directory: add `withNewDirectory` for creating an empty dir
|
New naming scheme for copying files/dirs vs creating files/dirs: https://github.com/dagger/dagger/issues/3567#issuecomment-1294368392
> * `withDirectory`, `withFile`: copy a directory/file (source always required)
>
> * `withNewDirectory`, `withNewFile`: create a new directory/file
This issue is for adding `withNewDirectory` since `withNewFile` already exists.
|
https://github.com/dagger/dagger/issues/3567
|
https://github.com/dagger/dagger/pull/3590
|
530446113eeeeffb2aa0388641ba30d9a1435158
|
027d0c09d20c3900da341686699b4da3525034d7
| 2022-10-26T22:43:16Z |
go
| 2022-11-01T20:14:00Z |
core/directory.go
|
if err != nil {
return nil, err
}
states = append(states, state)
}
return NewDirectory(ctx, llb.Merge(states), "", platform)
}
func (dir *Directory) Diff(ctx context.Context, other *Directory) (*Directory, error) {
lowerPayload, err := dir.ID.Decode()
if err != nil {
return nil, err
}
upperPayload, err := other.ID.Decode()
if err != nil {
return nil, err
}
if lowerPayload.Dir != upperPayload.Dir {
return nil, fmt.Errorf("TODO: cannot diff with different relative paths: %q != %q", lowerPayload.Dir, upperPayload.Dir)
}
if !reflect.DeepEqual(lowerPayload.Platform, upperPayload.Platform) {
return nil, fmt.Errorf("TODO: cannot diff across platforms: %+v != %+v", lowerPayload.Platform, upperPayload.Platform)
}
lowerSt, err := lowerPayload.State()
if err != nil {
return nil, err
}
upperSt, err := upperPayload.State()
if err != nil {
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 3,567 |
Directory: add `withNewDirectory` for creating an empty dir
|
New naming scheme for copying files/dirs vs creating files/dirs: https://github.com/dagger/dagger/issues/3567#issuecomment-1294368392
> * `withDirectory`, `withFile`: copy a directory/file (source always required)
>
> * `withNewDirectory`, `withNewFile`: create a new directory/file
This issue is for adding `withNewDirectory` since `withNewFile` already exists.
|
https://github.com/dagger/dagger/issues/3567
|
https://github.com/dagger/dagger/pull/3590
|
530446113eeeeffb2aa0388641ba30d9a1435158
|
027d0c09d20c3900da341686699b4da3525034d7
| 2022-10-26T22:43:16Z |
go
| 2022-11-01T20:14:00Z |
core/directory.go
|
return nil, err
}
err = lowerPayload.SetState(ctx, llb.Diff(lowerSt, upperSt))
if err != nil {
return nil, err
}
return lowerPayload.ToDirectory()
}
func (dir *Directory) Without(ctx context.Context, path string) (*Directory, error) {
payload, err := dir.ID.Decode()
if err != nil {
return nil, err
}
st, err := payload.State()
if err != nil {
return nil, err
}
err = payload.SetState(ctx, st.File(llb.Rm(path)))
if err != nil {
return nil, err
}
return payload.ToDirectory()
}
func (dir *Directory) Export(
ctx context.Context,
host *Host,
dest string,
bkClient *bkclient.Client,
solveOpts bkclient.SolveOpt,
solveCh chan<- *bkclient.SolveStatus,
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 3,567 |
Directory: add `withNewDirectory` for creating an empty dir
|
New naming scheme for copying files/dirs vs creating files/dirs: https://github.com/dagger/dagger/issues/3567#issuecomment-1294368392
> * `withDirectory`, `withFile`: copy a directory/file (source always required)
>
> * `withNewDirectory`, `withNewFile`: create a new directory/file
This issue is for adding `withNewDirectory` since `withNewFile` already exists.
|
https://github.com/dagger/dagger/issues/3567
|
https://github.com/dagger/dagger/pull/3590
|
530446113eeeeffb2aa0388641ba30d9a1435158
|
027d0c09d20c3900da341686699b4da3525034d7
| 2022-10-26T22:43:16Z |
go
| 2022-11-01T20:14:00Z |
core/directory.go
|
) error {
srcPayload, err := dir.ID.Decode()
if err != nil {
return err
}
return host.Export(ctx, dest, bkClient, solveOpts, solveCh, func(ctx context.Context, gw bkgw.Client) (*bkgw.Result, error) {
src, err := srcPayload.State()
if err != nil {
return nil, err
}
var defPB *pb.Definition
if srcPayload.Dir != "" {
src = llb.Scratch().File(llb.Copy(src, srcPayload.Dir, ".", &llb.CopyInfo{
CopyDirContentsOnly: true,
}))
def, err := src.Marshal(ctx, llb.Platform(srcPayload.Platform))
if err != nil {
return nil, err
}
defPB = def.ToPB()
} else {
defPB = srcPayload.LLB
}
return gw.Solve(ctx, bkgw.SolveRequest{
Evaluate: true,
Definition: defPB,
})
})
}
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 3,567 |
Directory: add `withNewDirectory` for creating an empty dir
|
New naming scheme for copying files/dirs vs creating files/dirs: https://github.com/dagger/dagger/issues/3567#issuecomment-1294368392
> * `withDirectory`, `withFile`: copy a directory/file (source always required)
>
> * `withNewDirectory`, `withNewFile`: create a new directory/file
This issue is for adding `withNewDirectory` since `withNewFile` already exists.
|
https://github.com/dagger/dagger/issues/3567
|
https://github.com/dagger/dagger/pull/3590
|
530446113eeeeffb2aa0388641ba30d9a1435158
|
027d0c09d20c3900da341686699b4da3525034d7
| 2022-10-26T22:43:16Z |
go
| 2022-11-01T20:14:00Z |
core/integration/directory_test.go
|
package core
import (
"testing"
"dagger.io/dagger"
"github.com/dagger/dagger/core"
"github.com/dagger/dagger/internal/testutil"
"github.com/stretchr/testify/require"
)
func TestEmptyDirectory(t *testing.T) {
t.Parallel()
var res struct {
Directory struct {
ID core.DirectoryID
Entries []string
}
}
err := testutil.Query(
`{
directory {
id
entries
}
}`, &res, nil)
require.NoError(t, err)
require.Empty(t, res.Directory.ID)
require.Empty(t, res.Directory.Entries)
}
func TestDirectoryWithNewFile(t *testing.T) {
t.Parallel()
var res struct {
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 3,567 |
Directory: add `withNewDirectory` for creating an empty dir
|
New naming scheme for copying files/dirs vs creating files/dirs: https://github.com/dagger/dagger/issues/3567#issuecomment-1294368392
> * `withDirectory`, `withFile`: copy a directory/file (source always required)
>
> * `withNewDirectory`, `withNewFile`: create a new directory/file
This issue is for adding `withNewDirectory` since `withNewFile` already exists.
|
https://github.com/dagger/dagger/issues/3567
|
https://github.com/dagger/dagger/pull/3590
|
530446113eeeeffb2aa0388641ba30d9a1435158
|
027d0c09d20c3900da341686699b4da3525034d7
| 2022-10-26T22:43:16Z |
go
| 2022-11-01T20:14:00Z |
core/integration/directory_test.go
|
Directory struct {
WithNewFile struct {
ID core.DirectoryID
Entries []string
}
}
}
err := testutil.Query(
`{
directory {
withNewFile(path: "some-file", contents: "some-content") {
id
entries
}
}
}`, &res, nil)
require.NoError(t, err)
require.NotEmpty(t, res.Directory.WithNewFile.ID)
require.Equal(t, []string{"some-file"}, res.Directory.WithNewFile.Entries)
}
func TestDirectoryEntries(t *testing.T) {
t.Parallel()
var res struct {
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 3,567 |
Directory: add `withNewDirectory` for creating an empty dir
|
New naming scheme for copying files/dirs vs creating files/dirs: https://github.com/dagger/dagger/issues/3567#issuecomment-1294368392
> * `withDirectory`, `withFile`: copy a directory/file (source always required)
>
> * `withNewDirectory`, `withNewFile`: create a new directory/file
This issue is for adding `withNewDirectory` since `withNewFile` already exists.
|
https://github.com/dagger/dagger/issues/3567
|
https://github.com/dagger/dagger/pull/3590
|
530446113eeeeffb2aa0388641ba30d9a1435158
|
027d0c09d20c3900da341686699b4da3525034d7
| 2022-10-26T22:43:16Z |
go
| 2022-11-01T20:14:00Z |
core/integration/directory_test.go
|
Directory struct {
WithNewFile struct {
WithNewFile struct {
Entries []string
}
}
}
}
err := testutil.Query(
`{
directory {
withNewFile(path: "some-file", contents: "some-content") {
withNewFile(path: "some-dir/sub-file", contents: "some-content") {
entries
}
}
}
}`, &res, nil)
require.NoError(t, err)
require.ElementsMatch(t, []string{"some-file", "some-dir"}, res.Directory.WithNewFile.WithNewFile.Entries)
}
func TestDirectoryEntriesOfPath(t *testing.T) {
t.Parallel()
var res struct {
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 3,567 |
Directory: add `withNewDirectory` for creating an empty dir
|
New naming scheme for copying files/dirs vs creating files/dirs: https://github.com/dagger/dagger/issues/3567#issuecomment-1294368392
> * `withDirectory`, `withFile`: copy a directory/file (source always required)
>
> * `withNewDirectory`, `withNewFile`: create a new directory/file
This issue is for adding `withNewDirectory` since `withNewFile` already exists.
|
https://github.com/dagger/dagger/issues/3567
|
https://github.com/dagger/dagger/pull/3590
|
530446113eeeeffb2aa0388641ba30d9a1435158
|
027d0c09d20c3900da341686699b4da3525034d7
| 2022-10-26T22:43:16Z |
go
| 2022-11-01T20:14:00Z |
core/integration/directory_test.go
|
Directory struct {
WithNewFile struct {
WithNewFile struct {
Entries []string
}
}
}
}
err := testutil.Query(
`{
directory {
withNewFile(path: "some-file", contents: "some-content") {
withNewFile(path: "some-dir/sub-file", contents: "some-content") {
entries(path: "some-dir")
}
}
}
}`, &res, nil)
require.NoError(t, err)
require.Equal(t, []string{"sub-file"}, res.Directory.WithNewFile.WithNewFile.Entries)
}
func TestDirectoryDirectory(t *testing.T) {
t.Parallel()
var res struct {
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 3,567 |
Directory: add `withNewDirectory` for creating an empty dir
|
New naming scheme for copying files/dirs vs creating files/dirs: https://github.com/dagger/dagger/issues/3567#issuecomment-1294368392
> * `withDirectory`, `withFile`: copy a directory/file (source always required)
>
> * `withNewDirectory`, `withNewFile`: create a new directory/file
This issue is for adding `withNewDirectory` since `withNewFile` already exists.
|
https://github.com/dagger/dagger/issues/3567
|
https://github.com/dagger/dagger/pull/3590
|
530446113eeeeffb2aa0388641ba30d9a1435158
|
027d0c09d20c3900da341686699b4da3525034d7
| 2022-10-26T22:43:16Z |
go
| 2022-11-01T20:14:00Z |
core/integration/directory_test.go
|
Directory struct {
WithNewFile struct {
WithNewFile struct {
Directory struct {
Entries []string
}
}
}
}
}
err := testutil.Query(
`{
directory {
withNewFile(path: "some-file", contents: "some-content") {
withNewFile(path: "some-dir/sub-file", contents: "some-content") {
directory(path: "some-dir") {
entries
}
}
}
}
}`, &res, nil)
require.NoError(t, err)
require.Equal(t, []string{"sub-file"}, res.Directory.WithNewFile.WithNewFile.Directory.Entries)
}
func TestDirectoryDirectoryWithNewFile(t *testing.T) {
t.Parallel()
var res struct {
Directory struct {
WithNewFile struct {
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 3,567 |
Directory: add `withNewDirectory` for creating an empty dir
|
New naming scheme for copying files/dirs vs creating files/dirs: https://github.com/dagger/dagger/issues/3567#issuecomment-1294368392
> * `withDirectory`, `withFile`: copy a directory/file (source always required)
>
> * `withNewDirectory`, `withNewFile`: create a new directory/file
This issue is for adding `withNewDirectory` since `withNewFile` already exists.
|
https://github.com/dagger/dagger/issues/3567
|
https://github.com/dagger/dagger/pull/3590
|
530446113eeeeffb2aa0388641ba30d9a1435158
|
027d0c09d20c3900da341686699b4da3525034d7
| 2022-10-26T22:43:16Z |
go
| 2022-11-01T20:14:00Z |
core/integration/directory_test.go
|
WithNewFile struct {
Directory struct {
WithNewFile struct {
Entries []string
}
}
}
}
}
}
err := testutil.Query(
`{
directory {
withNewFile(path: "some-file", contents: "some-content") {
withNewFile(path: "some-dir/sub-file", contents: "some-content") {
directory(path: "some-dir") {
withNewFile(path: "another-file", contents: "more-content") {
entries
}
}
}
}
}
}`, &res, nil)
require.NoError(t, err)
require.ElementsMatch(t,
[]string{"sub-file", "another-file"},
res.Directory.WithNewFile.WithNewFile.Directory.WithNewFile.Entries)
}
func TestDirectoryWithDirectory(t *testing.T) {
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 3,567 |
Directory: add `withNewDirectory` for creating an empty dir
|
New naming scheme for copying files/dirs vs creating files/dirs: https://github.com/dagger/dagger/issues/3567#issuecomment-1294368392
> * `withDirectory`, `withFile`: copy a directory/file (source always required)
>
> * `withNewDirectory`, `withNewFile`: create a new directory/file
This issue is for adding `withNewDirectory` since `withNewFile` already exists.
|
https://github.com/dagger/dagger/issues/3567
|
https://github.com/dagger/dagger/pull/3590
|
530446113eeeeffb2aa0388641ba30d9a1435158
|
027d0c09d20c3900da341686699b4da3525034d7
| 2022-10-26T22:43:16Z |
go
| 2022-11-01T20:14:00Z |
core/integration/directory_test.go
|
t.Parallel()
c, ctx := connect(t)
defer c.Close()
dirID, err := c.Directory().
WithNewFile("some-file", dagger.DirectoryWithNewFileOpts{
Contents: "some-content",
}).
WithNewFile("some-dir/sub-file", dagger.DirectoryWithNewFileOpts{
Contents: "sub-content",
}).
Directory("some-dir").ID(ctx)
require.NoError(t, err)
entries, err := c.Directory().WithDirectory(dirID, "with-dir").Entries(ctx, dagger.DirectoryEntriesOpts{
Path: "with-dir",
})
require.NoError(t, err)
require.Equal(t, []string{"sub-file"}, entries)
entries, err = c.Directory().WithDirectory(dirID, "sub-dir/sub-sub-dir/with-dir").Entries(ctx, dagger.DirectoryEntriesOpts{
Path: "sub-dir/sub-sub-dir/with-dir",
})
require.NoError(t, err)
require.Equal(t, []string{"sub-file"}, entries)
t.Run("copies directory contents to .", func(t *testing.T) {
entries, err := c.Directory().WithDirectory(dirID, ".").Entries(ctx)
require.NoError(t, err)
require.Equal(t, []string{"sub-file"}, entries)
})
}
func TestDirectoryWithDirectoryIncludeExclude(t *testing.T) {
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 3,567 |
Directory: add `withNewDirectory` for creating an empty dir
|
New naming scheme for copying files/dirs vs creating files/dirs: https://github.com/dagger/dagger/issues/3567#issuecomment-1294368392
> * `withDirectory`, `withFile`: copy a directory/file (source always required)
>
> * `withNewDirectory`, `withNewFile`: create a new directory/file
This issue is for adding `withNewDirectory` since `withNewFile` already exists.
|
https://github.com/dagger/dagger/issues/3567
|
https://github.com/dagger/dagger/pull/3590
|
530446113eeeeffb2aa0388641ba30d9a1435158
|
027d0c09d20c3900da341686699b4da3525034d7
| 2022-10-26T22:43:16Z |
go
| 2022-11-01T20:14:00Z |
core/integration/directory_test.go
|
t.Parallel()
c, ctx := connect(t)
defer c.Close()
dir := c.Directory().
WithNewFile("a.txt").
WithNewFile("b.txt").
WithNewFile("c.txt.rar").
WithNewFile("subdir/d.txt").
WithNewFile("subdir/e.txt").
WithNewFile("subdir/f.txt.rar")
dirID, err := dir.ID(ctx)
require.NoError(t, err)
t.Run("exclude", func(t *testing.T) {
entries, err := c.Directory().WithDirectory(dirID, ".", dagger.DirectoryWithDirectoryOpts{
Exclude: []string{"*.rar"},
}).Entries(ctx)
require.NoError(t, err)
require.Equal(t, []string{"a.txt", "b.txt", "subdir"}, entries)
})
t.Run("include", func(t *testing.T) {
entries, err := c.Directory().WithDirectory(dirID, ".", dagger.DirectoryWithDirectoryOpts{
Include: []string{"*.rar"},
}).Entries(ctx)
require.NoError(t, err)
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 3,567 |
Directory: add `withNewDirectory` for creating an empty dir
|
New naming scheme for copying files/dirs vs creating files/dirs: https://github.com/dagger/dagger/issues/3567#issuecomment-1294368392
> * `withDirectory`, `withFile`: copy a directory/file (source always required)
>
> * `withNewDirectory`, `withNewFile`: create a new directory/file
This issue is for adding `withNewDirectory` since `withNewFile` already exists.
|
https://github.com/dagger/dagger/issues/3567
|
https://github.com/dagger/dagger/pull/3590
|
530446113eeeeffb2aa0388641ba30d9a1435158
|
027d0c09d20c3900da341686699b4da3525034d7
| 2022-10-26T22:43:16Z |
go
| 2022-11-01T20:14:00Z |
core/integration/directory_test.go
|
require.Equal(t, []string{"c.txt.rar"}, entries)
})
t.Run("exclude overrides include", func(t *testing.T) {
entries, err := c.Directory().WithDirectory(dirID, ".", dagger.DirectoryWithDirectoryOpts{
Include: []string{"*.txt"},
Exclude: []string{"b.txt"},
}).Entries(ctx)
require.NoError(t, err)
require.Equal(t, []string{"a.txt"}, entries)
})
t.Run("include does not override exclude", func(t *testing.T) {
entries, err := c.Directory().WithDirectory(dirID, ".", dagger.DirectoryWithDirectoryOpts{
Include: []string{"a.txt"},
Exclude: []string{"*.txt"},
}).Entries(ctx)
require.NoError(t, err)
require.Equal(t, []string{}, entries)
})
subdirID, err := dir.Directory("subdir").ID(ctx)
require.NoError(t, err)
t.Run("exclude respects subdir", func(t *testing.T) {
entries, err := c.Directory().WithDirectory(subdirID, ".", dagger.DirectoryWithDirectoryOpts{
Exclude: []string{"*.rar"},
}).Entries(ctx)
require.NoError(t, err)
require.Equal(t, []string{"d.txt", "e.txt"}, entries)
})
}
func TestDirectoryWithCopiedFile(t *testing.T) {
var fileRes struct {
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.