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,266
Container: add `file`
Symmetrical to `container.directory`: returns a `FileID` while magically traversing mounts by path.
https://github.com/dagger/dagger/issues/3266
https://github.com/dagger/dagger/pull/3303
09c6e1f7a6405646a3c3733e9284ba94e959da36
44fb6275fcd9a789c905dc3570a8a506df598c36
2022-10-06T02:10:11Z
go
2022-10-12T01:34:30Z
core/integration/container_test.go
Container struct { From struct { Rootfs struct { File struct { Contents string } } } } }{} err := testutil.Query( `{ container { from(address: "alpine:3.16.2") { rootfs { file(path: "/etc/alpine-release") { contents } } } } }`, &res, nil) require.NoError(t, err) require.Equal(t, res.Container.From.Rootfs.File.Contents, "3.16.2\n") } func TestContainerExecExitCode(t *testing.T) { t.Parallel() res := struct {
closed
dagger/dagger
https://github.com/dagger/dagger
3,266
Container: add `file`
Symmetrical to `container.directory`: returns a `FileID` while magically traversing mounts by path.
https://github.com/dagger/dagger/issues/3266
https://github.com/dagger/dagger/pull/3303
09c6e1f7a6405646a3c3733e9284ba94e959da36
44fb6275fcd9a789c905dc3570a8a506df598c36
2022-10-06T02:10:11Z
go
2022-10-12T01:34:30Z
core/integration/container_test.go
Container struct { From struct { Exec struct { ExitCode *int } } } }{} err := testutil.Query( `{ container { from(address: "alpine:3.16.2") { exec(args: ["true"]) { exitCode } } } }`, &res, nil) require.NoError(t, err) require.NotNil(t, res.Container.From.Exec.ExitCode) require.Equal(t, 0, *res.Container.From.Exec.ExitCode)
closed
dagger/dagger
https://github.com/dagger/dagger
3,266
Container: add `file`
Symmetrical to `container.directory`: returns a `FileID` while magically traversing mounts by path.
https://github.com/dagger/dagger/issues/3266
https://github.com/dagger/dagger/pull/3303
09c6e1f7a6405646a3c3733e9284ba94e959da36
44fb6275fcd9a789c905dc3570a8a506df598c36
2022-10-06T02:10:11Z
go
2022-10-12T01:34:30Z
core/integration/container_test.go
/* It's not currently possible to get a nonzero exit code back because Buildkit raises an error. We could perhaps have the shim mask the exit status and always exit 0, but we would have to be careful not to let that happen in a big chained LLB since it would prevent short-circuiting. We could only do it when the user requests the exitCode, but then we would actually need to run the command _again_ since we'd need some way to tell the shim what to do. Hmm... err = testutil.Query( `{ container { from(address: "alpine:3.16.2") { exec(args: ["false"]) { exitCode } } } }`, &res, nil) require.NoError(t, err) require.Equal(t, res.Container.From.Exec.ExitCode, 1) */ } func TestContainerExecStdoutStderr(t *testing.T) { t.Parallel() res := struct { Container struct { From struct { Exec struct {
closed
dagger/dagger
https://github.com/dagger/dagger
3,266
Container: add `file`
Symmetrical to `container.directory`: returns a `FileID` while magically traversing mounts by path.
https://github.com/dagger/dagger/issues/3266
https://github.com/dagger/dagger/pull/3303
09c6e1f7a6405646a3c3733e9284ba94e959da36
44fb6275fcd9a789c905dc3570a8a506df598c36
2022-10-06T02:10:11Z
go
2022-10-12T01:34:30Z
core/integration/container_test.go
Stdout, Stderr struct { Contents string } } } } }{} err := testutil.Query( `{ container { from(address: "alpine:3.16.2") { exec(args: ["sh", "-c", "echo hello; echo goodbye >/dev/stderr"]) { stdout { contents } stderr { contents } } } } }`, &res, nil) require.NoError(t, err) require.Equal(t, res.Container.From.Exec.Stdout.Contents, "hello\n") require.Equal(t, res.Container.From.Exec.Stderr.Contents, "goodbye\n") } func TestContainerNullStdoutStderr(t *testing.T) { t.Parallel() res := struct { Container struct {
closed
dagger/dagger
https://github.com/dagger/dagger
3,266
Container: add `file`
Symmetrical to `container.directory`: returns a `FileID` while magically traversing mounts by path.
https://github.com/dagger/dagger/issues/3266
https://github.com/dagger/dagger/pull/3303
09c6e1f7a6405646a3c3733e9284ba94e959da36
44fb6275fcd9a789c905dc3570a8a506df598c36
2022-10-06T02:10:11Z
go
2022-10-12T01:34:30Z
core/integration/container_test.go
From struct { Stdout, Stderr *struct { Contents string } } } }{} err := testutil.Query( `{ container { from(address: "alpine:3.16.2") { stdout { contents } stderr { contents } } } }`, &res, nil) require.NoError(t, err) require.Nil(t, res.Container.From.Stdout) require.Nil(t, res.Container.From.Stderr) } func TestContainerExecWithWorkdir(t *testing.T) { t.Parallel() res := struct { Container struct { From struct { WithWorkdir struct {
closed
dagger/dagger
https://github.com/dagger/dagger
3,266
Container: add `file`
Symmetrical to `container.directory`: returns a `FileID` while magically traversing mounts by path.
https://github.com/dagger/dagger/issues/3266
https://github.com/dagger/dagger/pull/3303
09c6e1f7a6405646a3c3733e9284ba94e959da36
44fb6275fcd9a789c905dc3570a8a506df598c36
2022-10-06T02:10:11Z
go
2022-10-12T01:34:30Z
core/integration/container_test.go
Exec struct { Stdout struct { Contents string } } } } } }{} err := testutil.Query( `{ container { from(address: "alpine:3.16.2") { withWorkdir(path: "/usr") { exec(args: ["pwd"]) { stdout { contents } } } } } }`, &res, nil) require.NoError(t, err) require.Equal(t, res.Container.From.WithWorkdir.Exec.Stdout.Contents, "/usr\n") } func TestContainerExecWithUser(t *testing.T) { t.Parallel() res := struct { Container struct {
closed
dagger/dagger
https://github.com/dagger/dagger
3,266
Container: add `file`
Symmetrical to `container.directory`: returns a `FileID` while magically traversing mounts by path.
https://github.com/dagger/dagger/issues/3266
https://github.com/dagger/dagger/pull/3303
09c6e1f7a6405646a3c3733e9284ba94e959da36
44fb6275fcd9a789c905dc3570a8a506df598c36
2022-10-06T02:10:11Z
go
2022-10-12T01:34:30Z
core/integration/container_test.go
From struct { User string WithUser struct { User string Exec struct { Stdout struct { Contents string } } } } } }{} t.Run("user name", func(t *testing.T) { err := testutil.Query( `{ container { from(address: "alpine:3.16.2") { user withUser(name: "daemon") { user exec(args: ["whoami"]) { stdout { contents } } } } } }`, &res, nil)
closed
dagger/dagger
https://github.com/dagger/dagger
3,266
Container: add `file`
Symmetrical to `container.directory`: returns a `FileID` while magically traversing mounts by path.
https://github.com/dagger/dagger/issues/3266
https://github.com/dagger/dagger/pull/3303
09c6e1f7a6405646a3c3733e9284ba94e959da36
44fb6275fcd9a789c905dc3570a8a506df598c36
2022-10-06T02:10:11Z
go
2022-10-12T01:34:30Z
core/integration/container_test.go
require.NoError(t, err) require.Equal(t, "", res.Container.From.User) require.Equal(t, "daemon", res.Container.From.WithUser.User) require.Equal(t, "daemon\n", res.Container.From.WithUser.Exec.Stdout.Contents) }) t.Run("user and group name", func(t *testing.T) { err := testutil.Query( `{ container { from(address: "alpine:3.16.2") { user withUser(name: "daemon:floppy") { user exec(args: ["sh", "-c", "whoami; groups"]) { stdout { contents } } } } } }`, &res, nil) require.NoError(t, err) require.Equal(t, "", res.Container.From.User) require.Equal(t, "daemon:floppy", res.Container.From.WithUser.User) require.Equal(t, "daemon\nfloppy\n", res.Container.From.WithUser.Exec.Stdout.Contents) }) t.Run("user ID", func(t *testing.T) { err := testutil.Query( `{
closed
dagger/dagger
https://github.com/dagger/dagger
3,266
Container: add `file`
Symmetrical to `container.directory`: returns a `FileID` while magically traversing mounts by path.
https://github.com/dagger/dagger/issues/3266
https://github.com/dagger/dagger/pull/3303
09c6e1f7a6405646a3c3733e9284ba94e959da36
44fb6275fcd9a789c905dc3570a8a506df598c36
2022-10-06T02:10:11Z
go
2022-10-12T01:34:30Z
core/integration/container_test.go
container { from(address: "alpine:3.16.2") { user withUser(name: "2") { user exec(args: ["whoami"]) { stdout { contents } } } } } }`, &res, nil) require.NoError(t, err) require.Equal(t, "", res.Container.From.User) require.Equal(t, "2", res.Container.From.WithUser.User) require.Equal(t, "daemon\n", res.Container.From.WithUser.Exec.Stdout.Contents) }) t.Run("user and group ID", func(t *testing.T) { err := testutil.Query( `{ container { from(address: "alpine:3.16.2") { user withUser(name: "2:11") { user exec(args: ["sh", "-c", "whoami; groups"]) { stdout { contents
closed
dagger/dagger
https://github.com/dagger/dagger
3,266
Container: add `file`
Symmetrical to `container.directory`: returns a `FileID` while magically traversing mounts by path.
https://github.com/dagger/dagger/issues/3266
https://github.com/dagger/dagger/pull/3303
09c6e1f7a6405646a3c3733e9284ba94e959da36
44fb6275fcd9a789c905dc3570a8a506df598c36
2022-10-06T02:10:11Z
go
2022-10-12T01:34:30Z
core/integration/container_test.go
} } } } } }`, &res, nil) require.NoError(t, err) require.Equal(t, "", res.Container.From.User) require.Equal(t, "2:11", res.Container.From.WithUser.User) require.Equal(t, "daemon\nfloppy\n", res.Container.From.WithUser.Exec.Stdout.Contents) }) } func TestContainerExecWithEntrypoint(t *testing.T) { t.Parallel() res := struct { Container struct { From struct { Entrypoint []string WithEntrypoint struct { Entrypoint []string Exec struct { Stdout struct { Contents string } } WithEntrypoint struct { Entrypoint []string } } }
closed
dagger/dagger
https://github.com/dagger/dagger
3,266
Container: add `file`
Symmetrical to `container.directory`: returns a `FileID` while magically traversing mounts by path.
https://github.com/dagger/dagger/issues/3266
https://github.com/dagger/dagger/pull/3303
09c6e1f7a6405646a3c3733e9284ba94e959da36
44fb6275fcd9a789c905dc3570a8a506df598c36
2022-10-06T02:10:11Z
go
2022-10-12T01:34:30Z
core/integration/container_test.go
} }{} err := testutil.Query( `{ container { from(address: "alpine:3.16.2") { entrypoint withEntrypoint(args: ["sh", "-c"]) { entrypoint exec(args: ["echo $HOME"]) { stdout { contents } } withEntrypoint(args: []) { entrypoint } } } } }`, &res, nil) require.NoError(t, err) require.Empty(t, res.Container.From.Entrypoint) require.Equal(t, []string{"sh", "-c"}, res.Container.From.WithEntrypoint.Entrypoint) require.Equal(t, "/root\n", res.Container.From.WithEntrypoint.Exec.Stdout.Contents) require.Empty(t, res.Container.From.WithEntrypoint.WithEntrypoint.Entrypoint) } func TestContainerWithDefaultArgs(t *testing.T) { t.Parallel() res := struct {
closed
dagger/dagger
https://github.com/dagger/dagger
3,266
Container: add `file`
Symmetrical to `container.directory`: returns a `FileID` while magically traversing mounts by path.
https://github.com/dagger/dagger/issues/3266
https://github.com/dagger/dagger/pull/3303
09c6e1f7a6405646a3c3733e9284ba94e959da36
44fb6275fcd9a789c905dc3570a8a506df598c36
2022-10-06T02:10:11Z
go
2022-10-12T01:34:30Z
core/integration/container_test.go
Container struct { From struct { Entrypoint []string DefaultArgs []string Exec struct { Stdout struct { Contents string } } WithDefaultArgs struct { Entrypoint []string DefaultArgs []string } WithEntrypoint struct { Entrypoint []string DefaultArgs []string Exec struct { Stdout struct { Contents string } } WithDefaultArgs struct { Entrypoint []string DefaultArgs []string Exec struct { Stdout struct { Contents string } } }
closed
dagger/dagger
https://github.com/dagger/dagger
3,266
Container: add `file`
Symmetrical to `container.directory`: returns a `FileID` while magically traversing mounts by path.
https://github.com/dagger/dagger/issues/3266
https://github.com/dagger/dagger/pull/3303
09c6e1f7a6405646a3c3733e9284ba94e959da36
44fb6275fcd9a789c905dc3570a8a506df598c36
2022-10-06T02:10:11Z
go
2022-10-12T01:34:30Z
core/integration/container_test.go
} } } }{} err := testutil.Query( `{ container { from(address: "alpine:3.16.2") { entrypoint defaultArgs withDefaultArgs { entrypoint defaultArgs } withEntrypoint(args: ["sh", "-c"]) { entrypoint defaultArgs exec(args: ["echo $HOME"]) { stdout { contents } } withDefaultArgs(args: ["id"]) { entrypoint defaultArgs exec(args: []) { stdout { contents } }
closed
dagger/dagger
https://github.com/dagger/dagger
3,266
Container: add `file`
Symmetrical to `container.directory`: returns a `FileID` while magically traversing mounts by path.
https://github.com/dagger/dagger/issues/3266
https://github.com/dagger/dagger/pull/3303
09c6e1f7a6405646a3c3733e9284ba94e959da36
44fb6275fcd9a789c905dc3570a8a506df598c36
2022-10-06T02:10:11Z
go
2022-10-12T01:34:30Z
core/integration/container_test.go
} } } } }`, &res, nil) t.Run("default alpine (no entrypoint)", func(t *testing.T) { require.NoError(t, err) require.Empty(t, res.Container.From.Entrypoint) require.Equal(t, []string{"/bin/sh"}, res.Container.From.DefaultArgs) }) t.Run("with nil default args", func(t *testing.T) { require.Empty(t, res.Container.From.WithDefaultArgs.Entrypoint) require.Empty(t, res.Container.From.WithDefaultArgs.DefaultArgs) }) t.Run("with entrypoint set", func(t *testing.T) { require.Equal(t, []string{"sh", "-c"}, res.Container.From.WithEntrypoint.Entrypoint) require.Equal(t, []string{"/bin/sh"}, res.Container.From.WithEntrypoint.DefaultArgs) }) t.Run("with exec args", func(t *testing.T) { require.Equal(t, "/root\n", res.Container.From.WithEntrypoint.Exec.Stdout.Contents) }) t.Run("with default args set", func(t *testing.T) { require.Equal(t, []string{"sh", "-c"}, res.Container.From.WithEntrypoint.WithDefaultArgs.Entrypoint) require.Equal(t, []string{"id"}, res.Container.From.WithEntrypoint.WithDefaultArgs.DefaultArgs) require.Equal(t, "uid=0(root) gid=0(root) groups=0(root),1(bin),2(daemon),3(sys),4(adm),6(disk),10(wheel),11(floppy),20(dialout),26(tape),27(video)\n", res.Container.From.WithEntrypoint.WithDefaultArgs.Exec.Stdout.Contents) }) } func TestContainerExecWithVariable(t *testing.T) { t.Parallel() res := struct {
closed
dagger/dagger
https://github.com/dagger/dagger
3,266
Container: add `file`
Symmetrical to `container.directory`: returns a `FileID` while magically traversing mounts by path.
https://github.com/dagger/dagger/issues/3266
https://github.com/dagger/dagger/pull/3303
09c6e1f7a6405646a3c3733e9284ba94e959da36
44fb6275fcd9a789c905dc3570a8a506df598c36
2022-10-06T02:10:11Z
go
2022-10-12T01:34:30Z
core/integration/container_test.go
Container struct { From struct { WithVariable struct { Exec struct { Stdout struct { Contents string } } } } } }{} err := testutil.Query( `{ container { from(address: "alpine:3.16.2") { withVariable(name: "FOO", value: "bar") { exec(args: ["env"]) { stdout { contents } } } } } }`, &res, nil) require.NoError(t, err) require.Contains(t, res.Container.From.WithVariable.Exec.Stdout.Contents, "FOO=bar\n") } func TestContainerVariables(t *testing.T) {
closed
dagger/dagger
https://github.com/dagger/dagger
3,266
Container: add `file`
Symmetrical to `container.directory`: returns a `FileID` while magically traversing mounts by path.
https://github.com/dagger/dagger/issues/3266
https://github.com/dagger/dagger/pull/3303
09c6e1f7a6405646a3c3733e9284ba94e959da36
44fb6275fcd9a789c905dc3570a8a506df598c36
2022-10-06T02:10:11Z
go
2022-10-12T01:34:30Z
core/integration/container_test.go
t.Parallel() res := struct { Container struct { From struct { Variables []string Exec struct { Stdout struct {
closed
dagger/dagger
https://github.com/dagger/dagger
3,266
Container: add `file`
Symmetrical to `container.directory`: returns a `FileID` while magically traversing mounts by path.
https://github.com/dagger/dagger/issues/3266
https://github.com/dagger/dagger/pull/3303
09c6e1f7a6405646a3c3733e9284ba94e959da36
44fb6275fcd9a789c905dc3570a8a506df598c36
2022-10-06T02:10:11Z
go
2022-10-12T01:34:30Z
core/integration/container_test.go
Contents string } } } } }{} err := testutil.Query( `{ container { from(address: "golang:1.18.2-alpine") { variables exec(args: ["env"]) { stdout { contents } } } } }`, &res, nil) require.NoError(t, err) require.Equal(t, res.Container.From.Variables, []string{ "PATH=/go/bin:/usr/local/go/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin", "GOLANG_VERSION=1.18.2", "GOPATH=/go", }) require.Contains(t, res.Container.From.Exec.Stdout.Contents, "GOPATH=/go\n") } func TestContainerVariable(t *testing.T) { t.Parallel() res := struct {
closed
dagger/dagger
https://github.com/dagger/dagger
3,266
Container: add `file`
Symmetrical to `container.directory`: returns a `FileID` while magically traversing mounts by path.
https://github.com/dagger/dagger/issues/3266
https://github.com/dagger/dagger/pull/3303
09c6e1f7a6405646a3c3733e9284ba94e959da36
44fb6275fcd9a789c905dc3570a8a506df598c36
2022-10-06T02:10:11Z
go
2022-10-12T01:34:30Z
core/integration/container_test.go
Container struct { From struct { Variable *string } } }{} err := testutil.Query( `{ container { from(address: "golang:1.18.2-alpine") { variable(name: "GOLANG_VERSION") } } }`, &res, nil) require.NoError(t, err) require.NotNil(t, res.Container.From.Variable) require.Equal(t, "1.18.2", *res.Container.From.Variable) err = testutil.Query( `{ container { from(address: "golang:1.18.2-alpine") { variable(name: "UNKNOWN") } } }`, &res, nil) require.NoError(t, err) require.Nil(t, res.Container.From.Variable) } func TestContainerWithoutVariable(t *testing.T) {
closed
dagger/dagger
https://github.com/dagger/dagger
3,266
Container: add `file`
Symmetrical to `container.directory`: returns a `FileID` while magically traversing mounts by path.
https://github.com/dagger/dagger/issues/3266
https://github.com/dagger/dagger/pull/3303
09c6e1f7a6405646a3c3733e9284ba94e959da36
44fb6275fcd9a789c905dc3570a8a506df598c36
2022-10-06T02:10:11Z
go
2022-10-12T01:34:30Z
core/integration/container_test.go
t.Parallel() res := struct { Container struct { From struct { WithoutVariable struct { Variables []string Exec struct { Stdout struct {
closed
dagger/dagger
https://github.com/dagger/dagger
3,266
Container: add `file`
Symmetrical to `container.directory`: returns a `FileID` while magically traversing mounts by path.
https://github.com/dagger/dagger/issues/3266
https://github.com/dagger/dagger/pull/3303
09c6e1f7a6405646a3c3733e9284ba94e959da36
44fb6275fcd9a789c905dc3570a8a506df598c36
2022-10-06T02:10:11Z
go
2022-10-12T01:34:30Z
core/integration/container_test.go
Contents string } } } } } }{} err := testutil.Query( `{ container { from(address: "golang:1.18.2-alpine") { withoutVariable(name: "GOLANG_VERSION") { variables exec(args: ["env"]) { stdout { contents } } } } } }`, &res, nil) require.NoError(t, err) require.Equal(t, res.Container.From.WithoutVariable.Variables, []string{ "PATH=/go/bin:/usr/local/go/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin", "GOPATH=/go", }) require.NotContains(t, res.Container.From.WithoutVariable.Exec.Stdout.Contents, "GOLANG_VERSION") } func TestContainerVariablesReplace(t *testing.T) {
closed
dagger/dagger
https://github.com/dagger/dagger
3,266
Container: add `file`
Symmetrical to `container.directory`: returns a `FileID` while magically traversing mounts by path.
https://github.com/dagger/dagger/issues/3266
https://github.com/dagger/dagger/pull/3303
09c6e1f7a6405646a3c3733e9284ba94e959da36
44fb6275fcd9a789c905dc3570a8a506df598c36
2022-10-06T02:10:11Z
go
2022-10-12T01:34:30Z
core/integration/container_test.go
t.Parallel() res := struct { Container struct { From struct { WithVariable struct { Variables []string Exec struct { Stdout struct { Contents string } } } } } }{}
closed
dagger/dagger
https://github.com/dagger/dagger
3,266
Container: add `file`
Symmetrical to `container.directory`: returns a `FileID` while magically traversing mounts by path.
https://github.com/dagger/dagger/issues/3266
https://github.com/dagger/dagger/pull/3303
09c6e1f7a6405646a3c3733e9284ba94e959da36
44fb6275fcd9a789c905dc3570a8a506df598c36
2022-10-06T02:10:11Z
go
2022-10-12T01:34:30Z
core/integration/container_test.go
err := testutil.Query( `{ container { from(address: "golang:1.18.2-alpine") { withVariable(name: "GOPATH", value: "/gone") { variables exec(args: ["env"]) { stdout { contents } } } } } }`, &res, nil) require.NoError(t, err) require.Equal(t, res.Container.From.WithVariable.Variables, []string{ "PATH=/go/bin:/usr/local/go/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin", "GOLANG_VERSION=1.18.2", "GOPATH=/gone", }) require.Contains(t, res.Container.From.WithVariable.Exec.Stdout.Contents, "GOPATH=/gone\n") } func TestContainerWorkdir(t *testing.T) { t.Parallel() res := struct { Container struct { From struct { Workdir string Exec struct {
closed
dagger/dagger
https://github.com/dagger/dagger
3,266
Container: add `file`
Symmetrical to `container.directory`: returns a `FileID` while magically traversing mounts by path.
https://github.com/dagger/dagger/issues/3266
https://github.com/dagger/dagger/pull/3303
09c6e1f7a6405646a3c3733e9284ba94e959da36
44fb6275fcd9a789c905dc3570a8a506df598c36
2022-10-06T02:10:11Z
go
2022-10-12T01:34:30Z
core/integration/container_test.go
Stdout struct { Contents string } } } } }{} err := testutil.Query( `{ container { from(address: "golang:1.18.2-alpine") { workdir exec(args: ["pwd"]) { stdout { contents } } } } }`, &res, nil) require.NoError(t, err) require.Equal(t, res.Container.From.Workdir, "/go") require.Equal(t, res.Container.From.Exec.Stdout.Contents, "/go\n") } func TestContainerWithWorkdir(t *testing.T) { t.Parallel() res := struct { Container struct { From struct { WithWorkdir struct {
closed
dagger/dagger
https://github.com/dagger/dagger
3,266
Container: add `file`
Symmetrical to `container.directory`: returns a `FileID` while magically traversing mounts by path.
https://github.com/dagger/dagger/issues/3266
https://github.com/dagger/dagger/pull/3303
09c6e1f7a6405646a3c3733e9284ba94e959da36
44fb6275fcd9a789c905dc3570a8a506df598c36
2022-10-06T02:10:11Z
go
2022-10-12T01:34:30Z
core/integration/container_test.go
Workdir string Exec struct { Stdout struct { Contents string } } } } } }{} err := testutil.Query( `{ container { from(address: "golang:1.18.2-alpine") { withWorkdir(path: "/usr") { workdir exec(args: ["pwd"]) { stdout { contents } } } } } }`, &res, nil) require.NoError(t, err) require.Equal(t, res.Container.From.WithWorkdir.Workdir, "/usr") require.Equal(t, res.Container.From.WithWorkdir.Exec.Stdout.Contents, "/usr\n") } func TestContainerWithMountedDirectory(t *testing.T) {
closed
dagger/dagger
https://github.com/dagger/dagger
3,266
Container: add `file`
Symmetrical to `container.directory`: returns a `FileID` while magically traversing mounts by path.
https://github.com/dagger/dagger/issues/3266
https://github.com/dagger/dagger/pull/3303
09c6e1f7a6405646a3c3733e9284ba94e959da36
44fb6275fcd9a789c905dc3570a8a506df598c36
2022-10-06T02:10:11Z
go
2022-10-12T01:34:30Z
core/integration/container_test.go
t.Parallel() dirRes := struct { Directory struct { WithNewFile struct { WithNewFile struct { ID string } } } }{} err := testutil.Query( `{ directory { withNewFile(path: "some-file", contents: "some-content") { withNewFile(path: "some-dir/sub-file", contents: "sub-content") { id } } } }`, &dirRes, nil) require.NoError(t, err) id := dirRes.Directory.WithNewFile.WithNewFile.ID execRes := struct {
closed
dagger/dagger
https://github.com/dagger/dagger
3,266
Container: add `file`
Symmetrical to `container.directory`: returns a `FileID` while magically traversing mounts by path.
https://github.com/dagger/dagger/issues/3266
https://github.com/dagger/dagger/pull/3303
09c6e1f7a6405646a3c3733e9284ba94e959da36
44fb6275fcd9a789c905dc3570a8a506df598c36
2022-10-06T02:10:11Z
go
2022-10-12T01:34:30Z
core/integration/container_test.go
Container struct { From struct { WithMountedDirectory struct { Exec struct { Stdout struct { Contents string } Exec struct { Stdout struct { Contents string } } } } } }
closed
dagger/dagger
https://github.com/dagger/dagger
3,266
Container: add `file`
Symmetrical to `container.directory`: returns a `FileID` while magically traversing mounts by path.
https://github.com/dagger/dagger/issues/3266
https://github.com/dagger/dagger/pull/3303
09c6e1f7a6405646a3c3733e9284ba94e959da36
44fb6275fcd9a789c905dc3570a8a506df598c36
2022-10-06T02:10:11Z
go
2022-10-12T01:34:30Z
core/integration/container_test.go
}{} err = testutil.Query( `query Test($id: DirectoryID!) { container { from(address: "alpine:3.16.2") { withMountedDirectory(path: "/mnt", source: $id) { exec(args: ["cat", "/mnt/some-file"]) { stdout { contents } exec(args: ["cat", "/mnt/some-dir/sub-file"]) { stdout { contents } } } } } } }`, &execRes, &testutil.QueryOptions{Variables: map[string]any{ "id": id, }}) require.NoError(t, err) require.Equal(t, "some-content", execRes.Container.From.WithMountedDirectory.Exec.Stdout.Contents) require.Equal(t, "sub-content", execRes.Container.From.WithMountedDirectory.Exec.Exec.Stdout.Contents) } func TestContainerWithMountedDirectorySourcePath(t *testing.T) { t.Parallel() dirRes := struct { Directory struct {
closed
dagger/dagger
https://github.com/dagger/dagger
3,266
Container: add `file`
Symmetrical to `container.directory`: returns a `FileID` while magically traversing mounts by path.
https://github.com/dagger/dagger/issues/3266
https://github.com/dagger/dagger/pull/3303
09c6e1f7a6405646a3c3733e9284ba94e959da36
44fb6275fcd9a789c905dc3570a8a506df598c36
2022-10-06T02:10:11Z
go
2022-10-12T01:34:30Z
core/integration/container_test.go
WithNewFile struct { WithNewFile struct { Directory struct { ID string } } } } }{} err := testutil.Query( `{ directory { withNewFile(path: "some-file", contents: "some-content") { withNewFile(path: "some-dir/sub-file", contents: "sub-content") { directory(path: "some-dir") { id } } } } }`, &dirRes, nil) require.NoError(t, err) id := dirRes.Directory.WithNewFile.WithNewFile.Directory.ID execRes := struct { Container struct { From struct { WithMountedDirectory struct { Exec struct { Exec struct { Stdout struct {
closed
dagger/dagger
https://github.com/dagger/dagger
3,266
Container: add `file`
Symmetrical to `container.directory`: returns a `FileID` while magically traversing mounts by path.
https://github.com/dagger/dagger/issues/3266
https://github.com/dagger/dagger/pull/3303
09c6e1f7a6405646a3c3733e9284ba94e959da36
44fb6275fcd9a789c905dc3570a8a506df598c36
2022-10-06T02:10:11Z
go
2022-10-12T01:34:30Z
core/integration/container_test.go
Contents string } } } } } } }{} err = testutil.Query( `query Test($id: DirectoryID!) { container { from(address: "alpine:3.16.2") { withMountedDirectory(path: "/mnt", source: $id) { exec(args: ["sh", "-c", "echo >> /mnt/sub-file; echo -n more-content >> /mnt/sub-file"]) { exec(args: ["cat", "/mnt/sub-file"]) { stdout { contents } } } } } } }`, &execRes, &testutil.QueryOptions{Variables: map[string]any{ "id": id, }}) require.NoError(t, err) require.Equal(t, "sub-content\nmore-content", execRes.Container.From.WithMountedDirectory.Exec.Exec.Stdout.Contents) } func TestContainerWithMountedDirectoryPropagation(t *testing.T) {
closed
dagger/dagger
https://github.com/dagger/dagger
3,266
Container: add `file`
Symmetrical to `container.directory`: returns a `FileID` while magically traversing mounts by path.
https://github.com/dagger/dagger/issues/3266
https://github.com/dagger/dagger/pull/3303
09c6e1f7a6405646a3c3733e9284ba94e959da36
44fb6275fcd9a789c905dc3570a8a506df598c36
2022-10-06T02:10:11Z
go
2022-10-12T01:34:30Z
core/integration/container_test.go
t.Parallel() dirRes := struct { Directory struct { WithNewFile struct { ID core.DirectoryID } } }{} err := testutil.Query( `{ directory { withNewFile(path: "some-file", contents: "some-content") { id } } }`, &dirRes, nil) require.NoError(t, err) id := dirRes.Directory.WithNewFile.ID execRes := struct {
closed
dagger/dagger
https://github.com/dagger/dagger
3,266
Container: add `file`
Symmetrical to `container.directory`: returns a `FileID` while magically traversing mounts by path.
https://github.com/dagger/dagger/issues/3266
https://github.com/dagger/dagger/pull/3303
09c6e1f7a6405646a3c3733e9284ba94e959da36
44fb6275fcd9a789c905dc3570a8a506df598c36
2022-10-06T02:10:11Z
go
2022-10-12T01:34:30Z
core/integration/container_test.go
Container struct { From struct { WithMountedDirectory struct { Exec struct { Stdout struct { Contents string } Exec struct { Exec struct { Stdout struct { Contents string } WithMountedDirectory struct { Exec struct { Stdout struct { Contents string } Exec struct { Stdout struct {
closed
dagger/dagger
https://github.com/dagger/dagger
3,266
Container: add `file`
Symmetrical to `container.directory`: returns a `FileID` while magically traversing mounts by path.
https://github.com/dagger/dagger/issues/3266
https://github.com/dagger/dagger/pull/3303
09c6e1f7a6405646a3c3733e9284ba94e959da36
44fb6275fcd9a789c905dc3570a8a506df598c36
2022-10-06T02:10:11Z
go
2022-10-12T01:34:30Z
core/integration/container_test.go
Contents string } } } } } } } } } } }{} err = testutil.Query( `query Test($id: DirectoryID!) { container { from(address: "alpine:3.16.2") { withMountedDirectory(path: "/mnt", source: $id) { exec(args: ["cat", "/mnt/some-file"]) { # original content stdout { contents } exec(args: ["sh", "-c", "echo >> /mnt/some-file; echo -n more-content >> /mnt/some-file"]) { exec(args: ["cat", "/mnt/some-file"]) { # modified content should propagate stdout { contents } withMountedDirectory(path: "/mnt", source: $id) { exec(args: ["cat", "/mnt/some-file"]) { # should be back to the original content stdout { contents } exec(args: ["cat", "/mnt/some-file"]) { # original content override should propagate
closed
dagger/dagger
https://github.com/dagger/dagger
3,266
Container: add `file`
Symmetrical to `container.directory`: returns a `FileID` while magically traversing mounts by path.
https://github.com/dagger/dagger/issues/3266
https://github.com/dagger/dagger/pull/3303
09c6e1f7a6405646a3c3733e9284ba94e959da36
44fb6275fcd9a789c905dc3570a8a506df598c36
2022-10-06T02:10:11Z
go
2022-10-12T01:34:30Z
core/integration/container_test.go
stdout { contents } } } } } } } } } } }`, &execRes, &testutil.QueryOptions{Variables: map[string]any{ "id": id, }}) require.NoError(t, err) require.Equal(t, "some-content", execRes.Container.From.WithMountedDirectory.Exec.Stdout.Contents) require.Equal(t, "some-content\nmore-content", execRes.Container.From.WithMountedDirectory.Exec.Exec.Exec.Stdout.Contents) require.Equal(t, "some-content", execRes.Container.From.WithMountedDirectory.Exec.Exec.Exec.WithMountedDirectory.Exec.Stdout.Contents) require.Equal(t, "some-content", execRes.Container.From.WithMountedDirectory.Exec.Exec.Exec.WithMountedDirectory.Exec.Exec.Stdout.Contents) } func TestContainerWithMountedFile(t *testing.T) { t.Parallel() dirRes := struct {
closed
dagger/dagger
https://github.com/dagger/dagger
3,266
Container: add `file`
Symmetrical to `container.directory`: returns a `FileID` while magically traversing mounts by path.
https://github.com/dagger/dagger/issues/3266
https://github.com/dagger/dagger/pull/3303
09c6e1f7a6405646a3c3733e9284ba94e959da36
44fb6275fcd9a789c905dc3570a8a506df598c36
2022-10-06T02:10:11Z
go
2022-10-12T01:34:30Z
core/integration/container_test.go
Directory struct { WithNewFile struct { File struct { ID core.FileID } } } }{} err := testutil.Query( `{ directory { withNewFile(path: "some-dir/sub-file", contents: "sub-content") { file(path: "some-dir/sub-file") { id } } } }`, &dirRes, nil) require.NoError(t, err) id := dirRes.Directory.WithNewFile.File.ID execRes := struct { Container struct { From struct { WithMountedFile struct { Exec struct { Stdout struct {
closed
dagger/dagger
https://github.com/dagger/dagger
3,266
Container: add `file`
Symmetrical to `container.directory`: returns a `FileID` while magically traversing mounts by path.
https://github.com/dagger/dagger/issues/3266
https://github.com/dagger/dagger/pull/3303
09c6e1f7a6405646a3c3733e9284ba94e959da36
44fb6275fcd9a789c905dc3570a8a506df598c36
2022-10-06T02:10:11Z
go
2022-10-12T01:34:30Z
core/integration/container_test.go
Contents string } } } } } }{} err = testutil.Query( `query Test($id: FileID!) { container { from(address: "alpine:3.16.2") { withMountedFile(path: "/mnt/file", source: $id) { exec(args: ["cat", "/mnt/file"]) { stdout { contents } } } } } }`, &execRes, &testutil.QueryOptions{Variables: map[string]any{ "id": id, }}) require.NoError(t, err) require.Equal(t, "sub-content", execRes.Container.From.WithMountedFile.Exec.Stdout.Contents) } func TestContainerWithMountedCache(t *testing.T) { t.Parallel() cacheID := newCache(t) execRes := struct {
closed
dagger/dagger
https://github.com/dagger/dagger
3,266
Container: add `file`
Symmetrical to `container.directory`: returns a `FileID` while magically traversing mounts by path.
https://github.com/dagger/dagger/issues/3266
https://github.com/dagger/dagger/pull/3303
09c6e1f7a6405646a3c3733e9284ba94e959da36
44fb6275fcd9a789c905dc3570a8a506df598c36
2022-10-06T02:10:11Z
go
2022-10-12T01:34:30Z
core/integration/container_test.go
Container struct { From struct { WithVariable struct { WithMountedCache struct { Exec struct { Stdout struct { Contents string } } } } } } }{} query := `query Test($cache: CacheID!, $rand: String!) { container { from(address: "alpine:3.16.2") {
closed
dagger/dagger
https://github.com/dagger/dagger
3,266
Container: add `file`
Symmetrical to `container.directory`: returns a `FileID` while magically traversing mounts by path.
https://github.com/dagger/dagger/issues/3266
https://github.com/dagger/dagger/pull/3303
09c6e1f7a6405646a3c3733e9284ba94e959da36
44fb6275fcd9a789c905dc3570a8a506df598c36
2022-10-06T02:10:11Z
go
2022-10-12T01:34:30Z
core/integration/container_test.go
withVariable(name: "RAND", value: $rand) { withMountedCache(path: "/mnt/cache", cache: $cache) { exec(args: ["sh", "-c", "echo $RAND >> /mnt/cache/file; cat /mnt/cache/file"]) { stdout { contents } } } } } } }` rand1 := identity.NewID() err := testutil.Query(query, &execRes, &testutil.QueryOptions{Variables: map[string]any{ "cache": cacheID, "rand": rand1, }}) require.NoError(t, err) require.Equal(t, rand1+"\n", execRes.Container.From.WithVariable.WithMountedCache.Exec.Stdout.Contents) rand2 := identity.NewID() err = testutil.Query(query, &execRes, &testutil.QueryOptions{Variables: map[string]any{ "cache": cacheID, "rand": rand2, }}) require.NoError(t, err) require.Equal(t, rand1+"\n"+rand2+"\n", execRes.Container.From.WithVariable.WithMountedCache.Exec.Stdout.Contents) } func TestContainerWithMountedCacheFromDirectory(t *testing.T) { t.Parallel() dirRes := struct {
closed
dagger/dagger
https://github.com/dagger/dagger
3,266
Container: add `file`
Symmetrical to `container.directory`: returns a `FileID` while magically traversing mounts by path.
https://github.com/dagger/dagger/issues/3266
https://github.com/dagger/dagger/pull/3303
09c6e1f7a6405646a3c3733e9284ba94e959da36
44fb6275fcd9a789c905dc3570a8a506df598c36
2022-10-06T02:10:11Z
go
2022-10-12T01:34:30Z
core/integration/container_test.go
Directory struct { WithNewFile struct { Directory struct { ID core.FileID } } } }{} err := testutil.Query( `{ directory { withNewFile(path: "some-dir/sub-file", contents: "initial-content\n") { directory(path: "some-dir") { id } } } }`, &dirRes, nil) require.NoError(t, err) initialID := dirRes.Directory.WithNewFile.Directory.ID cacheID := newCache(t) execRes := struct {
closed
dagger/dagger
https://github.com/dagger/dagger
3,266
Container: add `file`
Symmetrical to `container.directory`: returns a `FileID` while magically traversing mounts by path.
https://github.com/dagger/dagger/issues/3266
https://github.com/dagger/dagger/pull/3303
09c6e1f7a6405646a3c3733e9284ba94e959da36
44fb6275fcd9a789c905dc3570a8a506df598c36
2022-10-06T02:10:11Z
go
2022-10-12T01:34:30Z
core/integration/container_test.go
Container struct { From struct { WithVariable struct { WithMountedCache struct { Exec struct { Stdout struct { Contents string } } } } } } }{} query := `query Test($cache: CacheID!, $rand: String!, $init: DirectoryID!) { container { from(address: "alpine:3.16.2") { withVariable(name: "RAND", value: $rand) { withMountedCache(path: "/mnt/cache", cache: $cache, source: $init) { exec(args: ["sh", "-c", "echo $RAND >> /mnt/cache/sub-file; cat /mnt/cache/sub-file"]) {
closed
dagger/dagger
https://github.com/dagger/dagger
3,266
Container: add `file`
Symmetrical to `container.directory`: returns a `FileID` while magically traversing mounts by path.
https://github.com/dagger/dagger/issues/3266
https://github.com/dagger/dagger/pull/3303
09c6e1f7a6405646a3c3733e9284ba94e959da36
44fb6275fcd9a789c905dc3570a8a506df598c36
2022-10-06T02:10:11Z
go
2022-10-12T01:34:30Z
core/integration/container_test.go
stdout { contents } } } } } } }` rand1 := identity.NewID() err = testutil.Query(query, &execRes, &testutil.QueryOptions{Variables: map[string]any{ "init": initialID, "rand": rand1, "cache": cacheID, }}) require.NoError(t, err) require.Equal(t, "initial-content\n"+rand1+"\n", execRes.Container.From.WithVariable.WithMountedCache.Exec.Stdout.Contents) rand2 := identity.NewID() err = testutil.Query(query, &execRes, &testutil.QueryOptions{Variables: map[string]any{ "init": initialID, "rand": rand2, "cache": cacheID, }}) require.NoError(t, err) require.Equal(t, "initial-content\n"+rand1+"\n"+rand2+"\n", execRes.Container.From.WithVariable.WithMountedCache.Exec.Stdout.Contents) } func TestContainerWithMountedTemp(t *testing.T) { t.Parallel() execRes := struct { Container struct {
closed
dagger/dagger
https://github.com/dagger/dagger
3,266
Container: add `file`
Symmetrical to `container.directory`: returns a `FileID` while magically traversing mounts by path.
https://github.com/dagger/dagger/issues/3266
https://github.com/dagger/dagger/pull/3303
09c6e1f7a6405646a3c3733e9284ba94e959da36
44fb6275fcd9a789c905dc3570a8a506df598c36
2022-10-06T02:10:11Z
go
2022-10-12T01:34:30Z
core/integration/container_test.go
From struct { WithMountedTemp struct { Exec struct { Stdout struct { Contents string } } } } } }{} err := testutil.Query(`{ container { from(address: "alpine:3.16.2") { withMountedTemp(path: "/mnt/tmp") { exec(args: ["grep", "/mnt/tmp", "/proc/mounts"]) { stdout { contents } } } } } }`, &execRes, nil) require.NoError(t, err) require.Contains(t, execRes.Container.From.WithMountedTemp.Exec.Stdout.Contents, "tmpfs /mnt/tmp tmpfs") } func TestContainerMountsWithoutMount(t *testing.T) { t.Parallel() dirRes := struct {
closed
dagger/dagger
https://github.com/dagger/dagger
3,266
Container: add `file`
Symmetrical to `container.directory`: returns a `FileID` while magically traversing mounts by path.
https://github.com/dagger/dagger/issues/3266
https://github.com/dagger/dagger/pull/3303
09c6e1f7a6405646a3c3733e9284ba94e959da36
44fb6275fcd9a789c905dc3570a8a506df598c36
2022-10-06T02:10:11Z
go
2022-10-12T01:34:30Z
core/integration/container_test.go
Directory struct { WithNewFile struct { WithNewFile struct { ID string } } } }{} err := testutil.Query( `{ directory { withNewFile(path: "some-file", contents: "some-content") { withNewFile(path: "some-dir/sub-file", contents: "sub-content") { id } } } }`, &dirRes, nil) require.NoError(t, err) id := dirRes.Directory.WithNewFile.WithNewFile.ID execRes := struct { Container struct { From struct {
closed
dagger/dagger
https://github.com/dagger/dagger
3,266
Container: add `file`
Symmetrical to `container.directory`: returns a `FileID` while magically traversing mounts by path.
https://github.com/dagger/dagger/issues/3266
https://github.com/dagger/dagger/pull/3303
09c6e1f7a6405646a3c3733e9284ba94e959da36
44fb6275fcd9a789c905dc3570a8a506df598c36
2022-10-06T02:10:11Z
go
2022-10-12T01:34:30Z
core/integration/container_test.go
WithMountedTemp struct { Mounts []string WithMountedDirectory struct { Mounts []string Exec struct { Stdout struct { Contents string } WithoutMount struct { Mounts []string Exec struct { Stdout struct { Contents string } } } } } } } } }{} err = testutil.Query( `query Test($id: DirectoryID!) { container { from(address: "alpine:3.16.2") { withMountedTemp(path: "/mnt/tmp") { mounts withMountedDirectory(path: "/mnt/dir", source: $id) { mounts
closed
dagger/dagger
https://github.com/dagger/dagger
3,266
Container: add `file`
Symmetrical to `container.directory`: returns a `FileID` while magically traversing mounts by path.
https://github.com/dagger/dagger/issues/3266
https://github.com/dagger/dagger/pull/3303
09c6e1f7a6405646a3c3733e9284ba94e959da36
44fb6275fcd9a789c905dc3570a8a506df598c36
2022-10-06T02:10:11Z
go
2022-10-12T01:34:30Z
core/integration/container_test.go
exec(args: ["ls", "/mnt/dir"]) { stdout { contents } withoutMount(path: "/mnt/dir") { mounts exec(args: ["ls", "/mnt/dir"]) { stdout { contents } } } } } } } } }`, &execRes, &testutil.QueryOptions{Variables: map[string]any{ "id": id, }}) require.NoError(t, err) require.Equal(t, []string{"/mnt/tmp"}, execRes.Container.From.WithMountedTemp.Mounts) require.Equal(t, []string{"/mnt/tmp", "/mnt/dir"}, execRes.Container.From.WithMountedTemp.WithMountedDirectory.Mounts) require.Equal(t, "some-dir\nsome-file\n", execRes.Container.From.WithMountedTemp.WithMountedDirectory.Exec.Stdout.Contents) require.Equal(t, "", execRes.Container.From.WithMountedTemp.WithMountedDirectory.Exec.WithoutMount.Exec.Stdout.Contents) require.Equal(t, []string{"/mnt/tmp"}, execRes.Container.From.WithMountedTemp.WithMountedDirectory.Exec.WithoutMount.Mounts) } func TestContainerStackedMounts(t *testing.T) { t.Parallel() dirRes := struct {
closed
dagger/dagger
https://github.com/dagger/dagger
3,266
Container: add `file`
Symmetrical to `container.directory`: returns a `FileID` while magically traversing mounts by path.
https://github.com/dagger/dagger/issues/3266
https://github.com/dagger/dagger/pull/3303
09c6e1f7a6405646a3c3733e9284ba94e959da36
44fb6275fcd9a789c905dc3570a8a506df598c36
2022-10-06T02:10:11Z
go
2022-10-12T01:34:30Z
core/integration/container_test.go
Directory struct { WithNewFile struct { ID string } } }{} err := testutil.Query( `{ directory { withNewFile(path: "some-file", contents: "lower-content") { id } } }`, &dirRes, nil) require.NoError(t, err) lowerID := dirRes.Directory.WithNewFile.ID err = testutil.Query( `{ directory { withNewFile(path: "some-file", contents: "upper-content") { id } } }`, &dirRes, nil) require.NoError(t, err) upperID := dirRes.Directory.WithNewFile.ID execRes := struct {
closed
dagger/dagger
https://github.com/dagger/dagger
3,266
Container: add `file`
Symmetrical to `container.directory`: returns a `FileID` while magically traversing mounts by path.
https://github.com/dagger/dagger/issues/3266
https://github.com/dagger/dagger/pull/3303
09c6e1f7a6405646a3c3733e9284ba94e959da36
44fb6275fcd9a789c905dc3570a8a506df598c36
2022-10-06T02:10:11Z
go
2022-10-12T01:34:30Z
core/integration/container_test.go
Container struct { From struct { WithMountedDirectory struct { Mounts []string Exec struct { Stdout struct { Contents string } WithMountedDirectory struct { Mounts []string Exec struct { Stdout struct { Contents string } WithoutMount struct {
closed
dagger/dagger
https://github.com/dagger/dagger
3,266
Container: add `file`
Symmetrical to `container.directory`: returns a `FileID` while magically traversing mounts by path.
https://github.com/dagger/dagger/issues/3266
https://github.com/dagger/dagger/pull/3303
09c6e1f7a6405646a3c3733e9284ba94e959da36
44fb6275fcd9a789c905dc3570a8a506df598c36
2022-10-06T02:10:11Z
go
2022-10-12T01:34:30Z
core/integration/container_test.go
Mounts []string Exec struct { Stdout struct { Contents string } } } } } } } } } }{} err = testutil.Query( `query Test($lower: DirectoryID!, $upper: DirectoryID!) { container { from(address: "alpine:3.16.2") { withMountedDirectory(path: "/mnt/dir", source: $lower) { mounts exec(args: ["cat", "/mnt/dir/some-file"]) { stdout { contents } withMountedDirectory(path: "/mnt/dir", source: $upper) { mounts exec(args: ["cat", "/mnt/dir/some-file"]) { stdout { contents
closed
dagger/dagger
https://github.com/dagger/dagger
3,266
Container: add `file`
Symmetrical to `container.directory`: returns a `FileID` while magically traversing mounts by path.
https://github.com/dagger/dagger/issues/3266
https://github.com/dagger/dagger/pull/3303
09c6e1f7a6405646a3c3733e9284ba94e959da36
44fb6275fcd9a789c905dc3570a8a506df598c36
2022-10-06T02:10:11Z
go
2022-10-12T01:34:30Z
core/integration/container_test.go
} withoutMount(path: "/mnt/dir") { mounts exec(args: ["cat", "/mnt/dir/some-file"]) { stdout { contents } } } } } } } } } }`, &execRes, &testutil.QueryOptions{Variables: map[string]any{ "lower": lowerID, "upper": upperID, }}) require.NoError(t, err) require.Equal(t, []string{"/mnt/dir"}, execRes.Container.From.WithMountedDirectory.Mounts) require.Equal(t, "lower-content", execRes.Container.From.WithMountedDirectory.Exec.Stdout.Contents) require.Equal(t, []string{"/mnt/dir", "/mnt/dir"}, execRes.Container.From.WithMountedDirectory.Exec.WithMountedDirectory.Mounts) require.Equal(t, "upper-content", execRes.Container.From.WithMountedDirectory.Exec.WithMountedDirectory.Exec.Stdout.Contents) require.Equal(t, []string{"/mnt/dir"}, execRes.Container.From.WithMountedDirectory.Exec.WithMountedDirectory.Exec.WithoutMount.Mounts) require.Equal(t, "lower-content", execRes.Container.From.WithMountedDirectory.Exec.WithMountedDirectory.Exec.WithoutMount.Exec.Stdout.Contents) } func TestContainerMountDirectory(t *testing.T) { t.Parallel() dirRes := struct {
closed
dagger/dagger
https://github.com/dagger/dagger
3,266
Container: add `file`
Symmetrical to `container.directory`: returns a `FileID` while magically traversing mounts by path.
https://github.com/dagger/dagger/issues/3266
https://github.com/dagger/dagger/pull/3303
09c6e1f7a6405646a3c3733e9284ba94e959da36
44fb6275fcd9a789c905dc3570a8a506df598c36
2022-10-06T02:10:11Z
go
2022-10-12T01:34:30Z
core/integration/container_test.go
Directory struct { WithNewFile struct { WithNewFile struct { ID core.DirectoryID } } } }{} err := testutil.Query( `{ directory { withNewFile(path: "some-file", contents: "some-content") { withNewFile(path: "some-dir/sub-file", contents: "sub-content") { id } } } }`, &dirRes, nil) require.NoError(t, err) id := dirRes.Directory.WithNewFile.WithNewFile.ID writeRes := struct { Container struct { From struct { WithMountedDirectory struct { WithMountedDirectory struct { Exec struct {
closed
dagger/dagger
https://github.com/dagger/dagger
3,266
Container: add `file`
Symmetrical to `container.directory`: returns a `FileID` while magically traversing mounts by path.
https://github.com/dagger/dagger/issues/3266
https://github.com/dagger/dagger/pull/3303
09c6e1f7a6405646a3c3733e9284ba94e959da36
44fb6275fcd9a789c905dc3570a8a506df598c36
2022-10-06T02:10:11Z
go
2022-10-12T01:34:30Z
core/integration/container_test.go
Directory struct { ID core.DirectoryID } } } } } } }{} err = testutil.Query( `query Test($id: DirectoryID!) { container { from(address: "alpine:3.16.2") { withMountedDirectory(path: "/mnt/dir", source: $id) { withMountedDirectory(path: "/mnt/dir/overlap", source: $id) { exec(args: ["sh", "-c", "echo hello >> /mnt/dir/overlap/another-file"]) { directory(path: "/mnt/dir/overlap") { id } } } } } } }`, &writeRes, &testutil.QueryOptions{Variables: map[string]any{ "id": id, }}) require.NoError(t, err) writtenID := writeRes.Container.From.WithMountedDirectory.WithMountedDirectory.Exec.Directory.ID execRes := struct {
closed
dagger/dagger
https://github.com/dagger/dagger
3,266
Container: add `file`
Symmetrical to `container.directory`: returns a `FileID` while magically traversing mounts by path.
https://github.com/dagger/dagger/issues/3266
https://github.com/dagger/dagger/pull/3303
09c6e1f7a6405646a3c3733e9284ba94e959da36
44fb6275fcd9a789c905dc3570a8a506df598c36
2022-10-06T02:10:11Z
go
2022-10-12T01:34:30Z
core/integration/container_test.go
Container struct { From struct { WithMountedDirectory struct { Exec struct {
closed
dagger/dagger
https://github.com/dagger/dagger
3,266
Container: add `file`
Symmetrical to `container.directory`: returns a `FileID` while magically traversing mounts by path.
https://github.com/dagger/dagger/issues/3266
https://github.com/dagger/dagger/pull/3303
09c6e1f7a6405646a3c3733e9284ba94e959da36
44fb6275fcd9a789c905dc3570a8a506df598c36
2022-10-06T02:10:11Z
go
2022-10-12T01:34:30Z
core/integration/container_test.go
Stdout struct { Contents string } } } } } }{} err = testutil.Query( `query Test($id: DirectoryID!) { container { from(address: "alpine:3.16.2") { withMountedDirectory(path: "/mnt/dir", source: $id) { exec(args: ["cat", "/mnt/dir/another-file"]) { stdout { contents } } } } } }`, &execRes, &testutil.QueryOptions{Variables: map[string]any{ "id": writtenID, }}) require.NoError(t, err) require.Equal(t, "hello\n", execRes.Container.From.WithMountedDirectory.Exec.Stdout.Contents) } func TestContainerMountDirectoryErrors(t *testing.T) { t.Parallel() dirRes := struct {
closed
dagger/dagger
https://github.com/dagger/dagger
3,266
Container: add `file`
Symmetrical to `container.directory`: returns a `FileID` while magically traversing mounts by path.
https://github.com/dagger/dagger/issues/3266
https://github.com/dagger/dagger/pull/3303
09c6e1f7a6405646a3c3733e9284ba94e959da36
44fb6275fcd9a789c905dc3570a8a506df598c36
2022-10-06T02:10:11Z
go
2022-10-12T01:34:30Z
core/integration/container_test.go
Directory struct { WithNewFile struct { WithNewFile struct { ID core.DirectoryID } } } }{} err := testutil.Query( `{ directory {
closed
dagger/dagger
https://github.com/dagger/dagger
3,266
Container: add `file`
Symmetrical to `container.directory`: returns a `FileID` while magically traversing mounts by path.
https://github.com/dagger/dagger/issues/3266
https://github.com/dagger/dagger/pull/3303
09c6e1f7a6405646a3c3733e9284ba94e959da36
44fb6275fcd9a789c905dc3570a8a506df598c36
2022-10-06T02:10:11Z
go
2022-10-12T01:34:30Z
core/integration/container_test.go
withNewFile(path: "some-file", contents: "some-content") { withNewFile(path: "some-dir/sub-file", contents: "sub-content") { id } } } }`, &dirRes, nil) require.NoError(t, err) id := dirRes.Directory.WithNewFile.WithNewFile.ID err = testutil.Query( `query Test($id: DirectoryID!) { container { from(address: "alpine:3.16.2") { withMountedDirectory(path: "/mnt/dir", source: $id) { directory(path: "/mnt/dir/bogus") { id } } } } }`, nil, &testutil.QueryOptions{Variables: map[string]any{ "id": id, }}) require.Error(t, err) require.Contains(t, err.Error(), "bogus: no such file or directory") err = testutil.Query( `{ container { from(address: "alpine:3.16.2") { withMountedTemp(path: "/mnt/tmp") {
closed
dagger/dagger
https://github.com/dagger/dagger
3,266
Container: add `file`
Symmetrical to `container.directory`: returns a `FileID` while magically traversing mounts by path.
https://github.com/dagger/dagger/issues/3266
https://github.com/dagger/dagger/pull/3303
09c6e1f7a6405646a3c3733e9284ba94e959da36
44fb6275fcd9a789c905dc3570a8a506df598c36
2022-10-06T02:10:11Z
go
2022-10-12T01:34:30Z
core/integration/container_test.go
directory(path: "/mnt/tmp/bogus") { id } } } } }`, nil, nil) require.Error(t, err) require.Contains(t, err.Error(), "bogus: cannot retrieve directory from tmpfs") cacheID := newCache(t) err = testutil.Query( `query Test($cache: CacheID!) { container { from(address: "alpine:3.16.2") { withMountedCache(path: "/mnt/cache", cache: $cache) { directory(path: "/mnt/cache/bogus") { id } } } } }`, nil, &testutil.QueryOptions{Variables: map[string]any{ "cache": cacheID, }}) require.Error(t, err) require.Contains(t, err.Error(), "bogus: cannot retrieve directory from cache") } func TestContainerMountDirectorySourcePath(t *testing.T) { t.Parallel() dirRes := struct {
closed
dagger/dagger
https://github.com/dagger/dagger
3,266
Container: add `file`
Symmetrical to `container.directory`: returns a `FileID` while magically traversing mounts by path.
https://github.com/dagger/dagger/issues/3266
https://github.com/dagger/dagger/pull/3303
09c6e1f7a6405646a3c3733e9284ba94e959da36
44fb6275fcd9a789c905dc3570a8a506df598c36
2022-10-06T02:10:11Z
go
2022-10-12T01:34:30Z
core/integration/container_test.go
Directory struct { WithNewFile struct { Directory struct { ID core.DirectoryID } } } }{} err := testutil.Query( `{ directory { withNewFile(path: "some-dir/sub-dir/sub-file", contents: "sub-content\n") { directory(path: "some-dir") { id } } } }`, &dirRes, nil) require.NoError(t, err) id := dirRes.Directory.WithNewFile.Directory.ID writeRes := struct { Container struct { From struct { WithMountedDirectory struct { Exec struct { Directory struct {
closed
dagger/dagger
https://github.com/dagger/dagger
3,266
Container: add `file`
Symmetrical to `container.directory`: returns a `FileID` while magically traversing mounts by path.
https://github.com/dagger/dagger/issues/3266
https://github.com/dagger/dagger/pull/3303
09c6e1f7a6405646a3c3733e9284ba94e959da36
44fb6275fcd9a789c905dc3570a8a506df598c36
2022-10-06T02:10:11Z
go
2022-10-12T01:34:30Z
core/integration/container_test.go
ID core.DirectoryID } } } } } }{} err = testutil.Query( `query Test($id: DirectoryID!) { container { from(address: "alpine:3.16.2") { withMountedDirectory(path: "/mnt/dir", source: $id) { exec(args: ["sh", "-c", "echo more-content >> /mnt/dir/sub-dir/sub-file"]) { directory(path: "/mnt/dir/sub-dir") { id } } } } } }`, &writeRes, &testutil.QueryOptions{Variables: map[string]any{ "id": id, }}) require.NoError(t, err) writtenID := writeRes.Container.From.WithMountedDirectory.Exec.Directory.ID execRes := struct { Container struct { From struct { WithMountedDirectory struct { Exec struct {
closed
dagger/dagger
https://github.com/dagger/dagger
3,266
Container: add `file`
Symmetrical to `container.directory`: returns a `FileID` while magically traversing mounts by path.
https://github.com/dagger/dagger/issues/3266
https://github.com/dagger/dagger/pull/3303
09c6e1f7a6405646a3c3733e9284ba94e959da36
44fb6275fcd9a789c905dc3570a8a506df598c36
2022-10-06T02:10:11Z
go
2022-10-12T01:34:30Z
core/integration/container_test.go
Stdout struct { Contents string } } } } } }{} err = testutil.Query( `query Test($id: DirectoryID!) { container { from(address: "alpine:3.16.2") { withMountedDirectory(path: "/mnt/dir", source: $id) { exec(args: ["cat", "/mnt/dir/sub-file"]) { stdout { contents } } } } } }`, &execRes, &testutil.QueryOptions{Variables: map[string]any{ "id": writtenID, }}) require.NoError(t, err) require.Equal(t, "sub-content\nmore-content\n", execRes.Container.From.WithMountedDirectory.Exec.Stdout.Contents) } func TestContainerFSDirectory(t *testing.T) { t.Parallel() dirRes := struct {
closed
dagger/dagger
https://github.com/dagger/dagger
3,266
Container: add `file`
Symmetrical to `container.directory`: returns a `FileID` while magically traversing mounts by path.
https://github.com/dagger/dagger/issues/3266
https://github.com/dagger/dagger/pull/3303
09c6e1f7a6405646a3c3733e9284ba94e959da36
44fb6275fcd9a789c905dc3570a8a506df598c36
2022-10-06T02:10:11Z
go
2022-10-12T01:34:30Z
core/integration/container_test.go
Container struct { From struct { Directory struct { ID core.DirectoryID } } } }{} err := testutil.Query( `{ container { from(address: "alpine:3.16.2") { directory(path: "/etc") { id } } } }`, &dirRes, nil) require.NoError(t, err) etcID := dirRes.Container.From.Directory.ID execRes := struct { Container struct { From struct { WithMountedDirectory struct { Exec struct {
closed
dagger/dagger
https://github.com/dagger/dagger
3,266
Container: add `file`
Symmetrical to `container.directory`: returns a `FileID` while magically traversing mounts by path.
https://github.com/dagger/dagger/issues/3266
https://github.com/dagger/dagger/pull/3303
09c6e1f7a6405646a3c3733e9284ba94e959da36
44fb6275fcd9a789c905dc3570a8a506df598c36
2022-10-06T02:10:11Z
go
2022-10-12T01:34:30Z
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,266
Container: add `file`
Symmetrical to `container.directory`: returns a `FileID` while magically traversing mounts by path.
https://github.com/dagger/dagger/issues/3266
https://github.com/dagger/dagger/pull/3303
09c6e1f7a6405646a3c3733e9284ba94e959da36
44fb6275fcd9a789c905dc3570a8a506df598c36
2022-10-06T02:10:11Z
go
2022-10-12T01:34:30Z
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,266
Container: add `file`
Symmetrical to `container.directory`: returns a `FileID` while magically traversing mounts by path.
https://github.com/dagger/dagger/issues/3266
https://github.com/dagger/dagger/pull/3303
09c6e1f7a6405646a3c3733e9284ba94e959da36
44fb6275fcd9a789c905dc3570a8a506df598c36
2022-10-06T02:10:11Z
go
2022-10-12T01:34:30Z
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,266
Container: add `file`
Symmetrical to `container.directory`: returns a `FileID` while magically traversing mounts by path.
https://github.com/dagger/dagger/issues/3266
https://github.com/dagger/dagger/pull/3303
09c6e1f7a6405646a3c3733e9284ba94e959da36
44fb6275fcd9a789c905dc3570a8a506df598c36
2022-10-06T02:10:11Z
go
2022-10-12T01:34:30Z
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,266
Container: add `file`
Symmetrical to `container.directory`: returns a `FileID` while magically traversing mounts by path.
https://github.com/dagger/dagger/issues/3266
https://github.com/dagger/dagger/pull/3303
09c6e1f7a6405646a3c3733e9284ba94e959da36
44fb6275fcd9a789c905dc3570a8a506df598c36
2022-10-06T02:10:11Z
go
2022-10-12T01:34:30Z
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,266
Container: add `file`
Symmetrical to `container.directory`: returns a `FileID` while magically traversing mounts by path.
https://github.com/dagger/dagger/issues/3266
https://github.com/dagger/dagger/pull/3303
09c6e1f7a6405646a3c3733e9284ba94e959da36
44fb6275fcd9a789c905dc3570a8a506df598c36
2022-10-06T02:10:11Z
go
2022-10-12T01:34:30Z
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 { Container struct { From struct { WithMountedDirectory struct { Exec struct { From struct {
closed
dagger/dagger
https://github.com/dagger/dagger
3,266
Container: add `file`
Symmetrical to `container.directory`: returns a `FileID` while magically traversing mounts by path.
https://github.com/dagger/dagger/issues/3266
https://github.com/dagger/dagger/pull/3303
09c6e1f7a6405646a3c3733e9284ba94e959da36
44fb6275fcd9a789c905dc3570a8a506df598c36
2022-10-06T02:10:11Z
go
2022-10-12T01:34:30Z
core/integration/container_test.go
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"]) { from(address: "golang:1.18.2-alpine") { exec(args: ["sh", "-c", "go version >> /mnt/versions"]) { exec(args: ["cat", "/mnt/versions"]) { stdout { contents } } } } } }
closed
dagger/dagger
https://github.com/dagger/dagger
3,266
Container: add `file`
Symmetrical to `container.directory`: returns a `FileID` while magically traversing mounts by path.
https://github.com/dagger/dagger/issues/3266
https://github.com/dagger/dagger/pull/3303
09c6e1f7a6405646a3c3733e9284ba94e959da36
44fb6275fcd9a789c905dc3570a8a506df598c36
2022-10-06T02:10:11Z
go
2022-10-12T01:34:30Z
core/integration/container_test.go
} } }`, &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) { randomID := identity.NewID() err := engine.Start(context.Background(), nil, func(ctx engine.Context) error { go func() { err := ctx.Client.MakeRequest(ctx, &graphql.Request{ Query: `query RunRegistry($rand: String!) { container { from(address: "registry:2") { withVariable(name: "RANDOM", value: $rand) { exec(args: ["/etc/docker/registry/config.yml"]) { stdout { contents } stderr { contents } }
closed
dagger/dagger
https://github.com/dagger/dagger
3,266
Container: add `file`
Symmetrical to `container.directory`: returns a `FileID` while magically traversing mounts by path.
https://github.com/dagger/dagger/issues/3266
https://github.com/dagger/dagger/pull/3303
09c6e1f7a6405646a3c3733e9284ba94e959da36
44fb6275fcd9a789c905dc3570a8a506df598c36
2022-10-06T02:10:11Z
go
2022-10-12T01:34:30Z
core/integration/container_test.go
} } } }`, Variables: map[string]any{ "rand": randomID, }, }, &graphql.Response{Data: new(map[string]any)}, ) if err != nil { t.Logf("error running registry: %v", err) } }() err := ctx.Client.MakeRequest(ctx, &graphql.Request{ Query: `query WaitForRegistry($rand: String!) { container { from(address: "alpine:3.16.2") { withVariable(name: "RANDOM", value: $rand) { exec(args: ["sh", "-c", "for i in $(seq 1 60); do nc -zv 127.0.0.1 5000 && exit 0; sleep 1; done; exit 1"]) { stdout { contents } } } } } }`, Variables: map[string]any{
closed
dagger/dagger
https://github.com/dagger/dagger
3,266
Container: add `file`
Symmetrical to `container.directory`: returns a `FileID` while magically traversing mounts by path.
https://github.com/dagger/dagger/issues/3266
https://github.com/dagger/dagger/pull/3303
09c6e1f7a6405646a3c3733e9284ba94e959da36
44fb6275fcd9a789c905dc3570a8a506df598c36
2022-10-06T02:10:11Z
go
2022-10-12T01:34:30Z
core/integration/container_test.go
"rand": randomID, }, }, &graphql.Response{Data: new(map[string]any)}, ) require.NoError(t, err) testRef := core.ContainerAddress("127.0.0.1:5000/testimagepush:latest") err = ctx.Client.MakeRequest(ctx, &graphql.Request{ Query: `query TestImagePush($ref: ContainerAddress!) { container { from(address: "alpine:3.16.2") { publish(address: $ref) } } }`, Variables: map[string]any{ "ref": testRef, }, }, &graphql.Response{Data: new(map[string]any)}, ) require.NoError(t, err) res := struct { Container struct { From struct { Rootfs struct { File struct { Contents string }
closed
dagger/dagger
https://github.com/dagger/dagger
3,266
Container: add `file`
Symmetrical to `container.directory`: returns a `FileID` while magically traversing mounts by path.
https://github.com/dagger/dagger/issues/3266
https://github.com/dagger/dagger/pull/3303
09c6e1f7a6405646a3c3733e9284ba94e959da36
44fb6275fcd9a789c905dc3570a8a506df598c36
2022-10-06T02:10:11Z
go
2022-10-12T01:34:30Z
core/integration/container_test.go
} } } }{} err = ctx.Client.MakeRequest(ctx, &graphql.Request{ Query: `query TestImagePull($ref: ContainerAddress!) { container { from(address: $ref) { rootfs { file(path: "/etc/alpine-release") { contents } } } } }`, Variables: map[string]any{ "ref": testRef, }, }, &graphql.Response{Data: &res}, ) require.NoError(t, err) require.Equal(t, res.Container.From.Rootfs.File.Contents, "3.16.2\n") return nil }) require.NoError(t, err) }
closed
dagger/dagger
https://github.com/dagger/dagger
3,266
Container: add `file`
Symmetrical to `container.directory`: returns a `FileID` while magically traversing mounts by path.
https://github.com/dagger/dagger/issues/3266
https://github.com/dagger/dagger/pull/3303
09c6e1f7a6405646a3c3733e9284ba94e959da36
44fb6275fcd9a789c905dc3570a8a506df598c36
2022-10-06T02:10:11Z
go
2022-10-12T01:34:30Z
core/integration/secret_test.go
package core import ( "testing" "github.com/stretchr/testify/require" "go.dagger.io/dagger/core" "go.dagger.io/dagger/internal/testutil" ) func TestSecretEnvFromFile(t *testing.T) { t.Parallel() secretID := secretID(t, "some-content") var envRes struct { Container struct {
closed
dagger/dagger
https://github.com/dagger/dagger
3,266
Container: add `file`
Symmetrical to `container.directory`: returns a `FileID` while magically traversing mounts by path.
https://github.com/dagger/dagger/issues/3266
https://github.com/dagger/dagger/pull/3303
09c6e1f7a6405646a3c3733e9284ba94e959da36
44fb6275fcd9a789c905dc3570a8a506df598c36
2022-10-06T02:10:11Z
go
2022-10-12T01:34:30Z
core/integration/secret_test.go
From struct { WithSecretVariable struct { Exec struct { Stdout struct{ Contents string } } } } } } err := testutil.Query( `query Test($secret: SecretID!) { container { from(address: "alpine:3.16.2") { withSecretVariable(name: "SECRET", secret: $secret) { exec(args: ["env"]) { stdout { contents } } } } } }`, &envRes, &testutil.QueryOptions{Variables: map[string]any{ "secret": secretID, }}) require.NoError(t, err) require.Contains(t, envRes.Container.From.WithSecretVariable.Exec.Stdout.Contents, "SECRET=some-content\n") } func TestSecretMountFromFile(t *testing.T) { t.Parallel() secretID := secretID(t, "some-content") var envRes struct {
closed
dagger/dagger
https://github.com/dagger/dagger
3,266
Container: add `file`
Symmetrical to `container.directory`: returns a `FileID` while magically traversing mounts by path.
https://github.com/dagger/dagger/issues/3266
https://github.com/dagger/dagger/pull/3303
09c6e1f7a6405646a3c3733e9284ba94e959da36
44fb6275fcd9a789c905dc3570a8a506df598c36
2022-10-06T02:10:11Z
go
2022-10-12T01:34:30Z
core/integration/secret_test.go
Container struct { From struct { WithMountedSecret struct { Exec struct { Stdout struct{ Contents string } } } } } } err := testutil.Query( `query Test($secret: SecretID!) { container { from(address: "alpine:3.16.2") { withMountedSecret(path: "/sekret", source: $secret) { exec(args: ["cat", "/sekret"]) { stdout { contents } } } } } }`, &envRes, &testutil.QueryOptions{Variables: map[string]any{ "secret": secretID, }}) require.NoError(t, err) require.Contains(t, envRes.Container.From.WithMountedSecret.Exec.Stdout.Contents, "some-content") } func secretID(t *testing.T, content string) core.SecretID { var secretRes struct {
closed
dagger/dagger
https://github.com/dagger/dagger
3,266
Container: add `file`
Symmetrical to `container.directory`: returns a `FileID` while magically traversing mounts by path.
https://github.com/dagger/dagger/issues/3266
https://github.com/dagger/dagger/pull/3303
09c6e1f7a6405646a3c3733e9284ba94e959da36
44fb6275fcd9a789c905dc3570a8a506df598c36
2022-10-06T02:10:11Z
go
2022-10-12T01:34:30Z
core/integration/secret_test.go
Directory struct { WithNewFile struct { File struct { Secret struct { ID core.SecretID } } } } } err := testutil.Query( `query Test($content: String!) { directory { withNewFile(path: "some-file", contents: $content) { file(path: "some-file") { secret { id } } } } }`, &secretRes, &testutil.QueryOptions{Variables: map[string]any{ "content": content, }}) require.NoError(t, err) secretID := secretRes.Directory.WithNewFile.File.Secret.ID require.NotEmpty(t, secretID) return secretID }
closed
dagger/dagger
https://github.com/dagger/dagger
3,266
Container: add `file`
Symmetrical to `container.directory`: returns a `FileID` while magically traversing mounts by path.
https://github.com/dagger/dagger/issues/3266
https://github.com/dagger/dagger/pull/3303
09c6e1f7a6405646a3c3733e9284ba94e959da36
44fb6275fcd9a789c905dc3570a8a506df598c36
2022-10-06T02:10:11Z
go
2022-10-12T01:34:30Z
core/integration/suite_test.go
package core import ( "testing" "github.com/moby/buildkit/identity" "github.com/stretchr/testify/require" "go.dagger.io/dagger/core" "go.dagger.io/dagger/internal/testutil" ) func init() { if err := testutil.SetupBuildkitd(); err != nil { panic(err) } } func newCache(t *testing.T) core.CacheID { var res struct {
closed
dagger/dagger
https://github.com/dagger/dagger
3,266
Container: add `file`
Symmetrical to `container.directory`: returns a `FileID` while magically traversing mounts by path.
https://github.com/dagger/dagger/issues/3266
https://github.com/dagger/dagger/pull/3303
09c6e1f7a6405646a3c3733e9284ba94e959da36
44fb6275fcd9a789c905dc3570a8a506df598c36
2022-10-06T02:10:11Z
go
2022-10-12T01:34:30Z
core/integration/suite_test.go
CacheFromTokens struct { ID core.CacheID } } err := testutil.Query(` query CreateCache($token: String!) { cacheFromTokens(tokens: [$token]) { id } } `, &res, &testutil.QueryOptions{Variables: map[string]any{ "token": identity.NewID(), }}) require.NoError(t, err) return res.CacheFromTokens.ID }
closed
dagger/dagger
https://github.com/dagger/dagger
3,266
Container: add `file`
Symmetrical to `container.directory`: returns a `FileID` while magically traversing mounts by path.
https://github.com/dagger/dagger/issues/3266
https://github.com/dagger/dagger/pull/3303
09c6e1f7a6405646a3c3733e9284ba94e959da36
44fb6275fcd9a789c905dc3570a8a506df598c36
2022-10-06T02:10:11Z
go
2022-10-12T01:34:30Z
core/schema/container.go
package schema import ( "encoding/json" "fmt" "path" "strings" "github.com/docker/distribution/reference" "github.com/moby/buildkit/client/llb" specs "github.com/opencontainers/image-spec/specs-go/v1" "go.dagger.io/dagger/core" "go.dagger.io/dagger/router" ) type containerSchema struct {
closed
dagger/dagger
https://github.com/dagger/dagger
3,266
Container: add `file`
Symmetrical to `container.directory`: returns a `FileID` while magically traversing mounts by path.
https://github.com/dagger/dagger/issues/3266
https://github.com/dagger/dagger/pull/3303
09c6e1f7a6405646a3c3733e9284ba94e959da36
44fb6275fcd9a789c905dc3570a8a506df598c36
2022-10-06T02:10:11Z
go
2022-10-12T01:34:30Z
core/schema/container.go
*baseSchema } var _ router.ExecutableSchema = &containerSchema{} func (s *containerSchema) Name() string { return "container" } func (s *containerSchema) Schema() string { return Container } func (s *containerSchema) Resolvers() router.Resolvers { return router.Resolvers{ "ContainerID": stringResolver(core.ContainerID("")), "ContainerAddress": stringResolver(core.ContainerAddress("")), "Query": router.ObjectResolver{ "container": router.ToResolver(s.container), }, "Container": router.ObjectResolver{ "from": router.ToResolver(s.from), "rootfs": router.ToResolver(s.rootfs), "directory": router.ToResolver(s.directory), "user": router.ToResolver(s.user), "withUser": router.ToResolver(s.withUser),
closed
dagger/dagger
https://github.com/dagger/dagger
3,266
Container: add `file`
Symmetrical to `container.directory`: returns a `FileID` while magically traversing mounts by path.
https://github.com/dagger/dagger/issues/3266
https://github.com/dagger/dagger/pull/3303
09c6e1f7a6405646a3c3733e9284ba94e959da36
44fb6275fcd9a789c905dc3570a8a506df598c36
2022-10-06T02:10:11Z
go
2022-10-12T01:34:30Z
core/schema/container.go
"workdir": router.ToResolver(s.workdir), "withWorkdir": router.ToResolver(s.withWorkdir), "variables": router.ToResolver(s.variables), "variable": router.ToResolver(s.variable), "withVariable": router.ToResolver(s.withVariable), "withSecretVariable": router.ToResolver(s.withSecretVariable), "withoutVariable": router.ToResolver(s.withoutVariable), "entrypoint": router.ToResolver(s.entrypoint), "withEntrypoint": router.ToResolver(s.withEntrypoint), "defaultArgs": router.ToResolver(s.defaultArgs), "withDefaultArgs": router.ToResolver(s.withDefaultArgs), "mounts": router.ToResolver(s.mounts), "withMountedDirectory": router.ToResolver(s.withMountedDirectory), "withMountedFile": router.ToResolver(s.withMountedFile), "withMountedTemp": router.ToResolver(s.withMountedTemp), "withMountedCache": router.ToResolver(s.withMountedCache), "withMountedSecret": router.ToResolver(s.withMountedSecret), "withoutMount": router.ToResolver(s.withoutMount), "exec": router.ToResolver(s.exec), "exitCode": router.ToResolver(s.exitCode), "stdout": router.ToResolver(s.stdout), "stderr": router.ToResolver(s.stderr), "publish": router.ToResolver(s.publish), }, } } func (s *containerSchema) Dependencies() []router.ExecutableSchema { return nil } type containerArgs struct {
closed
dagger/dagger
https://github.com/dagger/dagger
3,266
Container: add `file`
Symmetrical to `container.directory`: returns a `FileID` while magically traversing mounts by path.
https://github.com/dagger/dagger/issues/3266
https://github.com/dagger/dagger/pull/3303
09c6e1f7a6405646a3c3733e9284ba94e959da36
44fb6275fcd9a789c905dc3570a8a506df598c36
2022-10-06T02:10:11Z
go
2022-10-12T01:34:30Z
core/schema/container.go
ID core.ContainerID } func (s *containerSchema) container(ctx *router.Context, parent any, args containerArgs) (*core.Container, error) { return &core.Container{ ID: args.ID, }, nil } type containerFromArgs struct { Address core.ContainerAddress } func (s *containerSchema) from(ctx *router.Context, parent *core.Container, args containerFromArgs) (*core.Container, error) { addr := string(args.Address) refName, err := reference.ParseNormalizedNamed(addr) if err != nil { return nil, err } ref := reference.TagNameOnly(refName).String() _, cfgBytes, err := s.gw.ResolveImageConfig(ctx, ref, llb.ResolveImageConfigOpt{ Platform: &s.platform, ResolveMode: llb.ResolveModeDefault.String(), }) if err != nil { return nil, err } var imgSpec specs.Image if err := json.Unmarshal(cfgBytes, &imgSpec); err != nil { return nil, err
closed
dagger/dagger
https://github.com/dagger/dagger
3,266
Container: add `file`
Symmetrical to `container.directory`: returns a `FileID` while magically traversing mounts by path.
https://github.com/dagger/dagger/issues/3266
https://github.com/dagger/dagger/pull/3303
09c6e1f7a6405646a3c3733e9284ba94e959da36
44fb6275fcd9a789c905dc3570a8a506df598c36
2022-10-06T02:10:11Z
go
2022-10-12T01:34:30Z
core/schema/container.go
} ctr, err := parent.WithFS(ctx, llb.Image(addr), s.platform) if err != nil { return nil, err } return ctr.UpdateImageConfig(ctx, func(specs.ImageConfig) specs.ImageConfig { return imgSpec.Config }) } func (s *containerSchema) rootfs(ctx *router.Context, parent *core.Container, args any) (*core.Directory, error) { return parent.FS(ctx) } type containerExecArgs struct { Args *[]string Opts core.ContainerExecOpts } func (s *containerSchema) exec(ctx *router.Context, parent *core.Container, args containerExecArgs) (*core.Container, error) { return parent.Exec(ctx, s.gw, args.Args, args.Opts) } func (s *containerSchema) exitCode(ctx *router.Context, parent *core.Container, args any) (*int, error) { return parent.ExitCode(ctx, s.gw) } func (s *containerSchema) stdout(ctx *router.Context, parent *core.Container, args any) (*core.File, error) { return parent.MetaFile(ctx, s.gw, "stdout") } func (s *containerSchema) stderr(ctx *router.Context, parent *core.Container, args any) (*core.File, error) { return parent.MetaFile(ctx, s.gw, "stderr") } type containerWithEntrypointArgs struct {
closed
dagger/dagger
https://github.com/dagger/dagger
3,266
Container: add `file`
Symmetrical to `container.directory`: returns a `FileID` while magically traversing mounts by path.
https://github.com/dagger/dagger/issues/3266
https://github.com/dagger/dagger/pull/3303
09c6e1f7a6405646a3c3733e9284ba94e959da36
44fb6275fcd9a789c905dc3570a8a506df598c36
2022-10-06T02:10:11Z
go
2022-10-12T01:34:30Z
core/schema/container.go
Args []string } func (s *containerSchema) withEntrypoint(ctx *router.Context, parent *core.Container, args containerWithEntrypointArgs) (*core.Container, error) { return parent.UpdateImageConfig(ctx, func(cfg specs.ImageConfig) specs.ImageConfig { cfg.Entrypoint = args.Args return cfg }) } func (s *containerSchema) entrypoint(ctx *router.Context, parent *core.Container, args containerWithVariableArgs) ([]string, error) { cfg, err := parent.ImageConfig(ctx) if err != nil { return nil, err } return cfg.Entrypoint, nil } type containerWithDefaultArgs struct {
closed
dagger/dagger
https://github.com/dagger/dagger
3,266
Container: add `file`
Symmetrical to `container.directory`: returns a `FileID` while magically traversing mounts by path.
https://github.com/dagger/dagger/issues/3266
https://github.com/dagger/dagger/pull/3303
09c6e1f7a6405646a3c3733e9284ba94e959da36
44fb6275fcd9a789c905dc3570a8a506df598c36
2022-10-06T02:10:11Z
go
2022-10-12T01:34:30Z
core/schema/container.go
Args *[]string } func (s *containerSchema) withDefaultArgs(ctx *router.Context, parent *core.Container, args containerWithDefaultArgs) (*core.Container, error) { return parent.UpdateImageConfig(ctx, func(cfg specs.ImageConfig) specs.ImageConfig { if args.Args == nil { cfg.Cmd = []string{} return cfg } cfg.Cmd = *args.Args return cfg }) } func (s *containerSchema) defaultArgs(ctx *router.Context, parent *core.Container, args any) ([]string, error) { cfg, err := parent.ImageConfig(ctx) if err != nil { return nil, err } return cfg.Cmd, nil } type containerWithUserArgs struct {
closed
dagger/dagger
https://github.com/dagger/dagger
3,266
Container: add `file`
Symmetrical to `container.directory`: returns a `FileID` while magically traversing mounts by path.
https://github.com/dagger/dagger/issues/3266
https://github.com/dagger/dagger/pull/3303
09c6e1f7a6405646a3c3733e9284ba94e959da36
44fb6275fcd9a789c905dc3570a8a506df598c36
2022-10-06T02:10:11Z
go
2022-10-12T01:34:30Z
core/schema/container.go
Name string } func (s *containerSchema) withUser(ctx *router.Context, parent *core.Container, args containerWithUserArgs) (*core.Container, error) { return parent.UpdateImageConfig(ctx, func(cfg specs.ImageConfig) specs.ImageConfig { cfg.User = args.Name return cfg }) } func (s *containerSchema) user(ctx *router.Context, parent *core.Container, args containerWithVariableArgs) (string, error) { cfg, err := parent.ImageConfig(ctx) if err != nil { return "", err } return cfg.User, nil } type containerWithWorkdirArgs struct {
closed
dagger/dagger
https://github.com/dagger/dagger
3,266
Container: add `file`
Symmetrical to `container.directory`: returns a `FileID` while magically traversing mounts by path.
https://github.com/dagger/dagger/issues/3266
https://github.com/dagger/dagger/pull/3303
09c6e1f7a6405646a3c3733e9284ba94e959da36
44fb6275fcd9a789c905dc3570a8a506df598c36
2022-10-06T02:10:11Z
go
2022-10-12T01:34:30Z
core/schema/container.go
Path string } func (s *containerSchema) withWorkdir(ctx *router.Context, parent *core.Container, args containerWithWorkdirArgs) (*core.Container, error) { return parent.UpdateImageConfig(ctx, func(cfg specs.ImageConfig) specs.ImageConfig { cfg.WorkingDir = absPath(cfg.WorkingDir, args.Path) return cfg }) } func (s *containerSchema) workdir(ctx *router.Context, parent *core.Container, args containerWithVariableArgs) (string, error) { cfg, err := parent.ImageConfig(ctx) if err != nil { return "", err } return cfg.WorkingDir, nil } type containerWithVariableArgs struct {
closed
dagger/dagger
https://github.com/dagger/dagger
3,266
Container: add `file`
Symmetrical to `container.directory`: returns a `FileID` while magically traversing mounts by path.
https://github.com/dagger/dagger/issues/3266
https://github.com/dagger/dagger/pull/3303
09c6e1f7a6405646a3c3733e9284ba94e959da36
44fb6275fcd9a789c905dc3570a8a506df598c36
2022-10-06T02:10:11Z
go
2022-10-12T01:34:30Z
core/schema/container.go
Name string Value string } func (s *containerSchema) withVariable(ctx *router.Context, parent *core.Container, args containerWithVariableArgs) (*core.Container, error) { return parent.UpdateImageConfig(ctx, func(cfg specs.ImageConfig) specs.ImageConfig { newEnv := []string{} prefix := args.Name + "=" for _, env := range cfg.Env { if !strings.HasPrefix(env, prefix) { newEnv = append(newEnv, env) } } newEnv = append(newEnv, fmt.Sprintf("%s=%s", args.Name, args.Value)) cfg.Env = newEnv return cfg }) } type containerWithoutVariableArgs struct {
closed
dagger/dagger
https://github.com/dagger/dagger
3,266
Container: add `file`
Symmetrical to `container.directory`: returns a `FileID` while magically traversing mounts by path.
https://github.com/dagger/dagger/issues/3266
https://github.com/dagger/dagger/pull/3303
09c6e1f7a6405646a3c3733e9284ba94e959da36
44fb6275fcd9a789c905dc3570a8a506df598c36
2022-10-06T02:10:11Z
go
2022-10-12T01:34:30Z
core/schema/container.go
Name string } func (s *containerSchema) withoutVariable(ctx *router.Context, parent *core.Container, args containerWithoutVariableArgs) (*core.Container, error) { return parent.UpdateImageConfig(ctx, func(cfg specs.ImageConfig) specs.ImageConfig { removedEnv := []string{} prefix := args.Name + "=" for _, env := range cfg.Env { if !strings.HasPrefix(env, prefix) { removedEnv = append(removedEnv, env) } } cfg.Env = removedEnv return cfg }) } func (s *containerSchema) variables(ctx *router.Context, parent *core.Container, args any) ([]string, error) { cfg, err := parent.ImageConfig(ctx) if err != nil { return nil, err } return cfg.Env, nil } type containerVariableArgs struct {
closed
dagger/dagger
https://github.com/dagger/dagger
3,266
Container: add `file`
Symmetrical to `container.directory`: returns a `FileID` while magically traversing mounts by path.
https://github.com/dagger/dagger/issues/3266
https://github.com/dagger/dagger/pull/3303
09c6e1f7a6405646a3c3733e9284ba94e959da36
44fb6275fcd9a789c905dc3570a8a506df598c36
2022-10-06T02:10:11Z
go
2022-10-12T01:34:30Z
core/schema/container.go
Name string } func (s *containerSchema) variable(ctx *router.Context, parent *core.Container, args containerVariableArgs) (*string, error) { cfg, err := parent.ImageConfig(ctx) if err != nil { return nil, err } for _, env := range cfg.Env { name, val, ok := strings.Cut(env, "=") if ok && name == args.Name { return &val, nil } } return nil, nil } type containerWithMountedDirectoryArgs struct {
closed
dagger/dagger
https://github.com/dagger/dagger
3,266
Container: add `file`
Symmetrical to `container.directory`: returns a `FileID` while magically traversing mounts by path.
https://github.com/dagger/dagger/issues/3266
https://github.com/dagger/dagger/pull/3303
09c6e1f7a6405646a3c3733e9284ba94e959da36
44fb6275fcd9a789c905dc3570a8a506df598c36
2022-10-06T02:10:11Z
go
2022-10-12T01:34:30Z
core/schema/container.go
Path string Source core.DirectoryID } func (s *containerSchema) withMountedDirectory(ctx *router.Context, parent *core.Container, args containerWithMountedDirectoryArgs) (*core.Container, error) { return parent.WithMountedDirectory(ctx, args.Path, &core.Directory{ID: args.Source}) } type containerPublishArgs struct { Address core.ContainerAddress } func (s *containerSchema) publish(ctx *router.Context, parent *core.Container, args containerPublishArgs) (core.ContainerAddress, error) { return parent.Publish(ctx, args.Address, s.bkClient, s.solveOpts, s.solveCh) } type containerWithMountedFileArgs struct { Path string Source core.FileID } func (s *containerSchema) withMountedFile(ctx *router.Context, parent *core.Container, args containerWithMountedFileArgs) (*core.Container, error) { return parent.WithMountedFile(ctx, args.Path, &core.File{ID: args.Source}) } type containerWithMountedCacheArgs struct {
closed
dagger/dagger
https://github.com/dagger/dagger
3,266
Container: add `file`
Symmetrical to `container.directory`: returns a `FileID` while magically traversing mounts by path.
https://github.com/dagger/dagger/issues/3266
https://github.com/dagger/dagger/pull/3303
09c6e1f7a6405646a3c3733e9284ba94e959da36
44fb6275fcd9a789c905dc3570a8a506df598c36
2022-10-06T02:10:11Z
go
2022-10-12T01:34:30Z
core/schema/container.go
Path string Cache core.CacheID Source core.DirectoryID } func (s *containerSchema) withMountedCache(ctx *router.Context, parent *core.Container, args containerWithMountedCacheArgs) (*core.Container, error) { var dir *core.Directory if args.Source != "" { dir = &core.Directory{ID: args.Source} } return parent.WithMountedCache(ctx, args.Path, args.Cache, dir) } type containerWithMountedTempArgs struct { Path string } func (s *containerSchema) withMountedTemp(ctx *router.Context, parent *core.Container, args containerWithMountedTempArgs) (*core.Container, error) { return parent.WithMountedTemp(ctx, args.Path) } type containerWithoutMountArgs struct { Path string } func (s *containerSchema) withoutMount(ctx *router.Context, parent *core.Container, args containerWithoutMountArgs) (*core.Container, error) { return parent.WithoutMount(ctx, args.Path) } func (s *containerSchema) mounts(ctx *router.Context, parent *core.Container, _ any) ([]string, error) { return parent.Mounts(ctx) } type containerDirectoryArgs struct {
closed
dagger/dagger
https://github.com/dagger/dagger
3,266
Container: add `file`
Symmetrical to `container.directory`: returns a `FileID` while magically traversing mounts by path.
https://github.com/dagger/dagger/issues/3266
https://github.com/dagger/dagger/pull/3303
09c6e1f7a6405646a3c3733e9284ba94e959da36
44fb6275fcd9a789c905dc3570a8a506df598c36
2022-10-06T02:10:11Z
go
2022-10-12T01:34:30Z
core/schema/container.go
Path string } func (s *containerSchema) directory(ctx *router.Context, parent *core.Container, args containerDirectoryArgs) (*core.Directory, error) { return parent.Directory(ctx, s.gw, args.Path) } func absPath(workDir string, containerPath string) string { if path.IsAbs(containerPath) { return containerPath } if workDir == "" { workDir = "/" } return path.Join(workDir, containerPath) } type containerWithSecretVariableArgs struct { Name string Secret core.SecretID } func (s *containerSchema) withSecretVariable(ctx *router.Context, parent *core.Container, args containerWithSecretVariableArgs) (*core.Container, error) { return parent.WithSecretVariable(ctx, args.Name, &core.Secret{ID: args.Secret}) } type containerWithMountedSecretArgs struct { Path string Source core.SecretID } func (s *containerSchema) withMountedSecret(ctx *router.Context, parent *core.Container, args containerWithMountedSecretArgs) (*core.Container, error) { return parent.WithMountedSecret(ctx, args.Path, core.NewSecret(args.Source)) }
closed
dagger/dagger
https://github.com/dagger/dagger
3,315
Respect container exec opts (stdio redirects)
`ContainerExecOpts` is currently ignored
https://github.com/dagger/dagger/issues/3315
https://github.com/dagger/dagger/pull/3331
d988bac255771bfaa2967fe84ffb9bc421927e4e
c5b941d438bcf744deb8f103657d4f264973ab45
2022-10-11T20:01:24Z
go
2022-10-13T21:37:08Z
core/container.go
package core import ( "context" "encoding/json" "fmt" "path" "strconv" "strings" bkclient "github.com/moby/buildkit/client" "github.com/moby/buildkit/client/llb" "github.com/moby/buildkit/exporter/containerimage/exptypes" bkgw "github.com/moby/buildkit/frontend/gateway/client" "github.com/moby/buildkit/solver/pb" specs "github.com/opencontainers/image-spec/specs-go/v1" "github.com/pkg/errors" "go.dagger.io/dagger/core/shim" ) type Container struct {
closed
dagger/dagger
https://github.com/dagger/dagger
3,315
Respect container exec opts (stdio redirects)
`ContainerExecOpts` is currently ignored
https://github.com/dagger/dagger/issues/3315
https://github.com/dagger/dagger/pull/3331
d988bac255771bfaa2967fe84ffb9bc421927e4e
c5b941d438bcf744deb8f103657d4f264973ab45
2022-10-11T20:01:24Z
go
2022-10-13T21:37:08Z
core/container.go
ID ContainerID `json:"id"` } type ContainerAddress string type ContainerID string func (id ContainerID) decode() (*containerIDPayload, error) { if id == "" { return &containerIDPayload{}, nil } var payload containerIDPayload if err := decodeID(&payload, id); err != nil { return nil, err } return &payload, nil } type containerIDPayload struct { FS *pb.Definition `json:"fs"` Config specs.ImageConfig `json:"cfg"` Mounts []ContainerMount `json:"mounts,omitempty"` Meta *pb.Definition `json:"meta,omitempty"` Platform specs.Platform `json:"platform,omitempty"` Secrets []ContainerSecret `json:"secret_env,omitempty"` } type ContainerSecret struct {
closed
dagger/dagger
https://github.com/dagger/dagger
3,315
Respect container exec opts (stdio redirects)
`ContainerExecOpts` is currently ignored
https://github.com/dagger/dagger/issues/3315
https://github.com/dagger/dagger/pull/3331
d988bac255771bfaa2967fe84ffb9bc421927e4e
c5b941d438bcf744deb8f103657d4f264973ab45
2022-10-11T20:01:24Z
go
2022-10-13T21:37:08Z
core/container.go
Secret SecretID `json:"secret"` EnvName string `json:"env,omitempty"` MountPath string `json:"path,omitempty"` } func (payload *containerIDPayload) Encode() (ContainerID, error) { id, err := encodeID(payload) if err != nil { return "", err } return ContainerID(id), nil } func (payload *containerIDPayload) FSState() (llb.State, error) { if payload.FS == nil { return llb.Scratch(), nil } return defToState(payload.FS) } const metaMount = "/dagger" const metaSourcePath = "meta" func (payload *containerIDPayload) MetaState() (*llb.State, error) { if payload.Meta == nil { return nil, nil } metaSt, err := defToState(payload.Meta) if err != nil { return nil, err } return &metaSt, nil } type ContainerMount struct {
closed
dagger/dagger
https://github.com/dagger/dagger
3,315
Respect container exec opts (stdio redirects)
`ContainerExecOpts` is currently ignored
https://github.com/dagger/dagger/issues/3315
https://github.com/dagger/dagger/pull/3331
d988bac255771bfaa2967fe84ffb9bc421927e4e
c5b941d438bcf744deb8f103657d4f264973ab45
2022-10-11T20:01:24Z
go
2022-10-13T21:37:08Z
core/container.go
Source *pb.Definition `json:"source,omitempty"` SourcePath string `json:"source_path,omitempty"` Target string `json:"target"` CacheID string `json:"cache_id,omitempty"` CacheSharingMode string `json:"cache_sharing,omitempty"` Tmpfs bool `json:"tmpfs,omitempty"` } func (mnt ContainerMount) SourceState() (llb.State, error) { if mnt.Source == nil { return llb.Scratch(), nil } return defToState(mnt.Source) } func (container *Container) FS(ctx context.Context) (*Directory, error) { payload, err := container.ID.decode() if err != nil {
closed
dagger/dagger
https://github.com/dagger/dagger
3,315
Respect container exec opts (stdio redirects)
`ContainerExecOpts` is currently ignored
https://github.com/dagger/dagger/issues/3315
https://github.com/dagger/dagger/pull/3331
d988bac255771bfaa2967fe84ffb9bc421927e4e
c5b941d438bcf744deb8f103657d4f264973ab45
2022-10-11T20:01:24Z
go
2022-10-13T21:37:08Z
core/container.go
return nil, err } st, err := payload.FSState() if err != nil { return nil, err } return NewDirectory(ctx, st, "", payload.Platform) } func (container *Container) WithFS(ctx context.Context, dir *Directory, platform specs.Platform) (*Container, error) { payload, err := container.ID.decode() if err != nil { return nil, err } dirPayload, err := dir.ID.decode() if err != nil { return nil, err } payload.FS = dirPayload.LLB payload.Platform = platform id, err := payload.Encode() if err != nil { return nil, err } return &Container{ID: id}, nil } func (container *Container) WithMountedDirectory(ctx context.Context, target string, source *Directory) (*Container, error) { return container.withMounted(ctx, target, source) } func (container *Container) WithMountedFile(ctx context.Context, target string, source *File) (*Container, error) { return container.withMounted(ctx, target, source)
closed
dagger/dagger
https://github.com/dagger/dagger
3,315
Respect container exec opts (stdio redirects)
`ContainerExecOpts` is currently ignored
https://github.com/dagger/dagger/issues/3315
https://github.com/dagger/dagger/pull/3331
d988bac255771bfaa2967fe84ffb9bc421927e4e
c5b941d438bcf744deb8f103657d4f264973ab45
2022-10-11T20:01:24Z
go
2022-10-13T21:37:08Z
core/container.go
} func (container *Container) WithMountedCache(ctx context.Context, target string, cache CacheID, source *Directory) (*Container, error) { payload, err := container.ID.decode() if err != nil { return nil, err } cachePayload, err := cache.decode() if err != nil { return nil, err } target = absPath(payload.Config.WorkingDir, target) mount := ContainerMount{ Target: target, CacheID: cachePayload.Sum(), CacheSharingMode: "shared", } if source != nil { dirSt, dirRel, dirPlatform, err := source.Decode() if err != nil { return nil, err } dirDef, err := dirSt.Marshal(ctx, llb.Platform(dirPlatform)) if err != nil { return nil, err } mount.Source = dirDef.ToPB() mount.SourcePath = dirRel } payload.Mounts = append(payload.Mounts, mount) id, err := payload.Encode()
closed
dagger/dagger
https://github.com/dagger/dagger
3,315
Respect container exec opts (stdio redirects)
`ContainerExecOpts` is currently ignored
https://github.com/dagger/dagger/issues/3315
https://github.com/dagger/dagger/pull/3331
d988bac255771bfaa2967fe84ffb9bc421927e4e
c5b941d438bcf744deb8f103657d4f264973ab45
2022-10-11T20:01:24Z
go
2022-10-13T21:37:08Z
core/container.go
if err != nil { return nil, err } return &Container{ID: id}, nil } func (container *Container) WithMountedTemp(ctx context.Context, target string) (*Container, error) { payload, err := container.ID.decode() if err != nil { return nil, err } target = absPath(payload.Config.WorkingDir, target) payload.Mounts = append(payload.Mounts, ContainerMount{ Target: target, Tmpfs: true, }) id, err := payload.Encode() if err != nil { return nil, err } return &Container{ID: id}, nil } func (container *Container) WithMountedSecret(ctx context.Context, target string, source *Secret) (*Container, error) { payload, err := container.ID.decode() if err != nil { return nil, err } target = absPath(payload.Config.WorkingDir, target) payload.Secrets = append(payload.Secrets, ContainerSecret{ Secret: source.ID, MountPath: target,
closed
dagger/dagger
https://github.com/dagger/dagger
3,315
Respect container exec opts (stdio redirects)
`ContainerExecOpts` is currently ignored
https://github.com/dagger/dagger/issues/3315
https://github.com/dagger/dagger/pull/3331
d988bac255771bfaa2967fe84ffb9bc421927e4e
c5b941d438bcf744deb8f103657d4f264973ab45
2022-10-11T20:01:24Z
go
2022-10-13T21:37:08Z
core/container.go
}) id, err := payload.Encode() if err != nil { return nil, err } return &Container{ID: id}, nil } func (container *Container) WithoutMount(ctx context.Context, target string) (*Container, error) { payload, err := container.ID.decode() if err != nil { return nil, err } target = absPath(payload.Config.WorkingDir, target) var found bool var foundIdx int for i := len(payload.Mounts) - 1; i >= 0; i-- { if payload.Mounts[i].Target == target { found = true foundIdx = i break } } if found { payload.Mounts = append(payload.Mounts[:foundIdx], payload.Mounts[foundIdx+1:]...) } id, err := payload.Encode() if err != nil { return nil, err } return &Container{ID: id}, nil
closed
dagger/dagger
https://github.com/dagger/dagger
3,315
Respect container exec opts (stdio redirects)
`ContainerExecOpts` is currently ignored
https://github.com/dagger/dagger/issues/3315
https://github.com/dagger/dagger/pull/3331
d988bac255771bfaa2967fe84ffb9bc421927e4e
c5b941d438bcf744deb8f103657d4f264973ab45
2022-10-11T20:01:24Z
go
2022-10-13T21:37:08Z
core/container.go
} func (container *Container) Mounts(ctx context.Context) ([]string, error) { payload, err := container.ID.decode() if err != nil { return nil, err } mounts := []string{} for _, mnt := range payload.Mounts { mounts = append(mounts, mnt.Target) } return mounts, nil } func (container *Container) WithSecretVariable(ctx context.Context, name string, secret *Secret) (*Container, error) { payload, err := container.ID.decode() if err != nil { return nil, err } payload.Secrets = append(payload.Secrets, ContainerSecret{ Secret: secret.ID, EnvName: name, }) id, err := payload.Encode() if err != nil { return nil, err } return &Container{ID: id}, nil } func (container *Container) Directory(ctx context.Context, gw bkgw.Client, dirPath string) (*Directory, error) { dir, err := locatePath(ctx, container, dirPath, gw, NewDirectory) if err != nil {