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,025
Include output of failed exec in graphql errors
Right now if an exec fails the graphql error just says that it exited non-zero. This makes it hard to debug unless you go look at the buildkit progress output. We should instead include the output of the execop in the graphql error to help debugging. The implementation is not incredibly straightforward. Buildkit has the ability to obtain the FS of a failed exec op (including changes made during the command): https://github.com/moby/buildkit/blob/c9a0f4d2de095591e742d7f411d9ed36a03a1c4e/client/build_test.go#L1278-L1310 We will probably need to use that to obtain the output as written to the output files by the shim. We should also make sure to limit the size of the output included so if there's a failure during a command with many megabytes of output (e.g. compiling a large project) we don't try to transfer all of that in the error. Instead, we can just return the last N bytes.
https://github.com/dagger/dagger/issues/3025
https://github.com/dagger/dagger/pull/4161
5257ac03f6bae55e7f8ac4d0713251b9e0499aa3
a795bea02f59a980912cf95e04902b5a77cab39a
2022-09-07T20:42:51Z
go
2022-12-12T21:30:21Z
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 { WithMountedDirectory struct { WithExec struct { Stdout string WithExec struct {
closed
dagger/dagger
https://github.com/dagger/dagger
3,025
Include output of failed exec in graphql errors
Right now if an exec fails the graphql error just says that it exited non-zero. This makes it hard to debug unless you go look at the buildkit progress output. We should instead include the output of the execop in the graphql error to help debugging. The implementation is not incredibly straightforward. Buildkit has the ability to obtain the FS of a failed exec op (including changes made during the command): https://github.com/moby/buildkit/blob/c9a0f4d2de095591e742d7f411d9ed36a03a1c4e/client/build_test.go#L1278-L1310 We will probably need to use that to obtain the output as written to the output files by the shim. We should also make sure to limit the size of the output included so if there's a failure during a command with many megabytes of output (e.g. compiling a large project) we don't try to transfer all of that in the error. Instead, we can just return the last N bytes.
https://github.com/dagger/dagger/issues/3025
https://github.com/dagger/dagger/pull/4161
5257ac03f6bae55e7f8ac4d0713251b9e0499aa3
a795bea02f59a980912cf95e04902b5a77cab39a
2022-09-07T20:42:51Z
go
2022-12-12T21:30:21Z
core/integration/container_test.go
Stdout string } } } } } }{} err = testutil.Query( `query Test($id: DirectoryID!) { container { from(address: "alpine:3.16.2") { withMountedDirectory(path: "/mnt", source: $id) { withExec(args: ["cat", "/mnt/some-file"]) { stdout withExec(args: ["cat", "/mnt/some-dir/sub-file"]) { stdout } } } } } }`, &execRes, &testutil.QueryOptions{Variables: map[string]any{ "id": id, }}) require.NoError(t, err) require.Equal(t, "some-content", execRes.Container.From.WithMountedDirectory.WithExec.Stdout) require.Equal(t, "sub-content", execRes.Container.From.WithMountedDirectory.WithExec.WithExec.Stdout) } func TestContainerWithMountedDirectorySourcePath(t *testing.T) {
closed
dagger/dagger
https://github.com/dagger/dagger
3,025
Include output of failed exec in graphql errors
Right now if an exec fails the graphql error just says that it exited non-zero. This makes it hard to debug unless you go look at the buildkit progress output. We should instead include the output of the execop in the graphql error to help debugging. The implementation is not incredibly straightforward. Buildkit has the ability to obtain the FS of a failed exec op (including changes made during the command): https://github.com/moby/buildkit/blob/c9a0f4d2de095591e742d7f411d9ed36a03a1c4e/client/build_test.go#L1278-L1310 We will probably need to use that to obtain the output as written to the output files by the shim. We should also make sure to limit the size of the output included so if there's a failure during a command with many megabytes of output (e.g. compiling a large project) we don't try to transfer all of that in the error. Instead, we can just return the last N bytes.
https://github.com/dagger/dagger/issues/3025
https://github.com/dagger/dagger/pull/4161
5257ac03f6bae55e7f8ac4d0713251b9e0499aa3
a795bea02f59a980912cf95e04902b5a77cab39a
2022-09-07T20:42:51Z
go
2022-12-12T21:30:21Z
core/integration/container_test.go
t.Parallel() dirRes := struct {
closed
dagger/dagger
https://github.com/dagger/dagger
3,025
Include output of failed exec in graphql errors
Right now if an exec fails the graphql error just says that it exited non-zero. This makes it hard to debug unless you go look at the buildkit progress output. We should instead include the output of the execop in the graphql error to help debugging. The implementation is not incredibly straightforward. Buildkit has the ability to obtain the FS of a failed exec op (including changes made during the command): https://github.com/moby/buildkit/blob/c9a0f4d2de095591e742d7f411d9ed36a03a1c4e/client/build_test.go#L1278-L1310 We will probably need to use that to obtain the output as written to the output files by the shim. We should also make sure to limit the size of the output included so if there's a failure during a command with many megabytes of output (e.g. compiling a large project) we don't try to transfer all of that in the error. Instead, we can just return the last N bytes.
https://github.com/dagger/dagger/issues/3025
https://github.com/dagger/dagger/pull/4161
5257ac03f6bae55e7f8ac4d0713251b9e0499aa3
a795bea02f59a980912cf95e04902b5a77cab39a
2022-09-07T20:42:51Z
go
2022-12-12T21:30:21Z
core/integration/container_test.go
Directory struct { 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 { WithExec struct {
closed
dagger/dagger
https://github.com/dagger/dagger
3,025
Include output of failed exec in graphql errors
Right now if an exec fails the graphql error just says that it exited non-zero. This makes it hard to debug unless you go look at the buildkit progress output. We should instead include the output of the execop in the graphql error to help debugging. The implementation is not incredibly straightforward. Buildkit has the ability to obtain the FS of a failed exec op (including changes made during the command): https://github.com/moby/buildkit/blob/c9a0f4d2de095591e742d7f411d9ed36a03a1c4e/client/build_test.go#L1278-L1310 We will probably need to use that to obtain the output as written to the output files by the shim. We should also make sure to limit the size of the output included so if there's a failure during a command with many megabytes of output (e.g. compiling a large project) we don't try to transfer all of that in the error. Instead, we can just return the last N bytes.
https://github.com/dagger/dagger/issues/3025
https://github.com/dagger/dagger/pull/4161
5257ac03f6bae55e7f8ac4d0713251b9e0499aa3
a795bea02f59a980912cf95e04902b5a77cab39a
2022-09-07T20:42:51Z
go
2022-12-12T21:30:21Z
core/integration/container_test.go
WithExec struct { Stdout string } } } } } }{} err = testutil.Query( `query Test($id: DirectoryID!) { container { from(address: "alpine:3.16.2") { withMountedDirectory(path: "/mnt", source: $id) { withExec(args: ["sh", "-c", "echo >> /mnt/sub-file; echo -n more-content >> /mnt/sub-file"]) { withExec(args: ["cat", "/mnt/sub-file"]) { stdout } } } } } }`, &execRes, &testutil.QueryOptions{Variables: map[string]any{ "id": id, }}) require.NoError(t, err) require.Equal(t, "sub-content\nmore-content", execRes.Container.From.WithMountedDirectory.WithExec.WithExec.Stdout) } func TestContainerWithMountedDirectoryPropagation(t *testing.T) { t.Parallel() dirRes := struct {
closed
dagger/dagger
https://github.com/dagger/dagger
3,025
Include output of failed exec in graphql errors
Right now if an exec fails the graphql error just says that it exited non-zero. This makes it hard to debug unless you go look at the buildkit progress output. We should instead include the output of the execop in the graphql error to help debugging. The implementation is not incredibly straightforward. Buildkit has the ability to obtain the FS of a failed exec op (including changes made during the command): https://github.com/moby/buildkit/blob/c9a0f4d2de095591e742d7f411d9ed36a03a1c4e/client/build_test.go#L1278-L1310 We will probably need to use that to obtain the output as written to the output files by the shim. We should also make sure to limit the size of the output included so if there's a failure during a command with many megabytes of output (e.g. compiling a large project) we don't try to transfer all of that in the error. Instead, we can just return the last N bytes.
https://github.com/dagger/dagger/issues/3025
https://github.com/dagger/dagger/pull/4161
5257ac03f6bae55e7f8ac4d0713251b9e0499aa3
a795bea02f59a980912cf95e04902b5a77cab39a
2022-09-07T20:42:51Z
go
2022-12-12T21:30:21Z
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 execRes := struct { Container struct { From struct { WithMountedDirectory struct { WithExec struct { Stdout string WithExec struct { WithExec struct { Stdout string WithMountedDirectory struct { WithExec struct { Stdout string WithExec struct {
closed
dagger/dagger
https://github.com/dagger/dagger
3,025
Include output of failed exec in graphql errors
Right now if an exec fails the graphql error just says that it exited non-zero. This makes it hard to debug unless you go look at the buildkit progress output. We should instead include the output of the execop in the graphql error to help debugging. The implementation is not incredibly straightforward. Buildkit has the ability to obtain the FS of a failed exec op (including changes made during the command): https://github.com/moby/buildkit/blob/c9a0f4d2de095591e742d7f411d9ed36a03a1c4e/client/build_test.go#L1278-L1310 We will probably need to use that to obtain the output as written to the output files by the shim. We should also make sure to limit the size of the output included so if there's a failure during a command with many megabytes of output (e.g. compiling a large project) we don't try to transfer all of that in the error. Instead, we can just return the last N bytes.
https://github.com/dagger/dagger/issues/3025
https://github.com/dagger/dagger/pull/4161
5257ac03f6bae55e7f8ac4d0713251b9e0499aa3
a795bea02f59a980912cf95e04902b5a77cab39a
2022-09-07T20:42:51Z
go
2022-12-12T21:30:21Z
core/integration/container_test.go
Stdout string } } } } } } } } } }{} err = testutil.Query( `query Test($id: DirectoryID!) { container { from(address: "alpine:3.16.2") { withMountedDirectory(path: "/mnt", source: $id) { withExec(args: ["cat", "/mnt/some-file"]) { # original content stdout withExec(args: ["sh", "-c", "echo >> /mnt/some-file; echo -n more-content >> /mnt/some-file"]) { withExec(args: ["cat", "/mnt/some-file"]) { # modified content should propagate stdout withMountedDirectory(path: "/mnt", source: $id) { withExec(args: ["cat", "/mnt/some-file"]) { # should be back to the original content stdout withExec(args: ["cat", "/mnt/some-file"]) { # original content override should propagate
closed
dagger/dagger
https://github.com/dagger/dagger
3,025
Include output of failed exec in graphql errors
Right now if an exec fails the graphql error just says that it exited non-zero. This makes it hard to debug unless you go look at the buildkit progress output. We should instead include the output of the execop in the graphql error to help debugging. The implementation is not incredibly straightforward. Buildkit has the ability to obtain the FS of a failed exec op (including changes made during the command): https://github.com/moby/buildkit/blob/c9a0f4d2de095591e742d7f411d9ed36a03a1c4e/client/build_test.go#L1278-L1310 We will probably need to use that to obtain the output as written to the output files by the shim. We should also make sure to limit the size of the output included so if there's a failure during a command with many megabytes of output (e.g. compiling a large project) we don't try to transfer all of that in the error. Instead, we can just return the last N bytes.
https://github.com/dagger/dagger/issues/3025
https://github.com/dagger/dagger/pull/4161
5257ac03f6bae55e7f8ac4d0713251b9e0499aa3
a795bea02f59a980912cf95e04902b5a77cab39a
2022-09-07T20:42:51Z
go
2022-12-12T21:30:21Z
core/integration/container_test.go
stdout } } } } } } } } } }`, &execRes, &testutil.QueryOptions{Variables: map[string]any{ "id": id, }}) require.NoError(t, err) require.Equal(t, "some-content", execRes.Container.From.WithMountedDirectory.WithExec.Stdout) require.Equal(t, "some-content\nmore-content", execRes.Container.From.WithMountedDirectory.WithExec.WithExec.WithExec.Stdout) require.Equal(t, "some-content", execRes.Container.From.WithMountedDirectory.WithExec.WithExec.WithExec.WithMountedDirectory.WithExec.Stdout) require.Equal(t, "some-content", execRes.Container.From.WithMountedDirectory.WithExec.WithExec.WithExec.WithMountedDirectory.WithExec.WithExec.Stdout) } func TestContainerWithMountedFile(t *testing.T) { t.Parallel() dirRes := struct {
closed
dagger/dagger
https://github.com/dagger/dagger
3,025
Include output of failed exec in graphql errors
Right now if an exec fails the graphql error just says that it exited non-zero. This makes it hard to debug unless you go look at the buildkit progress output. We should instead include the output of the execop in the graphql error to help debugging. The implementation is not incredibly straightforward. Buildkit has the ability to obtain the FS of a failed exec op (including changes made during the command): https://github.com/moby/buildkit/blob/c9a0f4d2de095591e742d7f411d9ed36a03a1c4e/client/build_test.go#L1278-L1310 We will probably need to use that to obtain the output as written to the output files by the shim. We should also make sure to limit the size of the output included so if there's a failure during a command with many megabytes of output (e.g. compiling a large project) we don't try to transfer all of that in the error. Instead, we can just return the last N bytes.
https://github.com/dagger/dagger/issues/3025
https://github.com/dagger/dagger/pull/4161
5257ac03f6bae55e7f8ac4d0713251b9e0499aa3
a795bea02f59a980912cf95e04902b5a77cab39a
2022-09-07T20:42:51Z
go
2022-12-12T21:30:21Z
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 {
closed
dagger/dagger
https://github.com/dagger/dagger
3,025
Include output of failed exec in graphql errors
Right now if an exec fails the graphql error just says that it exited non-zero. This makes it hard to debug unless you go look at the buildkit progress output. We should instead include the output of the execop in the graphql error to help debugging. The implementation is not incredibly straightforward. Buildkit has the ability to obtain the FS of a failed exec op (including changes made during the command): https://github.com/moby/buildkit/blob/c9a0f4d2de095591e742d7f411d9ed36a03a1c4e/client/build_test.go#L1278-L1310 We will probably need to use that to obtain the output as written to the output files by the shim. We should also make sure to limit the size of the output included so if there's a failure during a command with many megabytes of output (e.g. compiling a large project) we don't try to transfer all of that in the error. Instead, we can just return the last N bytes.
https://github.com/dagger/dagger/issues/3025
https://github.com/dagger/dagger/pull/4161
5257ac03f6bae55e7f8ac4d0713251b9e0499aa3
a795bea02f59a980912cf95e04902b5a77cab39a
2022-09-07T20:42:51Z
go
2022-12-12T21:30:21Z
core/integration/container_test.go
From struct { WithMountedFile struct { WithExec struct { Stdout string } } } } }{} err = testutil.Query( `query Test($id: FileID!) { container { from(address: "alpine:3.16.2") { withMountedFile(path: "/mnt/file", source: $id) { withExec(args: ["cat", "/mnt/file"]) { stdout } } } } }`, &execRes, &testutil.QueryOptions{Variables: map[string]any{ "id": id, }}) require.NoError(t, err) require.Equal(t, "sub-content", execRes.Container.From.WithMountedFile.WithExec.Stdout) } func TestContainerWithMountedCache(t *testing.T) { t.Parallel() cacheID := newCache(t) execRes := struct {
closed
dagger/dagger
https://github.com/dagger/dagger
3,025
Include output of failed exec in graphql errors
Right now if an exec fails the graphql error just says that it exited non-zero. This makes it hard to debug unless you go look at the buildkit progress output. We should instead include the output of the execop in the graphql error to help debugging. The implementation is not incredibly straightforward. Buildkit has the ability to obtain the FS of a failed exec op (including changes made during the command): https://github.com/moby/buildkit/blob/c9a0f4d2de095591e742d7f411d9ed36a03a1c4e/client/build_test.go#L1278-L1310 We will probably need to use that to obtain the output as written to the output files by the shim. We should also make sure to limit the size of the output included so if there's a failure during a command with many megabytes of output (e.g. compiling a large project) we don't try to transfer all of that in the error. Instead, we can just return the last N bytes.
https://github.com/dagger/dagger/issues/3025
https://github.com/dagger/dagger/pull/4161
5257ac03f6bae55e7f8ac4d0713251b9e0499aa3
a795bea02f59a980912cf95e04902b5a77cab39a
2022-09-07T20:42:51Z
go
2022-12-12T21:30:21Z
core/integration/container_test.go
Container struct { From struct { WithEnvVariable struct { WithMountedCache struct { WithExec struct {
closed
dagger/dagger
https://github.com/dagger/dagger
3,025
Include output of failed exec in graphql errors
Right now if an exec fails the graphql error just says that it exited non-zero. This makes it hard to debug unless you go look at the buildkit progress output. We should instead include the output of the execop in the graphql error to help debugging. The implementation is not incredibly straightforward. Buildkit has the ability to obtain the FS of a failed exec op (including changes made during the command): https://github.com/moby/buildkit/blob/c9a0f4d2de095591e742d7f411d9ed36a03a1c4e/client/build_test.go#L1278-L1310 We will probably need to use that to obtain the output as written to the output files by the shim. We should also make sure to limit the size of the output included so if there's a failure during a command with many megabytes of output (e.g. compiling a large project) we don't try to transfer all of that in the error. Instead, we can just return the last N bytes.
https://github.com/dagger/dagger/issues/3025
https://github.com/dagger/dagger/pull/4161
5257ac03f6bae55e7f8ac4d0713251b9e0499aa3
a795bea02f59a980912cf95e04902b5a77cab39a
2022-09-07T20:42:51Z
go
2022-12-12T21:30:21Z
core/integration/container_test.go
Stdout string } } } } } }{} query := `query Test($cache: CacheID!, $rand: String!) { container { from(address: "alpine:3.16.2") { withEnvVariable(name: "RAND", value: $rand) { withMountedCache(path: "/mnt/cache", cache: $cache) { withExec(args: ["sh", "-c", "echo $RAND >> /mnt/cache/file; cat /mnt/cache/file"]) { stdout } } } } } }` rand1 := identity.NewID() err := testutil.Query(query, &execRes, &testutil.QueryOptions{Variables: map[string]any{ "cache": cacheID, "rand": rand1, }}) require.NoError(t, err) require.Equal(t, rand1+"\n", execRes.Container.From.WithEnvVariable.WithMountedCache.WithExec.Stdout) rand2 := identity.NewID() err = testutil.Query(query, &execRes, &testutil.QueryOptions{Variables: map[string]any{ "cache": cacheID,
closed
dagger/dagger
https://github.com/dagger/dagger
3,025
Include output of failed exec in graphql errors
Right now if an exec fails the graphql error just says that it exited non-zero. This makes it hard to debug unless you go look at the buildkit progress output. We should instead include the output of the execop in the graphql error to help debugging. The implementation is not incredibly straightforward. Buildkit has the ability to obtain the FS of a failed exec op (including changes made during the command): https://github.com/moby/buildkit/blob/c9a0f4d2de095591e742d7f411d9ed36a03a1c4e/client/build_test.go#L1278-L1310 We will probably need to use that to obtain the output as written to the output files by the shim. We should also make sure to limit the size of the output included so if there's a failure during a command with many megabytes of output (e.g. compiling a large project) we don't try to transfer all of that in the error. Instead, we can just return the last N bytes.
https://github.com/dagger/dagger/issues/3025
https://github.com/dagger/dagger/pull/4161
5257ac03f6bae55e7f8ac4d0713251b9e0499aa3
a795bea02f59a980912cf95e04902b5a77cab39a
2022-09-07T20:42:51Z
go
2022-12-12T21:30:21Z
core/integration/container_test.go
"rand": rand2, }}) require.NoError(t, err) require.Equal(t, rand1+"\n"+rand2+"\n", execRes.Container.From.WithEnvVariable.WithMountedCache.WithExec.Stdout) } func TestContainerWithMountedCacheFromDirectory(t *testing.T) { t.Parallel() dirRes := struct { 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,025
Include output of failed exec in graphql errors
Right now if an exec fails the graphql error just says that it exited non-zero. This makes it hard to debug unless you go look at the buildkit progress output. We should instead include the output of the execop in the graphql error to help debugging. The implementation is not incredibly straightforward. Buildkit has the ability to obtain the FS of a failed exec op (including changes made during the command): https://github.com/moby/buildkit/blob/c9a0f4d2de095591e742d7f411d9ed36a03a1c4e/client/build_test.go#L1278-L1310 We will probably need to use that to obtain the output as written to the output files by the shim. We should also make sure to limit the size of the output included so if there's a failure during a command with many megabytes of output (e.g. compiling a large project) we don't try to transfer all of that in the error. Instead, we can just return the last N bytes.
https://github.com/dagger/dagger/issues/3025
https://github.com/dagger/dagger/pull/4161
5257ac03f6bae55e7f8ac4d0713251b9e0499aa3
a795bea02f59a980912cf95e04902b5a77cab39a
2022-09-07T20:42:51Z
go
2022-12-12T21:30:21Z
core/integration/container_test.go
Container struct { From struct { WithEnvVariable struct { WithMountedCache struct { WithExec struct { Stdout string } } } } } }{} query := `query Test($cache: CacheID!, $rand: String!, $init: DirectoryID!) { container { from(address: "alpine:3.16.2") {
closed
dagger/dagger
https://github.com/dagger/dagger
3,025
Include output of failed exec in graphql errors
Right now if an exec fails the graphql error just says that it exited non-zero. This makes it hard to debug unless you go look at the buildkit progress output. We should instead include the output of the execop in the graphql error to help debugging. The implementation is not incredibly straightforward. Buildkit has the ability to obtain the FS of a failed exec op (including changes made during the command): https://github.com/moby/buildkit/blob/c9a0f4d2de095591e742d7f411d9ed36a03a1c4e/client/build_test.go#L1278-L1310 We will probably need to use that to obtain the output as written to the output files by the shim. We should also make sure to limit the size of the output included so if there's a failure during a command with many megabytes of output (e.g. compiling a large project) we don't try to transfer all of that in the error. Instead, we can just return the last N bytes.
https://github.com/dagger/dagger/issues/3025
https://github.com/dagger/dagger/pull/4161
5257ac03f6bae55e7f8ac4d0713251b9e0499aa3
a795bea02f59a980912cf95e04902b5a77cab39a
2022-09-07T20:42:51Z
go
2022-12-12T21:30:21Z
core/integration/container_test.go
withEnvVariable(name: "RAND", value: $rand) { withMountedCache(path: "/mnt/cache", cache: $cache, source: $init) { withExec(args: ["sh", "-c", "echo $RAND >> /mnt/cache/sub-file; cat /mnt/cache/sub-file"]) { stdout } } } } } }` rand1 := identity.NewID() err = testutil.Query(query, &execRes, &testutil.QueryOptions{Variables: map[string]any{ "init": initialID, "rand": rand1, "cache": cacheID, }}) require.NoError(t, err) require.Equal(t, "initial-content\n"+rand1+"\n", execRes.Container.From.WithEnvVariable.WithMountedCache.WithExec.Stdout) rand2 := identity.NewID() err = testutil.Query(query, &execRes, &testutil.QueryOptions{Variables: map[string]any{ "init": initialID, "rand": rand2, "cache": cacheID, }}) require.NoError(t, err) require.Equal(t, "initial-content\n"+rand1+"\n"+rand2+"\n", execRes.Container.From.WithEnvVariable.WithMountedCache.WithExec.Stdout) } func TestContainerWithMountedTemp(t *testing.T) { t.Parallel() execRes := struct {
closed
dagger/dagger
https://github.com/dagger/dagger
3,025
Include output of failed exec in graphql errors
Right now if an exec fails the graphql error just says that it exited non-zero. This makes it hard to debug unless you go look at the buildkit progress output. We should instead include the output of the execop in the graphql error to help debugging. The implementation is not incredibly straightforward. Buildkit has the ability to obtain the FS of a failed exec op (including changes made during the command): https://github.com/moby/buildkit/blob/c9a0f4d2de095591e742d7f411d9ed36a03a1c4e/client/build_test.go#L1278-L1310 We will probably need to use that to obtain the output as written to the output files by the shim. We should also make sure to limit the size of the output included so if there's a failure during a command with many megabytes of output (e.g. compiling a large project) we don't try to transfer all of that in the error. Instead, we can just return the last N bytes.
https://github.com/dagger/dagger/issues/3025
https://github.com/dagger/dagger/pull/4161
5257ac03f6bae55e7f8ac4d0713251b9e0499aa3
a795bea02f59a980912cf95e04902b5a77cab39a
2022-09-07T20:42:51Z
go
2022-12-12T21:30:21Z
core/integration/container_test.go
Container struct { From struct { WithMountedTemp struct { WithExec struct { Stdout string } } } } }{} err := testutil.Query(`{ container { from(address: "alpine:3.16.2") { withMountedTemp(path: "/mnt/tmp") { withExec(args: ["grep", "/mnt/tmp", "/proc/mounts"]) { stdout } } } } }`, &execRes, nil) require.NoError(t, err) require.Contains(t, execRes.Container.From.WithMountedTemp.WithExec.Stdout, "tmpfs /mnt/tmp tmpfs") } func TestContainerWithDirectory(t *testing.T) {
closed
dagger/dagger
https://github.com/dagger/dagger
3,025
Include output of failed exec in graphql errors
Right now if an exec fails the graphql error just says that it exited non-zero. This makes it hard to debug unless you go look at the buildkit progress output. We should instead include the output of the execop in the graphql error to help debugging. The implementation is not incredibly straightforward. Buildkit has the ability to obtain the FS of a failed exec op (including changes made during the command): https://github.com/moby/buildkit/blob/c9a0f4d2de095591e742d7f411d9ed36a03a1c4e/client/build_test.go#L1278-L1310 We will probably need to use that to obtain the output as written to the output files by the shim. We should also make sure to limit the size of the output included so if there's a failure during a command with many megabytes of output (e.g. compiling a large project) we don't try to transfer all of that in the error. Instead, we can just return the last N bytes.
https://github.com/dagger/dagger/issues/3025
https://github.com/dagger/dagger/pull/4161
5257ac03f6bae55e7f8ac4d0713251b9e0499aa3
a795bea02f59a980912cf95e04902b5a77cab39a
2022-09-07T20:42:51Z
go
2022-12-12T21:30:21Z
core/integration/container_test.go
t.Parallel() c, ctx := connect(t) defer c.Close() dir := c.Directory(). WithNewFile("some-file", "some-content"). WithNewFile("some-dir/sub-file", "sub-content"). Directory("some-dir") ctr := c.Container(). From("alpine:3.16.2"). WithWorkdir("/workdir"). WithDirectory("with-dir", dir) contents, err := ctr.WithExec([]string{"cat", "with-dir/sub-file"}). Stdout(ctx) require.NoError(t, err) require.Equal(t, "sub-content", contents) contents, err = ctr.WithExec([]string{"cat", "/workdir/with-dir/sub-file"}). Stdout(ctx) require.NoError(t, err) require.Equal(t, "sub-content", contents)
closed
dagger/dagger
https://github.com/dagger/dagger
3,025
Include output of failed exec in graphql errors
Right now if an exec fails the graphql error just says that it exited non-zero. This makes it hard to debug unless you go look at the buildkit progress output. We should instead include the output of the execop in the graphql error to help debugging. The implementation is not incredibly straightforward. Buildkit has the ability to obtain the FS of a failed exec op (including changes made during the command): https://github.com/moby/buildkit/blob/c9a0f4d2de095591e742d7f411d9ed36a03a1c4e/client/build_test.go#L1278-L1310 We will probably need to use that to obtain the output as written to the output files by the shim. We should also make sure to limit the size of the output included so if there's a failure during a command with many megabytes of output (e.g. compiling a large project) we don't try to transfer all of that in the error. Instead, we can just return the last N bytes.
https://github.com/dagger/dagger/issues/3025
https://github.com/dagger/dagger/pull/4161
5257ac03f6bae55e7f8ac4d0713251b9e0499aa3
a795bea02f59a980912cf95e04902b5a77cab39a
2022-09-07T20:42:51Z
go
2022-12-12T21:30:21Z
core/integration/container_test.go
mount := c.Directory(). WithNewFile("mounted-file", "mounted-content") ctr = c.Container(). From("alpine:3.16.2"). WithWorkdir("/workdir"). WithMountedDirectory("mnt/mount", mount). WithDirectory("mnt/mount/dst/with-dir", dir) contents, err = ctr.WithExec([]string{"cat", "mnt/mount/mounted-file"}). Stdout(ctx) require.NoError(t, err) require.Equal(t, "mounted-content", contents) contents, err = ctr.WithExec([]string{"cat", "mnt/mount/dst/with-dir/sub-file"}). Stdout(ctx) require.NoError(t, err) require.Equal(t, "sub-content", contents) mnt := c.Directory().WithNewDirectory("/a/b/c") ctr = c.Container(). From("alpine:3.16.2"). WithMountedDirectory("/mnt", mnt) dir = c.Directory(). WithNewDirectory("/foo"). WithNewFile("/foo/some-file", "some-content") ctr = ctr.WithDirectory("/mnt/a/b/foo", dir) contents, err = ctr.WithExec([]string{"cat", "/mnt/a/b/foo/foo/some-file"}). Stdout(ctx) require.NoError(t, err) require.Equal(t, "some-content", contents) } func TestContainerWithFile(t *testing.T) {
closed
dagger/dagger
https://github.com/dagger/dagger
3,025
Include output of failed exec in graphql errors
Right now if an exec fails the graphql error just says that it exited non-zero. This makes it hard to debug unless you go look at the buildkit progress output. We should instead include the output of the execop in the graphql error to help debugging. The implementation is not incredibly straightforward. Buildkit has the ability to obtain the FS of a failed exec op (including changes made during the command): https://github.com/moby/buildkit/blob/c9a0f4d2de095591e742d7f411d9ed36a03a1c4e/client/build_test.go#L1278-L1310 We will probably need to use that to obtain the output as written to the output files by the shim. We should also make sure to limit the size of the output included so if there's a failure during a command with many megabytes of output (e.g. compiling a large project) we don't try to transfer all of that in the error. Instead, we can just return the last N bytes.
https://github.com/dagger/dagger/issues/3025
https://github.com/dagger/dagger/pull/4161
5257ac03f6bae55e7f8ac4d0713251b9e0499aa3
a795bea02f59a980912cf95e04902b5a77cab39a
2022-09-07T20:42:51Z
go
2022-12-12T21:30:21Z
core/integration/container_test.go
t.Parallel() c, ctx := connect(t) defer c.Close() file := c.Directory(). WithNewFile("some-file", "some-content"). File("some-file") ctr := c.Container(). From("alpine:3.16.2"). WithWorkdir("/workdir"). WithFile("target-file", file) contents, err := ctr.WithExec([]string{"cat", "target-file"}). Stdout(ctx) require.NoError(t, err) require.Equal(t, "some-content", contents) contents, err = ctr.WithExec([]string{"cat", "/workdir/target-file"}). Stdout(ctx) require.NoError(t, err) require.Equal(t, "some-content", contents) } func TestContainerWithNewFile(t *testing.T) {
closed
dagger/dagger
https://github.com/dagger/dagger
3,025
Include output of failed exec in graphql errors
Right now if an exec fails the graphql error just says that it exited non-zero. This makes it hard to debug unless you go look at the buildkit progress output. We should instead include the output of the execop in the graphql error to help debugging. The implementation is not incredibly straightforward. Buildkit has the ability to obtain the FS of a failed exec op (including changes made during the command): https://github.com/moby/buildkit/blob/c9a0f4d2de095591e742d7f411d9ed36a03a1c4e/client/build_test.go#L1278-L1310 We will probably need to use that to obtain the output as written to the output files by the shim. We should also make sure to limit the size of the output included so if there's a failure during a command with many megabytes of output (e.g. compiling a large project) we don't try to transfer all of that in the error. Instead, we can just return the last N bytes.
https://github.com/dagger/dagger/issues/3025
https://github.com/dagger/dagger/pull/4161
5257ac03f6bae55e7f8ac4d0713251b9e0499aa3
a795bea02f59a980912cf95e04902b5a77cab39a
2022-09-07T20:42:51Z
go
2022-12-12T21:30:21Z
core/integration/container_test.go
t.Parallel() c, ctx := connect(t) defer c.Close() ctr := c.Container(). From("alpine:3.16.2"). WithWorkdir("/workdir"). WithNewFile("some-file", dagger.ContainerWithNewFileOpts{ Contents: "some-content", }) contents, err := ctr.WithExec([]string{"cat", "some-file"}). Stdout(ctx) require.NoError(t, err) require.Equal(t, "some-content", contents) contents, err = ctr.WithExec([]string{"cat", "/workdir/some-file"}). Stdout(ctx) require.NoError(t, err) require.Equal(t, "some-content", contents) } func TestContainerMountsWithoutMount(t *testing.T) { t.Parallel() dirRes := struct {
closed
dagger/dagger
https://github.com/dagger/dagger
3,025
Include output of failed exec in graphql errors
Right now if an exec fails the graphql error just says that it exited non-zero. This makes it hard to debug unless you go look at the buildkit progress output. We should instead include the output of the execop in the graphql error to help debugging. The implementation is not incredibly straightforward. Buildkit has the ability to obtain the FS of a failed exec op (including changes made during the command): https://github.com/moby/buildkit/blob/c9a0f4d2de095591e742d7f411d9ed36a03a1c4e/client/build_test.go#L1278-L1310 We will probably need to use that to obtain the output as written to the output files by the shim. We should also make sure to limit the size of the output included so if there's a failure during a command with many megabytes of output (e.g. compiling a large project) we don't try to transfer all of that in the error. Instead, we can just return the last N bytes.
https://github.com/dagger/dagger/issues/3025
https://github.com/dagger/dagger/pull/4161
5257ac03f6bae55e7f8ac4d0713251b9e0499aa3
a795bea02f59a980912cf95e04902b5a77cab39a
2022-09-07T20:42:51Z
go
2022-12-12T21:30:21Z
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 {
closed
dagger/dagger
https://github.com/dagger/dagger
3,025
Include output of failed exec in graphql errors
Right now if an exec fails the graphql error just says that it exited non-zero. This makes it hard to debug unless you go look at the buildkit progress output. We should instead include the output of the execop in the graphql error to help debugging. The implementation is not incredibly straightforward. Buildkit has the ability to obtain the FS of a failed exec op (including changes made during the command): https://github.com/moby/buildkit/blob/c9a0f4d2de095591e742d7f411d9ed36a03a1c4e/client/build_test.go#L1278-L1310 We will probably need to use that to obtain the output as written to the output files by the shim. We should also make sure to limit the size of the output included so if there's a failure during a command with many megabytes of output (e.g. compiling a large project) we don't try to transfer all of that in the error. Instead, we can just return the last N bytes.
https://github.com/dagger/dagger/issues/3025
https://github.com/dagger/dagger/pull/4161
5257ac03f6bae55e7f8ac4d0713251b9e0499aa3
a795bea02f59a980912cf95e04902b5a77cab39a
2022-09-07T20:42:51Z
go
2022-12-12T21:30:21Z
core/integration/container_test.go
Container struct { From struct { WithMountedTemp struct { Mounts []string WithMountedDirectory struct { Mounts []string WithExec struct { Stdout string WithoutMount struct { Mounts []string WithExec struct { Stdout string } } } } } } } }{} err = testutil.Query( `query Test($id: DirectoryID!) {
closed
dagger/dagger
https://github.com/dagger/dagger
3,025
Include output of failed exec in graphql errors
Right now if an exec fails the graphql error just says that it exited non-zero. This makes it hard to debug unless you go look at the buildkit progress output. We should instead include the output of the execop in the graphql error to help debugging. The implementation is not incredibly straightforward. Buildkit has the ability to obtain the FS of a failed exec op (including changes made during the command): https://github.com/moby/buildkit/blob/c9a0f4d2de095591e742d7f411d9ed36a03a1c4e/client/build_test.go#L1278-L1310 We will probably need to use that to obtain the output as written to the output files by the shim. We should also make sure to limit the size of the output included so if there's a failure during a command with many megabytes of output (e.g. compiling a large project) we don't try to transfer all of that in the error. Instead, we can just return the last N bytes.
https://github.com/dagger/dagger/issues/3025
https://github.com/dagger/dagger/pull/4161
5257ac03f6bae55e7f8ac4d0713251b9e0499aa3
a795bea02f59a980912cf95e04902b5a77cab39a
2022-09-07T20:42:51Z
go
2022-12-12T21:30:21Z
core/integration/container_test.go
container { from(address: "alpine:3.16.2") { withMountedTemp(path: "/mnt/tmp") { mounts withMountedDirectory(path: "/mnt/dir", source: $id) { mounts withExec(args: ["ls", "/mnt/dir"]) { stdout withoutMount(path: "/mnt/dir") { mounts withExec(args: ["ls", "/mnt/dir"]) { stdout } } } } } } } }`, &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.WithExec.Stdout) require.Equal(t, "", execRes.Container.From.WithMountedTemp.WithMountedDirectory.WithExec.WithoutMount.WithExec.Stdout) require.Equal(t, []string{"/mnt/tmp"}, execRes.Container.From.WithMountedTemp.WithMountedDirectory.WithExec.WithoutMount.Mounts) } func TestContainerReplacedMounts(t *testing.T) {
closed
dagger/dagger
https://github.com/dagger/dagger
3,025
Include output of failed exec in graphql errors
Right now if an exec fails the graphql error just says that it exited non-zero. This makes it hard to debug unless you go look at the buildkit progress output. We should instead include the output of the execop in the graphql error to help debugging. The implementation is not incredibly straightforward. Buildkit has the ability to obtain the FS of a failed exec op (including changes made during the command): https://github.com/moby/buildkit/blob/c9a0f4d2de095591e742d7f411d9ed36a03a1c4e/client/build_test.go#L1278-L1310 We will probably need to use that to obtain the output as written to the output files by the shim. We should also make sure to limit the size of the output included so if there's a failure during a command with many megabytes of output (e.g. compiling a large project) we don't try to transfer all of that in the error. Instead, we can just return the last N bytes.
https://github.com/dagger/dagger/issues/3025
https://github.com/dagger/dagger/pull/4161
5257ac03f6bae55e7f8ac4d0713251b9e0499aa3
a795bea02f59a980912cf95e04902b5a77cab39a
2022-09-07T20:42:51Z
go
2022-12-12T21:30:21Z
core/integration/container_test.go
t.Parallel() c, ctx := connect(t) defer c.Close() lower := c.Directory().WithNewFile("some-file", "lower-content") upper := c.Directory().WithNewFile("some-file", "upper-content") ctr := c.Container(). From("alpine:3.16.2"). WithMountedDirectory("/mnt/dir", lower) t.Run("initial content is lower", func(t *testing.T) { mnts, err := ctr.Mounts(ctx) require.NoError(t, err) require.Equal(t, []string{"/mnt/dir"}, mnts) out, err := ctr.WithExec([]string{"cat", "/mnt/dir/some-file"}).Stdout(ctx) require.NoError(t, err) require.Equal(t, "lower-content", out) }) replaced := ctr.WithMountedDirectory("/mnt/dir", upper) t.Run("mounts of same path are replaced", func(t *testing.T) { mnts, err := replaced.Mounts(ctx) require.NoError(t, err) require.Equal(t, []string{"/mnt/dir"}, mnts) out, err := replaced.WithExec([]string{"cat", "/mnt/dir/some-file"}).Stdout(ctx) require.NoError(t, err) require.Equal(t, "upper-content", out) })
closed
dagger/dagger
https://github.com/dagger/dagger
3,025
Include output of failed exec in graphql errors
Right now if an exec fails the graphql error just says that it exited non-zero. This makes it hard to debug unless you go look at the buildkit progress output. We should instead include the output of the execop in the graphql error to help debugging. The implementation is not incredibly straightforward. Buildkit has the ability to obtain the FS of a failed exec op (including changes made during the command): https://github.com/moby/buildkit/blob/c9a0f4d2de095591e742d7f411d9ed36a03a1c4e/client/build_test.go#L1278-L1310 We will probably need to use that to obtain the output as written to the output files by the shim. We should also make sure to limit the size of the output included so if there's a failure during a command with many megabytes of output (e.g. compiling a large project) we don't try to transfer all of that in the error. Instead, we can just return the last N bytes.
https://github.com/dagger/dagger/issues/3025
https://github.com/dagger/dagger/pull/4161
5257ac03f6bae55e7f8ac4d0713251b9e0499aa3
a795bea02f59a980912cf95e04902b5a77cab39a
2022-09-07T20:42:51Z
go
2022-12-12T21:30:21Z
core/integration/container_test.go
t.Run("removing a replaced mount does not reveal previous mount", func(t *testing.T) { removed := replaced.WithoutMount("/mnt/dir") mnts, err := removed.Mounts(ctx) require.NoError(t, err) require.Empty(t, mnts) }) clobberedDir := c.Directory().WithNewFile("some-file", "clobbered-content") clobbered := replaced.WithMountedDirectory("/mnt", clobberedDir) t.Run("replacing parent of a mount clobbers child", func(t *testing.T) { mnts, err := clobbered.Mounts(ctx) require.NoError(t, err) require.Equal(t, []string{"/mnt"}, mnts) out, err := clobbered.WithExec([]string{"cat", "/mnt/some-file"}).Stdout(ctx) require.NoError(t, err) require.Equal(t, "clobbered-content", out) }) clobberedSubDir := c.Directory().WithNewFile("some-file", "clobbered-sub-content") clobberedSub := clobbered.WithMountedDirectory("/mnt/dir", clobberedSubDir) t.Run("restoring mount under clobbered mount", func(t *testing.T) { mnts, err := clobberedSub.Mounts(ctx) require.NoError(t, err) require.Equal(t, []string{"/mnt", "/mnt/dir"}, mnts) out, err := clobberedSub.WithExec([]string{"cat", "/mnt/dir/some-file"}).Stdout(ctx) require.NoError(t, err) require.Equal(t, "clobbered-sub-content", out) }) } func TestContainerDirectory(t *testing.T) { t.Parallel() dirRes := struct {
closed
dagger/dagger
https://github.com/dagger/dagger
3,025
Include output of failed exec in graphql errors
Right now if an exec fails the graphql error just says that it exited non-zero. This makes it hard to debug unless you go look at the buildkit progress output. We should instead include the output of the execop in the graphql error to help debugging. The implementation is not incredibly straightforward. Buildkit has the ability to obtain the FS of a failed exec op (including changes made during the command): https://github.com/moby/buildkit/blob/c9a0f4d2de095591e742d7f411d9ed36a03a1c4e/client/build_test.go#L1278-L1310 We will probably need to use that to obtain the output as written to the output files by the shim. We should also make sure to limit the size of the output included so if there's a failure during a command with many megabytes of output (e.g. compiling a large project) we don't try to transfer all of that in the error. Instead, we can just return the last N bytes.
https://github.com/dagger/dagger/issues/3025
https://github.com/dagger/dagger/pull/4161
5257ac03f6bae55e7f8ac4d0713251b9e0499aa3
a795bea02f59a980912cf95e04902b5a77cab39a
2022-09-07T20:42:51Z
go
2022-12-12T21:30:21Z
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 { WithExec struct {
closed
dagger/dagger
https://github.com/dagger/dagger
3,025
Include output of failed exec in graphql errors
Right now if an exec fails the graphql error just says that it exited non-zero. This makes it hard to debug unless you go look at the buildkit progress output. We should instead include the output of the execop in the graphql error to help debugging. The implementation is not incredibly straightforward. Buildkit has the ability to obtain the FS of a failed exec op (including changes made during the command): https://github.com/moby/buildkit/blob/c9a0f4d2de095591e742d7f411d9ed36a03a1c4e/client/build_test.go#L1278-L1310 We will probably need to use that to obtain the output as written to the output files by the shim. We should also make sure to limit the size of the output included so if there's a failure during a command with many megabytes of output (e.g. compiling a large project) we don't try to transfer all of that in the error. Instead, we can just return the last N bytes.
https://github.com/dagger/dagger/issues/3025
https://github.com/dagger/dagger/pull/4161
5257ac03f6bae55e7f8ac4d0713251b9e0499aa3
a795bea02f59a980912cf95e04902b5a77cab39a
2022-09-07T20:42:51Z
go
2022-12-12T21:30:21Z
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) { withExec(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.WithExec.Directory.ID execRes := struct {
closed
dagger/dagger
https://github.com/dagger/dagger
3,025
Include output of failed exec in graphql errors
Right now if an exec fails the graphql error just says that it exited non-zero. This makes it hard to debug unless you go look at the buildkit progress output. We should instead include the output of the execop in the graphql error to help debugging. The implementation is not incredibly straightforward. Buildkit has the ability to obtain the FS of a failed exec op (including changes made during the command): https://github.com/moby/buildkit/blob/c9a0f4d2de095591e742d7f411d9ed36a03a1c4e/client/build_test.go#L1278-L1310 We will probably need to use that to obtain the output as written to the output files by the shim. We should also make sure to limit the size of the output included so if there's a failure during a command with many megabytes of output (e.g. compiling a large project) we don't try to transfer all of that in the error. Instead, we can just return the last N bytes.
https://github.com/dagger/dagger/issues/3025
https://github.com/dagger/dagger/pull/4161
5257ac03f6bae55e7f8ac4d0713251b9e0499aa3
a795bea02f59a980912cf95e04902b5a77cab39a
2022-09-07T20:42:51Z
go
2022-12-12T21:30:21Z
core/integration/container_test.go
Container struct { From struct { WithMountedDirectory struct { WithExec struct { Stdout string } } } } }{} err = testutil.Query( `query Test($id: DirectoryID!) { container { from(address: "alpine:3.16.2") { withMountedDirectory(path: "/mnt/dir", source: $id) { withExec(args: ["cat", "/mnt/dir/another-file"]) { stdout } } } } }`, &execRes, &testutil.QueryOptions{Variables: map[string]any{ "id": writtenID, }}) require.NoError(t, err) require.Equal(t, "hello\n", execRes.Container.From.WithMountedDirectory.WithExec.Stdout) } func TestContainerDirectoryErrors(t *testing.T) { t.Parallel() dirRes := struct {
closed
dagger/dagger
https://github.com/dagger/dagger
3,025
Include output of failed exec in graphql errors
Right now if an exec fails the graphql error just says that it exited non-zero. This makes it hard to debug unless you go look at the buildkit progress output. We should instead include the output of the execop in the graphql error to help debugging. The implementation is not incredibly straightforward. Buildkit has the ability to obtain the FS of a failed exec op (including changes made during the command): https://github.com/moby/buildkit/blob/c9a0f4d2de095591e742d7f411d9ed36a03a1c4e/client/build_test.go#L1278-L1310 We will probably need to use that to obtain the output as written to the output files by the shim. We should also make sure to limit the size of the output included so if there's a failure during a command with many megabytes of output (e.g. compiling a large project) we don't try to transfer all of that in the error. Instead, we can just return the last N bytes.
https://github.com/dagger/dagger/issues/3025
https://github.com/dagger/dagger/pull/4161
5257ac03f6bae55e7f8ac4d0713251b9e0499aa3
a795bea02f59a980912cf95e04902b5a77cab39a
2022-09-07T20:42:51Z
go
2022-12-12T21:30:21Z
core/integration/container_test.go
Directory struct { WithNewFile struct { WithNewFile struct { ID core.DirectoryID } } } }{} err := testutil.Query( `{ directory { withNewFile(path: "some-file", contents: "some-content") { withNewFile(path: "some-dir/sub-file", contents: "sub-content") { id } } } }`, &dirRes, nil) require.NoError(t, err) id := dirRes.Directory.WithNewFile.WithNewFile.ID err = testutil.Query( `query Test($id: DirectoryID!) { container { from(address: "alpine:3.16.2") { withMountedDirectory(path: "/mnt/dir", source: $id) { directory(path: "/mnt/dir/some-file") { id
closed
dagger/dagger
https://github.com/dagger/dagger
3,025
Include output of failed exec in graphql errors
Right now if an exec fails the graphql error just says that it exited non-zero. This makes it hard to debug unless you go look at the buildkit progress output. We should instead include the output of the execop in the graphql error to help debugging. The implementation is not incredibly straightforward. Buildkit has the ability to obtain the FS of a failed exec op (including changes made during the command): https://github.com/moby/buildkit/blob/c9a0f4d2de095591e742d7f411d9ed36a03a1c4e/client/build_test.go#L1278-L1310 We will probably need to use that to obtain the output as written to the output files by the shim. We should also make sure to limit the size of the output included so if there's a failure during a command with many megabytes of output (e.g. compiling a large project) we don't try to transfer all of that in the error. Instead, we can just return the last N bytes.
https://github.com/dagger/dagger/issues/3025
https://github.com/dagger/dagger/pull/4161
5257ac03f6bae55e7f8ac4d0713251b9e0499aa3
a795bea02f59a980912cf95e04902b5a77cab39a
2022-09-07T20:42:51Z
go
2022-12-12T21:30:21Z
core/integration/container_test.go
} } } } }`, nil, &testutil.QueryOptions{Variables: map[string]any{ "id": id, }}) require.Error(t, err) require.Contains(t, err.Error(), "path /mnt/dir/some-file is a file, not a directory") err = testutil.Query( `query Test($id: DirectoryID!) { container { from(address: "alpine:3.16.2") { withMountedDirectory(path: "/mnt/dir", source: $id) { directory(path: "/mnt/dir/bogus") { id } } } } }`, nil, &testutil.QueryOptions{Variables: map[string]any{ "id": id, }}) require.Error(t, err) require.Contains(t, err.Error(), "bogus: no such file or directory") err = testutil.Query( `{ container { from(address: "alpine:3.16.2") { withMountedTemp(path: "/mnt/tmp") {
closed
dagger/dagger
https://github.com/dagger/dagger
3,025
Include output of failed exec in graphql errors
Right now if an exec fails the graphql error just says that it exited non-zero. This makes it hard to debug unless you go look at the buildkit progress output. We should instead include the output of the execop in the graphql error to help debugging. The implementation is not incredibly straightforward. Buildkit has the ability to obtain the FS of a failed exec op (including changes made during the command): https://github.com/moby/buildkit/blob/c9a0f4d2de095591e742d7f411d9ed36a03a1c4e/client/build_test.go#L1278-L1310 We will probably need to use that to obtain the output as written to the output files by the shim. We should also make sure to limit the size of the output included so if there's a failure during a command with many megabytes of output (e.g. compiling a large project) we don't try to transfer all of that in the error. Instead, we can just return the last N bytes.
https://github.com/dagger/dagger/issues/3025
https://github.com/dagger/dagger/pull/4161
5257ac03f6bae55e7f8ac4d0713251b9e0499aa3
a795bea02f59a980912cf95e04902b5a77cab39a
2022-09-07T20:42:51Z
go
2022-12-12T21:30:21Z
core/integration/container_test.go
directory(path: "/mnt/tmp/bogus") { id } } } } }`, nil, nil) require.Error(t, err) require.Contains(t, err.Error(), "bogus: cannot retrieve path from tmpfs") cacheID := newCache(t) err = testutil.Query( `query Test($cache: CacheID!) { container { from(address: "alpine:3.16.2") { withMountedCache(path: "/mnt/cache", cache: $cache) { directory(path: "/mnt/cache/bogus") { id } } } } }`, nil, &testutil.QueryOptions{Variables: map[string]any{ "cache": cacheID, }}) require.Error(t, err) require.Contains(t, err.Error(), "bogus: cannot retrieve path from cache") } func TestContainerDirectorySourcePath(t *testing.T) { t.Parallel() dirRes := struct {
closed
dagger/dagger
https://github.com/dagger/dagger
3,025
Include output of failed exec in graphql errors
Right now if an exec fails the graphql error just says that it exited non-zero. This makes it hard to debug unless you go look at the buildkit progress output. We should instead include the output of the execop in the graphql error to help debugging. The implementation is not incredibly straightforward. Buildkit has the ability to obtain the FS of a failed exec op (including changes made during the command): https://github.com/moby/buildkit/blob/c9a0f4d2de095591e742d7f411d9ed36a03a1c4e/client/build_test.go#L1278-L1310 We will probably need to use that to obtain the output as written to the output files by the shim. We should also make sure to limit the size of the output included so if there's a failure during a command with many megabytes of output (e.g. compiling a large project) we don't try to transfer all of that in the error. Instead, we can just return the last N bytes.
https://github.com/dagger/dagger/issues/3025
https://github.com/dagger/dagger/pull/4161
5257ac03f6bae55e7f8ac4d0713251b9e0499aa3
a795bea02f59a980912cf95e04902b5a77cab39a
2022-09-07T20:42:51Z
go
2022-12-12T21:30:21Z
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 {
closed
dagger/dagger
https://github.com/dagger/dagger
3,025
Include output of failed exec in graphql errors
Right now if an exec fails the graphql error just says that it exited non-zero. This makes it hard to debug unless you go look at the buildkit progress output. We should instead include the output of the execop in the graphql error to help debugging. The implementation is not incredibly straightforward. Buildkit has the ability to obtain the FS of a failed exec op (including changes made during the command): https://github.com/moby/buildkit/blob/c9a0f4d2de095591e742d7f411d9ed36a03a1c4e/client/build_test.go#L1278-L1310 We will probably need to use that to obtain the output as written to the output files by the shim. We should also make sure to limit the size of the output included so if there's a failure during a command with many megabytes of output (e.g. compiling a large project) we don't try to transfer all of that in the error. Instead, we can just return the last N bytes.
https://github.com/dagger/dagger/issues/3025
https://github.com/dagger/dagger/pull/4161
5257ac03f6bae55e7f8ac4d0713251b9e0499aa3
a795bea02f59a980912cf95e04902b5a77cab39a
2022-09-07T20:42:51Z
go
2022-12-12T21:30:21Z
core/integration/container_test.go
WithMountedDirectory struct { WithExec struct { Directory struct { ID core.DirectoryID } } } } } }{} err = testutil.Query( `query Test($id: DirectoryID!) { container { from(address: "alpine:3.16.2") { withMountedDirectory(path: "/mnt/dir", source: $id) { withExec(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.WithExec.Directory.ID execRes := struct { Container struct {
closed
dagger/dagger
https://github.com/dagger/dagger
3,025
Include output of failed exec in graphql errors
Right now if an exec fails the graphql error just says that it exited non-zero. This makes it hard to debug unless you go look at the buildkit progress output. We should instead include the output of the execop in the graphql error to help debugging. The implementation is not incredibly straightforward. Buildkit has the ability to obtain the FS of a failed exec op (including changes made during the command): https://github.com/moby/buildkit/blob/c9a0f4d2de095591e742d7f411d9ed36a03a1c4e/client/build_test.go#L1278-L1310 We will probably need to use that to obtain the output as written to the output files by the shim. We should also make sure to limit the size of the output included so if there's a failure during a command with many megabytes of output (e.g. compiling a large project) we don't try to transfer all of that in the error. Instead, we can just return the last N bytes.
https://github.com/dagger/dagger/issues/3025
https://github.com/dagger/dagger/pull/4161
5257ac03f6bae55e7f8ac4d0713251b9e0499aa3
a795bea02f59a980912cf95e04902b5a77cab39a
2022-09-07T20:42:51Z
go
2022-12-12T21:30:21Z
core/integration/container_test.go
From struct { WithMountedDirectory struct { WithExec struct { Stdout string } } } } }{} err = testutil.Query( `query Test($id: DirectoryID!) { container { from(address: "alpine:3.16.2") { withMountedDirectory(path: "/mnt/dir", source: $id) { withExec(args: ["cat", "/mnt/dir/sub-file"]) { stdout } } } } }`, &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.WithExec.Stdout) } func TestContainerFile(t *testing.T) { t.Parallel() id := newDirWithFile(t, "some-file", "some-content-") writeRes := struct {
closed
dagger/dagger
https://github.com/dagger/dagger
3,025
Include output of failed exec in graphql errors
Right now if an exec fails the graphql error just says that it exited non-zero. This makes it hard to debug unless you go look at the buildkit progress output. We should instead include the output of the execop in the graphql error to help debugging. The implementation is not incredibly straightforward. Buildkit has the ability to obtain the FS of a failed exec op (including changes made during the command): https://github.com/moby/buildkit/blob/c9a0f4d2de095591e742d7f411d9ed36a03a1c4e/client/build_test.go#L1278-L1310 We will probably need to use that to obtain the output as written to the output files by the shim. We should also make sure to limit the size of the output included so if there's a failure during a command with many megabytes of output (e.g. compiling a large project) we don't try to transfer all of that in the error. Instead, we can just return the last N bytes.
https://github.com/dagger/dagger/issues/3025
https://github.com/dagger/dagger/pull/4161
5257ac03f6bae55e7f8ac4d0713251b9e0499aa3
a795bea02f59a980912cf95e04902b5a77cab39a
2022-09-07T20:42:51Z
go
2022-12-12T21:30:21Z
core/integration/container_test.go
Container struct { From struct { WithMountedDirectory struct { WithMountedDirectory struct { WithExec struct {
closed
dagger/dagger
https://github.com/dagger/dagger
3,025
Include output of failed exec in graphql errors
Right now if an exec fails the graphql error just says that it exited non-zero. This makes it hard to debug unless you go look at the buildkit progress output. We should instead include the output of the execop in the graphql error to help debugging. The implementation is not incredibly straightforward. Buildkit has the ability to obtain the FS of a failed exec op (including changes made during the command): https://github.com/moby/buildkit/blob/c9a0f4d2de095591e742d7f411d9ed36a03a1c4e/client/build_test.go#L1278-L1310 We will probably need to use that to obtain the output as written to the output files by the shim. We should also make sure to limit the size of the output included so if there's a failure during a command with many megabytes of output (e.g. compiling a large project) we don't try to transfer all of that in the error. Instead, we can just return the last N bytes.
https://github.com/dagger/dagger/issues/3025
https://github.com/dagger/dagger/pull/4161
5257ac03f6bae55e7f8ac4d0713251b9e0499aa3
a795bea02f59a980912cf95e04902b5a77cab39a
2022-09-07T20:42:51Z
go
2022-12-12T21:30:21Z
core/integration/container_test.go
File struct { ID core.FileID } } } } } } }{} err := testutil.Query( `query Test($id: DirectoryID!) { container { from(address: "alpine:3.16.2") { withMountedDirectory(path: "/mnt/dir", source: $id) { withMountedDirectory(path: "/mnt/dir/overlap", source: $id) { withExec(args: ["sh", "-c", "echo -n appended >> /mnt/dir/overlap/some-file"]) { file(path: "/mnt/dir/overlap/some-file") { id } } } } } } }`, &writeRes, &testutil.QueryOptions{Variables: map[string]any{ "id": id, }}) require.NoError(t, err) writtenID := writeRes.Container.From.WithMountedDirectory.WithMountedDirectory.WithExec.File.ID execRes := struct {
closed
dagger/dagger
https://github.com/dagger/dagger
3,025
Include output of failed exec in graphql errors
Right now if an exec fails the graphql error just says that it exited non-zero. This makes it hard to debug unless you go look at the buildkit progress output. We should instead include the output of the execop in the graphql error to help debugging. The implementation is not incredibly straightforward. Buildkit has the ability to obtain the FS of a failed exec op (including changes made during the command): https://github.com/moby/buildkit/blob/c9a0f4d2de095591e742d7f411d9ed36a03a1c4e/client/build_test.go#L1278-L1310 We will probably need to use that to obtain the output as written to the output files by the shim. We should also make sure to limit the size of the output included so if there's a failure during a command with many megabytes of output (e.g. compiling a large project) we don't try to transfer all of that in the error. Instead, we can just return the last N bytes.
https://github.com/dagger/dagger/issues/3025
https://github.com/dagger/dagger/pull/4161
5257ac03f6bae55e7f8ac4d0713251b9e0499aa3
a795bea02f59a980912cf95e04902b5a77cab39a
2022-09-07T20:42:51Z
go
2022-12-12T21:30:21Z
core/integration/container_test.go
Container struct { From struct { WithMountedFile struct { WithExec struct { Stdout string } } } } }{} err = testutil.Query( `query Test($id: FileID!) { container { from(address: "alpine:3.16.2") { withMountedFile(path: "/mnt/file", source: $id) { withExec(args: ["cat", "/mnt/file"]) { stdout } } } } }`, &execRes, &testutil.QueryOptions{Variables: map[string]any{ "id": writtenID, }}) require.NoError(t, err) require.Equal(t, "some-content-appended", execRes.Container.From.WithMountedFile.WithExec.Stdout) } func TestContainerFileErrors(t *testing.T) {
closed
dagger/dagger
https://github.com/dagger/dagger
3,025
Include output of failed exec in graphql errors
Right now if an exec fails the graphql error just says that it exited non-zero. This makes it hard to debug unless you go look at the buildkit progress output. We should instead include the output of the execop in the graphql error to help debugging. The implementation is not incredibly straightforward. Buildkit has the ability to obtain the FS of a failed exec op (including changes made during the command): https://github.com/moby/buildkit/blob/c9a0f4d2de095591e742d7f411d9ed36a03a1c4e/client/build_test.go#L1278-L1310 We will probably need to use that to obtain the output as written to the output files by the shim. We should also make sure to limit the size of the output included so if there's a failure during a command with many megabytes of output (e.g. compiling a large project) we don't try to transfer all of that in the error. Instead, we can just return the last N bytes.
https://github.com/dagger/dagger/issues/3025
https://github.com/dagger/dagger/pull/4161
5257ac03f6bae55e7f8ac4d0713251b9e0499aa3
a795bea02f59a980912cf95e04902b5a77cab39a
2022-09-07T20:42:51Z
go
2022-12-12T21:30:21Z
core/integration/container_test.go
t.Parallel() id := newDirWithFile(t, "some-file", "some-content") err := testutil.Query( `query Test($id: DirectoryID!) { container { from(address: "alpine:3.16.2") { withMountedDirectory(path: "/mnt/dir", source: $id) { file(path: "/mnt/dir/bogus") { id } } } } }`, nil, &testutil.QueryOptions{Variables: map[string]any{ "id": id, }}) require.Error(t, err) require.Contains(t, err.Error(), "bogus: no such file or directory") err = testutil.Query( `query Test($id: DirectoryID!) { container { from(address: "alpine:3.16.2") { withMountedDirectory(path: "/mnt/dir", source: $id) { file(path: "/mnt/dir") { id }
closed
dagger/dagger
https://github.com/dagger/dagger
3,025
Include output of failed exec in graphql errors
Right now if an exec fails the graphql error just says that it exited non-zero. This makes it hard to debug unless you go look at the buildkit progress output. We should instead include the output of the execop in the graphql error to help debugging. The implementation is not incredibly straightforward. Buildkit has the ability to obtain the FS of a failed exec op (including changes made during the command): https://github.com/moby/buildkit/blob/c9a0f4d2de095591e742d7f411d9ed36a03a1c4e/client/build_test.go#L1278-L1310 We will probably need to use that to obtain the output as written to the output files by the shim. We should also make sure to limit the size of the output included so if there's a failure during a command with many megabytes of output (e.g. compiling a large project) we don't try to transfer all of that in the error. Instead, we can just return the last N bytes.
https://github.com/dagger/dagger/issues/3025
https://github.com/dagger/dagger/pull/4161
5257ac03f6bae55e7f8ac4d0713251b9e0499aa3
a795bea02f59a980912cf95e04902b5a77cab39a
2022-09-07T20:42:51Z
go
2022-12-12T21:30:21Z
core/integration/container_test.go
} } } }`, nil, &testutil.QueryOptions{Variables: map[string]any{ "id": id, }}) require.Error(t, err) require.Contains(t, err.Error(), "path /mnt/dir is a directory, not a file") err = testutil.Query( `{ container { from(address: "alpine:3.16.2") { withMountedTemp(path: "/mnt/tmp") { file(path: "/mnt/tmp/bogus") { id } } } } }`, nil, nil) require.Error(t, err) require.Contains(t, err.Error(), "bogus: cannot retrieve path from tmpfs") cacheID := newCache(t) err = testutil.Query( `query Test($cache: CacheID!) { container { from(address: "alpine:3.16.2") { withMountedCache(path: "/mnt/cache", cache: $cache) { file(path: "/mnt/cache/bogus") { id
closed
dagger/dagger
https://github.com/dagger/dagger
3,025
Include output of failed exec in graphql errors
Right now if an exec fails the graphql error just says that it exited non-zero. This makes it hard to debug unless you go look at the buildkit progress output. We should instead include the output of the execop in the graphql error to help debugging. The implementation is not incredibly straightforward. Buildkit has the ability to obtain the FS of a failed exec op (including changes made during the command): https://github.com/moby/buildkit/blob/c9a0f4d2de095591e742d7f411d9ed36a03a1c4e/client/build_test.go#L1278-L1310 We will probably need to use that to obtain the output as written to the output files by the shim. We should also make sure to limit the size of the output included so if there's a failure during a command with many megabytes of output (e.g. compiling a large project) we don't try to transfer all of that in the error. Instead, we can just return the last N bytes.
https://github.com/dagger/dagger/issues/3025
https://github.com/dagger/dagger/pull/4161
5257ac03f6bae55e7f8ac4d0713251b9e0499aa3
a795bea02f59a980912cf95e04902b5a77cab39a
2022-09-07T20:42:51Z
go
2022-12-12T21:30:21Z
core/integration/container_test.go
} } } } }`, nil, &testutil.QueryOptions{Variables: map[string]any{ "cache": cacheID, }}) require.Error(t, err) require.Contains(t, err.Error(), "bogus: cannot retrieve path from cache") secretID := newSecret(t, "some-secret") err = testutil.Query( `query Test($secret: SecretID!) { container { from(address: "alpine:3.16.2") { withMountedSecret(path: "/sekret", source: $secret) { file(path: "/sekret") { contents } } } } }`, nil, &testutil.QueryOptions{Variables: map[string]any{ "secret": secretID, }}) require.Error(t, err) require.Contains(t, err.Error(), "sekret: no such file or directory") } func TestContainerFSDirectory(t *testing.T) { t.Parallel() dirRes := struct {
closed
dagger/dagger
https://github.com/dagger/dagger
3,025
Include output of failed exec in graphql errors
Right now if an exec fails the graphql error just says that it exited non-zero. This makes it hard to debug unless you go look at the buildkit progress output. We should instead include the output of the execop in the graphql error to help debugging. The implementation is not incredibly straightforward. Buildkit has the ability to obtain the FS of a failed exec op (including changes made during the command): https://github.com/moby/buildkit/blob/c9a0f4d2de095591e742d7f411d9ed36a03a1c4e/client/build_test.go#L1278-L1310 We will probably need to use that to obtain the output as written to the output files by the shim. We should also make sure to limit the size of the output included so if there's a failure during a command with many megabytes of output (e.g. compiling a large project) we don't try to transfer all of that in the error. Instead, we can just return the last N bytes.
https://github.com/dagger/dagger/issues/3025
https://github.com/dagger/dagger/pull/4161
5257ac03f6bae55e7f8ac4d0713251b9e0499aa3
a795bea02f59a980912cf95e04902b5a77cab39a
2022-09-07T20:42:51Z
go
2022-12-12T21:30:21Z
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 {
closed
dagger/dagger
https://github.com/dagger/dagger
3,025
Include output of failed exec in graphql errors
Right now if an exec fails the graphql error just says that it exited non-zero. This makes it hard to debug unless you go look at the buildkit progress output. We should instead include the output of the execop in the graphql error to help debugging. The implementation is not incredibly straightforward. Buildkit has the ability to obtain the FS of a failed exec op (including changes made during the command): https://github.com/moby/buildkit/blob/c9a0f4d2de095591e742d7f411d9ed36a03a1c4e/client/build_test.go#L1278-L1310 We will probably need to use that to obtain the output as written to the output files by the shim. We should also make sure to limit the size of the output included so if there's a failure during a command with many megabytes of output (e.g. compiling a large project) we don't try to transfer all of that in the error. Instead, we can just return the last N bytes.
https://github.com/dagger/dagger/issues/3025
https://github.com/dagger/dagger/pull/4161
5257ac03f6bae55e7f8ac4d0713251b9e0499aa3
a795bea02f59a980912cf95e04902b5a77cab39a
2022-09-07T20:42:51Z
go
2022-12-12T21:30:21Z
core/integration/container_test.go
Container struct { From struct { WithMountedDirectory struct { WithExec struct { Stdout string } } } } }{} err = testutil.Query( `query Test($id: DirectoryID!) { container { from(address: "alpine:3.16.2") { withMountedDirectory(path: "/mnt/etc", source: $id) { withExec(args: ["cat", "/mnt/etc/alpine-release"]) { stdout } } } } }`, &execRes, &testutil.QueryOptions{Variables: map[string]any{ "id": etcID, }}) require.NoError(t, err) require.Equal(t, "3.16.2\n", execRes.Container.From.WithMountedDirectory.WithExec.Stdout) } func TestContainerRelativePaths(t *testing.T) { t.Parallel() dirRes := struct {
closed
dagger/dagger
https://github.com/dagger/dagger
3,025
Include output of failed exec in graphql errors
Right now if an exec fails the graphql error just says that it exited non-zero. This makes it hard to debug unless you go look at the buildkit progress output. We should instead include the output of the execop in the graphql error to help debugging. The implementation is not incredibly straightforward. Buildkit has the ability to obtain the FS of a failed exec op (including changes made during the command): https://github.com/moby/buildkit/blob/c9a0f4d2de095591e742d7f411d9ed36a03a1c4e/client/build_test.go#L1278-L1310 We will probably need to use that to obtain the output as written to the output files by the shim. We should also make sure to limit the size of the output included so if there's a failure during a command with many megabytes of output (e.g. compiling a large project) we don't try to transfer all of that in the error. Instead, we can just return the last N bytes.
https://github.com/dagger/dagger/issues/3025
https://github.com/dagger/dagger/pull/4161
5257ac03f6bae55e7f8ac4d0713251b9e0499aa3
a795bea02f59a980912cf95e04902b5a77cab39a
2022-09-07T20:42:51Z
go
2022-12-12T21:30:21Z
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 { WithExec struct { WithWorkdir struct { WithWorkdir struct { Workdir string WithMountedDirectory struct { WithMountedTemp struct { WithMountedCache struct {
closed
dagger/dagger
https://github.com/dagger/dagger
3,025
Include output of failed exec in graphql errors
Right now if an exec fails the graphql error just says that it exited non-zero. This makes it hard to debug unless you go look at the buildkit progress output. We should instead include the output of the execop in the graphql error to help debugging. The implementation is not incredibly straightforward. Buildkit has the ability to obtain the FS of a failed exec op (including changes made during the command): https://github.com/moby/buildkit/blob/c9a0f4d2de095591e742d7f411d9ed36a03a1c4e/client/build_test.go#L1278-L1310 We will probably need to use that to obtain the output as written to the output files by the shim. We should also make sure to limit the size of the output included so if there's a failure during a command with many megabytes of output (e.g. compiling a large project) we don't try to transfer all of that in the error. Instead, we can just return the last N bytes.
https://github.com/dagger/dagger/issues/3025
https://github.com/dagger/dagger/pull/4161
5257ac03f6bae55e7f8ac4d0713251b9e0499aa3
a795bea02f59a980912cf95e04902b5a77cab39a
2022-09-07T20:42:51Z
go
2022-12-12T21:30:21Z
core/integration/container_test.go
Mounts []string WithExec struct { 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") { withExec(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) {
closed
dagger/dagger
https://github.com/dagger/dagger
3,025
Include output of failed exec in graphql errors
Right now if an exec fails the graphql error just says that it exited non-zero. This makes it hard to debug unless you go look at the buildkit progress output. We should instead include the output of the execop in the graphql error to help debugging. The implementation is not incredibly straightforward. Buildkit has the ability to obtain the FS of a failed exec op (including changes made during the command): https://github.com/moby/buildkit/blob/c9a0f4d2de095591e742d7f411d9ed36a03a1c4e/client/build_test.go#L1278-L1310 We will probably need to use that to obtain the output as written to the output files by the shim. We should also make sure to limit the size of the output included so if there's a failure during a command with many megabytes of output (e.g. compiling a large project) we don't try to transfer all of that in the error. Instead, we can just return the last N bytes.
https://github.com/dagger/dagger/issues/3025
https://github.com/dagger/dagger/pull/4161
5257ac03f6bae55e7f8ac4d0713251b9e0499aa3
a795bea02f59a980912cf95e04902b5a77cab39a
2022-09-07T20:42:51Z
go
2022-12-12T21:30:21Z
core/integration/container_test.go
mounts withExec(args: ["touch", "dir/another-file"]) { 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.WithExec.WithWorkdir.WithWorkdir.WithMountedDirectory.WithMountedTemp.WithMountedCache.Mounts) require.Equal(t, []string{"/mnt/sub/dir", "/mnt/sub/tmp"}, writeRes.Container.From.WithExec.WithWorkdir.WithWorkdir.WithMountedDirectory.WithMountedTemp.WithMountedCache.WithoutMount.Mounts) writtenID := writeRes.Container.From.WithExec.WithWorkdir.WithWorkdir.WithMountedDirectory.WithMountedTemp.WithMountedCache.WithExec.Directory.ID execRes := struct {
closed
dagger/dagger
https://github.com/dagger/dagger
3,025
Include output of failed exec in graphql errors
Right now if an exec fails the graphql error just says that it exited non-zero. This makes it hard to debug unless you go look at the buildkit progress output. We should instead include the output of the execop in the graphql error to help debugging. The implementation is not incredibly straightforward. Buildkit has the ability to obtain the FS of a failed exec op (including changes made during the command): https://github.com/moby/buildkit/blob/c9a0f4d2de095591e742d7f411d9ed36a03a1c4e/client/build_test.go#L1278-L1310 We will probably need to use that to obtain the output as written to the output files by the shim. We should also make sure to limit the size of the output included so if there's a failure during a command with many megabytes of output (e.g. compiling a large project) we don't try to transfer all of that in the error. Instead, we can just return the last N bytes.
https://github.com/dagger/dagger/issues/3025
https://github.com/dagger/dagger/pull/4161
5257ac03f6bae55e7f8ac4d0713251b9e0499aa3
a795bea02f59a980912cf95e04902b5a77cab39a
2022-09-07T20:42:51Z
go
2022-12-12T21:30:21Z
core/integration/container_test.go
Container struct { From struct { WithMountedDirectory struct { WithExec struct { Stdout string } } } } }{} err = testutil.Query( `query Test($id: DirectoryID!) { container { from(address: "alpine:3.16.2") { withMountedDirectory(path: "/mnt/dir", source: $id) { withExec(args: ["ls", "/mnt/dir"]) { stdout } } } } }`, &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.WithExec.Stdout) } func TestContainerMultiFrom(t *testing.T) { t.Parallel() dirRes := struct {
closed
dagger/dagger
https://github.com/dagger/dagger
3,025
Include output of failed exec in graphql errors
Right now if an exec fails the graphql error just says that it exited non-zero. This makes it hard to debug unless you go look at the buildkit progress output. We should instead include the output of the execop in the graphql error to help debugging. The implementation is not incredibly straightforward. Buildkit has the ability to obtain the FS of a failed exec op (including changes made during the command): https://github.com/moby/buildkit/blob/c9a0f4d2de095591e742d7f411d9ed36a03a1c4e/client/build_test.go#L1278-L1310 We will probably need to use that to obtain the output as written to the output files by the shim. We should also make sure to limit the size of the output included so if there's a failure during a command with many megabytes of output (e.g. compiling a large project) we don't try to transfer all of that in the error. Instead, we can just return the last N bytes.
https://github.com/dagger/dagger/issues/3025
https://github.com/dagger/dagger/pull/4161
5257ac03f6bae55e7f8ac4d0713251b9e0499aa3
a795bea02f59a980912cf95e04902b5a77cab39a
2022-09-07T20:42:51Z
go
2022-12-12T21:30:21Z
core/integration/container_test.go
Directory struct { ID core.DirectoryID } }{} err := testutil.Query( `{ directory { id } }`, &dirRes, nil) require.NoError(t, err) id := dirRes.Directory.ID execRes := struct {
closed
dagger/dagger
https://github.com/dagger/dagger
3,025
Include output of failed exec in graphql errors
Right now if an exec fails the graphql error just says that it exited non-zero. This makes it hard to debug unless you go look at the buildkit progress output. We should instead include the output of the execop in the graphql error to help debugging. The implementation is not incredibly straightforward. Buildkit has the ability to obtain the FS of a failed exec op (including changes made during the command): https://github.com/moby/buildkit/blob/c9a0f4d2de095591e742d7f411d9ed36a03a1c4e/client/build_test.go#L1278-L1310 We will probably need to use that to obtain the output as written to the output files by the shim. We should also make sure to limit the size of the output included so if there's a failure during a command with many megabytes of output (e.g. compiling a large project) we don't try to transfer all of that in the error. Instead, we can just return the last N bytes.
https://github.com/dagger/dagger/issues/3025
https://github.com/dagger/dagger/pull/4161
5257ac03f6bae55e7f8ac4d0713251b9e0499aa3
a795bea02f59a980912cf95e04902b5a77cab39a
2022-09-07T20:42:51Z
go
2022-12-12T21:30:21Z
core/integration/container_test.go
Container struct { From struct { WithMountedDirectory struct { WithExec struct { From struct { WithExec struct { WithExec struct { Stdout string } } } } } } } }{} err = testutil.Query( `query Test($id: DirectoryID!) { container { from(address: "node:18.10.0-alpine") { withMountedDirectory(path: "/mnt", source: $id) { withExec(args: ["sh", "-c", "node --version >> /mnt/versions"]) { from(address: "golang:1.18.2-alpine") { withExec(args: ["sh", "-c", "go version >> /mnt/versions"]) { withExec(args: ["cat", "/mnt/versions"]) { stdout } } } }
closed
dagger/dagger
https://github.com/dagger/dagger
3,025
Include output of failed exec in graphql errors
Right now if an exec fails the graphql error just says that it exited non-zero. This makes it hard to debug unless you go look at the buildkit progress output. We should instead include the output of the execop in the graphql error to help debugging. The implementation is not incredibly straightforward. Buildkit has the ability to obtain the FS of a failed exec op (including changes made during the command): https://github.com/moby/buildkit/blob/c9a0f4d2de095591e742d7f411d9ed36a03a1c4e/client/build_test.go#L1278-L1310 We will probably need to use that to obtain the output as written to the output files by the shim. We should also make sure to limit the size of the output included so if there's a failure during a command with many megabytes of output (e.g. compiling a large project) we don't try to transfer all of that in the error. Instead, we can just return the last N bytes.
https://github.com/dagger/dagger/issues/3025
https://github.com/dagger/dagger/pull/4161
5257ac03f6bae55e7f8ac4d0713251b9e0499aa3
a795bea02f59a980912cf95e04902b5a77cab39a
2022-09-07T20:42:51Z
go
2022-12-12T21:30:21Z
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.WithExec.From.WithExec.WithExec.Stdout, "v18.10.0\n") require.Contains(t, execRes.Container.From.WithMountedDirectory.WithExec.From.WithExec.WithExec.Stdout, "go version go1.18.2") } func TestContainerPublish(t *testing.T) { ctx, cancel := context.WithCancel(context.Background()) defer cancel() c, err := dagger.Connect(ctx) require.NoError(t, err) defer c.Close() startRegistry(ctx, c, t) testRef := "127.0.0.1:5000/testimagepush:latest" pushedRef, err := c.Container(). From("alpine:3.16.2"). Publish(ctx, testRef) require.NoError(t, err) require.NotEqual(t, testRef, pushedRef) require.Contains(t, pushedRef, "@sha256:") contents, err := c.Container(). From(pushedRef).Rootfs().File("/etc/alpine-release").Contents(ctx) require.NoError(t, err) require.Equal(t, contents, "3.16.2\n") } func TestExecFromScratch(t *testing.T) {
closed
dagger/dagger
https://github.com/dagger/dagger
3,025
Include output of failed exec in graphql errors
Right now if an exec fails the graphql error just says that it exited non-zero. This makes it hard to debug unless you go look at the buildkit progress output. We should instead include the output of the execop in the graphql error to help debugging. The implementation is not incredibly straightforward. Buildkit has the ability to obtain the FS of a failed exec op (including changes made during the command): https://github.com/moby/buildkit/blob/c9a0f4d2de095591e742d7f411d9ed36a03a1c4e/client/build_test.go#L1278-L1310 We will probably need to use that to obtain the output as written to the output files by the shim. We should also make sure to limit the size of the output included so if there's a failure during a command with many megabytes of output (e.g. compiling a large project) we don't try to transfer all of that in the error. Instead, we can just return the last N bytes.
https://github.com/dagger/dagger/issues/3025
https://github.com/dagger/dagger/pull/4161
5257ac03f6bae55e7f8ac4d0713251b9e0499aa3
a795bea02f59a980912cf95e04902b5a77cab39a
2022-09-07T20:42:51Z
go
2022-12-12T21:30:21Z
core/integration/container_test.go
ctx, cancel := context.WithCancel(context.Background()) defer cancel() c, err := dagger.Connect(ctx) require.NoError(t, err) defer c.Close() startRegistry(ctx, c, t) execBusybox := c.Container(). WithMountedFile("/busybox", c.Container().From("busybox:musl").File("/bin/busybox")). WithExec([]string{"/busybox"}) _, err = execBusybox.Stdout(ctx) require.NoError(t, err) _, err = execBusybox.Publish(ctx, "127.0.0.1:5000/testexecfromscratch:latest") require.NoError(t, err) } func TestContainerMultipleMounts(t *testing.T) {
closed
dagger/dagger
https://github.com/dagger/dagger
3,025
Include output of failed exec in graphql errors
Right now if an exec fails the graphql error just says that it exited non-zero. This makes it hard to debug unless you go look at the buildkit progress output. We should instead include the output of the execop in the graphql error to help debugging. The implementation is not incredibly straightforward. Buildkit has the ability to obtain the FS of a failed exec op (including changes made during the command): https://github.com/moby/buildkit/blob/c9a0f4d2de095591e742d7f411d9ed36a03a1c4e/client/build_test.go#L1278-L1310 We will probably need to use that to obtain the output as written to the output files by the shim. We should also make sure to limit the size of the output included so if there's a failure during a command with many megabytes of output (e.g. compiling a large project) we don't try to transfer all of that in the error. Instead, we can just return the last N bytes.
https://github.com/dagger/dagger/issues/3025
https://github.com/dagger/dagger/pull/4161
5257ac03f6bae55e7f8ac4d0713251b9e0499aa3
a795bea02f59a980912cf95e04902b5a77cab39a
2022-09-07T20:42:51Z
go
2022-12-12T21:30:21Z
core/integration/container_test.go
c, ctx := connect(t) defer c.Close() dir := t.TempDir() require.NoError(t, os.WriteFile(filepath.Join(dir, "one"), []byte("1"), 0600)) require.NoError(t, os.WriteFile(filepath.Join(dir, "two"), []byte("2"), 0600)) require.NoError(t, os.WriteFile(filepath.Join(dir, "three"), []byte("3"), 0600)) one := c.Host().Directory(dir).File("one") two := c.Host().Directory(dir).File("two") three := c.Host().Directory(dir).File("three") build := c.Container().From("alpine:3.16.2"). WithMountedFile("/example/one", one). WithMountedFile("/example/two", two). WithMountedFile("/example/three", three) build = build.WithExec([]string{"ls", "/example/one", "/example/two", "/example/three"}) build = build.WithExec([]string{"cat", "/example/one", "/example/two", "/example/three"}) out, err := build.Stdout(ctx) require.NoError(t, err) require.Equal(t, "123", out) } func TestContainerExport(t *testing.T) { t.Parallel() ctx := context.Background() wd := t.TempDir() dest := t.TempDir() c, err := dagger.Connect(ctx, dagger.WithWorkdir(wd)) require.NoError(t, err)
closed
dagger/dagger
https://github.com/dagger/dagger
3,025
Include output of failed exec in graphql errors
Right now if an exec fails the graphql error just says that it exited non-zero. This makes it hard to debug unless you go look at the buildkit progress output. We should instead include the output of the execop in the graphql error to help debugging. The implementation is not incredibly straightforward. Buildkit has the ability to obtain the FS of a failed exec op (including changes made during the command): https://github.com/moby/buildkit/blob/c9a0f4d2de095591e742d7f411d9ed36a03a1c4e/client/build_test.go#L1278-L1310 We will probably need to use that to obtain the output as written to the output files by the shim. We should also make sure to limit the size of the output included so if there's a failure during a command with many megabytes of output (e.g. compiling a large project) we don't try to transfer all of that in the error. Instead, we can just return the last N bytes.
https://github.com/dagger/dagger/issues/3025
https://github.com/dagger/dagger/pull/4161
5257ac03f6bae55e7f8ac4d0713251b9e0499aa3
a795bea02f59a980912cf95e04902b5a77cab39a
2022-09-07T20:42:51Z
go
2022-12-12T21:30:21Z
core/integration/container_test.go
defer c.Close() ctr := c.Container().From("alpine:3.16.2") t.Run("to absolute dir", func(t *testing.T) { imagePath := filepath.Join(dest, "image.tar") ok, err := ctr.Export(ctx, imagePath) require.NoError(t, err) require.True(t, ok) entries := tarEntries(t, imagePath) require.Contains(t, entries, "oci-layout") require.Contains(t, entries, "index.json") require.Contains(t, entries, "manifest.json") }) t.Run("to workdir", func(t *testing.T) { ok, err := ctr.Export(ctx, "./image.tar") require.NoError(t, err) require.True(t, ok) entries := tarEntries(t, filepath.Join(wd, "image.tar")) require.Contains(t, entries, "oci-layout") require.Contains(t, entries, "index.json") require.Contains(t, entries, "manifest.json") }) t.Run("to outer dir", func(t *testing.T) { ok, err := ctr.Export(ctx, "../") require.Error(t, err) require.False(t, ok) }) } func TestContainerMultiPlatformExport(t *testing.T) {
closed
dagger/dagger
https://github.com/dagger/dagger
3,025
Include output of failed exec in graphql errors
Right now if an exec fails the graphql error just says that it exited non-zero. This makes it hard to debug unless you go look at the buildkit progress output. We should instead include the output of the execop in the graphql error to help debugging. The implementation is not incredibly straightforward. Buildkit has the ability to obtain the FS of a failed exec op (including changes made during the command): https://github.com/moby/buildkit/blob/c9a0f4d2de095591e742d7f411d9ed36a03a1c4e/client/build_test.go#L1278-L1310 We will probably need to use that to obtain the output as written to the output files by the shim. We should also make sure to limit the size of the output included so if there's a failure during a command with many megabytes of output (e.g. compiling a large project) we don't try to transfer all of that in the error. Instead, we can just return the last N bytes.
https://github.com/dagger/dagger/issues/3025
https://github.com/dagger/dagger/pull/4161
5257ac03f6bae55e7f8ac4d0713251b9e0499aa3
a795bea02f59a980912cf95e04902b5a77cab39a
2022-09-07T20:42:51Z
go
2022-12-12T21:30:21Z
core/integration/container_test.go
ctx, cancel := context.WithCancel(context.Background()) defer cancel() c, err := dagger.Connect(ctx, dagger.WithLogOutput(os.Stdout)) require.NoError(t, err) defer c.Close() startRegistry(ctx, c, t) variants := make([]*dagger.Container, 0, len(platformToUname)) for platform := range platformToUname { ctr := c.Container(dagger.ContainerOpts{Platform: platform}). From("alpine:3.16.2"). WithExec([]string{"uname", "-m"}) variants = append(variants, ctr) } dest := filepath.Join(t.TempDir(), "image.tar") ok, err := c.Container().Export(ctx, dest, dagger.ContainerExportOpts{ PlatformVariants: variants, }) require.NoError(t, err) require.True(t, ok) entries := tarEntries(t, dest) require.Contains(t, entries, "oci-layout") require.Contains(t, entries, "index.json") require.NotContains(t, entries, "manifest.json") } func TestContainerWithDirectoryToMount(t *testing.T) {
closed
dagger/dagger
https://github.com/dagger/dagger
3,025
Include output of failed exec in graphql errors
Right now if an exec fails the graphql error just says that it exited non-zero. This makes it hard to debug unless you go look at the buildkit progress output. We should instead include the output of the execop in the graphql error to help debugging. The implementation is not incredibly straightforward. Buildkit has the ability to obtain the FS of a failed exec op (including changes made during the command): https://github.com/moby/buildkit/blob/c9a0f4d2de095591e742d7f411d9ed36a03a1c4e/client/build_test.go#L1278-L1310 We will probably need to use that to obtain the output as written to the output files by the shim. We should also make sure to limit the size of the output included so if there's a failure during a command with many megabytes of output (e.g. compiling a large project) we don't try to transfer all of that in the error. Instead, we can just return the last N bytes.
https://github.com/dagger/dagger/issues/3025
https://github.com/dagger/dagger/pull/4161
5257ac03f6bae55e7f8ac4d0713251b9e0499aa3
a795bea02f59a980912cf95e04902b5a77cab39a
2022-09-07T20:42:51Z
go
2022-12-12T21:30:21Z
core/integration/container_test.go
t.Parallel() ctx := context.Background() c, err := dagger.Connect(ctx, dagger.WithLogOutput(os.Stdout)) require.NoError(t, err) defer c.Close() mnt := c.Directory(). WithNewDirectory("/top/sub-dir/sub-file"). Directory("/top") ctr := c.Container(). From("alpine:3.16.2"). WithMountedDirectory("/mnt", mnt) dir := c.Directory(). WithNewFile("/copied-file", "some-content") ctr = ctr.WithDirectory("/mnt/sub-dir/copied-dir", dir) contents, err := ctr.WithExec([]string{"find", "/mnt"}).Stdout(ctx) require.NoError(t, err) require.Equal(t, []string{ "/mnt", "/mnt/sub-dir", "/mnt/sub-dir/sub-file", "/mnt/sub-dir/copied-dir", "/mnt/sub-dir/copied-dir/copied-file", }, strings.Split(strings.Trim(contents, "\n"), "\n")) } var echoSocketSrc string func TestContainerWithUnixSocket(t *testing.T) {
closed
dagger/dagger
https://github.com/dagger/dagger
3,025
Include output of failed exec in graphql errors
Right now if an exec fails the graphql error just says that it exited non-zero. This makes it hard to debug unless you go look at the buildkit progress output. We should instead include the output of the execop in the graphql error to help debugging. The implementation is not incredibly straightforward. Buildkit has the ability to obtain the FS of a failed exec op (including changes made during the command): https://github.com/moby/buildkit/blob/c9a0f4d2de095591e742d7f411d9ed36a03a1c4e/client/build_test.go#L1278-L1310 We will probably need to use that to obtain the output as written to the output files by the shim. We should also make sure to limit the size of the output included so if there's a failure during a command with many megabytes of output (e.g. compiling a large project) we don't try to transfer all of that in the error. Instead, we can just return the last N bytes.
https://github.com/dagger/dagger/issues/3025
https://github.com/dagger/dagger/pull/4161
5257ac03f6bae55e7f8ac4d0713251b9e0499aa3
a795bea02f59a980912cf95e04902b5a77cab39a
2022-09-07T20:42:51Z
go
2022-12-12T21:30:21Z
core/integration/container_test.go
ctx := context.Background() c, err := dagger.Connect(ctx, dagger.WithLogOutput(os.Stdout)) require.NoError(t, err) tmp := t.TempDir() sock := filepath.Join(tmp, "test.sock") l, err := net.Listen("unix", sock) require.NoError(t, err) defer l.Close() go func() { for { c, err := l.Accept() if err != nil { if !errors.Is(err, net.ErrClosed) { t.Logf("accept: %s", err) panic(err) } return } n, err := io.Copy(c, c) if err != nil { t.Logf("hello: %s", err) panic(err) } t.Logf("copied %d bytes", n) err = c.Close() if err != nil { t.Logf("close: %s", err) panic(err) } }
closed
dagger/dagger
https://github.com/dagger/dagger
3,025
Include output of failed exec in graphql errors
Right now if an exec fails the graphql error just says that it exited non-zero. This makes it hard to debug unless you go look at the buildkit progress output. We should instead include the output of the execop in the graphql error to help debugging. The implementation is not incredibly straightforward. Buildkit has the ability to obtain the FS of a failed exec op (including changes made during the command): https://github.com/moby/buildkit/blob/c9a0f4d2de095591e742d7f411d9ed36a03a1c4e/client/build_test.go#L1278-L1310 We will probably need to use that to obtain the output as written to the output files by the shim. We should also make sure to limit the size of the output included so if there's a failure during a command with many megabytes of output (e.g. compiling a large project) we don't try to transfer all of that in the error. Instead, we can just return the last N bytes.
https://github.com/dagger/dagger/issues/3025
https://github.com/dagger/dagger/pull/4161
5257ac03f6bae55e7f8ac4d0713251b9e0499aa3
a795bea02f59a980912cf95e04902b5a77cab39a
2022-09-07T20:42:51Z
go
2022-12-12T21:30:21Z
core/integration/container_test.go
}() echo := c.Directory().WithNewFile("main.go", echoSocketSrc).File("main.go") ctr := c.Container(). From("golang:1.18.2-alpine"). WithMountedFile("/src/main.go", echo). WithUnixSocket("/tmp/test.sock", c.Host().UnixSocket(sock)). WithExec([]string{"go", "run", "/src/main.go", "/tmp/test.sock", "hello"}) stdout, err := ctr.Stdout(ctx) require.NoError(t, err) require.Equal(t, "hello\n", stdout) t.Run("socket can be removed", func(t *testing.T) { without := ctr.WithoutUnixSocket("/tmp/test.sock"). WithExec([]string{"ls", "/tmp"}) stdout, err = without.Stdout(ctx) require.NoError(t, err) require.Empty(t, stdout) }) t.Run("replaces existing socket at same path", func(t *testing.T) { repeated := ctr.WithUnixSocket("/tmp/test.sock", c.Host().UnixSocket(sock)) stdout, err := repeated.Stdout(ctx) require.NoError(t, err) require.Equal(t, "hello\n", stdout) without := repeated.WithoutUnixSocket("/tmp/test.sock"). WithExec([]string{"ls", "/tmp"}) stdout, err = without.Stdout(ctx) require.NoError(t, err) require.Empty(t, stdout) }) }
closed
dagger/dagger
https://github.com/dagger/dagger
3,025
Include output of failed exec in graphql errors
Right now if an exec fails the graphql error just says that it exited non-zero. This makes it hard to debug unless you go look at the buildkit progress output. We should instead include the output of the execop in the graphql error to help debugging. The implementation is not incredibly straightforward. Buildkit has the ability to obtain the FS of a failed exec op (including changes made during the command): https://github.com/moby/buildkit/blob/c9a0f4d2de095591e742d7f411d9ed36a03a1c4e/client/build_test.go#L1278-L1310 We will probably need to use that to obtain the output as written to the output files by the shim. We should also make sure to limit the size of the output included so if there's a failure during a command with many megabytes of output (e.g. compiling a large project) we don't try to transfer all of that in the error. Instead, we can just return the last N bytes.
https://github.com/dagger/dagger/issues/3025
https://github.com/dagger/dagger/pull/4161
5257ac03f6bae55e7f8ac4d0713251b9e0499aa3
a795bea02f59a980912cf95e04902b5a77cab39a
2022-09-07T20:42:51Z
go
2022-12-12T21:30:21Z
core/schema/base.go
package schema import ( "github.com/dagger/dagger/core" "github.com/dagger/dagger/project" "github.com/dagger/dagger/router" bkclient "github.com/moby/buildkit/client" bkgw "github.com/moby/buildkit/frontend/gateway/client" specs "github.com/opencontainers/image-spec/specs-go/v1" ) type InitializeArgs struct { Router *router.Router Workdir string Gateway bkgw.Client BKClient *bkclient.Client SolveOpts bkclient.SolveOpt SolveCh chan *bkclient.SolveStatus Platform specs.Platform DisableHostRW bool } func New(params InitializeArgs) (router.ExecutableSchema, error) {
closed
dagger/dagger
https://github.com/dagger/dagger
3,025
Include output of failed exec in graphql errors
Right now if an exec fails the graphql error just says that it exited non-zero. This makes it hard to debug unless you go look at the buildkit progress output. We should instead include the output of the execop in the graphql error to help debugging. The implementation is not incredibly straightforward. Buildkit has the ability to obtain the FS of a failed exec op (including changes made during the command): https://github.com/moby/buildkit/blob/c9a0f4d2de095591e742d7f411d9ed36a03a1c4e/client/build_test.go#L1278-L1310 We will probably need to use that to obtain the output as written to the output files by the shim. We should also make sure to limit the size of the output included so if there's a failure during a command with many megabytes of output (e.g. compiling a large project) we don't try to transfer all of that in the error. Instead, we can just return the last N bytes.
https://github.com/dagger/dagger/issues/3025
https://github.com/dagger/dagger/pull/4161
5257ac03f6bae55e7f8ac4d0713251b9e0499aa3
a795bea02f59a980912cf95e04902b5a77cab39a
2022-09-07T20:42:51Z
go
2022-12-12T21:30:21Z
core/schema/base.go
base := &baseSchema{ router: params.Router, gw: params.Gateway, bkClient: params.BKClient, solveOpts: params.SolveOpts, solveCh: params.SolveCh, platform: params.Platform, } host := core.NewHost(params.Workdir, params.DisableHostRW) return router.MergeExecutableSchemas("core", &directorySchema{base, host}, &fileSchema{base, host}, &gitSchema{base}, &containerSchema{base, host}, &cacheSchema{base}, &secretSchema{base}, &hostSchema{base, host}, &projectSchema{ baseSchema: base, projectStates: make(map[string]*project.State), }, &httpSchema{base}, &platformSchema{base}, &socketSchema{base, host}, ) } type baseSchema struct {
closed
dagger/dagger
https://github.com/dagger/dagger
3,025
Include output of failed exec in graphql errors
Right now if an exec fails the graphql error just says that it exited non-zero. This makes it hard to debug unless you go look at the buildkit progress output. We should instead include the output of the execop in the graphql error to help debugging. The implementation is not incredibly straightforward. Buildkit has the ability to obtain the FS of a failed exec op (including changes made during the command): https://github.com/moby/buildkit/blob/c9a0f4d2de095591e742d7f411d9ed36a03a1c4e/client/build_test.go#L1278-L1310 We will probably need to use that to obtain the output as written to the output files by the shim. We should also make sure to limit the size of the output included so if there's a failure during a command with many megabytes of output (e.g. compiling a large project) we don't try to transfer all of that in the error. Instead, we can just return the last N bytes.
https://github.com/dagger/dagger/issues/3025
https://github.com/dagger/dagger/pull/4161
5257ac03f6bae55e7f8ac4d0713251b9e0499aa3
a795bea02f59a980912cf95e04902b5a77cab39a
2022-09-07T20:42:51Z
go
2022-12-12T21:30:21Z
core/schema/base.go
router *router.Router gw bkgw.Client bkClient *bkclient.Client solveOpts bkclient.SolveOpt solveCh chan *bkclient.SolveStatus platform specs.Platform }
closed
dagger/dagger
https://github.com/dagger/dagger
4,216
🐞 NodeJS: Support GraphQL `input` types
### What is the issue? As evidenced in https://github.com/dagger/dagger/pull/4207, the NodeJS/Typescript codegen doesn't currently support [GraphQL input types](https://graphql.org/learn/schema/#input-types). ### Log output ``` #26 docker-entrypoint.sh yarn test #26 0.304 yarn run v1.22.19 #26 0.354 $ mocha #26 0.643 (node:39) ExperimentalWarning: Custom ESM Loaders is an experimental feature. This feature could change at any time #26 0.643 (Use `node --trace-warnings ...` to show where the warning was created) #26 4.956 #26 4.956 TSError: ⨯ Unable to compile TypeScript: #26 4.956 api/client.gen.ts(62,15): error TS2304: Cannot find name 'BuildArg'. #26 4.956 api/client.gen.ts(156,15): error TS2304: Cannot find name 'BuildArg'. #26 4.956 #26 4.956 at createTSError (/workdir/node_modules/ts-node/src/index.ts:859:12) #26 4.956 at reportTSError (/workdir/node_modules/ts-node/src/index.ts:863:19) #26 4.956 at getOutput (/workdir/node_modules/ts-node/src/index.ts:1077:36) #26 4.956 at Object.compile (/workdir/node_modules/ts-node/src/index.ts:1433:41) #26 4.956 at transformSource (/workdir/node_modules/ts-node/src/esm.ts:400:37) #26 4.956 at /workdir/node_modules/ts-node/src/esm.ts:278:53 #26 4.956 at async addShortCircuitFlag (/workdir/node_modules/ts-node/src/esm.ts:409:15) #26 4.956 at async nextLoad (node:internal/modules/esm/loader:163:22) #26 4.956 at async ESMLoader.load (node:internal/modules/esm/loader:605:20) #26 4.956 at async ESMLoader.moduleProvider (node:internal/modules/esm/loader:457:11) #26 5.003 error Command failed with exit code 1. #26 5.003 info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command. #26 ERROR: process "docker-entrypoint.sh yarn test" did not complete successfully: exit code: 1 Error: input:1: container.from.withWorkdir.withRootfs.withExec.withRootfs.withUnixSocket.withMountedFile.withMountedFile.withEnvVariable.withEnvVariable.withMountedDirectory.withExec.exitCode process "docker-entrypoint.sh yarn test" did not complete successfully: exit code: 1 ``` ### Steps to reproduce _No response_ ### SDK version Latest NodeJS SDK ### OS version All of them. :)
https://github.com/dagger/dagger/issues/4216
https://github.com/dagger/dagger/pull/4247
7725948fedd64364e87d55404dfa0416b55c637b
385d9a9fabb838b783b13a107f0488c0d67f1721
2022-12-16T23:03:21Z
go
2022-12-22T14:49:15Z
codegen/generator/nodejs/templates/src/type_test.go
package test import ( "bytes" "testing" "github.com/stretchr/testify/require" ) func TestType(t *testing.T) { t.Run("scalar", func(t *testing.T) { var expectedFieldArgsType = ` /** * Hola */ export type Container = string; ` var fieldArgsTypeJSON = ` { "kind": "SCALAR", "name": "Container", "description": "Hola" } `
closed
dagger/dagger
https://github.com/dagger/dagger
4,216
🐞 NodeJS: Support GraphQL `input` types
### What is the issue? As evidenced in https://github.com/dagger/dagger/pull/4207, the NodeJS/Typescript codegen doesn't currently support [GraphQL input types](https://graphql.org/learn/schema/#input-types). ### Log output ``` #26 docker-entrypoint.sh yarn test #26 0.304 yarn run v1.22.19 #26 0.354 $ mocha #26 0.643 (node:39) ExperimentalWarning: Custom ESM Loaders is an experimental feature. This feature could change at any time #26 0.643 (Use `node --trace-warnings ...` to show where the warning was created) #26 4.956 #26 4.956 TSError: ⨯ Unable to compile TypeScript: #26 4.956 api/client.gen.ts(62,15): error TS2304: Cannot find name 'BuildArg'. #26 4.956 api/client.gen.ts(156,15): error TS2304: Cannot find name 'BuildArg'. #26 4.956 #26 4.956 at createTSError (/workdir/node_modules/ts-node/src/index.ts:859:12) #26 4.956 at reportTSError (/workdir/node_modules/ts-node/src/index.ts:863:19) #26 4.956 at getOutput (/workdir/node_modules/ts-node/src/index.ts:1077:36) #26 4.956 at Object.compile (/workdir/node_modules/ts-node/src/index.ts:1433:41) #26 4.956 at transformSource (/workdir/node_modules/ts-node/src/esm.ts:400:37) #26 4.956 at /workdir/node_modules/ts-node/src/esm.ts:278:53 #26 4.956 at async addShortCircuitFlag (/workdir/node_modules/ts-node/src/esm.ts:409:15) #26 4.956 at async nextLoad (node:internal/modules/esm/loader:163:22) #26 4.956 at async ESMLoader.load (node:internal/modules/esm/loader:605:20) #26 4.956 at async ESMLoader.moduleProvider (node:internal/modules/esm/loader:457:11) #26 5.003 error Command failed with exit code 1. #26 5.003 info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command. #26 ERROR: process "docker-entrypoint.sh yarn test" did not complete successfully: exit code: 1 Error: input:1: container.from.withWorkdir.withRootfs.withExec.withRootfs.withUnixSocket.withMountedFile.withMountedFile.withEnvVariable.withEnvVariable.withMountedDirectory.withExec.exitCode process "docker-entrypoint.sh yarn test" did not complete successfully: exit code: 1 ``` ### Steps to reproduce _No response_ ### SDK version Latest NodeJS SDK ### OS version All of them. :)
https://github.com/dagger/dagger/issues/4216
https://github.com/dagger/dagger/pull/4247
7725948fedd64364e87d55404dfa0416b55c637b
385d9a9fabb838b783b13a107f0488c0d67f1721
2022-12-16T23:03:21Z
go
2022-12-22T14:49:15Z
codegen/generator/nodejs/templates/src/type_test.go
tmpl := templateHelper(t) object := objectInit(t, fieldArgsTypeJSON) var b bytes.Buffer err := tmpl.ExecuteTemplate(&b, "type", object) want := expectedFieldArgsType require.NoError(t, err) require.Equal(t, want, b.String()) }) t.Run("args", func(t *testing.T) { var expectedFieldArgsType = ` export type ContainerExecOpts = { /** * Command to run instead of the container's default command */ args?: string[]; /** * Content to write to the command's standard input before closing */ stdin?: string; /** * Redirect the command's standard output to a file in the container */ redirectStdout?: string; /** * Redirect the command's standard error to a file in the container */ redirectStderr?: string; /** * Provide dagger access to the executed command * Do not use this option unless you trust the command being executed
closed
dagger/dagger
https://github.com/dagger/dagger
4,216
🐞 NodeJS: Support GraphQL `input` types
### What is the issue? As evidenced in https://github.com/dagger/dagger/pull/4207, the NodeJS/Typescript codegen doesn't currently support [GraphQL input types](https://graphql.org/learn/schema/#input-types). ### Log output ``` #26 docker-entrypoint.sh yarn test #26 0.304 yarn run v1.22.19 #26 0.354 $ mocha #26 0.643 (node:39) ExperimentalWarning: Custom ESM Loaders is an experimental feature. This feature could change at any time #26 0.643 (Use `node --trace-warnings ...` to show where the warning was created) #26 4.956 #26 4.956 TSError: ⨯ Unable to compile TypeScript: #26 4.956 api/client.gen.ts(62,15): error TS2304: Cannot find name 'BuildArg'. #26 4.956 api/client.gen.ts(156,15): error TS2304: Cannot find name 'BuildArg'. #26 4.956 #26 4.956 at createTSError (/workdir/node_modules/ts-node/src/index.ts:859:12) #26 4.956 at reportTSError (/workdir/node_modules/ts-node/src/index.ts:863:19) #26 4.956 at getOutput (/workdir/node_modules/ts-node/src/index.ts:1077:36) #26 4.956 at Object.compile (/workdir/node_modules/ts-node/src/index.ts:1433:41) #26 4.956 at transformSource (/workdir/node_modules/ts-node/src/esm.ts:400:37) #26 4.956 at /workdir/node_modules/ts-node/src/esm.ts:278:53 #26 4.956 at async addShortCircuitFlag (/workdir/node_modules/ts-node/src/esm.ts:409:15) #26 4.956 at async nextLoad (node:internal/modules/esm/loader:163:22) #26 4.956 at async ESMLoader.load (node:internal/modules/esm/loader:605:20) #26 4.956 at async ESMLoader.moduleProvider (node:internal/modules/esm/loader:457:11) #26 5.003 error Command failed with exit code 1. #26 5.003 info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command. #26 ERROR: process "docker-entrypoint.sh yarn test" did not complete successfully: exit code: 1 Error: input:1: container.from.withWorkdir.withRootfs.withExec.withRootfs.withUnixSocket.withMountedFile.withMountedFile.withEnvVariable.withEnvVariable.withMountedDirectory.withExec.exitCode process "docker-entrypoint.sh yarn test" did not complete successfully: exit code: 1 ``` ### Steps to reproduce _No response_ ### SDK version Latest NodeJS SDK ### OS version All of them. :)
https://github.com/dagger/dagger/issues/4216
https://github.com/dagger/dagger/pull/4247
7725948fedd64364e87d55404dfa0416b55c637b
385d9a9fabb838b783b13a107f0488c0d67f1721
2022-12-16T23:03:21Z
go
2022-12-22T14:49:15Z
codegen/generator/nodejs/templates/src/type_test.go
* The command being executed WILL BE GRANTED FULL ACCESS TO YOUR HOST FILESYSTEM */ experimentalPrivilegedNesting?: boolean; }; ` var fieldArgsTypeJSON = ` { "description": "An OCI-compatible container, also known as a docker container", "fields": [ { "args": [ { "defaultValue": null, "description": "Command to run instead of the container's default command", "name": "args", "type": { "kind": "LIST", "ofType": { "kind": "NON_NULL", "ofType": { "kind": "SCALAR", "name": "String" } } } }, { "defaultValue": null, "description": "Content to write to the command's standard input before closing", "name": "stdin",
closed
dagger/dagger
https://github.com/dagger/dagger
4,216
🐞 NodeJS: Support GraphQL `input` types
### What is the issue? As evidenced in https://github.com/dagger/dagger/pull/4207, the NodeJS/Typescript codegen doesn't currently support [GraphQL input types](https://graphql.org/learn/schema/#input-types). ### Log output ``` #26 docker-entrypoint.sh yarn test #26 0.304 yarn run v1.22.19 #26 0.354 $ mocha #26 0.643 (node:39) ExperimentalWarning: Custom ESM Loaders is an experimental feature. This feature could change at any time #26 0.643 (Use `node --trace-warnings ...` to show where the warning was created) #26 4.956 #26 4.956 TSError: ⨯ Unable to compile TypeScript: #26 4.956 api/client.gen.ts(62,15): error TS2304: Cannot find name 'BuildArg'. #26 4.956 api/client.gen.ts(156,15): error TS2304: Cannot find name 'BuildArg'. #26 4.956 #26 4.956 at createTSError (/workdir/node_modules/ts-node/src/index.ts:859:12) #26 4.956 at reportTSError (/workdir/node_modules/ts-node/src/index.ts:863:19) #26 4.956 at getOutput (/workdir/node_modules/ts-node/src/index.ts:1077:36) #26 4.956 at Object.compile (/workdir/node_modules/ts-node/src/index.ts:1433:41) #26 4.956 at transformSource (/workdir/node_modules/ts-node/src/esm.ts:400:37) #26 4.956 at /workdir/node_modules/ts-node/src/esm.ts:278:53 #26 4.956 at async addShortCircuitFlag (/workdir/node_modules/ts-node/src/esm.ts:409:15) #26 4.956 at async nextLoad (node:internal/modules/esm/loader:163:22) #26 4.956 at async ESMLoader.load (node:internal/modules/esm/loader:605:20) #26 4.956 at async ESMLoader.moduleProvider (node:internal/modules/esm/loader:457:11) #26 5.003 error Command failed with exit code 1. #26 5.003 info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command. #26 ERROR: process "docker-entrypoint.sh yarn test" did not complete successfully: exit code: 1 Error: input:1: container.from.withWorkdir.withRootfs.withExec.withRootfs.withUnixSocket.withMountedFile.withMountedFile.withEnvVariable.withEnvVariable.withMountedDirectory.withExec.exitCode process "docker-entrypoint.sh yarn test" did not complete successfully: exit code: 1 ``` ### Steps to reproduce _No response_ ### SDK version Latest NodeJS SDK ### OS version All of them. :)
https://github.com/dagger/dagger/issues/4216
https://github.com/dagger/dagger/pull/4247
7725948fedd64364e87d55404dfa0416b55c637b
385d9a9fabb838b783b13a107f0488c0d67f1721
2022-12-16T23:03:21Z
go
2022-12-22T14:49:15Z
codegen/generator/nodejs/templates/src/type_test.go
"type": { "kind": "SCALAR", "name": "String" } }, { "defaultValue": null, "description": "Redirect the command's standard output to a file in the container", "name": "redirectStdout", "type": { "kind": "SCALAR", "name": "String" } }, { "defaultValue": null, "description": "Redirect the command's standard error to a file in the container", "name": "redirectStderr", "type": { "kind": "SCALAR", "name": "String" } }, { "defaultValue": null, "description": "Provide dagger access to the executed command\nDo not use this option unless you trust the command being executed\nThe command being executed WILL BE GRANTED FULL ACCESS TO YOUR HOST FILESYSTEM", "name": "experimentalPrivilegedNesting", "type": { "kind": "SCALAR", "name": "Boolean"
closed
dagger/dagger
https://github.com/dagger/dagger
4,216
🐞 NodeJS: Support GraphQL `input` types
### What is the issue? As evidenced in https://github.com/dagger/dagger/pull/4207, the NodeJS/Typescript codegen doesn't currently support [GraphQL input types](https://graphql.org/learn/schema/#input-types). ### Log output ``` #26 docker-entrypoint.sh yarn test #26 0.304 yarn run v1.22.19 #26 0.354 $ mocha #26 0.643 (node:39) ExperimentalWarning: Custom ESM Loaders is an experimental feature. This feature could change at any time #26 0.643 (Use `node --trace-warnings ...` to show where the warning was created) #26 4.956 #26 4.956 TSError: ⨯ Unable to compile TypeScript: #26 4.956 api/client.gen.ts(62,15): error TS2304: Cannot find name 'BuildArg'. #26 4.956 api/client.gen.ts(156,15): error TS2304: Cannot find name 'BuildArg'. #26 4.956 #26 4.956 at createTSError (/workdir/node_modules/ts-node/src/index.ts:859:12) #26 4.956 at reportTSError (/workdir/node_modules/ts-node/src/index.ts:863:19) #26 4.956 at getOutput (/workdir/node_modules/ts-node/src/index.ts:1077:36) #26 4.956 at Object.compile (/workdir/node_modules/ts-node/src/index.ts:1433:41) #26 4.956 at transformSource (/workdir/node_modules/ts-node/src/esm.ts:400:37) #26 4.956 at /workdir/node_modules/ts-node/src/esm.ts:278:53 #26 4.956 at async addShortCircuitFlag (/workdir/node_modules/ts-node/src/esm.ts:409:15) #26 4.956 at async nextLoad (node:internal/modules/esm/loader:163:22) #26 4.956 at async ESMLoader.load (node:internal/modules/esm/loader:605:20) #26 4.956 at async ESMLoader.moduleProvider (node:internal/modules/esm/loader:457:11) #26 5.003 error Command failed with exit code 1. #26 5.003 info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command. #26 ERROR: process "docker-entrypoint.sh yarn test" did not complete successfully: exit code: 1 Error: input:1: container.from.withWorkdir.withRootfs.withExec.withRootfs.withUnixSocket.withMountedFile.withMountedFile.withEnvVariable.withEnvVariable.withMountedDirectory.withExec.exitCode process "docker-entrypoint.sh yarn test" did not complete successfully: exit code: 1 ``` ### Steps to reproduce _No response_ ### SDK version Latest NodeJS SDK ### OS version All of them. :)
https://github.com/dagger/dagger/issues/4216
https://github.com/dagger/dagger/pull/4247
7725948fedd64364e87d55404dfa0416b55c637b
385d9a9fabb838b783b13a107f0488c0d67f1721
2022-12-16T23:03:21Z
go
2022-12-22T14:49:15Z
codegen/generator/nodejs/templates/src/type_test.go
} } ], "deprecationReason": "", "description": "This container after executing the specified command inside it", "isDeprecated": false, "name": "exec", "type": { "kind": "NON_NULL", "ofType": { "kind": "OBJECT", "name": "Container" } } } ], "kind": "OBJECT", "name": "Container" } ` tmpl := templateHelper(t) object := objectInit(t, fieldArgsTypeJSON) var b bytes.Buffer err := tmpl.ExecuteTemplate(&b, "type", object) want := expectedFieldArgsType require.NoError(t, err) require.Equal(t, want, b.String()) }) }
closed
dagger/dagger
https://github.com/dagger/dagger
4,258
NodeJS SDK has input type order generated randomly (which makes CI fail)
https://github.com/dagger/dagger/actions/runs/3765190410/jobs/6400412139 We need to order it alphabetically.
https://github.com/dagger/dagger/issues/4258
https://github.com/dagger/dagger/pull/4259
9680b708c649db8cc1527411c5787ab2816223d7
22b205cdd9bd303148ec751af89a02cd30001339
2022-12-23T15:40:52Z
go
2022-12-23T18:11:34Z
codegen/generator/nodejs/templates/functions.go
package templates import ( "regexp" "strings" "text/template" "github.com/iancoleman/strcase" "github.com/dagger/dagger/codegen/introspection" ) var ( funcMap = template.FuncMap{ "CommentToLines": commentToLines, "FormatDeprecation": formatDeprecation, "FormatInputType": formatInputType, "FormatOutputType": formatOutputType, "FormatName": formatName, "GetOptionalArgs": getOptionalArgs, "GetRequiredArgs": getRequiredArgs, "HasPrefix": strings.HasPrefix, "PascalCase": pascalCase, "IsArgOptional": isArgOptional, "IsCustomScalar": isCustomScalar, "Solve": solve, "Subtract": subtract, } ) func pascalCase(name string) string {
closed
dagger/dagger
https://github.com/dagger/dagger
4,258
NodeJS SDK has input type order generated randomly (which makes CI fail)
https://github.com/dagger/dagger/actions/runs/3765190410/jobs/6400412139 We need to order it alphabetically.
https://github.com/dagger/dagger/issues/4258
https://github.com/dagger/dagger/pull/4259
9680b708c649db8cc1527411c5787ab2816223d7
22b205cdd9bd303148ec751af89a02cd30001339
2022-12-23T15:40:52Z
go
2022-12-23T18:11:34Z
codegen/generator/nodejs/templates/functions.go
return strcase.ToCamel(name) } func solve(field introspection.Field) bool { if field.TypeRef == nil { return false } return field.TypeRef.IsScalar() || field.TypeRef.IsList() } func subtract(a, b int) int { return a - b } func commentToLines(s string) []string {
closed
dagger/dagger
https://github.com/dagger/dagger
4,258
NodeJS SDK has input type order generated randomly (which makes CI fail)
https://github.com/dagger/dagger/actions/runs/3765190410/jobs/6400412139 We need to order it alphabetically.
https://github.com/dagger/dagger/issues/4258
https://github.com/dagger/dagger/pull/4259
9680b708c649db8cc1527411c5787ab2816223d7
22b205cdd9bd303148ec751af89a02cd30001339
2022-12-23T15:40:52Z
go
2022-12-23T18:11:34Z
codegen/generator/nodejs/templates/functions.go
split := strings.Split(s, "\n") return split } func formatDeprecation(s string) []string { r := regexp.MustCompile("`[a-zA-Z0-9_]+`") matches := r.FindAllString(s, -1) for _, match := range matches { replacement := strings.TrimPrefix(match, "`") replacement = strings.TrimSuffix(replacement, "`") replacement = formatName(replacement) s = strings.ReplaceAll(s, match, replacement) } return commentToLines("@deprecated " + s) } func formatInputType(r *introspection.TypeRef) string { return formatType(r, true) } func formatOutputType(r *introspection.TypeRef) string { return formatType(r, false) } func isCustomScalar(t *introspection.Type) bool { switch introspection.Scalar(t.Name) { case introspection.ScalarString, introspection.ScalarInt, introspection.ScalarFloat, introspection.ScalarBoolean: return false default: return true && t.Kind == introspection.TypeKindScalar } } func formatType(r *introspection.TypeRef, input bool) (representation string) {
closed
dagger/dagger
https://github.com/dagger/dagger
4,258
NodeJS SDK has input type order generated randomly (which makes CI fail)
https://github.com/dagger/dagger/actions/runs/3765190410/jobs/6400412139 We need to order it alphabetically.
https://github.com/dagger/dagger/issues/4258
https://github.com/dagger/dagger/pull/4259
9680b708c649db8cc1527411c5787ab2816223d7
22b205cdd9bd303148ec751af89a02cd30001339
2022-12-23T15:40:52Z
go
2022-12-23T18:11:34Z
codegen/generator/nodejs/templates/functions.go
var isList bool for ref := r; ref != nil; ref = ref.OfType { switch ref.Kind { case introspection.TypeKindList: isList = true defer func() { if isList { representation += "[]" } }() case introspection.TypeKindScalar: switch introspection.Scalar(ref.Name) { case introspection.ScalarString: representation += "string" return representation case introspection.ScalarInt, introspection.ScalarFloat: representation += "number" return representation case introspection.ScalarBoolean: representation += "boolean" return representation default: rewrite := map[string]string{
closed
dagger/dagger
https://github.com/dagger/dagger
4,258
NodeJS SDK has input type order generated randomly (which makes CI fail)
https://github.com/dagger/dagger/actions/runs/3765190410/jobs/6400412139 We need to order it alphabetically.
https://github.com/dagger/dagger/issues/4258
https://github.com/dagger/dagger/pull/4259
9680b708c649db8cc1527411c5787ab2816223d7
22b205cdd9bd303148ec751af89a02cd30001339
2022-12-23T15:40:52Z
go
2022-12-23T18:11:34Z
codegen/generator/nodejs/templates/functions.go
"ContainerID": "Container", "FileID": "File", "DirectoryID": "Directory", "SecretID": "Secret", "CacheID": "CacheVolume", } if alias, ok := rewrite[ref.Name]; ok && input { listChars := "[]" if isList { representation += ref.Name + listChars + " | " + alias + listChars } else { representation += ref.Name + " | " + alias } isList = false } else { representation += ref.Name } return representation } case introspection.TypeKindObject: representation += formatName(ref.Name) return representation case introspection.TypeKindInputObject: representation += formatName(ref.Name) return representation } } panic(r) } func formatName(s string) string {
closed
dagger/dagger
https://github.com/dagger/dagger
4,258
NodeJS SDK has input type order generated randomly (which makes CI fail)
https://github.com/dagger/dagger/actions/runs/3765190410/jobs/6400412139 We need to order it alphabetically.
https://github.com/dagger/dagger/issues/4258
https://github.com/dagger/dagger/pull/4259
9680b708c649db8cc1527411c5787ab2816223d7
22b205cdd9bd303148ec751af89a02cd30001339
2022-12-23T15:40:52Z
go
2022-12-23T18:11:34Z
codegen/generator/nodejs/templates/functions.go
return s } func isArgOptional(values introspection.InputValues) bool { for _, v := range values { if v.TypeRef != nil && !v.TypeRef.IsOptional() { return false } } return true } func splitRequiredOptionalArgs(values introspection.InputValues) (required introspection.InputValues, optionals introspection.InputValues) { for i, v := range values { if v.TypeRef != nil && !v.TypeRef.IsOptional() { continue } return values[:i], values[i:] } return values, nil } func getRequiredArgs(values introspection.InputValues) introspection.InputValues { required, _ := splitRequiredOptionalArgs(values) return required } func getOptionalArgs(values introspection.InputValues) introspection.InputValues { _, optional := splitRequiredOptionalArgs(values) return optional }
closed
dagger/dagger
https://github.com/dagger/dagger
4,258
NodeJS SDK has input type order generated randomly (which makes CI fail)
https://github.com/dagger/dagger/actions/runs/3765190410/jobs/6400412139 We need to order it alphabetically.
https://github.com/dagger/dagger/issues/4258
https://github.com/dagger/dagger/pull/4259
9680b708c649db8cc1527411c5787ab2816223d7
22b205cdd9bd303148ec751af89a02cd30001339
2022-12-23T15:40:52Z
go
2022-12-23T18:11:34Z
codegen/generator/nodejs/templates/functions_test.go
package templates import ( "context" "testing" "github.com/dagger/dagger/codegen/generator" "github.com/dagger/dagger/codegen/introspection" "github.com/dagger/dagger/engine" internalengine "github.com/dagger/dagger/internal/engine" "github.com/dagger/dagger/router" "github.com/stretchr/testify/require" ) var currentSchema *introspection.Schema func init() {
closed
dagger/dagger
https://github.com/dagger/dagger
4,258
NodeJS SDK has input type order generated randomly (which makes CI fail)
https://github.com/dagger/dagger/actions/runs/3765190410/jobs/6400412139 We need to order it alphabetically.
https://github.com/dagger/dagger/issues/4258
https://github.com/dagger/dagger/pull/4259
9680b708c649db8cc1527411c5787ab2816223d7
22b205cdd9bd303148ec751af89a02cd30001339
2022-12-23T15:40:52Z
go
2022-12-23T18:11:34Z
codegen/generator/nodejs/templates/functions_test.go
ctx := context.Background() engineConf := &engine.Config{ RunnerHost: internalengine.RunnerHost(), NoExtensions: true, } err := engine.Start(ctx, engineConf, func(ctx context.Context, r *router.Router) error { var err error currentSchema, err = generator.Introspect(ctx, r) if err != nil { panic(err) } generator.SetSchemaParents(currentSchema) return nil }) if err != nil { panic(err) } } func getField(t *introspection.Type, name string) *introspection.Field {
closed
dagger/dagger
https://github.com/dagger/dagger
4,258
NodeJS SDK has input type order generated randomly (which makes CI fail)
https://github.com/dagger/dagger/actions/runs/3765190410/jobs/6400412139 We need to order it alphabetically.
https://github.com/dagger/dagger/issues/4258
https://github.com/dagger/dagger/pull/4259
9680b708c649db8cc1527411c5787ab2816223d7
22b205cdd9bd303148ec751af89a02cd30001339
2022-12-23T15:40:52Z
go
2022-12-23T18:11:34Z
codegen/generator/nodejs/templates/functions_test.go
for _, v := range t.Fields { if v.Name == name { return v } } return nil } func TestSplitRequiredOptionalArgs(t *testing.T) { t.Run("container exec", func(t *testing.T) { container := currentSchema.Types.Get("Container") require.NotNil(t, container) execField := getField(container, "exec") t.Log(container) required, optional := splitRequiredOptionalArgs(execField.Args) require.Equal(t, execField.Args[:0], required) require.Equal(t, execField.Args, optional) }) t.Run("container export", func(t *testing.T) { container := currentSchema.Types.Get("Container") require.NotNil(t, container) execField := getField(container, "export") t.Log(container) required, optional := splitRequiredOptionalArgs(execField.Args) require.Equal(t, execField.Args[:1], required) require.Equal(t, execField.Args[1:], optional) }) }
closed
dagger/dagger
https://github.com/dagger/dagger
4,206
Fix serve of nested session from shim
Realized as I was chatting about something that the serving of a nested session needs to occur inside the `shim()` func, whereas today it's in the `setupBundle()` func: https://github.com/sipsma/dagger/blob/6272f1919c78abb46c83fe5e1e460a71ef7a9980/cmd/shim/main.go#L207-L207 Otherwise, the local dirs referenced by the nested session will be incorrect and outside the container. The fix is simple but going to add some explicit tests for this. It got missed because previously our test coverage of nested sessions happened implicitly by using dagger-in-dagger to run all our CI tests, but since we moved away from that it's not covered anymore
https://github.com/dagger/dagger/issues/4206
https://github.com/dagger/dagger/pull/4260
54350a6defea3a1be6ec517902fed0aebe9b9689
a8c7fb9b3664f0388fab5f73216d00868e56abbf
2022-12-15T22:51:38Z
go
2023-01-03T20:20:56Z
cmd/shim/main.go
package main import ( "context" "encoding/json" "fmt" "io" "net" "net/http" "os" "os/exec" "os/signal" "path/filepath" "strings" "syscall" "github.com/dagger/dagger/core" "github.com/dagger/dagger/engine" "github.com/dagger/dagger/router" "github.com/google/uuid" "github.com/opencontainers/runtime-spec/specs-go" "golang.org/x/sys/unix" )
closed
dagger/dagger
https://github.com/dagger/dagger
4,206
Fix serve of nested session from shim
Realized as I was chatting about something that the serving of a nested session needs to occur inside the `shim()` func, whereas today it's in the `setupBundle()` func: https://github.com/sipsma/dagger/blob/6272f1919c78abb46c83fe5e1e460a71ef7a9980/cmd/shim/main.go#L207-L207 Otherwise, the local dirs referenced by the nested session will be incorrect and outside the container. The fix is simple but going to add some explicit tests for this. It got missed because previously our test coverage of nested sessions happened implicitly by using dagger-in-dagger to run all our CI tests, but since we moved away from that it's not covered anymore
https://github.com/dagger/dagger/issues/4206
https://github.com/dagger/dagger/pull/4260
54350a6defea3a1be6ec517902fed0aebe9b9689
a8c7fb9b3664f0388fab5f73216d00868e56abbf
2022-12-15T22:51:38Z
go
2023-01-03T20:20:56Z
cmd/shim/main.go
const ( metaMountPath = "/.dagger_meta_mount" stdinPath = metaMountPath + "/stdin" exitCodePath = metaMountPath + "/exitCode" runcPath = "/usr/bin/buildkit-runc" shimPath = "/_shim" ) var ( stdoutPath = metaMountPath + "/stdout" stderrPath = metaMountPath + "/stderr" ) /* There are two "subcommands" of this binary: 1. The setupBundle command, which is invoked by buildkitd as the oci executor. It updates the spec provided by buildkitd's executor to wrap the command in our shim (described below). It then exec's to runc which will do the actual container setup+execution. 2. The shim, which is included in each Container.Exec and enables us to capture/redirect stdio, capture the exit code, etc. */ func main() { if os.Args[0] == shimPath { os.Exit(shim()) } else { os.Exit(setupBundle()) } } func shim() int {
closed
dagger/dagger
https://github.com/dagger/dagger
4,206
Fix serve of nested session from shim
Realized as I was chatting about something that the serving of a nested session needs to occur inside the `shim()` func, whereas today it's in the `setupBundle()` func: https://github.com/sipsma/dagger/blob/6272f1919c78abb46c83fe5e1e460a71ef7a9980/cmd/shim/main.go#L207-L207 Otherwise, the local dirs referenced by the nested session will be incorrect and outside the container. The fix is simple but going to add some explicit tests for this. It got missed because previously our test coverage of nested sessions happened implicitly by using dagger-in-dagger to run all our CI tests, but since we moved away from that it's not covered anymore
https://github.com/dagger/dagger/issues/4206
https://github.com/dagger/dagger/pull/4260
54350a6defea3a1be6ec517902fed0aebe9b9689
a8c7fb9b3664f0388fab5f73216d00868e56abbf
2022-12-15T22:51:38Z
go
2023-01-03T20:20:56Z
cmd/shim/main.go
if len(os.Args) < 2 { fmt.Fprintf(os.Stderr, "usage: %s <path> [<args>]\n", os.Args[0]) return 1 } name := os.Args[1] args := []string{} if len(os.Args) > 2 { args = os.Args[2:] } cmd := exec.Command(name, args...) cmd.Env = os.Environ() if stdinFile, err := os.Open(stdinPath); err == nil { defer stdinFile.Close() cmd.Stdin = stdinFile } else { cmd.Stdin = nil } stdoutRedirect, found := internalEnv("_DAGGER_REDIRECT_STDOUT") if found { stdoutPath = stdoutRedirect } stderrRedirect, found := internalEnv("_DAGGER_REDIRECT_STDERR") if found { stderrPath = stderrRedirect } if _, found := internalEnv(core.DebugFailedExecEnv); found { stdoutFile, err := os.Open(stdoutPath)
closed
dagger/dagger
https://github.com/dagger/dagger
4,206
Fix serve of nested session from shim
Realized as I was chatting about something that the serving of a nested session needs to occur inside the `shim()` func, whereas today it's in the `setupBundle()` func: https://github.com/sipsma/dagger/blob/6272f1919c78abb46c83fe5e1e460a71ef7a9980/cmd/shim/main.go#L207-L207 Otherwise, the local dirs referenced by the nested session will be incorrect and outside the container. The fix is simple but going to add some explicit tests for this. It got missed because previously our test coverage of nested sessions happened implicitly by using dagger-in-dagger to run all our CI tests, but since we moved away from that it's not covered anymore
https://github.com/dagger/dagger/issues/4206
https://github.com/dagger/dagger/pull/4260
54350a6defea3a1be6ec517902fed0aebe9b9689
a8c7fb9b3664f0388fab5f73216d00868e56abbf
2022-12-15T22:51:38Z
go
2023-01-03T20:20:56Z
cmd/shim/main.go
if err != nil && !os.IsNotExist(err) { panic(err) } _, err = io.Copy(os.Stdout, stdoutFile) if err != nil { panic(err) } stderrFile, err := os.Open(stderrPath) if err != nil && !os.IsNotExist(err) { panic(err) } _, err = io.Copy(os.Stderr, stderrFile) if err != nil { panic(err) } return 0 } stdoutFile, err := os.Create(stdoutPath) if err != nil { panic(err) } defer stdoutFile.Close() cmd.Stdout = io.MultiWriter(stdoutFile, os.Stdout) stderrFile, err := os.Create(stderrPath) if err != nil { panic(err) } defer stderrFile.Close() cmd.Stderr = io.MultiWriter(stderrFile, os.Stderr) exitCode := 0
closed
dagger/dagger
https://github.com/dagger/dagger
4,206
Fix serve of nested session from shim
Realized as I was chatting about something that the serving of a nested session needs to occur inside the `shim()` func, whereas today it's in the `setupBundle()` func: https://github.com/sipsma/dagger/blob/6272f1919c78abb46c83fe5e1e460a71ef7a9980/cmd/shim/main.go#L207-L207 Otherwise, the local dirs referenced by the nested session will be incorrect and outside the container. The fix is simple but going to add some explicit tests for this. It got missed because previously our test coverage of nested sessions happened implicitly by using dagger-in-dagger to run all our CI tests, but since we moved away from that it's not covered anymore
https://github.com/dagger/dagger/issues/4206
https://github.com/dagger/dagger/pull/4260
54350a6defea3a1be6ec517902fed0aebe9b9689
a8c7fb9b3664f0388fab5f73216d00868e56abbf
2022-12-15T22:51:38Z
go
2023-01-03T20:20:56Z
cmd/shim/main.go
if err := cmd.Run(); err != nil { exitCode = 1 if exiterr, ok := err.(*exec.ExitError); ok { exitCode = exiterr.ExitCode() } } if err := os.WriteFile(exitCodePath, []byte(fmt.Sprintf("%d", exitCode)), 0600); err != nil { panic(err) } return exitCode } func setupBundle() int { ctx, cancel := context.WithCancel(context.Background()) defer cancel() var bundleDir string var isRun bool for i, arg := range os.Args { if arg == "--bundle" && i+1 < len(os.Args) { bundleDir = os.Args[i+1] } if arg == "run" { isRun = true } } if bundleDir == "" || !isRun { return execRunc() }
closed
dagger/dagger
https://github.com/dagger/dagger
4,206
Fix serve of nested session from shim
Realized as I was chatting about something that the serving of a nested session needs to occur inside the `shim()` func, whereas today it's in the `setupBundle()` func: https://github.com/sipsma/dagger/blob/6272f1919c78abb46c83fe5e1e460a71ef7a9980/cmd/shim/main.go#L207-L207 Otherwise, the local dirs referenced by the nested session will be incorrect and outside the container. The fix is simple but going to add some explicit tests for this. It got missed because previously our test coverage of nested sessions happened implicitly by using dagger-in-dagger to run all our CI tests, but since we moved away from that it's not covered anymore
https://github.com/dagger/dagger/issues/4206
https://github.com/dagger/dagger/pull/4260
54350a6defea3a1be6ec517902fed0aebe9b9689
a8c7fb9b3664f0388fab5f73216d00868e56abbf
2022-12-15T22:51:38Z
go
2023-01-03T20:20:56Z
cmd/shim/main.go
configPath := filepath.Join(bundleDir, "config.json") configBytes, err := os.ReadFile(configPath) if err != nil { fmt.Printf("Error reading config.json: %v\n", err) return 1 } var spec specs.Spec if err := json.Unmarshal(configBytes, &spec); err != nil { fmt.Printf("Error parsing config.json: %v\n", err) return 1 } var isDaggerExec bool for _, mnt := range spec.Mounts { if mnt.Destination == metaMountPath { isDaggerExec = true break } } if isDaggerExec { selfPath, err := os.Executable() if err != nil { fmt.Printf("Error getting self path: %v\n", err) return 1 } selfPath, err = filepath.EvalSymlinks(selfPath)
closed
dagger/dagger
https://github.com/dagger/dagger
4,206
Fix serve of nested session from shim
Realized as I was chatting about something that the serving of a nested session needs to occur inside the `shim()` func, whereas today it's in the `setupBundle()` func: https://github.com/sipsma/dagger/blob/6272f1919c78abb46c83fe5e1e460a71ef7a9980/cmd/shim/main.go#L207-L207 Otherwise, the local dirs referenced by the nested session will be incorrect and outside the container. The fix is simple but going to add some explicit tests for this. It got missed because previously our test coverage of nested sessions happened implicitly by using dagger-in-dagger to run all our CI tests, but since we moved away from that it's not covered anymore
https://github.com/dagger/dagger/issues/4206
https://github.com/dagger/dagger/pull/4260
54350a6defea3a1be6ec517902fed0aebe9b9689
a8c7fb9b3664f0388fab5f73216d00868e56abbf
2022-12-15T22:51:38Z
go
2023-01-03T20:20:56Z
cmd/shim/main.go
if err != nil { fmt.Printf("Error getting self path: %v\n", err) return 1 } spec.Mounts = append(spec.Mounts, specs.Mount{ Destination: shimPath, Type: "bind", Source: selfPath, Options: []string{"rbind", "ro"}, }) spec.Process.Args = append([]string{shimPath}, spec.Process.Args...) } spec, err = toggleNesting(ctx, spec) if err != nil { fmt.Printf("Error toggling nesting: %v\n", err) return 1 } configBytes, err = json.Marshal(spec) if err != nil { fmt.Printf("Error marshaling config.json: %v\n", err) return 1 } if err := os.WriteFile(configPath, configBytes, 0600); err != nil { fmt.Printf("Error writing config.json: %v\n", err) return 1 }
closed
dagger/dagger
https://github.com/dagger/dagger
4,206
Fix serve of nested session from shim
Realized as I was chatting about something that the serving of a nested session needs to occur inside the `shim()` func, whereas today it's in the `setupBundle()` func: https://github.com/sipsma/dagger/blob/6272f1919c78abb46c83fe5e1e460a71ef7a9980/cmd/shim/main.go#L207-L207 Otherwise, the local dirs referenced by the nested session will be incorrect and outside the container. The fix is simple but going to add some explicit tests for this. It got missed because previously our test coverage of nested sessions happened implicitly by using dagger-in-dagger to run all our CI tests, but since we moved away from that it's not covered anymore
https://github.com/dagger/dagger/issues/4206
https://github.com/dagger/dagger/pull/4260
54350a6defea3a1be6ec517902fed0aebe9b9689
a8c7fb9b3664f0388fab5f73216d00868e56abbf
2022-12-15T22:51:38Z
go
2023-01-03T20:20:56Z
cmd/shim/main.go
cmd := exec.Command(runcPath, os.Args[1:]...) cmd.Stdin = os.Stdin cmd.Stdout = os.Stdout cmd.Stderr = os.Stderr cmd.SysProcAttr = &syscall.SysProcAttr{ Pdeathsig: syscall.SIGKILL, } sigCh := make(chan os.Signal, 32) signal.Notify(sigCh) if err := cmd.Start(); err != nil { fmt.Printf("Error starting runc: %v", err) return 1 } go func() { for sig := range sigCh { cmd.Process.Signal(sig) } }() if err := cmd.Wait(); err != nil { if exiterr, ok := err.(*exec.ExitError); ok { if exitcode, ok := exiterr.Sys().(syscall.WaitStatus); ok { return exitcode.ExitStatus() } } fmt.Printf("Error waiting for runc: %v", err) return 1 } return 0 } func execRunc() int {
closed
dagger/dagger
https://github.com/dagger/dagger
4,206
Fix serve of nested session from shim
Realized as I was chatting about something that the serving of a nested session needs to occur inside the `shim()` func, whereas today it's in the `setupBundle()` func: https://github.com/sipsma/dagger/blob/6272f1919c78abb46c83fe5e1e460a71ef7a9980/cmd/shim/main.go#L207-L207 Otherwise, the local dirs referenced by the nested session will be incorrect and outside the container. The fix is simple but going to add some explicit tests for this. It got missed because previously our test coverage of nested sessions happened implicitly by using dagger-in-dagger to run all our CI tests, but since we moved away from that it's not covered anymore
https://github.com/dagger/dagger/issues/4206
https://github.com/dagger/dagger/pull/4260
54350a6defea3a1be6ec517902fed0aebe9b9689
a8c7fb9b3664f0388fab5f73216d00868e56abbf
2022-12-15T22:51:38Z
go
2023-01-03T20:20:56Z
cmd/shim/main.go
args := []string{runcPath} args = append(args, os.Args[1:]...) if err := unix.Exec(runcPath, args, os.Environ()); err != nil { fmt.Printf("Error execing runc: %v\n", err) return 1 } panic("congratulations: you've reached unreachable code, please report a bug!") } func internalEnv(name string) (string, bool) { val, found := os.LookupEnv(name) if !found { return "", false } os.Unsetenv(name) return val, true } func toggleNesting(ctx context.Context, spec specs.Spec) (specs.Spec, error) { checkenv: for i, env := range spec.Process.Env { switch { case strings.HasPrefix(env, "_DAGGER_ENABLE_NESTING="): spec.Process.Env = append(spec.Process.Env[:i], spec.Process.Env[i+1:]...)
closed
dagger/dagger
https://github.com/dagger/dagger
4,206
Fix serve of nested session from shim
Realized as I was chatting about something that the serving of a nested session needs to occur inside the `shim()` func, whereas today it's in the `setupBundle()` func: https://github.com/sipsma/dagger/blob/6272f1919c78abb46c83fe5e1e460a71ef7a9980/cmd/shim/main.go#L207-L207 Otherwise, the local dirs referenced by the nested session will be incorrect and outside the container. The fix is simple but going to add some explicit tests for this. It got missed because previously our test coverage of nested sessions happened implicitly by using dagger-in-dagger to run all our CI tests, but since we moved away from that it's not covered anymore
https://github.com/dagger/dagger/issues/4206
https://github.com/dagger/dagger/pull/4260
54350a6defea3a1be6ec517902fed0aebe9b9689
a8c7fb9b3664f0388fab5f73216d00868e56abbf
2022-12-15T22:51:38Z
go
2023-01-03T20:20:56Z
cmd/shim/main.go
sessionToken, err := uuid.NewRandom() if err != nil { return specs.Spec{}, fmt.Errorf("error generating session token: %w", err) } l, err := net.Listen("tcp", "127.0.0.1:0") if err != nil { return specs.Spec{}, fmt.Errorf("error listening on session socket: %w", err) } engineConf := &engine.Config{ SessionToken: sessionToken.String(), RunnerHost: "unix:///run/buildkit/buildkitd.sock", LogOutput: os.Stderr, } go func() { err := engine.Start(ctx, engineConf, func(ctx context.Context, r *router.Router) error { return http.Serve(l, r) }) if err != nil { fmt.Printf("Error starting engine: %v\n", err) } }() spec.Process.Env = append(spec.Process.Env, fmt.Sprintf("DAGGER_SESSION_URL=http://127.0.0.1:%d", l.Addr().(*net.TCPAddr).Port)) spec.Process.Env = append(spec.Process.Env, fmt.Sprintf("DAGGER_SESSION_TOKEN=%s", sessionToken.String())) break checkenv } } return spec, nil }
closed
dagger/dagger
https://github.com/dagger/dagger
4,206
Fix serve of nested session from shim
Realized as I was chatting about something that the serving of a nested session needs to occur inside the `shim()` func, whereas today it's in the `setupBundle()` func: https://github.com/sipsma/dagger/blob/6272f1919c78abb46c83fe5e1e460a71ef7a9980/cmd/shim/main.go#L207-L207 Otherwise, the local dirs referenced by the nested session will be incorrect and outside the container. The fix is simple but going to add some explicit tests for this. It got missed because previously our test coverage of nested sessions happened implicitly by using dagger-in-dagger to run all our CI tests, but since we moved away from that it's not covered anymore
https://github.com/dagger/dagger/issues/4206
https://github.com/dagger/dagger/pull/4260
54350a6defea3a1be6ec517902fed0aebe9b9689
a8c7fb9b3664f0388fab5f73216d00868e56abbf
2022-12-15T22:51:38Z
go
2023-01-03T20:20:56Z
project/project.go
package project import ( "context" "encoding/json" "fmt" "path" "path/filepath" "sync" "github.com/dagger/dagger/core" "github.com/dagger/dagger/router" "github.com/dagger/graphql" "github.com/dagger/graphql/language/ast" "github.com/dagger/graphql/language/parser" "github.com/moby/buildkit/client/llb" bkgw "github.com/moby/buildkit/frontend/gateway/client" specs "github.com/opencontainers/image-spec/specs-go/v1" ) const ( schemaPath = "/schema.graphql" entrypointPath = "/entrypoint" fsMountPath = "/mnt" tmpMountPath = "/tmp" inputMountPath = "/inputs" inputFile = "/dagger.json" outputMountPath = "/outputs" outputFile = "/dagger.json" ) type State struct {
closed
dagger/dagger
https://github.com/dagger/dagger
4,206
Fix serve of nested session from shim
Realized as I was chatting about something that the serving of a nested session needs to occur inside the `shim()` func, whereas today it's in the `setupBundle()` func: https://github.com/sipsma/dagger/blob/6272f1919c78abb46c83fe5e1e460a71ef7a9980/cmd/shim/main.go#L207-L207 Otherwise, the local dirs referenced by the nested session will be incorrect and outside the container. The fix is simple but going to add some explicit tests for this. It got missed because previously our test coverage of nested sessions happened implicitly by using dagger-in-dagger to run all our CI tests, but since we moved away from that it's not covered anymore
https://github.com/dagger/dagger/issues/4206
https://github.com/dagger/dagger/pull/4260
54350a6defea3a1be6ec517902fed0aebe9b9689
a8c7fb9b3664f0388fab5f73216d00868e56abbf
2022-12-15T22:51:38Z
go
2023-01-03T20:20:56Z
project/project.go
config Config workdir *core.Directory configPath string schema string schemaOnce sync.Once extensions []*State extensionsOnce sync.Once resolvers router.Resolvers resolversOnce sync.Once } func Load( ctx context.Context, workdir *core.Directory, configPath string, cache map[string]*State, cacheMu *sync.RWMutex, gw bkgw.Client, ) (*State, error) { file, err := workdir.File(ctx, configPath) if err != nil { return nil, err } cfgBytes, err := file.Contents(ctx, gw) if err != nil { return nil, err
closed
dagger/dagger
https://github.com/dagger/dagger
4,206
Fix serve of nested session from shim
Realized as I was chatting about something that the serving of a nested session needs to occur inside the `shim()` func, whereas today it's in the `setupBundle()` func: https://github.com/sipsma/dagger/blob/6272f1919c78abb46c83fe5e1e460a71ef7a9980/cmd/shim/main.go#L207-L207 Otherwise, the local dirs referenced by the nested session will be incorrect and outside the container. The fix is simple but going to add some explicit tests for this. It got missed because previously our test coverage of nested sessions happened implicitly by using dagger-in-dagger to run all our CI tests, but since we moved away from that it's not covered anymore
https://github.com/dagger/dagger/issues/4206
https://github.com/dagger/dagger/pull/4260
54350a6defea3a1be6ec517902fed0aebe9b9689
a8c7fb9b3664f0388fab5f73216d00868e56abbf
2022-12-15T22:51:38Z
go
2023-01-03T20:20:56Z
project/project.go
} s := &State{ workdir: workdir, configPath: configPath, resolvers: make(router.Resolvers), } if err := json.Unmarshal(cfgBytes, &s.config); err != nil { return nil, err } if s.config.Name == "" { return nil, fmt.Errorf("project name must be set") } cacheMu.Lock() defer cacheMu.Unlock() existing, ok := cache[s.config.Name] if ok { return existing, nil } cache[s.config.Name] = s return s, nil } func (p *State) Name() string { return p.config.Name } func (p *State) SDK() string { return p.config.SDK } func (p *State) Schema(ctx context.Context, gw bkgw.Client, platform specs.Platform) (string, error) { var rerr error p.schemaOnce.Do(func() {
closed
dagger/dagger
https://github.com/dagger/dagger
4,206
Fix serve of nested session from shim
Realized as I was chatting about something that the serving of a nested session needs to occur inside the `shim()` func, whereas today it's in the `setupBundle()` func: https://github.com/sipsma/dagger/blob/6272f1919c78abb46c83fe5e1e460a71ef7a9980/cmd/shim/main.go#L207-L207 Otherwise, the local dirs referenced by the nested session will be incorrect and outside the container. The fix is simple but going to add some explicit tests for this. It got missed because previously our test coverage of nested sessions happened implicitly by using dagger-in-dagger to run all our CI tests, but since we moved away from that it's not covered anymore
https://github.com/dagger/dagger/issues/4206
https://github.com/dagger/dagger/pull/4260
54350a6defea3a1be6ec517902fed0aebe9b9689
a8c7fb9b3664f0388fab5f73216d00868e56abbf
2022-12-15T22:51:38Z
go
2023-01-03T20:20:56Z
project/project.go
if p.config.SDK == "" { return } schemaFile, err := p.workdir.File(ctx, path.Join(path.Dir(p.configPath), schemaPath)) if err == nil { schemaBytes, err := schemaFile.Contents(ctx, gw) if err == nil { p.schema = string(schemaBytes) return } } runtimeFS, err := p.Runtime(ctx, gw, platform) if err != nil { rerr = err return } fsPayload, err := runtimeFS.ID.Decode() if err != nil { rerr = err return } wdPayload, err := p.workdir.ID.Decode() if err != nil { rerr = err return }
closed
dagger/dagger
https://github.com/dagger/dagger
4,206
Fix serve of nested session from shim
Realized as I was chatting about something that the serving of a nested session needs to occur inside the `shim()` func, whereas today it's in the `setupBundle()` func: https://github.com/sipsma/dagger/blob/6272f1919c78abb46c83fe5e1e460a71ef7a9980/cmd/shim/main.go#L207-L207 Otherwise, the local dirs referenced by the nested session will be incorrect and outside the container. The fix is simple but going to add some explicit tests for this. It got missed because previously our test coverage of nested sessions happened implicitly by using dagger-in-dagger to run all our CI tests, but since we moved away from that it's not covered anymore
https://github.com/dagger/dagger/issues/4206
https://github.com/dagger/dagger/pull/4260
54350a6defea3a1be6ec517902fed0aebe9b9689
a8c7fb9b3664f0388fab5f73216d00868e56abbf
2022-12-15T22:51:38Z
go
2023-01-03T20:20:56Z
project/project.go
fsState, err := fsPayload.State() if err != nil { rerr = err return } wdState, err := wdPayload.State() if err != nil { rerr = err return } st := fsState.Run( llb.Args([]string{entrypointPath, "-schema"}), llb.AddMount("/src", wdState, llb.Readonly), llb.ReadonlyRootFS(), ) outputMnt := st.AddMount(outputMountPath, llb.Scratch()) outputDef, err := outputMnt.Marshal(ctx, llb.Platform(platform)) if err != nil { rerr = err return } res, err := gw.Solve(ctx, bkgw.SolveRequest{ Definition: outputDef.ToPB(), }) if err != nil { rerr = err return } ref, err := res.SingleRef() if err != nil {
closed
dagger/dagger
https://github.com/dagger/dagger
4,206
Fix serve of nested session from shim
Realized as I was chatting about something that the serving of a nested session needs to occur inside the `shim()` func, whereas today it's in the `setupBundle()` func: https://github.com/sipsma/dagger/blob/6272f1919c78abb46c83fe5e1e460a71ef7a9980/cmd/shim/main.go#L207-L207 Otherwise, the local dirs referenced by the nested session will be incorrect and outside the container. The fix is simple but going to add some explicit tests for this. It got missed because previously our test coverage of nested sessions happened implicitly by using dagger-in-dagger to run all our CI tests, but since we moved away from that it's not covered anymore
https://github.com/dagger/dagger/issues/4206
https://github.com/dagger/dagger/pull/4260
54350a6defea3a1be6ec517902fed0aebe9b9689
a8c7fb9b3664f0388fab5f73216d00868e56abbf
2022-12-15T22:51:38Z
go
2023-01-03T20:20:56Z
project/project.go
rerr = err return } outputBytes, err := ref.ReadFile(ctx, bkgw.ReadRequest{ Filename: "/schema.graphql", }) if err != nil { rerr = err return } p.schema = string(outputBytes) }) return p.schema, rerr } func (p *State) Extensions( ctx context.Context, cache map[string]*State, cacheMu *sync.RWMutex, gw bkgw.Client, platform specs.Platform, ) ([]*State, error) { var rerr error p.extensionsOnce.Do(func() { p.extensions = make([]*State, 0, len(p.config.Extensions)) for depName, dep := range p.config.Extensions { switch { case dep.Local != nil: depConfigPath := filepath.ToSlash(filepath.Join(filepath.Dir(p.configPath), dep.Local.Path)) depState, err := Load(ctx, p.workdir, depConfigPath, cache, cacheMu, gw) if err != nil {
closed
dagger/dagger
https://github.com/dagger/dagger
4,206
Fix serve of nested session from shim
Realized as I was chatting about something that the serving of a nested session needs to occur inside the `shim()` func, whereas today it's in the `setupBundle()` func: https://github.com/sipsma/dagger/blob/6272f1919c78abb46c83fe5e1e460a71ef7a9980/cmd/shim/main.go#L207-L207 Otherwise, the local dirs referenced by the nested session will be incorrect and outside the container. The fix is simple but going to add some explicit tests for this. It got missed because previously our test coverage of nested sessions happened implicitly by using dagger-in-dagger to run all our CI tests, but since we moved away from that it's not covered anymore
https://github.com/dagger/dagger/issues/4206
https://github.com/dagger/dagger/pull/4260
54350a6defea3a1be6ec517902fed0aebe9b9689
a8c7fb9b3664f0388fab5f73216d00868e56abbf
2022-12-15T22:51:38Z
go
2023-01-03T20:20:56Z
project/project.go
rerr = err return } p.extensions = append(p.extensions, depState) case dep.Git != nil: gitFS, err := core.NewDirectory(ctx, llb.Git(dep.Git.Remote, dep.Git.Ref), "", platform) if err != nil { rerr = err return } depState, err := Load(ctx, gitFS, dep.Git.Path, cache, cacheMu, gw) if err != nil { rerr = err return } p.extensions = append(p.extensions, depState) default: rerr = fmt.Errorf("unset extension %s", depName) return } } }) return p.extensions, rerr } func (p *State) Resolvers( ctx context.Context, gw bkgw.Client, platform specs.Platform, ) (router.Resolvers, error) { var rerr error
closed
dagger/dagger
https://github.com/dagger/dagger
4,206
Fix serve of nested session from shim
Realized as I was chatting about something that the serving of a nested session needs to occur inside the `shim()` func, whereas today it's in the `setupBundle()` func: https://github.com/sipsma/dagger/blob/6272f1919c78abb46c83fe5e1e460a71ef7a9980/cmd/shim/main.go#L207-L207 Otherwise, the local dirs referenced by the nested session will be incorrect and outside the container. The fix is simple but going to add some explicit tests for this. It got missed because previously our test coverage of nested sessions happened implicitly by using dagger-in-dagger to run all our CI tests, but since we moved away from that it's not covered anymore
https://github.com/dagger/dagger/issues/4206
https://github.com/dagger/dagger/pull/4260
54350a6defea3a1be6ec517902fed0aebe9b9689
a8c7fb9b3664f0388fab5f73216d00868e56abbf
2022-12-15T22:51:38Z
go
2023-01-03T20:20:56Z
project/project.go
p.resolversOnce.Do(func() { if p.config.SDK == "" { return } runtimeFS, err := p.Runtime(ctx, gw, platform) if err != nil { rerr = err return } schema, err := p.Schema(ctx, gw, platform) if err != nil { rerr = err return } doc, err := parser.Parse(parser.ParseParams{Source: schema}) if err != nil { rerr = err return } for _, def := range doc.Definitions { var obj *ast.ObjectDefinition if def, ok := def.(*ast.ObjectDefinition); ok { obj = def } if def, ok := def.(*ast.TypeExtensionDefinition); ok { obj = def.Definition } if obj == nil { continue }
closed
dagger/dagger
https://github.com/dagger/dagger
4,206
Fix serve of nested session from shim
Realized as I was chatting about something that the serving of a nested session needs to occur inside the `shim()` func, whereas today it's in the `setupBundle()` func: https://github.com/sipsma/dagger/blob/6272f1919c78abb46c83fe5e1e460a71ef7a9980/cmd/shim/main.go#L207-L207 Otherwise, the local dirs referenced by the nested session will be incorrect and outside the container. The fix is simple but going to add some explicit tests for this. It got missed because previously our test coverage of nested sessions happened implicitly by using dagger-in-dagger to run all our CI tests, but since we moved away from that it's not covered anymore
https://github.com/dagger/dagger/issues/4206
https://github.com/dagger/dagger/pull/4260
54350a6defea3a1be6ec517902fed0aebe9b9689
a8c7fb9b3664f0388fab5f73216d00868e56abbf
2022-12-15T22:51:38Z
go
2023-01-03T20:20:56Z
project/project.go
objResolver := router.ObjectResolver{} p.resolvers[obj.Name.Value] = objResolver for _, field := range obj.Fields { objResolver[field.Name.Value] = p.resolver(runtimeFS, p.config.SDK, gw, platform) } } }) return p.resolvers, rerr } func (p *State) resolver(runtimeFS *core.Directory, sdk string, gw bkgw.Client, platform specs.Platform) graphql.FieldResolveFn { return router.ToResolver(func(ctx *router.Context, parent any, args any) (any, error) { pathArray := ctx.ResolveParams.Info.Path.AsArray() name := fmt.Sprintf("%+v", pathArray) resolverName := fmt.Sprintf("%s.%s", ctx.ResolveParams.Info.ParentType.Name(), ctx.ResolveParams.Info.FieldName) inputMap := map[string]interface{}{ "resolver": resolverName, "args": args, "parent": parent, } inputBytes, err := json.Marshal(inputMap) if err != nil { return nil, err } input := llb.Scratch().File(llb.Mkfile(inputFile, 0644, inputBytes)) fsPayload, err := runtimeFS.ID.Decode() if err != nil { return nil, err } fsState, err := fsPayload.State()
closed
dagger/dagger
https://github.com/dagger/dagger
4,206
Fix serve of nested session from shim
Realized as I was chatting about something that the serving of a nested session needs to occur inside the `shim()` func, whereas today it's in the `setupBundle()` func: https://github.com/sipsma/dagger/blob/6272f1919c78abb46c83fe5e1e460a71ef7a9980/cmd/shim/main.go#L207-L207 Otherwise, the local dirs referenced by the nested session will be incorrect and outside the container. The fix is simple but going to add some explicit tests for this. It got missed because previously our test coverage of nested sessions happened implicitly by using dagger-in-dagger to run all our CI tests, but since we moved away from that it's not covered anymore
https://github.com/dagger/dagger/issues/4206
https://github.com/dagger/dagger/pull/4260
54350a6defea3a1be6ec517902fed0aebe9b9689
a8c7fb9b3664f0388fab5f73216d00868e56abbf
2022-12-15T22:51:38Z
go
2023-01-03T20:20:56Z
project/project.go
if err != nil { return nil, err } wdPayload, err := p.workdir.ID.Decode() if err != nil { return nil, err } wdState, err := wdPayload.State() if err != nil { return nil, err } st := fsState.Run( llb.Args([]string{entrypointPath}), llb.AddEnv("_DAGGER_ENABLE_NESTING", ""), llb.AddMount(inputMountPath, input, llb.Readonly), llb.AddMount(tmpMountPath, llb.Scratch(), llb.Tmpfs()), llb.ReadonlyRootFS(), ) if sdk == "go" { st.AddMount("/src", wdState, llb.Readonly) } for path, dirID := range collectDirPaths(ctx.ResolveParams.Args, fsMountPath, nil) { dirPayload, err := dirID.Decode() if err != nil { return nil, err } dirSt, err := dirPayload.State() if err != nil {
closed
dagger/dagger
https://github.com/dagger/dagger
4,206
Fix serve of nested session from shim
Realized as I was chatting about something that the serving of a nested session needs to occur inside the `shim()` func, whereas today it's in the `setupBundle()` func: https://github.com/sipsma/dagger/blob/6272f1919c78abb46c83fe5e1e460a71ef7a9980/cmd/shim/main.go#L207-L207 Otherwise, the local dirs referenced by the nested session will be incorrect and outside the container. The fix is simple but going to add some explicit tests for this. It got missed because previously our test coverage of nested sessions happened implicitly by using dagger-in-dagger to run all our CI tests, but since we moved away from that it's not covered anymore
https://github.com/dagger/dagger/issues/4206
https://github.com/dagger/dagger/pull/4260
54350a6defea3a1be6ec517902fed0aebe9b9689
a8c7fb9b3664f0388fab5f73216d00868e56abbf
2022-12-15T22:51:38Z
go
2023-01-03T20:20:56Z
project/project.go
return nil, err } st.AddMount(path, dirSt, llb.SourcePath(dirPayload.Dir), llb.ForceNoOutput) } if ctx.ResolveParams.Info.ParentType.Name() == "Directory" { var parentFS core.Directory bytes, err := json.Marshal(parent) if err != nil { return nil, err } if err := json.Unmarshal(bytes, &parentFS); err != nil { return nil, err } fsPayload, err := parentFS.ID.Decode() if err != nil { return nil, err } fsState, err := fsPayload.State() if err != nil { return nil, err } st.AddMount("/mnt/.parent", fsState, llb.ForceNoOutput)
closed
dagger/dagger
https://github.com/dagger/dagger
4,206
Fix serve of nested session from shim
Realized as I was chatting about something that the serving of a nested session needs to occur inside the `shim()` func, whereas today it's in the `setupBundle()` func: https://github.com/sipsma/dagger/blob/6272f1919c78abb46c83fe5e1e460a71ef7a9980/cmd/shim/main.go#L207-L207 Otherwise, the local dirs referenced by the nested session will be incorrect and outside the container. The fix is simple but going to add some explicit tests for this. It got missed because previously our test coverage of nested sessions happened implicitly by using dagger-in-dagger to run all our CI tests, but since we moved away from that it's not covered anymore
https://github.com/dagger/dagger/issues/4206
https://github.com/dagger/dagger/pull/4260
54350a6defea3a1be6ec517902fed0aebe9b9689
a8c7fb9b3664f0388fab5f73216d00868e56abbf
2022-12-15T22:51:38Z
go
2023-01-03T20:20:56Z
project/project.go
} outputMnt := st.AddMount(outputMountPath, llb.Scratch()) outputDef, err := outputMnt.Marshal(ctx, llb.Platform(platform), llb.WithCustomName(name)) if err != nil { return nil, err } res, err := gw.Solve(ctx, bkgw.SolveRequest{ Definition: outputDef.ToPB(), }) if err != nil { return nil, err } ref, err := res.SingleRef() if err != nil { return nil, err } outputBytes, err := ref.ReadFile(ctx, bkgw.ReadRequest{ Filename: outputFile, }) if err != nil { return nil, err } var output interface{} if err := json.Unmarshal(outputBytes, &output); err != nil { return nil, fmt.Errorf("failed to unmarshal output: %w", err) } return output, nil }) } func collectDirPaths(arg interface{}, curPath string, dirPaths map[string]core.DirectoryID) map[string]core.DirectoryID {
closed
dagger/dagger
https://github.com/dagger/dagger
4,206
Fix serve of nested session from shim
Realized as I was chatting about something that the serving of a nested session needs to occur inside the `shim()` func, whereas today it's in the `setupBundle()` func: https://github.com/sipsma/dagger/blob/6272f1919c78abb46c83fe5e1e460a71ef7a9980/cmd/shim/main.go#L207-L207 Otherwise, the local dirs referenced by the nested session will be incorrect and outside the container. The fix is simple but going to add some explicit tests for this. It got missed because previously our test coverage of nested sessions happened implicitly by using dagger-in-dagger to run all our CI tests, but since we moved away from that it's not covered anymore
https://github.com/dagger/dagger/issues/4206
https://github.com/dagger/dagger/pull/4260
54350a6defea3a1be6ec517902fed0aebe9b9689
a8c7fb9b3664f0388fab5f73216d00868e56abbf
2022-12-15T22:51:38Z
go
2023-01-03T20:20:56Z
project/project.go
if dirPaths == nil { dirPaths = make(map[string]core.DirectoryID) } switch arg := arg.(type) { case core.DirectoryID: dirPaths[curPath] = arg case map[string]interface{}: for k, v := range arg { dirPaths = collectDirPaths(v, filepath.Join(curPath, k), dirPaths) } case []interface{}: for i, v := range arg { dirPaths = collectDirPaths(v, fmt.Sprintf("%s/%d", curPath, i), dirPaths) } } return dirPaths }
closed
dagger/dagger
https://github.com/dagger/dagger
4,245
Implement labels for Dockerfile build
This allows a user to add labels the Dockerfile build ```graphql input Label { key: String! value: String! } type Directory { dockerBuild(dockerfile: String, platform: Platform, labels: [Label!]): Container! } ```
https://github.com/dagger/dagger/issues/4245
https://github.com/dagger/dagger/pull/4387
c5c5e0e3a51b6a80eee69f07b24aec36ae99cc13
e24ce91f30cec5ad7f35f975c46f34969ad3bae3
2022-12-21T20:35:16Z
go
2023-01-19T18:15:20Z
core/integration/container_test.go
package core import ( "context" _ "embed" "encoding/base64" "errors" "fmt" "io" "net" "os" "path/filepath" "strings" "testing" "dagger.io/dagger" "github.com/dagger/dagger/core" "github.com/dagger/dagger/core/schema" "github.com/dagger/dagger/internal/testutil" "github.com/moby/buildkit/identity" "github.com/stretchr/testify/require" ) func TestContainerScratch(t *testing.T) { t.Parallel() res := struct {
closed
dagger/dagger
https://github.com/dagger/dagger
4,245
Implement labels for Dockerfile build
This allows a user to add labels the Dockerfile build ```graphql input Label { key: String! value: String! } type Directory { dockerBuild(dockerfile: String, platform: Platform, labels: [Label!]): Container! } ```
https://github.com/dagger/dagger/issues/4245
https://github.com/dagger/dagger/pull/4387
c5c5e0e3a51b6a80eee69f07b24aec36ae99cc13
e24ce91f30cec5ad7f35f975c46f34969ad3bae3
2022-12-21T20:35:16Z
go
2023-01-19T18:15:20Z
core/integration/container_test.go
Container struct { ID string Fs struct { Entries []string } } }{} err := testutil.Query( `{ container { id fs { entries } } }`, &res, nil) require.NoError(t, err) require.Empty(t, res.Container.Fs.Entries) } func TestContainerFrom(t *testing.T) { t.Parallel() res := struct {
closed
dagger/dagger
https://github.com/dagger/dagger
4,245
Implement labels for Dockerfile build
This allows a user to add labels the Dockerfile build ```graphql input Label { key: String! value: String! } type Directory { dockerBuild(dockerfile: String, platform: Platform, labels: [Label!]): Container! } ```
https://github.com/dagger/dagger/issues/4245
https://github.com/dagger/dagger/pull/4387
c5c5e0e3a51b6a80eee69f07b24aec36ae99cc13
e24ce91f30cec5ad7f35f975c46f34969ad3bae3
2022-12-21T20:35:16Z
go
2023-01-19T18:15:20Z
core/integration/container_test.go
Container struct { From struct { Fs struct { File struct { Contents string } } } } }{} err := testutil.Query( `{ container { from(address: "alpine:3.16.2") { fs { file(path: "/etc/alpine-release") { contents } } } } }`, &res, nil) require.NoError(t, err) require.Equal(t, res.Container.From.Fs.File.Contents, "3.16.2\n") } func TestContainerBuild(t *testing.T) {
closed
dagger/dagger
https://github.com/dagger/dagger
4,245
Implement labels for Dockerfile build
This allows a user to add labels the Dockerfile build ```graphql input Label { key: String! value: String! } type Directory { dockerBuild(dockerfile: String, platform: Platform, labels: [Label!]): Container! } ```
https://github.com/dagger/dagger/issues/4245
https://github.com/dagger/dagger/pull/4387
c5c5e0e3a51b6a80eee69f07b24aec36ae99cc13
e24ce91f30cec5ad7f35f975c46f34969ad3bae3
2022-12-21T20:35:16Z
go
2023-01-19T18:15:20Z
core/integration/container_test.go
ctx := context.Background() c, err := dagger.Connect(ctx) require.NoError(t, err) defer c.Close() contextDir := c.Directory(). WithNewFile("main.go", `package main import "fmt" import "os" func main() { for _, env := range os.Environ() { fmt.Println(env) } }`) t.Run("default Dockerfile location", func(t *testing.T) { src := contextDir. WithNewFile("Dockerfile", `FROM golang:1.18.2-alpine WORKDIR /src COPY main.go . RUN go mod init hello RUN go build -o /usr/bin/goenv main.go ENV FOO=bar CMD goenv `) env, err := c.Container().Build(src).WithExec([]string{}).Stdout(ctx) require.NoError(t, err) require.Contains(t, env, "FOO=bar\n") })