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,284
Use `withoutEntrypoint`, `withoutWorkdir`, `withoutUser` and `withoutDefaultArgs` to remove
Currently, passing nil or empty arguments to those function reinit the values. It's not that explicit and clear. It will make more API endpoints, but it's gonna be clearer.
https://github.com/dagger/dagger/issues/3284
https://github.com/dagger/dagger/pull/6278
568d802bb892f1e074cf74cfce2a551989418964
cd825bde699a0beb0adb5c2529da5469118a172b
2022-10-07T15:00:07Z
go
2023-12-19T13:11:01Z
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,284
Use `withoutEntrypoint`, `withoutWorkdir`, `withoutUser` and `withoutDefaultArgs` to remove
Currently, passing nil or empty arguments to those function reinit the values. It's not that explicit and clear. It will make more API endpoints, but it's gonna be clearer.
https://github.com/dagger/dagger/issues/3284
https://github.com/dagger/dagger/pull/6278
568d802bb892f1e074cf74cfce2a551989418964
cd825bde699a0beb0adb5c2529da5469118a172b
2022-10-07T15:00:07Z
go
2023-12-19T13:11:01Z
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,284
Use `withoutEntrypoint`, `withoutWorkdir`, `withoutUser` and `withoutDefaultArgs` to remove
Currently, passing nil or empty arguments to those function reinit the values. It's not that explicit and clear. It will make more API endpoints, but it's gonna be clearer.
https://github.com/dagger/dagger/issues/3284
https://github.com/dagger/dagger/pull/6278
568d802bb892f1e074cf74cfce2a551989418964
cd825bde699a0beb0adb5c2529da5469118a172b
2022-10-07T15:00:07Z
go
2023-12-19T13:11:01Z
core/integration/container_test.go
Directory struct { ID core.DirectoryID } } } } } } }{} err = testutil.Query( `query Test($id: DirectoryID!) { container { from(address: "`+alpineImage+`") { 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,284
Use `withoutEntrypoint`, `withoutWorkdir`, `withoutUser` and `withoutDefaultArgs` to remove
Currently, passing nil or empty arguments to those function reinit the values. It's not that explicit and clear. It will make more API endpoints, but it's gonna be clearer.
https://github.com/dagger/dagger/issues/3284
https://github.com/dagger/dagger/pull/6278
568d802bb892f1e074cf74cfce2a551989418964
cd825bde699a0beb0adb5c2529da5469118a172b
2022-10-07T15:00:07Z
go
2023-12-19T13:11:01Z
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: "`+alpineImage+`") { 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,284
Use `withoutEntrypoint`, `withoutWorkdir`, `withoutUser` and `withoutDefaultArgs` to remove
Currently, passing nil or empty arguments to those function reinit the values. It's not that explicit and clear. It will make more API endpoints, but it's gonna be clearer.
https://github.com/dagger/dagger/issues/3284
https://github.com/dagger/dagger/pull/6278
568d802bb892f1e074cf74cfce2a551989418964
cd825bde699a0beb0adb5c2529da5469118a172b
2022-10-07T15:00:07Z
go
2023-12-19T13:11:01Z
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: "`+alpineImage+`") { withMountedDirectory(path: "/mnt/dir", source: $id) { directory(path: "/mnt/dir/some-file") { id
closed
dagger/dagger
https://github.com/dagger/dagger
3,284
Use `withoutEntrypoint`, `withoutWorkdir`, `withoutUser` and `withoutDefaultArgs` to remove
Currently, passing nil or empty arguments to those function reinit the values. It's not that explicit and clear. It will make more API endpoints, but it's gonna be clearer.
https://github.com/dagger/dagger/issues/3284
https://github.com/dagger/dagger/pull/6278
568d802bb892f1e074cf74cfce2a551989418964
cd825bde699a0beb0adb5c2529da5469118a172b
2022-10-07T15:00:07Z
go
2023-12-19T13:11:01Z
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: "`+alpineImage+`") { 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: "`+alpineImage+`") { withMountedTemp(path: "/mnt/tmp") {
closed
dagger/dagger
https://github.com/dagger/dagger
3,284
Use `withoutEntrypoint`, `withoutWorkdir`, `withoutUser` and `withoutDefaultArgs` to remove
Currently, passing nil or empty arguments to those function reinit the values. It's not that explicit and clear. It will make more API endpoints, but it's gonna be clearer.
https://github.com/dagger/dagger/issues/3284
https://github.com/dagger/dagger/pull/6278
568d802bb892f1e074cf74cfce2a551989418964
cd825bde699a0beb0adb5c2529da5469118a172b
2022-10-07T15:00:07Z
go
2023-12-19T13:11:01Z
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: CacheVolumeID!) { container { from(address: "`+alpineImage+`") { 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,284
Use `withoutEntrypoint`, `withoutWorkdir`, `withoutUser` and `withoutDefaultArgs` to remove
Currently, passing nil or empty arguments to those function reinit the values. It's not that explicit and clear. It will make more API endpoints, but it's gonna be clearer.
https://github.com/dagger/dagger/issues/3284
https://github.com/dagger/dagger/pull/6278
568d802bb892f1e074cf74cfce2a551989418964
cd825bde699a0beb0adb5c2529da5469118a172b
2022-10-07T15:00:07Z
go
2023-12-19T13:11:01Z
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,284
Use `withoutEntrypoint`, `withoutWorkdir`, `withoutUser` and `withoutDefaultArgs` to remove
Currently, passing nil or empty arguments to those function reinit the values. It's not that explicit and clear. It will make more API endpoints, but it's gonna be clearer.
https://github.com/dagger/dagger/issues/3284
https://github.com/dagger/dagger/pull/6278
568d802bb892f1e074cf74cfce2a551989418964
cd825bde699a0beb0adb5c2529da5469118a172b
2022-10-07T15:00:07Z
go
2023-12-19T13:11:01Z
core/integration/container_test.go
WithMountedDirectory struct { WithExec struct { Directory struct { ID core.DirectoryID } } } } } }{} err = testutil.Query( `query Test($id: DirectoryID!) { container { from(address: "`+alpineImage+`") { 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,284
Use `withoutEntrypoint`, `withoutWorkdir`, `withoutUser` and `withoutDefaultArgs` to remove
Currently, passing nil or empty arguments to those function reinit the values. It's not that explicit and clear. It will make more API endpoints, but it's gonna be clearer.
https://github.com/dagger/dagger/issues/3284
https://github.com/dagger/dagger/pull/6278
568d802bb892f1e074cf74cfce2a551989418964
cd825bde699a0beb0adb5c2529da5469118a172b
2022-10-07T15:00:07Z
go
2023-12-19T13:11:01Z
core/integration/container_test.go
From struct { WithMountedDirectory struct { WithExec struct { Stdout string } } } } }{} err = testutil.Query( `query Test($id: DirectoryID!) { container { from(address: "`+alpineImage+`") { 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,284
Use `withoutEntrypoint`, `withoutWorkdir`, `withoutUser` and `withoutDefaultArgs` to remove
Currently, passing nil or empty arguments to those function reinit the values. It's not that explicit and clear. It will make more API endpoints, but it's gonna be clearer.
https://github.com/dagger/dagger/issues/3284
https://github.com/dagger/dagger/pull/6278
568d802bb892f1e074cf74cfce2a551989418964
cd825bde699a0beb0adb5c2529da5469118a172b
2022-10-07T15:00:07Z
go
2023-12-19T13:11:01Z
core/integration/container_test.go
Container struct { From struct { WithMountedDirectory struct { WithMountedDirectory struct { WithExec struct {
closed
dagger/dagger
https://github.com/dagger/dagger
3,284
Use `withoutEntrypoint`, `withoutWorkdir`, `withoutUser` and `withoutDefaultArgs` to remove
Currently, passing nil or empty arguments to those function reinit the values. It's not that explicit and clear. It will make more API endpoints, but it's gonna be clearer.
https://github.com/dagger/dagger/issues/3284
https://github.com/dagger/dagger/pull/6278
568d802bb892f1e074cf74cfce2a551989418964
cd825bde699a0beb0adb5c2529da5469118a172b
2022-10-07T15:00:07Z
go
2023-12-19T13:11:01Z
core/integration/container_test.go
File struct { ID core.FileID } } } } } } }{} err := testutil.Query( `query Test($id: DirectoryID!) { container { from(address: "`+alpineImage+`") { 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,284
Use `withoutEntrypoint`, `withoutWorkdir`, `withoutUser` and `withoutDefaultArgs` to remove
Currently, passing nil or empty arguments to those function reinit the values. It's not that explicit and clear. It will make more API endpoints, but it's gonna be clearer.
https://github.com/dagger/dagger/issues/3284
https://github.com/dagger/dagger/pull/6278
568d802bb892f1e074cf74cfce2a551989418964
cd825bde699a0beb0adb5c2529da5469118a172b
2022-10-07T15:00:07Z
go
2023-12-19T13:11:01Z
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: "`+alpineImage+`") { 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,284
Use `withoutEntrypoint`, `withoutWorkdir`, `withoutUser` and `withoutDefaultArgs` to remove
Currently, passing nil or empty arguments to those function reinit the values. It's not that explicit and clear. It will make more API endpoints, but it's gonna be clearer.
https://github.com/dagger/dagger/issues/3284
https://github.com/dagger/dagger/pull/6278
568d802bb892f1e074cf74cfce2a551989418964
cd825bde699a0beb0adb5c2529da5469118a172b
2022-10-07T15:00:07Z
go
2023-12-19T13:11:01Z
core/integration/container_test.go
t.Parallel() id := newDirWithFile(t, "some-file", "some-content") err := testutil.Query( `query Test($id: DirectoryID!) { container { from(address: "`+alpineImage+`") { 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: "`+alpineImage+`") { withMountedDirectory(path: "/mnt/dir", source: $id) { file(path: "/mnt/dir") { id
closed
dagger/dagger
https://github.com/dagger/dagger
3,284
Use `withoutEntrypoint`, `withoutWorkdir`, `withoutUser` and `withoutDefaultArgs` to remove
Currently, passing nil or empty arguments to those function reinit the values. It's not that explicit and clear. It will make more API endpoints, but it's gonna be clearer.
https://github.com/dagger/dagger/issues/3284
https://github.com/dagger/dagger/pull/6278
568d802bb892f1e074cf74cfce2a551989418964
cd825bde699a0beb0adb5c2529da5469118a172b
2022-10-07T15:00:07Z
go
2023-12-19T13:11:01Z
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: "`+alpineImage+`") { 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: CacheVolumeID!) { container { from(address: "`+alpineImage+`") { withMountedCache(path: "/mnt/cache", cache: $cache) { file(path: "/mnt/cache/bogus") {
closed
dagger/dagger
https://github.com/dagger/dagger
3,284
Use `withoutEntrypoint`, `withoutWorkdir`, `withoutUser` and `withoutDefaultArgs` to remove
Currently, passing nil or empty arguments to those function reinit the values. It's not that explicit and clear. It will make more API endpoints, but it's gonna be clearer.
https://github.com/dagger/dagger/issues/3284
https://github.com/dagger/dagger/pull/6278
568d802bb892f1e074cf74cfce2a551989418964
cd825bde699a0beb0adb5c2529da5469118a172b
2022-10-07T15:00:07Z
go
2023-12-19T13:11:01Z
core/integration/container_test.go
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") err = testutil.Query( `query Test($secret: SecretID!) { container { from(address: "`+alpineImage+`") { withMountedSecret(path: "/sekret", source: $secret) { file(path: "/sekret") { contents } } } } }`, nil, &testutil.QueryOptions{Secrets: map[string]string{ "secret": "some-secret", }}) 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,284
Use `withoutEntrypoint`, `withoutWorkdir`, `withoutUser` and `withoutDefaultArgs` to remove
Currently, passing nil or empty arguments to those function reinit the values. It's not that explicit and clear. It will make more API endpoints, but it's gonna be clearer.
https://github.com/dagger/dagger/issues/3284
https://github.com/dagger/dagger/pull/6278
568d802bb892f1e074cf74cfce2a551989418964
cd825bde699a0beb0adb5c2529da5469118a172b
2022-10-07T15:00:07Z
go
2023-12-19T13:11:01Z
core/integration/container_test.go
Container struct { From struct { Directory struct { ID core.DirectoryID } } } }{} err := testutil.Query( `{ container { from(address: "`+alpineImage+`") { 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,284
Use `withoutEntrypoint`, `withoutWorkdir`, `withoutUser` and `withoutDefaultArgs` to remove
Currently, passing nil or empty arguments to those function reinit the values. It's not that explicit and clear. It will make more API endpoints, but it's gonna be clearer.
https://github.com/dagger/dagger/issues/3284
https://github.com/dagger/dagger/pull/6278
568d802bb892f1e074cf74cfce2a551989418964
cd825bde699a0beb0adb5c2529da5469118a172b
2022-10-07T15:00:07Z
go
2023-12-19T13:11:01Z
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: "`+alpineImage+`") { 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.18.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,284
Use `withoutEntrypoint`, `withoutWorkdir`, `withoutUser` and `withoutDefaultArgs` to remove
Currently, passing nil or empty arguments to those function reinit the values. It's not that explicit and clear. It will make more API endpoints, but it's gonna be clearer.
https://github.com/dagger/dagger/issues/3284
https://github.com/dagger/dagger/pull/6278
568d802bb892f1e074cf74cfce2a551989418964
cd825bde699a0beb0adb5c2529da5469118a172b
2022-10-07T15:00:07Z
go
2023-12-19T13:11:01Z
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,284
Use `withoutEntrypoint`, `withoutWorkdir`, `withoutUser` and `withoutDefaultArgs` to remove
Currently, passing nil or empty arguments to those function reinit the values. It's not that explicit and clear. It will make more API endpoints, but it's gonna be clearer.
https://github.com/dagger/dagger/issues/3284
https://github.com/dagger/dagger/pull/6278
568d802bb892f1e074cf74cfce2a551989418964
cd825bde699a0beb0adb5c2529da5469118a172b
2022-10-07T15:00:07Z
go
2023-12-19T13:11:01Z
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: CacheVolumeID!) { container { from(address: "`+alpineImage+`") { 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,284
Use `withoutEntrypoint`, `withoutWorkdir`, `withoutUser` and `withoutDefaultArgs` to remove
Currently, passing nil or empty arguments to those function reinit the values. It's not that explicit and clear. It will make more API endpoints, but it's gonna be clearer.
https://github.com/dagger/dagger/issues/3284
https://github.com/dagger/dagger/pull/6278
568d802bb892f1e074cf74cfce2a551989418964
cd825bde699a0beb0adb5c2529da5469118a172b
2022-10-07T15:00:07Z
go
2023-12-19T13:11:01Z
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,284
Use `withoutEntrypoint`, `withoutWorkdir`, `withoutUser` and `withoutDefaultArgs` to remove
Currently, passing nil or empty arguments to those function reinit the values. It's not that explicit and clear. It will make more API endpoints, but it's gonna be clearer.
https://github.com/dagger/dagger/issues/3284
https://github.com/dagger/dagger/pull/6278
568d802bb892f1e074cf74cfce2a551989418964
cd825bde699a0beb0adb5c2529da5469118a172b
2022-10-07T15:00:07Z
go
2023-12-19T13:11:01Z
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: "`+alpineImage+`") { 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,284
Use `withoutEntrypoint`, `withoutWorkdir`, `withoutUser` and `withoutDefaultArgs` to remove
Currently, passing nil or empty arguments to those function reinit the values. It's not that explicit and clear. It will make more API endpoints, but it's gonna be clearer.
https://github.com/dagger/dagger/issues/3284
https://github.com/dagger/dagger/pull/6278
568d802bb892f1e074cf74cfce2a551989418964
cd825bde699a0beb0adb5c2529da5469118a172b
2022-10-07T15:00:07Z
go
2023-12-19T13:11:01Z
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,284
Use `withoutEntrypoint`, `withoutWorkdir`, `withoutUser` and `withoutDefaultArgs` to remove
Currently, passing nil or empty arguments to those function reinit the values. It's not that explicit and clear. It will make more API endpoints, but it's gonna be clearer.
https://github.com/dagger/dagger/issues/3284
https://github.com/dagger/dagger/pull/6278
568d802bb892f1e074cf74cfce2a551989418964
cd825bde699a0beb0adb5c2529da5469118a172b
2022-10-07T15:00:07Z
go
2023-12-19T13:11:01Z
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,284
Use `withoutEntrypoint`, `withoutWorkdir`, `withoutUser` and `withoutDefaultArgs` to remove
Currently, passing nil or empty arguments to those function reinit the values. It's not that explicit and clear. It will make more API endpoints, but it's gonna be clearer.
https://github.com/dagger/dagger/issues/3284
https://github.com/dagger/dagger/pull/6278
568d802bb892f1e074cf74cfce2a551989418964
cd825bde699a0beb0adb5c2529da5469118a172b
2022-10-07T15:00:07Z
go
2023-12-19T13:11:01Z
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) { c, ctx := connect(t) testRef := registryRef("container-publish") entrypoint := []string{"echo", "im-a-entrypoint"} ctr := c.Container().From(alpineImage). WithDefaultArgs(dagger.ContainerWithDefaultArgsOpts{}). WithEntrypoint(entrypoint) pushedRef, err := ctr.Publish(ctx, testRef) require.NoError(t, err) require.NotEqual(t, testRef, pushedRef) require.Contains(t, pushedRef, "@sha256:") pulledCtr := c.Container().From(pushedRef) contents, err := pulledCtr.File("/etc/alpine-release").Contents(ctx) require.NoError(t, err) require.Equal(t, contents, "3.18.2\n") output, err := pulledCtr.WithExec(nil).Stdout(ctx) require.NoError(t, err) require.Equal(t, "im-a-entrypoint\n", output) } func TestExecFromScratch(t *testing.T) {
closed
dagger/dagger
https://github.com/dagger/dagger
3,284
Use `withoutEntrypoint`, `withoutWorkdir`, `withoutUser` and `withoutDefaultArgs` to remove
Currently, passing nil or empty arguments to those function reinit the values. It's not that explicit and clear. It will make more API endpoints, but it's gonna be clearer.
https://github.com/dagger/dagger/issues/3284
https://github.com/dagger/dagger/pull/6278
568d802bb892f1e074cf74cfce2a551989418964
cd825bde699a0beb0adb5c2529da5469118a172b
2022-10-07T15:00:07Z
go
2023-12-19T13:11:01Z
core/integration/container_test.go
c, ctx := connect(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, registryRef("from-scratch")) require.NoError(t, err) } func TestContainerMultipleMounts(t *testing.T) {
closed
dagger/dagger
https://github.com/dagger/dagger
3,284
Use `withoutEntrypoint`, `withoutWorkdir`, `withoutUser` and `withoutDefaultArgs` to remove
Currently, passing nil or empty arguments to those function reinit the values. It's not that explicit and clear. It will make more API endpoints, but it's gonna be clearer.
https://github.com/dagger/dagger/issues/3284
https://github.com/dagger/dagger/pull/6278
568d802bb892f1e074cf74cfce2a551989418964
cd825bde699a0beb0adb5c2529da5469118a172b
2022-10-07T15:00:07Z
go
2023-12-19T13:11:01Z
core/integration/container_test.go
c, ctx := connect(t) dir := t.TempDir() require.NoError(t, os.WriteFile(filepath.Join(dir, "one"), []byte("1"), 0o600)) require.NoError(t, os.WriteFile(filepath.Join(dir, "two"), []byte("2"), 0o600)) require.NoError(t, os.WriteFile(filepath.Join(dir, "three"), []byte("3"), 0o600)) 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(alpineImage). 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() wd := t.TempDir() dest := t.TempDir() c, ctx := connect(t, dagger.WithWorkdir(wd))
closed
dagger/dagger
https://github.com/dagger/dagger
3,284
Use `withoutEntrypoint`, `withoutWorkdir`, `withoutUser` and `withoutDefaultArgs` to remove
Currently, passing nil or empty arguments to those function reinit the values. It's not that explicit and clear. It will make more API endpoints, but it's gonna be clearer.
https://github.com/dagger/dagger/issues/3284
https://github.com/dagger/dagger/pull/6278
568d802bb892f1e074cf74cfce2a551989418964
cd825bde699a0beb0adb5c2529da5469118a172b
2022-10-07T15:00:07Z
go
2023-12-19T13:11:01Z
core/integration/container_test.go
entrypoint := []string{"sh", "-c", "im-a-entrypoint"} ctr := c.Container().From(alpineImage). WithEntrypoint(entrypoint) t.Run("to absolute dir", func(t *testing.T) { for _, useAsTarball := range []bool{true, false} { t.Run(fmt.Sprintf("useAsTarball=%t", useAsTarball), func(t *testing.T) { imagePath := filepath.Join(dest, "image.tar") if useAsTarball { tarFile := ctr.AsTarball() ok, err := tarFile.Export(ctx, imagePath) require.NoError(t, err) require.True(t, ok) } else { ok, err := ctr.Export(ctx, imagePath) require.NoError(t, err) require.True(t, ok) } stat, err := os.Stat(imagePath) require.NoError(t, err) require.NotZero(t, stat.Size()) require.EqualValues(t, 0o600, stat.Mode().Perm()) entries := tarEntries(t, imagePath) require.Contains(t, entries, "oci-layout") require.Contains(t, entries, "index.json") require.Contains(t, entries, "manifest.json") dockerManifestBytes := readTarFile(t, imagePath, "manifest.json") var dockerManifest []struct {
closed
dagger/dagger
https://github.com/dagger/dagger
3,284
Use `withoutEntrypoint`, `withoutWorkdir`, `withoutUser` and `withoutDefaultArgs` to remove
Currently, passing nil or empty arguments to those function reinit the values. It's not that explicit and clear. It will make more API endpoints, but it's gonna be clearer.
https://github.com/dagger/dagger/issues/3284
https://github.com/dagger/dagger/pull/6278
568d802bb892f1e074cf74cfce2a551989418964
cd825bde699a0beb0adb5c2529da5469118a172b
2022-10-07T15:00:07Z
go
2023-12-19T13:11:01Z
core/integration/container_test.go
Config string } require.NoError(t, json.Unmarshal(dockerManifestBytes, &dockerManifest)) require.Len(t, dockerManifest, 1) configPath := dockerManifest[0].Config configBytes := readTarFile(t, imagePath, configPath) var img ocispecs.Image require.NoError(t, json.Unmarshal(configBytes, &img)) require.Equal(t, entrypoint, img.Config.Entrypoint) }) } }) t.Run("to workdir", func(t *testing.T) { ok, err := ctr.Export(ctx, "./image.tar") require.NoError(t, err) require.True(t, ok) stat, err := os.Stat(filepath.Join(wd, "image.tar")) require.NoError(t, err) require.NotZero(t, stat.Size()) require.EqualValues(t, 0o600, stat.Mode().Perm()) entries := tarEntries(t, filepath.Join(wd, "image.tar")) require.Contains(t, entries, "oci-layout") require.Contains(t, entries, "index.json")
closed
dagger/dagger
https://github.com/dagger/dagger
3,284
Use `withoutEntrypoint`, `withoutWorkdir`, `withoutUser` and `withoutDefaultArgs` to remove
Currently, passing nil or empty arguments to those function reinit the values. It's not that explicit and clear. It will make more API endpoints, but it's gonna be clearer.
https://github.com/dagger/dagger/issues/3284
https://github.com/dagger/dagger/pull/6278
568d802bb892f1e074cf74cfce2a551989418964
cd825bde699a0beb0adb5c2529da5469118a172b
2022-10-07T15:00:07Z
go
2023-12-19T13:11:01Z
core/integration/container_test.go
require.Contains(t, entries, "manifest.json") }) t.Run("to subdir", func(t *testing.T) { ok, err := ctr.Export(ctx, "./foo/image.tar") require.NoError(t, err) require.True(t, ok) entries := tarEntries(t, filepath.Join(wd, "foo", "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 TestContainerAsTarball(t *testing.T) { t.Parallel() c, ctx := connect(t) ctr := c.Container().From(alpineImage) output, err := ctr. WithMountedFile("/foo.tar", ctr.AsTarball()). WithExec([]string{"apk", "add", "file"}). WithExec([]string{"file", "/foo.tar"}). Stdout(ctx) require.NoError(t, err) require.Equal(t, "/foo.tar: POSIX tar archive\n", output) } func TestContainerImport(t *testing.T) {
closed
dagger/dagger
https://github.com/dagger/dagger
3,284
Use `withoutEntrypoint`, `withoutWorkdir`, `withoutUser` and `withoutDefaultArgs` to remove
Currently, passing nil or empty arguments to those function reinit the values. It's not that explicit and clear. It will make more API endpoints, but it's gonna be clearer.
https://github.com/dagger/dagger/issues/3284
https://github.com/dagger/dagger/pull/6278
568d802bb892f1e074cf74cfce2a551989418964
cd825bde699a0beb0adb5c2529da5469118a172b
2022-10-07T15:00:07Z
go
2023-12-19T13:11:01Z
core/integration/container_test.go
t.Parallel() c, ctx := connect(t) t.Run("OCI", func(t *testing.T) { pf, err := c.DefaultPlatform(ctx) require.NoError(t, err) platform, err := platforms.Parse(string(pf)) require.NoError(t, err) config := map[string]any{ "contents": map[string]any{ "keyring": []string{ "https://packages.wolfi.dev/os/wolfi-signing.rsa.pub", }, "repositories": []string{ "https://packages.wolfi.dev/os", }, "packages": []string{ "wolfi-base", }, }, "cmd": "/bin/sh -l", "environment": map[string]string{ "FOO": "bar", }, "archs": []string{ platform.Architecture, },
closed
dagger/dagger
https://github.com/dagger/dagger
3,284
Use `withoutEntrypoint`, `withoutWorkdir`, `withoutUser` and `withoutDefaultArgs` to remove
Currently, passing nil or empty arguments to those function reinit the values. It's not that explicit and clear. It will make more API endpoints, but it's gonna be clearer.
https://github.com/dagger/dagger/issues/3284
https://github.com/dagger/dagger/pull/6278
568d802bb892f1e074cf74cfce2a551989418964
cd825bde699a0beb0adb5c2529da5469118a172b
2022-10-07T15:00:07Z
go
2023-12-19T13:11:01Z
core/integration/container_test.go
} cfgYaml, err := yaml.Marshal(config) require.NoError(t, err) apko := c.Container(). From("cgr.dev/chainguard/apko:latest"). WithNewFile("config.yml", dagger.ContainerWithNewFileOpts{ Contents: string(cfgYaml), }) imageFile := apko. WithExec([]string{ "build", "config.yml", "latest", "output.tar", }). File("output.tar") imported := c.Container().Import(imageFile) out, err := imported.WithExec([]string{"sh", "-c", "echo $FOO"}).Stdout(ctx) require.NoError(t, err) require.Equal(t, "bar\n", out) }) t.Run("Docker", func(t *testing.T) { out, err := c.Container(). Import(c.Container().From(alpineImage).WithEnvVariable("FOO", "bar").AsTarball(dagger.ContainerAsTarballOpts{ MediaTypes: dagger.Dockermediatypes, })). WithExec([]string{"sh", "-c", "echo $FOO"}).Stdout(ctx) require.NoError(t, err) require.Equal(t, "bar\n", out) }) } func TestContainerFromIDPlatform(t *testing.T) {
closed
dagger/dagger
https://github.com/dagger/dagger
3,284
Use `withoutEntrypoint`, `withoutWorkdir`, `withoutUser` and `withoutDefaultArgs` to remove
Currently, passing nil or empty arguments to those function reinit the values. It's not that explicit and clear. It will make more API endpoints, but it's gonna be clearer.
https://github.com/dagger/dagger/issues/3284
https://github.com/dagger/dagger/pull/6278
568d802bb892f1e074cf74cfce2a551989418964
cd825bde699a0beb0adb5c2529da5469118a172b
2022-10-07T15:00:07Z
go
2023-12-19T13:11:01Z
core/integration/container_test.go
c, ctx := connect(t) var desiredPlatform dagger.Platform = "linux/arm64" id, err := c.Container(dagger.ContainerOpts{ Platform: desiredPlatform, }).From(alpineImage).ID(ctx) require.NoError(t, err) platform, err := c.Container(dagger.ContainerOpts{ ID: id, }).Platform(ctx) require.NoError(t, err) require.Equal(t, desiredPlatform, platform) } func TestContainerMultiPlatformExport(t *testing.T) { for _, useAsTarball := range []bool{true, false} { t.Run(fmt.Sprintf("useAsTarball=%t", useAsTarball), func(t *testing.T) { c, ctx := connect(t) variants := make([]*dagger.Container, 0, len(platformToUname)) for platform, uname := range platformToUname { ctr := c.Container(dagger.ContainerOpts{Platform: platform}). From(alpineImage). WithExec([]string{"uname", "-m"}). WithDefaultArgs(dagger.ContainerWithDefaultArgsOpts{}). WithEntrypoint([]string{"echo", uname}) variants = append(variants, ctr) }
closed
dagger/dagger
https://github.com/dagger/dagger
3,284
Use `withoutEntrypoint`, `withoutWorkdir`, `withoutUser` and `withoutDefaultArgs` to remove
Currently, passing nil or empty arguments to those function reinit the values. It's not that explicit and clear. It will make more API endpoints, but it's gonna be clearer.
https://github.com/dagger/dagger/issues/3284
https://github.com/dagger/dagger/pull/6278
568d802bb892f1e074cf74cfce2a551989418964
cd825bde699a0beb0adb5c2529da5469118a172b
2022-10-07T15:00:07Z
go
2023-12-19T13:11:01Z
core/integration/container_test.go
dest := filepath.Join(t.TempDir(), "image.tar") if useAsTarball { tarFile := c.Container().AsTarball(dagger.ContainerAsTarballOpts{ PlatformVariants: variants, }) ok, err := tarFile.Export(ctx, dest) require.NoError(t, err) require.True(t, ok) } else { 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.NotContains(t, entries, "manifest.json") indexBytes := readTarFile(t, dest, "index.json") var index ocispecs.Index require.NoError(t, json.Unmarshal(indexBytes, &index)) nestedIndexDigest := index.Manifests[0].Digest indexBytes = readTarFile(t, dest, "blobs/sha256/"+nestedIndexDigest.Encoded()) index = ocispecs.Index{} require.NoError(t, json.Unmarshal(indexBytes, &index)) exportedPlatforms := make(map[string]struct{})
closed
dagger/dagger
https://github.com/dagger/dagger
3,284
Use `withoutEntrypoint`, `withoutWorkdir`, `withoutUser` and `withoutDefaultArgs` to remove
Currently, passing nil or empty arguments to those function reinit the values. It's not that explicit and clear. It will make more API endpoints, but it's gonna be clearer.
https://github.com/dagger/dagger/issues/3284
https://github.com/dagger/dagger/pull/6278
568d802bb892f1e074cf74cfce2a551989418964
cd825bde699a0beb0adb5c2529da5469118a172b
2022-10-07T15:00:07Z
go
2023-12-19T13:11:01Z
core/integration/container_test.go
for _, desc := range index.Manifests { require.NotNil(t, desc.Platform) platformStr := platforms.Format(*desc.Platform) exportedPlatforms[platformStr] = struct{}{} manifestDigest := desc.Digest manifestBytes := readTarFile(t, dest, "blobs/sha256/"+manifestDigest.Encoded()) var manifest ocispecs.Manifest require.NoError(t, json.Unmarshal(manifestBytes, &manifest)) configDigest := manifest.Config.Digest configBytes := readTarFile(t, dest, "blobs/sha256/"+configDigest.Encoded()) var config ocispecs.Image require.NoError(t, json.Unmarshal(configBytes, &config)) require.Equal(t, []string{"echo", platformToUname[dagger.Platform(platformStr)]}, config.Config.Entrypoint) } for platform := range platformToUname { delete(exportedPlatforms, string(platform)) } require.Empty(t, exportedPlatforms) }) } } func TestContainerMultiPlatformPublish(t *testing.T) {
closed
dagger/dagger
https://github.com/dagger/dagger
3,284
Use `withoutEntrypoint`, `withoutWorkdir`, `withoutUser` and `withoutDefaultArgs` to remove
Currently, passing nil or empty arguments to those function reinit the values. It's not that explicit and clear. It will make more API endpoints, but it's gonna be clearer.
https://github.com/dagger/dagger/issues/3284
https://github.com/dagger/dagger/pull/6278
568d802bb892f1e074cf74cfce2a551989418964
cd825bde699a0beb0adb5c2529da5469118a172b
2022-10-07T15:00:07Z
go
2023-12-19T13:11:01Z
core/integration/container_test.go
c, ctx := connect(t) variants := make([]*dagger.Container, 0, len(platformToUname)) for platform, uname := range platformToUname { ctr := c.Container(dagger.ContainerOpts{Platform: platform}). From(alpineImage). WithExec([]string{"uname", "-m"}). WithDefaultArgs(dagger.ContainerWithDefaultArgsOpts{}). WithEntrypoint([]string{"echo", uname}) variants = append(variants, ctr) } testRef := registryRef("container-multiplatform-publish") publishedRef, err := c.Container().Publish(ctx, testRef, dagger.ContainerPublishOpts{ PlatformVariants: variants, }) require.NoError(t, err) for platform, uname := range platformToUname { output, err := c.Container(dagger.ContainerOpts{Platform: platform}). From(publishedRef). WithExec(nil).Stdout(ctx) require.NoError(t, err) require.Equal(t, uname+"\n", output) } } func TestContainerMultiPlatformImport(t *testing.T) {
closed
dagger/dagger
https://github.com/dagger/dagger
3,284
Use `withoutEntrypoint`, `withoutWorkdir`, `withoutUser` and `withoutDefaultArgs` to remove
Currently, passing nil or empty arguments to those function reinit the values. It's not that explicit and clear. It will make more API endpoints, but it's gonna be clearer.
https://github.com/dagger/dagger/issues/3284
https://github.com/dagger/dagger/pull/6278
568d802bb892f1e074cf74cfce2a551989418964
cd825bde699a0beb0adb5c2529da5469118a172b
2022-10-07T15:00:07Z
go
2023-12-19T13:11:01Z
core/integration/container_test.go
c, ctx := connect(t) variants := make([]*dagger.Container, 0, len(platformToUname)) for platform := range platformToUname { ctr := c.Container(dagger.ContainerOpts{Platform: platform}). From(alpineImage) variants = append(variants, ctr) } tmp := t.TempDir() imagePath := filepath.Join(tmp, "image.tar") ok, err := c.Container().Export(ctx, imagePath, dagger.ContainerExportOpts{ PlatformVariants: variants, }) require.NoError(t, err) require.True(t, ok) for platform, uname := range platformToUname { imported := c.Container(dagger.ContainerOpts{Platform: platform}). Import(c.Host().Directory(tmp).File("image.tar")) out, err := imported.WithExec([]string{"uname", "-m"}).Stdout(ctx) require.NoError(t, err) require.Equal(t, uname+"\n", out) } } func TestContainerWithDirectoryToMount(t *testing.T) {
closed
dagger/dagger
https://github.com/dagger/dagger
3,284
Use `withoutEntrypoint`, `withoutWorkdir`, `withoutUser` and `withoutDefaultArgs` to remove
Currently, passing nil or empty arguments to those function reinit the values. It's not that explicit and clear. It will make more API endpoints, but it's gonna be clearer.
https://github.com/dagger/dagger/issues/3284
https://github.com/dagger/dagger/pull/6278
568d802bb892f1e074cf74cfce2a551989418964
cd825bde699a0beb0adb5c2529da5469118a172b
2022-10-07T15:00:07Z
go
2023-12-19T13:11:01Z
core/integration/container_test.go
t.Parallel() c, ctx := connect(t) mnt := c.Directory(). WithNewDirectory("/top/sub-dir/sub-file"). Directory("/top") ctr := c.Container(). From(alpineImage). 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.ElementsMatch(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")) } func TestContainerExecError(t *testing.T) {
closed
dagger/dagger
https://github.com/dagger/dagger
3,284
Use `withoutEntrypoint`, `withoutWorkdir`, `withoutUser` and `withoutDefaultArgs` to remove
Currently, passing nil or empty arguments to those function reinit the values. It's not that explicit and clear. It will make more API endpoints, but it's gonna be clearer.
https://github.com/dagger/dagger/issues/3284
https://github.com/dagger/dagger/pull/6278
568d802bb892f1e074cf74cfce2a551989418964
cd825bde699a0beb0adb5c2529da5469118a172b
2022-10-07T15:00:07Z
go
2023-12-19T13:11:01Z
core/integration/container_test.go
t.Parallel() c, ctx := connect(t) outMsg := "THIS SHOULD GO TO STDOUT" encodedOutMsg := base64.StdEncoding.EncodeToString([]byte(outMsg)) errMsg := "THIS SHOULD GO TO STDERR" encodedErrMsg := base64.StdEncoding.EncodeToString([]byte(errMsg)) t.Run("includes output of failed exec in error", func(t *testing.T) { _, err := c.Container(). From(alpineImage). WithExec([]string{"sh", "-c", fmt.Sprintf( `echo %s | base64 -d >&1; echo %s | base64 -d >&2; exit 1`, encodedOutMsg, encodedErrMsg, )}). Sync(ctx) var exErr *dagger.ExecError require.ErrorAs(t, err, &exErr) require.Equal(t, outMsg, exErr.Stdout) require.Equal(t, errMsg, exErr.Stderr) }) t.Run("includes output of failed exec in error when redirects are enabled", func(t *testing.T) { _, err := c.Container(). From(alpineImage). WithExec( []string{"sh", "-c", fmt.Sprintf( `echo %s | base64 -d >&1; echo %s | base64 -d >&2; exit 1`, encodedOutMsg, encodedErrMsg, )}, dagger.ContainerWithExecOpts{ RedirectStdout: "/out", RedirectStderr: "/err", },
closed
dagger/dagger
https://github.com/dagger/dagger
3,284
Use `withoutEntrypoint`, `withoutWorkdir`, `withoutUser` and `withoutDefaultArgs` to remove
Currently, passing nil or empty arguments to those function reinit the values. It's not that explicit and clear. It will make more API endpoints, but it's gonna be clearer.
https://github.com/dagger/dagger/issues/3284
https://github.com/dagger/dagger/pull/6278
568d802bb892f1e074cf74cfce2a551989418964
cd825bde699a0beb0adb5c2529da5469118a172b
2022-10-07T15:00:07Z
go
2023-12-19T13:11:01Z
core/integration/container_test.go
). Sync(ctx) var exErr *dagger.ExecError require.ErrorAs(t, err, &exErr) require.Equal(t, outMsg, exErr.Stdout) require.Equal(t, errMsg, exErr.Stderr) }) t.Run("truncates output past a maximum size", func(t *testing.T) { var stdoutBuf bytes.Buffer for i := 0; i < buildkit.MaxExecErrorOutputBytes+50; i++ { stdoutBuf.WriteByte('a') } stdoutStr := stdoutBuf.String() encodedOutMsg := base64.StdEncoding.EncodeToString(stdoutBuf.Bytes()) var stderrBuf bytes.Buffer for i := 0; i < buildkit.MaxExecErrorOutputBytes+50; i++ { stderrBuf.WriteByte('b') } stderrStr := stderrBuf.String() encodedErrMsg := base64.StdEncoding.EncodeToString(stderrBuf.Bytes()) truncMsg := fmt.Sprintf(buildkit.TruncationMessage, 50) _, err := c.Container(). From(alpineImage). WithDirectory("/", c.Directory(). WithNewFile("encout", encodedOutMsg). WithNewFile("encerr", encodedErrMsg), ). WithExec([]string{"sh", "-c", "base64 -d encout >&1; base64 -d encerr >&2; exit 1"}).
closed
dagger/dagger
https://github.com/dagger/dagger
3,284
Use `withoutEntrypoint`, `withoutWorkdir`, `withoutUser` and `withoutDefaultArgs` to remove
Currently, passing nil or empty arguments to those function reinit the values. It's not that explicit and clear. It will make more API endpoints, but it's gonna be clearer.
https://github.com/dagger/dagger/issues/3284
https://github.com/dagger/dagger/pull/6278
568d802bb892f1e074cf74cfce2a551989418964
cd825bde699a0beb0adb5c2529da5469118a172b
2022-10-07T15:00:07Z
go
2023-12-19T13:11:01Z
core/integration/container_test.go
Sync(ctx) var exErr *dagger.ExecError require.ErrorAs(t, err, &exErr) require.Equal(t, truncMsg+stdoutStr[:buildkit.MaxExecErrorOutputBytes-len(truncMsg)], exErr.Stdout) require.Equal(t, truncMsg+stderrStr[:buildkit.MaxExecErrorOutputBytes-len(truncMsg)], exErr.Stderr) }) } func TestContainerWithRegistryAuth(t *testing.T) { t.Parallel() c, ctx := connect(t) testRef := privateRegistryRef("container-with-registry-auth") container := c.Container().From(alpineImage) _, err := container.Publish(ctx, testRef) require.Error(t, err) pushedRef, err := container. WithRegistryAuth( privateRegistryHost, "john", c.SetSecret("this-secret", "xFlejaPdjrt25Dvr"), ). Publish(ctx, testRef) require.NoError(t, err) require.NotEqual(t, testRef, pushedRef) require.Contains(t, pushedRef, "@sha256:") } func TestContainerImageRef(t *testing.T) { t.Parallel() t.Run("should test query returning imageRef", func(t *testing.T) { res := struct {
closed
dagger/dagger
https://github.com/dagger/dagger
3,284
Use `withoutEntrypoint`, `withoutWorkdir`, `withoutUser` and `withoutDefaultArgs` to remove
Currently, passing nil or empty arguments to those function reinit the values. It's not that explicit and clear. It will make more API endpoints, but it's gonna be clearer.
https://github.com/dagger/dagger/issues/3284
https://github.com/dagger/dagger/pull/6278
568d802bb892f1e074cf74cfce2a551989418964
cd825bde699a0beb0adb5c2529da5469118a172b
2022-10-07T15:00:07Z
go
2023-12-19T13:11:01Z
core/integration/container_test.go
Container struct { From struct { ImageRef string } } }{} err := testutil.Query( `{ container { from(address: "`+alpineImage+`") { imageRef } } }`, &res, nil) require.NoError(t, err) require.Contains(t, res.Container.From.ImageRef, "docker.io/library/alpine:3.18.2@sha256:") }) t.Run("should throw error after the container image modification with exec", func(t *testing.T) { res := struct {
closed
dagger/dagger
https://github.com/dagger/dagger
3,284
Use `withoutEntrypoint`, `withoutWorkdir`, `withoutUser` and `withoutDefaultArgs` to remove
Currently, passing nil or empty arguments to those function reinit the values. It's not that explicit and clear. It will make more API endpoints, but it's gonna be clearer.
https://github.com/dagger/dagger/issues/3284
https://github.com/dagger/dagger/pull/6278
568d802bb892f1e074cf74cfce2a551989418964
cd825bde699a0beb0adb5c2529da5469118a172b
2022-10-07T15:00:07Z
go
2023-12-19T13:11:01Z
core/integration/container_test.go
Container struct { From struct { ImageRef string } } }{} err := testutil.Query( `{ container { from(address:"hello-world") { withExec(args:["/hello"]) { imageRef } } } }`, &res, nil) require.Error(t, err) require.Contains(t, err.Error(), "Image reference can only be retrieved immediately after the 'Container.From' call. Error in fetching imageRef as the container image is changed") }) t.Run("should throw error after the container image modification with exec", func(t *testing.T) { res := struct {
closed
dagger/dagger
https://github.com/dagger/dagger
3,284
Use `withoutEntrypoint`, `withoutWorkdir`, `withoutUser` and `withoutDefaultArgs` to remove
Currently, passing nil or empty arguments to those function reinit the values. It's not that explicit and clear. It will make more API endpoints, but it's gonna be clearer.
https://github.com/dagger/dagger/issues/3284
https://github.com/dagger/dagger/pull/6278
568d802bb892f1e074cf74cfce2a551989418964
cd825bde699a0beb0adb5c2529da5469118a172b
2022-10-07T15:00:07Z
go
2023-12-19T13:11:01Z
core/integration/container_test.go
Container struct { From struct { ImageRef string } } }{} err := testutil.Query( `{ container { from(address:"hello-world") { withExec(args:["/hello"]) { imageRef } } } }`, &res, nil) require.Error(t, err) require.Contains(t, err.Error(), "Image reference can only be retrieved immediately after the 'Container.From' call. Error in fetching imageRef as the container image is changed")
closed
dagger/dagger
https://github.com/dagger/dagger
3,284
Use `withoutEntrypoint`, `withoutWorkdir`, `withoutUser` and `withoutDefaultArgs` to remove
Currently, passing nil or empty arguments to those function reinit the values. It's not that explicit and clear. It will make more API endpoints, but it's gonna be clearer.
https://github.com/dagger/dagger/issues/3284
https://github.com/dagger/dagger/pull/6278
568d802bb892f1e074cf74cfce2a551989418964
cd825bde699a0beb0adb5c2529da5469118a172b
2022-10-07T15:00:07Z
go
2023-12-19T13:11:01Z
core/integration/container_test.go
}) t.Run("should throw error after the container image modification with directory", func(t *testing.T) { c, ctx := connect(t) dir := c.Directory(). WithNewFile("some-file", "some-content"). WithNewFile("some-dir/sub-file", "sub-content"). Directory("some-dir") ctr := c.Container(). From(alpineImage). WithWorkdir("/workdir"). WithDirectory("with-dir", dir) _, err := ctr.ImageRef(ctx) require.Error(t, err) require.Contains(t, err.Error(), "Image reference can only be retrieved immediately after the 'Container.From' call. Error in fetching imageRef as the container image is changed") }) } func TestContainerBuildNilContextError(t *testing.T) { t.Parallel() err := testutil.Query( `{ container { build(context: "") { id } } }`, &map[any]any{}, nil) require.ErrorContains(t, err, "invalid nil input definition to definition op") } func TestContainerInsecureRootCapabilites(t *testing.T) {
closed
dagger/dagger
https://github.com/dagger/dagger
3,284
Use `withoutEntrypoint`, `withoutWorkdir`, `withoutUser` and `withoutDefaultArgs` to remove
Currently, passing nil or empty arguments to those function reinit the values. It's not that explicit and clear. It will make more API endpoints, but it's gonna be clearer.
https://github.com/dagger/dagger/issues/3284
https://github.com/dagger/dagger/pull/6278
568d802bb892f1e074cf74cfce2a551989418964
cd825bde699a0beb0adb5c2529da5469118a172b
2022-10-07T15:00:07Z
go
2023-12-19T13:11:01Z
core/integration/container_test.go
c, ctx := connect(t) privilegedCaps := []string{ "cap_sys_admin", "cap_net_admin", "cap_sys_module", "cap_sys_ptrace", "cap_sys_boot", "cap_sys_rawio", "cap_sys_resource", } for _, capSet := range []string{"CapPrm", "CapEff", "CapBnd"} { out, err := c.Container().From(alpineImage). WithExec([]string{"apk", "add", "libcap"}). WithExec([]string{"sh", "-c", "capsh --decode=$(grep " + capSet + " /proc/self/status | awk '{print $2}')"}). Stdout(ctx) require.NoError(t, err) for _, privCap := range privilegedCaps { require.NotContains(t, out, privCap) } } for _, capSet := range []string{"CapPrm", "CapEff", "CapBnd", "CapInh", "CapAmb"} { out, err := c.Container().From(alpineImage). WithExec([]string{"apk", "add", "libcap"}). WithExec([]string{"sh", "-c", "capsh --decode=$(grep " + capSet + " /proc/self/status | awk '{print $2}')"}, dagger.ContainerWithExecOpts{ InsecureRootCapabilities: true, }). Stdout(ctx) require.NoError(t, err)
closed
dagger/dagger
https://github.com/dagger/dagger
3,284
Use `withoutEntrypoint`, `withoutWorkdir`, `withoutUser` and `withoutDefaultArgs` to remove
Currently, passing nil or empty arguments to those function reinit the values. It's not that explicit and clear. It will make more API endpoints, but it's gonna be clearer.
https://github.com/dagger/dagger/issues/3284
https://github.com/dagger/dagger/pull/6278
568d802bb892f1e074cf74cfce2a551989418964
cd825bde699a0beb0adb5c2529da5469118a172b
2022-10-07T15:00:07Z
go
2023-12-19T13:11:01Z
core/integration/container_test.go
for _, privCap := range privilegedCaps { require.Contains(t, out, privCap) } } } func TestContainerInsecureRootCapabilitesWithService(t *testing.T) { c, ctx := connect(t) dockerd := c.Container().From("docker:23.0.1-dind"). WithMountedCache("/var/lib/docker", c.CacheVolume("docker-lib"), dagger.ContainerWithMountedCacheOpts{ Sharing: dagger.Private, }). WithMountedCache("/tmp", c.CacheVolume("share-tmp")). WithExposedPort(2375). WithExec([]string{ "dockerd", "--host=tcp://0.0.0.0:2375", "--tls=false", }, dagger.ContainerWithExecOpts{ InsecureRootCapabilities: true, }).AsService() dockerHost, err := dockerd.Endpoint(ctx, dagger.ServiceEndpointOpts{ Scheme: "tcp", }) require.NoError(t, err) randID := identity.NewID() out, err := c.Container().From("docker:23.0.1-cli"). WithMountedCache("/tmp", c.CacheVolume("share-tmp")).
closed
dagger/dagger
https://github.com/dagger/dagger
3,284
Use `withoutEntrypoint`, `withoutWorkdir`, `withoutUser` and `withoutDefaultArgs` to remove
Currently, passing nil or empty arguments to those function reinit the values. It's not that explicit and clear. It will make more API endpoints, but it's gonna be clearer.
https://github.com/dagger/dagger/issues/3284
https://github.com/dagger/dagger/pull/6278
568d802bb892f1e074cf74cfce2a551989418964
cd825bde699a0beb0adb5c2529da5469118a172b
2022-10-07T15:00:07Z
go
2023-12-19T13:11:01Z
core/integration/container_test.go
WithServiceBinding("docker", dockerd). WithEnvVariable("DOCKER_HOST", dockerHost). WithExec([]string{"sh", "-e", "-c", strings.Join([]string{ fmt.Sprintf("echo %s-from-outside > /tmp/from-outside", randID), "docker run --rm -v /tmp:/tmp alpine cat /tmp/from-outside", fmt.Sprintf("docker run --rm -v /tmp:/tmp alpine sh -c 'echo %s-from-inside > /tmp/from-inside'", randID), "cat /tmp/from-inside", }, "\n")}). Stdout(ctx) require.NoError(t, err) require.Equal(t, fmt.Sprintf("%s-from-outside\n%s-from-inside\n", randID, randID), out) } func TestContainerNoExec(t *testing.T) { c, ctx := connect(t) stdout, err := c.Container().From(alpineImage).Stdout(ctx) require.NoError(t, err) require.Equal(t, "", stdout) stderr, err := c.Container().From(alpineImage).Stderr(ctx) require.NoError(t, err) require.Equal(t, "", stderr) _, err = c.Container(). From(alpineImage). WithDefaultArgs(dagger.ContainerWithDefaultArgsOpts{ Args: nil, }). Stdout(ctx) require.Error(t, err) require.Contains(t, err.Error(), "no command has been set") } func TestContainerWithMountedFileOwner(t *testing.T) {
closed
dagger/dagger
https://github.com/dagger/dagger
3,284
Use `withoutEntrypoint`, `withoutWorkdir`, `withoutUser` and `withoutDefaultArgs` to remove
Currently, passing nil or empty arguments to those function reinit the values. It's not that explicit and clear. It will make more API endpoints, but it's gonna be clearer.
https://github.com/dagger/dagger/issues/3284
https://github.com/dagger/dagger/pull/6278
568d802bb892f1e074cf74cfce2a551989418964
cd825bde699a0beb0adb5c2529da5469118a172b
2022-10-07T15:00:07Z
go
2023-12-19T13:11:01Z
core/integration/container_test.go
c, ctx := connect(t) t.Run("simple file", func(t *testing.T) { tmp := t.TempDir() err := os.WriteFile(filepath.Join(tmp, "message.txt"), []byte("hello world"), 0o600) require.NoError(t, err) file := c.Host().Directory(tmp).File("message.txt") testOwnership(ctx, t, c, func(ctr *dagger.Container, name string, owner string) *dagger.Container { return ctr.WithMountedFile(name, file, dagger.ContainerWithMountedFileOpts{ Owner: owner, }) }) }) t.Run("file from subdirectory", func(t *testing.T) { tmp := t.TempDir() err := os.Mkdir(filepath.Join(tmp, "subdir"), 0o755) require.NoError(t, err) err = os.WriteFile(filepath.Join(tmp, "subdir", "message.txt"), []byte("hello world"), 0o600) require.NoError(t, err) file := c.Host().Directory(tmp).Directory("subdir").File("message.txt") testOwnership(ctx, t, c, func(ctr *dagger.Container, name string, owner string) *dagger.Container { return ctr.WithMountedFile(name, file, dagger.ContainerWithMountedFileOpts{ Owner: owner, }) }) }) } func TestContainerWithMountedDirectoryOwner(t *testing.T) {
closed
dagger/dagger
https://github.com/dagger/dagger
3,284
Use `withoutEntrypoint`, `withoutWorkdir`, `withoutUser` and `withoutDefaultArgs` to remove
Currently, passing nil or empty arguments to those function reinit the values. It's not that explicit and clear. It will make more API endpoints, but it's gonna be clearer.
https://github.com/dagger/dagger/issues/3284
https://github.com/dagger/dagger/pull/6278
568d802bb892f1e074cf74cfce2a551989418964
cd825bde699a0beb0adb5c2529da5469118a172b
2022-10-07T15:00:07Z
go
2023-12-19T13:11:01Z
core/integration/container_test.go
c, ctx := connect(t) t.Run("simple directory", func(t *testing.T) { tmp := t.TempDir() err := os.WriteFile(filepath.Join(tmp, "message.txt"), []byte("hello world"), 0o600) require.NoError(t, err) dir := c.Host().Directory(tmp) testOwnership(ctx, t, c, func(ctr *dagger.Container, name string, owner string) *dagger.Container { return ctr.WithMountedDirectory(name, dir, dagger.ContainerWithMountedDirectoryOpts{ Owner: owner, }) }) }) t.Run("subdirectory", func(t *testing.T) { tmp := t.TempDir() err := os.Mkdir(filepath.Join(tmp, "subdir"), 0o755) require.NoError(t, err) err = os.WriteFile(filepath.Join(tmp, "subdir", "message.txt"), []byte("hello world"), 0o600) require.NoError(t, err) dir := c.Host().Directory(tmp).Directory("subdir") testOwnership(ctx, t, c, func(ctr *dagger.Container, name string, owner string) *dagger.Container { return ctr.WithMountedDirectory(name, dir, dagger.ContainerWithMountedDirectoryOpts{
closed
dagger/dagger
https://github.com/dagger/dagger
3,284
Use `withoutEntrypoint`, `withoutWorkdir`, `withoutUser` and `withoutDefaultArgs` to remove
Currently, passing nil or empty arguments to those function reinit the values. It's not that explicit and clear. It will make more API endpoints, but it's gonna be clearer.
https://github.com/dagger/dagger/issues/3284
https://github.com/dagger/dagger/pull/6278
568d802bb892f1e074cf74cfce2a551989418964
cd825bde699a0beb0adb5c2529da5469118a172b
2022-10-07T15:00:07Z
go
2023-12-19T13:11:01Z
core/integration/container_test.go
Owner: owner, }) }) }) t.Run("permissions", func(t *testing.T) { dir := c.Directory(). WithNewDirectory("perms", dagger.DirectoryWithNewDirectoryOpts{ Permissions: 0o745, }). WithNewFile("perms/foo", "whee", dagger.DirectoryWithNewFileOpts{ Permissions: 0o645, }). Directory("perms") ctr := c.Container().From(alpineImage). WithExec([]string{"adduser", "-D", "inherituser"}). WithExec([]string{"adduser", "-u", "1234", "-D", "auser"}). WithExec([]string{"addgroup", "-g", "4321", "agroup"}). WithUser("inherituser"). WithMountedDirectory("/data", dir, dagger.ContainerWithMountedDirectoryOpts{ Owner: "auser:agroup", }) out, err := ctr.WithExec([]string{"stat", "-c", "%a:%U:%G", "/data"}).Stdout(ctx) require.NoError(t, err) require.Equal(t, "745:auser:agroup\n", out) out, err = ctr.WithExec([]string{"stat", "-c", "%a:%U:%G", "/data/foo"}).Stdout(ctx) require.NoError(t, err) require.Equal(t, "645:auser:agroup\n", out) }) } func TestContainerWithFileOwner(t *testing.T) {
closed
dagger/dagger
https://github.com/dagger/dagger
3,284
Use `withoutEntrypoint`, `withoutWorkdir`, `withoutUser` and `withoutDefaultArgs` to remove
Currently, passing nil or empty arguments to those function reinit the values. It's not that explicit and clear. It will make more API endpoints, but it's gonna be clearer.
https://github.com/dagger/dagger/issues/3284
https://github.com/dagger/dagger/pull/6278
568d802bb892f1e074cf74cfce2a551989418964
cd825bde699a0beb0adb5c2529da5469118a172b
2022-10-07T15:00:07Z
go
2023-12-19T13:11:01Z
core/integration/container_test.go
c, ctx := connect(t) t.Run("simple file", func(t *testing.T) { tmp := t.TempDir() err := os.WriteFile(filepath.Join(tmp, "message.txt"), []byte("hello world"), 0o600) require.NoError(t, err) file := c.Host().Directory(tmp).File("message.txt") testOwnership(ctx, t, c, func(ctr *dagger.Container, name string, owner string) *dagger.Container { return ctr.WithFile(name, file, dagger.ContainerWithFileOpts{ Owner: owner, }) }) }) t.Run("file from subdirectory", func(t *testing.T) { tmp := t.TempDir() err := os.Mkdir(filepath.Join(tmp, "subdir"), 0o755) require.NoError(t, err) err = os.WriteFile(filepath.Join(tmp, "subdir", "message.txt"), []byte("hello world"), 0o600) require.NoError(t, err) file := c.Host().Directory(tmp).Directory("subdir").File("message.txt") testOwnership(ctx, t, c, func(ctr *dagger.Container, name string, owner string) *dagger.Container { return ctr.WithFile(name, file, dagger.ContainerWithFileOpts{ Owner: owner, }) }) }) } func TestContainerWithDirectoryOwner(t *testing.T) {
closed
dagger/dagger
https://github.com/dagger/dagger
3,284
Use `withoutEntrypoint`, `withoutWorkdir`, `withoutUser` and `withoutDefaultArgs` to remove
Currently, passing nil or empty arguments to those function reinit the values. It's not that explicit and clear. It will make more API endpoints, but it's gonna be clearer.
https://github.com/dagger/dagger/issues/3284
https://github.com/dagger/dagger/pull/6278
568d802bb892f1e074cf74cfce2a551989418964
cd825bde699a0beb0adb5c2529da5469118a172b
2022-10-07T15:00:07Z
go
2023-12-19T13:11:01Z
core/integration/container_test.go
c, ctx := connect(t) t.Run("simple directory", func(t *testing.T) { tmp := t.TempDir() err := os.WriteFile(filepath.Join(tmp, "message.txt"), []byte("hello world"), 0o600) require.NoError(t, err) dir := c.Host().Directory(tmp) testOwnership(ctx, t, c, func(ctr *dagger.Container, name string, owner string) *dagger.Container { return ctr.WithDirectory(name, dir, dagger.ContainerWithDirectoryOpts{ Owner: owner, }) }) }) t.Run("subdirectory", func(t *testing.T) { tmp := t.TempDir() err := os.Mkdir(filepath.Join(tmp, "subdir"), 0o755) require.NoError(t, err) err = os.WriteFile(filepath.Join(tmp, "subdir", "message.txt"), []byte("hello world"), 0o600) require.NoError(t, err) dir := c.Host().Directory(tmp).Directory("subdir") testOwnership(ctx, t, c, func(ctr *dagger.Container, name string, owner string) *dagger.Container { return ctr.WithDirectory(name, dir, dagger.ContainerWithDirectoryOpts{ Owner: owner, }) }) }) } func TestContainerWithNewFileOwner(t *testing.T) {
closed
dagger/dagger
https://github.com/dagger/dagger
3,284
Use `withoutEntrypoint`, `withoutWorkdir`, `withoutUser` and `withoutDefaultArgs` to remove
Currently, passing nil or empty arguments to those function reinit the values. It's not that explicit and clear. It will make more API endpoints, but it's gonna be clearer.
https://github.com/dagger/dagger/issues/3284
https://github.com/dagger/dagger/pull/6278
568d802bb892f1e074cf74cfce2a551989418964
cd825bde699a0beb0adb5c2529da5469118a172b
2022-10-07T15:00:07Z
go
2023-12-19T13:11:01Z
core/integration/container_test.go
c, ctx := connect(t) testOwnership(ctx, t, c, func(ctr *dagger.Container, name string, owner string) *dagger.Container { return ctr.WithNewFile(name, dagger.ContainerWithNewFileOpts{ Owner: owner, }) }) } func TestContainerWithMountedCacheOwner(t *testing.T) {
closed
dagger/dagger
https://github.com/dagger/dagger
3,284
Use `withoutEntrypoint`, `withoutWorkdir`, `withoutUser` and `withoutDefaultArgs` to remove
Currently, passing nil or empty arguments to those function reinit the values. It's not that explicit and clear. It will make more API endpoints, but it's gonna be clearer.
https://github.com/dagger/dagger/issues/3284
https://github.com/dagger/dagger/pull/6278
568d802bb892f1e074cf74cfce2a551989418964
cd825bde699a0beb0adb5c2529da5469118a172b
2022-10-07T15:00:07Z
go
2023-12-19T13:11:01Z
core/integration/container_test.go
c, ctx := connect(t) cache := c.CacheVolume("test") testOwnership(ctx, t, c, func(ctr *dagger.Container, name string, owner string) *dagger.Container { return ctr.WithMountedCache(name, cache, dagger.ContainerWithMountedCacheOpts{ Owner: owner, }) }) t.Run("permissions (empty)", func(t *testing.T) { ctr := c.Container().From(alpineImage). WithExec([]string{"adduser", "-D", "inherituser"}). WithExec([]string{"adduser", "-u", "1234", "-D", "auser"}). WithExec([]string{"addgroup", "-g", "4321", "agroup"}). WithUser("inherituser"). WithMountedCache("/data", cache, dagger.ContainerWithMountedCacheOpts{ Owner: "auser:agroup", }) out, err := ctr.WithExec([]string{"stat", "-c", "%a:%U:%G", "/data"}).Stdout(ctx) require.NoError(t, err) require.Equal(t, "755:auser:agroup\n", out) }) t.Run("permissions (source)", func(t *testing.T) { dir := c.Directory(). WithNewDirectory("perms", dagger.DirectoryWithNewDirectoryOpts{ Permissions: 0o745, }). WithNewFile("perms/foo", "whee", dagger.DirectoryWithNewFileOpts{ Permissions: 0o645, }).
closed
dagger/dagger
https://github.com/dagger/dagger
3,284
Use `withoutEntrypoint`, `withoutWorkdir`, `withoutUser` and `withoutDefaultArgs` to remove
Currently, passing nil or empty arguments to those function reinit the values. It's not that explicit and clear. It will make more API endpoints, but it's gonna be clearer.
https://github.com/dagger/dagger/issues/3284
https://github.com/dagger/dagger/pull/6278
568d802bb892f1e074cf74cfce2a551989418964
cd825bde699a0beb0adb5c2529da5469118a172b
2022-10-07T15:00:07Z
go
2023-12-19T13:11:01Z
core/integration/container_test.go
Directory("perms") ctr := c.Container().From(alpineImage). WithExec([]string{"adduser", "-D", "inherituser"}). WithExec([]string{"adduser", "-u", "1234", "-D", "auser"}). WithExec([]string{"addgroup", "-g", "4321", "agroup"}). WithUser("inherituser"). WithMountedCache("/data", cache, dagger.ContainerWithMountedCacheOpts{ Source: dir, Owner: "auser:agroup", }) out, err := ctr.WithExec([]string{"stat", "-c", "%a:%U:%G", "/data"}).Stdout(ctx) require.NoError(t, err) require.Equal(t, "745:auser:agroup\n", out) out, err = ctr.WithExec([]string{"stat", "-c", "%a:%U:%G", "/data/foo"}).Stdout(ctx) require.NoError(t, err) require.Equal(t, "645:auser:agroup\n", out) }) } func TestContainerWithMountedSecretOwner(t *testing.T) { c, ctx := connect(t) secret := c.SetSecret("test", "hunter2") testOwnership(ctx, t, c, func(ctr *dagger.Container, name string, owner string) *dagger.Container { return ctr.WithMountedSecret(name, secret, dagger.ContainerWithMountedSecretOpts{ Owner: owner, }) }) } func TestContainerParallelMutation(t *testing.T) { t.Parallel() res := struct {
closed
dagger/dagger
https://github.com/dagger/dagger
3,284
Use `withoutEntrypoint`, `withoutWorkdir`, `withoutUser` and `withoutDefaultArgs` to remove
Currently, passing nil or empty arguments to those function reinit the values. It's not that explicit and clear. It will make more API endpoints, but it's gonna be clearer.
https://github.com/dagger/dagger/issues/3284
https://github.com/dagger/dagger/pull/6278
568d802bb892f1e074cf74cfce2a551989418964
cd825bde699a0beb0adb5c2529da5469118a172b
2022-10-07T15:00:07Z
go
2023-12-19T13:11:01Z
core/integration/container_test.go
Container struct { A struct { EnvVariable string } B string } }{} err := testutil.Query( `{ container { a: withEnvVariable(name: "FOO", value: "BAR") { envVariable(name: "FOO") } b: envVariable(name: "FOO") } }`, &res, nil) require.NoError(t, err) require.Equal(t, res.Container.A.EnvVariable, "BAR") require.Empty(t, res.Container.B, "BAR") } func TestContainerForceCompression(t *testing.T) { t.Parallel() for _, tc := range []struct {
closed
dagger/dagger
https://github.com/dagger/dagger
3,284
Use `withoutEntrypoint`, `withoutWorkdir`, `withoutUser` and `withoutDefaultArgs` to remove
Currently, passing nil or empty arguments to those function reinit the values. It's not that explicit and clear. It will make more API endpoints, but it's gonna be clearer.
https://github.com/dagger/dagger/issues/3284
https://github.com/dagger/dagger/pull/6278
568d802bb892f1e074cf74cfce2a551989418964
cd825bde699a0beb0adb5c2529da5469118a172b
2022-10-07T15:00:07Z
go
2023-12-19T13:11:01Z
core/integration/container_test.go
compression dagger.ImageLayerCompression expectedOCIMediaType string }{ { dagger.Gzip, "application/vnd.oci.image.layer.v1.tar+gzip", }, { dagger.Zstd, "application/vnd.oci.image.layer.v1.tar+zstd", }, { dagger.Uncompressed, "application/vnd.oci.image.layer.v1.tar", }, { dagger.Estargz, "application/vnd.oci.image.layer.v1.tar+gzip", }, } { tc := tc t.Run(string(tc.compression), func(t *testing.T) { t.Parallel() c, ctx := connect(t) ref := registryRef("testcontainerpublishforcecompression" + strings.ToLower(string(tc.compression))) _, err := c.Container(). From(alpineImage). Publish(ctx, ref, dagger.ContainerPublishOpts{ ForcedCompression: tc.compression, })
closed
dagger/dagger
https://github.com/dagger/dagger
3,284
Use `withoutEntrypoint`, `withoutWorkdir`, `withoutUser` and `withoutDefaultArgs` to remove
Currently, passing nil or empty arguments to those function reinit the values. It's not that explicit and clear. It will make more API endpoints, but it's gonna be clearer.
https://github.com/dagger/dagger/issues/3284
https://github.com/dagger/dagger/pull/6278
568d802bb892f1e074cf74cfce2a551989418964
cd825bde699a0beb0adb5c2529da5469118a172b
2022-10-07T15:00:07Z
go
2023-12-19T13:11:01Z
core/integration/container_test.go
require.NoError(t, err) parsedRef, err := name.ParseReference(ref, name.Insecure) require.NoError(t, err) imgDesc, err := remote.Get(parsedRef, remote.WithTransport(http.DefaultTransport)) require.NoError(t, err) img, err := imgDesc.Image() require.NoError(t, err) layers, err := img.Layers() require.NoError(t, err) for _, layer := range layers { mediaType, err := layer.MediaType() require.NoError(t, err) require.EqualValues(t, tc.expectedOCIMediaType, mediaType) } tarPath := filepath.Join(t.TempDir(), "export.tar") _, err = c.Container(). From(alpineImage). Export(ctx, tarPath, dagger.ContainerExportOpts{ ForcedCompression: tc.compression, }) require.NoError(t, err) dockerManifestBytes := readTarFile(t, tarPath, "manifest.json") require.NotNil(t, dockerManifestBytes) indexBytes := readTarFile(t, tarPath, "index.json") var index ocispecs.Index require.NoError(t, json.Unmarshal(indexBytes, &index)) manifestDigest := index.Manifests[0].Digest manifestBytes := readTarFile(t, tarPath, "blobs/sha256/"+manifestDigest.Encoded()) var manifest ocispecs.Manifest
closed
dagger/dagger
https://github.com/dagger/dagger
3,284
Use `withoutEntrypoint`, `withoutWorkdir`, `withoutUser` and `withoutDefaultArgs` to remove
Currently, passing nil or empty arguments to those function reinit the values. It's not that explicit and clear. It will make more API endpoints, but it's gonna be clearer.
https://github.com/dagger/dagger/issues/3284
https://github.com/dagger/dagger/pull/6278
568d802bb892f1e074cf74cfce2a551989418964
cd825bde699a0beb0adb5c2529da5469118a172b
2022-10-07T15:00:07Z
go
2023-12-19T13:11:01Z
core/integration/container_test.go
require.NoError(t, json.Unmarshal(manifestBytes, &manifest)) for _, layer := range manifest.Layers { require.EqualValues(t, tc.expectedOCIMediaType, layer.MediaType) } }) } } func TestContainerMediaTypes(t *testing.T) { t.Parallel() for _, tc := range []struct { mediaTypes dagger.ImageMediaTypes expectedOCIMediaType string }{ { "", "application/vnd.oci.image.layer.v1.tar+gzip", }, { dagger.Ocimediatypes, "application/vnd.oci.image.layer.v1.tar+gzip", }, { dagger.Dockermediatypes, "application/vnd.docker.image.rootfs.diff.tar.gzip", }, } { tc := tc t.Run(string(tc.mediaTypes), func(t *testing.T) { t.Parallel() c, ctx := connect(t)
closed
dagger/dagger
https://github.com/dagger/dagger
3,284
Use `withoutEntrypoint`, `withoutWorkdir`, `withoutUser` and `withoutDefaultArgs` to remove
Currently, passing nil or empty arguments to those function reinit the values. It's not that explicit and clear. It will make more API endpoints, but it's gonna be clearer.
https://github.com/dagger/dagger/issues/3284
https://github.com/dagger/dagger/pull/6278
568d802bb892f1e074cf74cfce2a551989418964
cd825bde699a0beb0adb5c2529da5469118a172b
2022-10-07T15:00:07Z
go
2023-12-19T13:11:01Z
core/integration/container_test.go
ref := registryRef("testcontainerpublishmediatypes" + strings.ToLower(string(tc.mediaTypes))) _, err := c.Container(). From(alpineImage). Publish(ctx, ref, dagger.ContainerPublishOpts{ MediaTypes: tc.mediaTypes, }) require.NoError(t, err) parsedRef, err := name.ParseReference(ref, name.Insecure) require.NoError(t, err) imgDesc, err := remote.Get(parsedRef, remote.WithTransport(http.DefaultTransport)) require.NoError(t, err) img, err := imgDesc.Image() require.NoError(t, err) layers, err := img.Layers() require.NoError(t, err) for _, layer := range layers { mediaType, err := layer.MediaType() require.NoError(t, err) require.EqualValues(t, tc.expectedOCIMediaType, mediaType) } for _, useAsTarball := range []bool{true, false} { useAsTarball := useAsTarball t.Run(fmt.Sprintf("useAsTarball=%t", useAsTarball), func(t *testing.T) { t.Parallel() tarPath := filepath.Join(t.TempDir(), "export.tar") if useAsTarball { _, err = c.Container(). From(alpineImage). AsTarball(dagger.ContainerAsTarballOpts{ MediaTypes: tc.mediaTypes,
closed
dagger/dagger
https://github.com/dagger/dagger
3,284
Use `withoutEntrypoint`, `withoutWorkdir`, `withoutUser` and `withoutDefaultArgs` to remove
Currently, passing nil or empty arguments to those function reinit the values. It's not that explicit and clear. It will make more API endpoints, but it's gonna be clearer.
https://github.com/dagger/dagger/issues/3284
https://github.com/dagger/dagger/pull/6278
568d802bb892f1e074cf74cfce2a551989418964
cd825bde699a0beb0adb5c2529da5469118a172b
2022-10-07T15:00:07Z
go
2023-12-19T13:11:01Z
core/integration/container_test.go
}). Export(ctx, tarPath) require.NoError(t, err) } else { _, err = c.Container(). From(alpineImage). Export(ctx, tarPath, dagger.ContainerExportOpts{ MediaTypes: tc.mediaTypes, }) require.NoError(t, err) } dockerManifestBytes := readTarFile(t, tarPath, "manifest.json") require.NotNil(t, dockerManifestBytes) indexBytes := readTarFile(t, tarPath, "index.json") var index ocispecs.Index require.NoError(t, json.Unmarshal(indexBytes, &index)) manifestDigest := index.Manifests[0].Digest manifestBytes := readTarFile(t, tarPath, "blobs/sha256/"+manifestDigest.Encoded()) var manifest ocispecs.Manifest require.NoError(t, json.Unmarshal(manifestBytes, &manifest)) for _, layer := range manifest.Layers { require.EqualValues(t, tc.expectedOCIMediaType, layer.MediaType) } }) } }) } } func TestContainerBuildMergesWithParent(t *testing.T) {
closed
dagger/dagger
https://github.com/dagger/dagger
3,284
Use `withoutEntrypoint`, `withoutWorkdir`, `withoutUser` and `withoutDefaultArgs` to remove
Currently, passing nil or empty arguments to those function reinit the values. It's not that explicit and clear. It will make more API endpoints, but it's gonna be clearer.
https://github.com/dagger/dagger/issues/3284
https://github.com/dagger/dagger/pull/6278
568d802bb892f1e074cf74cfce2a551989418964
cd825bde699a0beb0adb5c2529da5469118a172b
2022-10-07T15:00:07Z
go
2023-12-19T13:11:01Z
core/integration/container_test.go
t.Parallel() c, ctx := connect(t) builderCtr := c.Directory().WithNewFile("Dockerfile", `FROM `+alpineImage+` ENV FOO=BAR LABEL "com.example.test-should-replace"="foo" EXPOSE 8080 `, ) testCtr := c.Container(). WithEnvVariable("BOOL", "DOG"). WithEnvVariable("FOO", "BAZ"). WithLabel("com.example.test-should-exist", "test").
closed
dagger/dagger
https://github.com/dagger/dagger
3,284
Use `withoutEntrypoint`, `withoutWorkdir`, `withoutUser` and `withoutDefaultArgs` to remove
Currently, passing nil or empty arguments to those function reinit the values. It's not that explicit and clear. It will make more API endpoints, but it's gonna be clearer.
https://github.com/dagger/dagger/issues/3284
https://github.com/dagger/dagger/pull/6278
568d802bb892f1e074cf74cfce2a551989418964
cd825bde699a0beb0adb5c2529da5469118a172b
2022-10-07T15:00:07Z
go
2023-12-19T13:11:01Z
core/integration/container_test.go
WithLabel("com.example.test-should-replace", "bar"). WithExposedPort(5000, dagger.ContainerWithExposedPortOpts{ Description: "five thousand", }). Build(builderCtr) envShouldExist, err := testCtr.EnvVariable(ctx, "BOOL") require.NoError(t, err) require.Equal(t, "DOG", envShouldExist) envShouldBeReplaced, err := testCtr.EnvVariable(ctx, "FOO") require.NoError(t, err) require.Equal(t, "BAR", envShouldBeReplaced) labelShouldExist, err := testCtr.Label(ctx, "com.example.test-should-exist") require.NoError(t, err) require.Equal(t, "test", labelShouldExist) labelShouldBeReplaced, err := testCtr.Label(ctx, "com.example.test-should-replace") require.NoError(t, err) require.Equal(t, "foo", labelShouldBeReplaced) cid, err := testCtr.ID(ctx) require.NoError(t, err) res := struct { Container struct { ExposedPorts []core.Port } }{} err = testutil.Query(` query Test($id: ContainerID!) { container(id: $id) { exposedPorts {
closed
dagger/dagger
https://github.com/dagger/dagger
3,284
Use `withoutEntrypoint`, `withoutWorkdir`, `withoutUser` and `withoutDefaultArgs` to remove
Currently, passing nil or empty arguments to those function reinit the values. It's not that explicit and clear. It will make more API endpoints, but it's gonna be clearer.
https://github.com/dagger/dagger/issues/3284
https://github.com/dagger/dagger/pull/6278
568d802bb892f1e074cf74cfce2a551989418964
cd825bde699a0beb0adb5c2529da5469118a172b
2022-10-07T15:00:07Z
go
2023-12-19T13:11:01Z
core/integration/container_test.go
port protocol description } } }`, &res, &testutil.QueryOptions{ Variables: map[string]interface{}{ "id": cid, }, }, ) require.NoError(t, err) require.Len(t, res.Container.ExposedPorts, 2) for _, p := range res.Container.ExposedPorts { require.Equal(t, core.NetworkProtocolTCP, p.Protocol) switch p.Port { case 8080: require.Nil(t, p.Description) case 5000: require.NotNil(t, p.Description) require.Equal(t, "five thousand", *p.Description) default: t.Fatalf("unexpected port %d", p.Port) } } } func TestContainerFromMergesWithParent(t *testing.T) {
closed
dagger/dagger
https://github.com/dagger/dagger
3,284
Use `withoutEntrypoint`, `withoutWorkdir`, `withoutUser` and `withoutDefaultArgs` to remove
Currently, passing nil or empty arguments to those function reinit the values. It's not that explicit and clear. It will make more API endpoints, but it's gonna be clearer.
https://github.com/dagger/dagger/issues/3284
https://github.com/dagger/dagger/pull/6278
568d802bb892f1e074cf74cfce2a551989418964
cd825bde699a0beb0adb5c2529da5469118a172b
2022-10-07T15:00:07Z
go
2023-12-19T13:11:01Z
core/integration/container_test.go
t.Parallel() c, ctx := connect(t) testCtr := c.Container(). WithEnvVariable("FOO", "BAR"). WithEnvVariable("PATH", "/replace/me"). WithLabel("moby.buildkit.frontend.caps", "replace-me"). WithLabel("com.example.test-should-exist", "exist"). WithExposedPort(5000). From("docker/dockerfile:1.5") envShouldExist, err := testCtr.EnvVariable(ctx, "FOO") require.NoError(t, err) require.Equal(t, "BAR", envShouldExist) envShouldBeReplaced, err := testCtr.EnvVariable(ctx, "PATH") require.NoError(t, err) require.Equal(t, "/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin", envShouldBeReplaced) labelShouldExist, err := testCtr.Label(ctx, "com.example.test-should-exist") require.NoError(t, err) require.Equal(t, "exist", labelShouldExist) existingLabelFromImageShouldExist, err := testCtr.Label(ctx, "moby.buildkit.frontend.network.none") require.NoError(t, err) require.Equal(t, "true", existingLabelFromImageShouldExist) labelShouldBeReplaced, err := testCtr.Label(ctx, "moby.buildkit.frontend.caps") require.NoError(t, err)
closed
dagger/dagger
https://github.com/dagger/dagger
3,284
Use `withoutEntrypoint`, `withoutWorkdir`, `withoutUser` and `withoutDefaultArgs` to remove
Currently, passing nil or empty arguments to those function reinit the values. It's not that explicit and clear. It will make more API endpoints, but it's gonna be clearer.
https://github.com/dagger/dagger/issues/3284
https://github.com/dagger/dagger/pull/6278
568d802bb892f1e074cf74cfce2a551989418964
cd825bde699a0beb0adb5c2529da5469118a172b
2022-10-07T15:00:07Z
go
2023-12-19T13:11:01Z
core/integration/container_test.go
require.Equal(t, "moby.buildkit.frontend.inputs,moby.buildkit.frontend.subrequests,moby.buildkit.frontend.contexts", labelShouldBeReplaced) ports, err := testCtr.ExposedPorts(ctx) require.NoError(t, err) port, err := ports[0].Port(ctx) require.NoError(t, err) require.Equal(t, 5000, port) } func TestContainerImageLoadCompatibility(t *testing.T) { t.Parallel() c, ctx := connect(t) for i, dockerVersion := range []string{"20.10", "23.0", "24.0"} { dockerVersion := dockerVersion port := 2375 + i dockerd := c.Container().From(fmt.Sprintf("docker:%s-dind", dockerVersion)). WithMountedCache("/var/lib/docker", c.CacheVolume(t.Name()+"-"+dockerVersion+"-docker-lib"), dagger.ContainerWithMountedCacheOpts{ Sharing: dagger.Private, }). WithExposedPort(port). WithExec([]string{ "dockerd", "--host=tcp://0.0.0.0:" + strconv.Itoa(port), "--tls=false", }, dagger.ContainerWithExecOpts{ InsecureRootCapabilities: true, }). AsService() dockerHost, err := dockerd.Endpoint(ctx, dagger.ServiceEndpointOpts{ Scheme: "tcp", }) require.NoError(t, err)
closed
dagger/dagger
https://github.com/dagger/dagger
3,284
Use `withoutEntrypoint`, `withoutWorkdir`, `withoutUser` and `withoutDefaultArgs` to remove
Currently, passing nil or empty arguments to those function reinit the values. It's not that explicit and clear. It will make more API endpoints, but it's gonna be clearer.
https://github.com/dagger/dagger/issues/3284
https://github.com/dagger/dagger/pull/6278
568d802bb892f1e074cf74cfce2a551989418964
cd825bde699a0beb0adb5c2529da5469118a172b
2022-10-07T15:00:07Z
go
2023-12-19T13:11:01Z
core/integration/container_test.go
for _, mediaType := range []dagger.ImageMediaTypes{dagger.Ocimediatypes, dagger.Dockermediatypes} { mediaType := mediaType for _, compression := range []dagger.ImageLayerCompression{dagger.Gzip, dagger.Zstd, dagger.Uncompressed} { compression := compression t.Run(fmt.Sprintf("%s-%s-%s-%s", t.Name(), dockerVersion, mediaType, compression), func(t *testing.T) { t.Parallel() tmpdir := t.TempDir() tmpfile := filepath.Join(tmpdir, fmt.Sprintf("test-%s-%s-%s.tar", dockerVersion, mediaType, compression)) _, err := c.Container().From(alpineImage). WithExec([]string{"sh", "-c", "echo '" + string(compression) + string(mediaType) + "' > /foo"}). Export(ctx, tmpfile, dagger.ContainerExportOpts{ MediaTypes: mediaType, ForcedCompression: compression, }) require.NoError(t, err) randID := identity.NewID() ctr := c.Container().From(fmt.Sprintf("docker:%s-cli", dockerVersion)). WithEnvVariable("CACHEBUST", randID). WithServiceBinding("docker", dockerd). WithEnvVariable("DOCKER_HOST", dockerHost). WithMountedFile(path.Join("/", path.Base(tmpfile)), c.Host().File(tmpfile)). WithExec([]string{"docker", "load", "-i", "/" + path.Base(tmpfile)}) output, err := ctr.Stdout(ctx) if dockerVersion == "20.10" && compression == dagger.Zstd { require.Error(t, err) } else { require.NoError(t, err) _, imageID, ok := strings.Cut(output, "sha256:")
closed
dagger/dagger
https://github.com/dagger/dagger
3,284
Use `withoutEntrypoint`, `withoutWorkdir`, `withoutUser` and `withoutDefaultArgs` to remove
Currently, passing nil or empty arguments to those function reinit the values. It's not that explicit and clear. It will make more API endpoints, but it's gonna be clearer.
https://github.com/dagger/dagger/issues/3284
https://github.com/dagger/dagger/pull/6278
568d802bb892f1e074cf74cfce2a551989418964
cd825bde699a0beb0adb5c2529da5469118a172b
2022-10-07T15:00:07Z
go
2023-12-19T13:11:01Z
core/integration/container_test.go
require.True(t, ok) imageID = strings.TrimSpace(imageID) _, err = ctr.WithExec([]string{"docker", "run", "--rm", imageID, "echo", "hello"}).Sync(ctx) require.NoError(t, err) } _, err = c.Container(). Import(c.Host().File(tmpfile)). WithExec([]string{"echo", "hello"}). Sync(ctx) require.NoError(t, err) }) } } } } func TestContainerWithMountedSecretMode(t *testing.T) { t.Parallel() c, ctx := connect(t) t.Cleanup(func() { c.Close() }) secret := c.SetSecret("test", "secret") ctr := c.Container().From(alpineImage).WithMountedSecret("/secret", secret, dagger.ContainerWithMountedSecretOpts{ Mode: 0o666, Owner: "root:root", }) perms, err := ctr.WithExec([]string{"sh", "-c", "stat /secret "}).Stdout(ctx) require.Contains(t, perms, "0666/-rw-rw-rw-") require.NoError(t, err) }
closed
dagger/dagger
https://github.com/dagger/dagger
3,284
Use `withoutEntrypoint`, `withoutWorkdir`, `withoutUser` and `withoutDefaultArgs` to remove
Currently, passing nil or empty arguments to those function reinit the values. It's not that explicit and clear. It will make more API endpoints, but it's gonna be clearer.
https://github.com/dagger/dagger/issues/3284
https://github.com/dagger/dagger/pull/6278
568d802bb892f1e074cf74cfce2a551989418964
cd825bde699a0beb0adb5c2529da5469118a172b
2022-10-07T15:00:07Z
go
2023-12-19T13:11:01Z
core/schema/container.go
package schema import ( "context" "fmt" "os" "path" "strconv" "strings" "github.com/containerd/containerd/content" specs "github.com/opencontainers/image-spec/specs-go/v1" "github.com/dagger/dagger/core" "github.com/dagger/dagger/core/pipeline" "github.com/dagger/dagger/core/socket" "github.com/moby/buildkit/frontend/dockerfile/shell" "github.com/moby/buildkit/util/leaseutil" ) type containerSchema struct {
closed
dagger/dagger
https://github.com/dagger/dagger
3,284
Use `withoutEntrypoint`, `withoutWorkdir`, `withoutUser` and `withoutDefaultArgs` to remove
Currently, passing nil or empty arguments to those function reinit the values. It's not that explicit and clear. It will make more API endpoints, but it's gonna be clearer.
https://github.com/dagger/dagger/issues/3284
https://github.com/dagger/dagger/pull/6278
568d802bb892f1e074cf74cfce2a551989418964
cd825bde699a0beb0adb5c2529da5469118a172b
2022-10-07T15:00:07Z
go
2023-12-19T13:11:01Z
core/schema/container.go
*APIServer host *core.Host svcs *core.Services ociStore content.Store leaseManager *leaseutil.Manager buildCache *core.CacheMap[uint64, *core.Container] importCache *core.CacheMap[uint64, *specs.Descriptor] } var _ SchemaResolvers = &containerSchema{} func (s *containerSchema) Name() string { return "container" } func (s *containerSchema) Schema() string { return Container } func (s *containerSchema) Resolvers() Resolvers { rs := Resolvers{ "Query": ObjectResolver{ "container": ToResolver(s.container), }, } ResolveIDable[core.Container](rs, "Container", ObjectResolver{ "sync": ToResolver(s.sync),
closed
dagger/dagger
https://github.com/dagger/dagger
3,284
Use `withoutEntrypoint`, `withoutWorkdir`, `withoutUser` and `withoutDefaultArgs` to remove
Currently, passing nil or empty arguments to those function reinit the values. It's not that explicit and clear. It will make more API endpoints, but it's gonna be clearer.
https://github.com/dagger/dagger/issues/3284
https://github.com/dagger/dagger/pull/6278
568d802bb892f1e074cf74cfce2a551989418964
cd825bde699a0beb0adb5c2529da5469118a172b
2022-10-07T15:00:07Z
go
2023-12-19T13:11:01Z
core/schema/container.go
"from": ToResolver(s.from), "build": ToResolver(s.build), "rootfs": ToResolver(s.rootfs), "pipeline": ToResolver(s.pipeline), "withRootfs": ToResolver(s.withRootfs), "file": ToResolver(s.file), "directory": ToResolver(s.directory), "user": ToResolver(s.user), "withUser": ToResolver(s.withUser), "workdir": ToResolver(s.workdir), "withWorkdir": ToResolver(s.withWorkdir), "envVariables": ToResolver(s.envVariables), "envVariable": ToResolver(s.envVariable), "withEnvVariable": ToResolver(s.withEnvVariable), "withSecretVariable": ToResolver(s.withSecretVariable), "withoutEnvVariable": ToResolver(s.withoutEnvVariable), "withLabel": ToResolver(s.withLabel), "label": ToResolver(s.label), "labels": ToResolver(s.labels), "withoutLabel": ToResolver(s.withoutLabel), "entrypoint": ToResolver(s.entrypoint), "withEntrypoint": ToResolver(s.withEntrypoint), "defaultArgs": ToResolver(s.defaultArgs), "withDefaultArgs": ToResolver(s.withDefaultArgs), "mounts": ToResolver(s.mounts), "withMountedDirectory": ToResolver(s.withMountedDirectory), "withMountedFile": ToResolver(s.withMountedFile), "withMountedTemp": ToResolver(s.withMountedTemp), "withMountedCache": ToResolver(s.withMountedCache), "withMountedSecret": ToResolver(s.withMountedSecret),
closed
dagger/dagger
https://github.com/dagger/dagger
3,284
Use `withoutEntrypoint`, `withoutWorkdir`, `withoutUser` and `withoutDefaultArgs` to remove
Currently, passing nil or empty arguments to those function reinit the values. It's not that explicit and clear. It will make more API endpoints, but it's gonna be clearer.
https://github.com/dagger/dagger/issues/3284
https://github.com/dagger/dagger/pull/6278
568d802bb892f1e074cf74cfce2a551989418964
cd825bde699a0beb0adb5c2529da5469118a172b
2022-10-07T15:00:07Z
go
2023-12-19T13:11:01Z
core/schema/container.go
"withUnixSocket": ToResolver(s.withUnixSocket), "withoutUnixSocket": ToResolver(s.withoutUnixSocket), "withoutMount": ToResolver(s.withoutMount), "withFile": ToResolver(s.withFile), "withNewFile": ToResolver(s.withNewFile), "withDirectory": ToResolver(s.withDirectory), "withExec": ToResolver(s.withExec), "stdout": ToResolver(s.stdout), "stderr": ToResolver(s.stderr), "publish": ToResolver(s.publish), "platform": ToResolver(s.platform), "export": ToResolver(s.export), "asTarball": ToResolver(s.asTarball), "import": ToResolver(s.import_), "withRegistryAuth": ToResolver(s.withRegistryAuth), "withoutRegistryAuth": ToResolver(s.withoutRegistryAuth), "imageRef": ToResolver(s.imageRef), "withExposedPort": ToResolver(s.withExposedPort), "withoutExposedPort": ToResolver(s.withoutExposedPort), "exposedPorts": ToResolver(s.exposedPorts), "withServiceBinding": ToResolver(s.withServiceBinding), "withFocus": ToResolver(s.withFocus), "withoutFocus": ToResolver(s.withoutFocus), "shellEndpoint": ToResolver(s.shellEndpoint), "experimentalWithGPU": ToResolver(s.withGPU), "experimentalWithAllGPUs": ToResolver(s.withAllGPUs), }) return rs } type containerArgs struct {
closed
dagger/dagger
https://github.com/dagger/dagger
3,284
Use `withoutEntrypoint`, `withoutWorkdir`, `withoutUser` and `withoutDefaultArgs` to remove
Currently, passing nil or empty arguments to those function reinit the values. It's not that explicit and clear. It will make more API endpoints, but it's gonna be clearer.
https://github.com/dagger/dagger/issues/3284
https://github.com/dagger/dagger/pull/6278
568d802bb892f1e074cf74cfce2a551989418964
cd825bde699a0beb0adb5c2529da5469118a172b
2022-10-07T15:00:07Z
go
2023-12-19T13:11:01Z
core/schema/container.go
ID core.ContainerID Platform *specs.Platform } func (s *containerSchema) container(ctx context.Context, parent *core.Query, args containerArgs) (_ *core.Container, rerr error) { if args.ID != "" { return args.ID.Decode() } platform := s.APIServer.platform if args.Platform != nil { platform = *args.Platform } ctr, err := core.NewContainer(args.ID, parent.PipelinePath(), platform) if err != nil { return nil, err } return ctr, err } func (s *containerSchema) sync(ctx context.Context, parent *core.Container, _ any) (core.ContainerID, error) { _, err := parent.Evaluate(ctx, s.bk, s.svcs) if err != nil { return "", err } return parent.ID() } type containerFromArgs struct {
closed
dagger/dagger
https://github.com/dagger/dagger
3,284
Use `withoutEntrypoint`, `withoutWorkdir`, `withoutUser` and `withoutDefaultArgs` to remove
Currently, passing nil or empty arguments to those function reinit the values. It's not that explicit and clear. It will make more API endpoints, but it's gonna be clearer.
https://github.com/dagger/dagger/issues/3284
https://github.com/dagger/dagger/pull/6278
568d802bb892f1e074cf74cfce2a551989418964
cd825bde699a0beb0adb5c2529da5469118a172b
2022-10-07T15:00:07Z
go
2023-12-19T13:11:01Z
core/schema/container.go
Address string } func (s *containerSchema) from(ctx context.Context, parent *core.Container, args containerFromArgs) (*core.Container, error) { return parent.From(ctx, s.bk, args.Address) } type containerBuildArgs struct { Context core.DirectoryID Dockerfile string BuildArgs []core.BuildArg Target string Secrets []core.SecretID } func (s *containerSchema) build(ctx context.Context, parent *core.Container, args containerBuildArgs) (*core.Container, error) { dir, err := args.Context.Decode() if err != nil { return nil, err } return parent.Build( ctx, dir, args.Dockerfile, args.BuildArgs, args.Target, args.Secrets, s.bk, s.svcs, s.buildCache, ) } type containerWithRootFSArgs struct {
closed
dagger/dagger
https://github.com/dagger/dagger
3,284
Use `withoutEntrypoint`, `withoutWorkdir`, `withoutUser` and `withoutDefaultArgs` to remove
Currently, passing nil or empty arguments to those function reinit the values. It's not that explicit and clear. It will make more API endpoints, but it's gonna be clearer.
https://github.com/dagger/dagger/issues/3284
https://github.com/dagger/dagger/pull/6278
568d802bb892f1e074cf74cfce2a551989418964
cd825bde699a0beb0adb5c2529da5469118a172b
2022-10-07T15:00:07Z
go
2023-12-19T13:11:01Z
core/schema/container.go
Directory core.DirectoryID } func (s *containerSchema) withRootfs(ctx context.Context, parent *core.Container, args containerWithRootFSArgs) (*core.Container, error) { dir, err := args.Directory.Decode() if err != nil { return nil, err } return parent.WithRootFS(ctx, dir) } type containerPipelineArgs struct {
closed
dagger/dagger
https://github.com/dagger/dagger
3,284
Use `withoutEntrypoint`, `withoutWorkdir`, `withoutUser` and `withoutDefaultArgs` to remove
Currently, passing nil or empty arguments to those function reinit the values. It's not that explicit and clear. It will make more API endpoints, but it's gonna be clearer.
https://github.com/dagger/dagger/issues/3284
https://github.com/dagger/dagger/pull/6278
568d802bb892f1e074cf74cfce2a551989418964
cd825bde699a0beb0adb5c2529da5469118a172b
2022-10-07T15:00:07Z
go
2023-12-19T13:11:01Z
core/schema/container.go
Name string Description string Labels []pipeline.Label } func (s *containerSchema) pipeline(ctx context.Context, parent *core.Container, args containerPipelineArgs) (*core.Container, error) { return parent.WithPipeline(ctx, args.Name, args.Description, args.Labels) } func (s *containerSchema) rootfs(ctx context.Context, parent *core.Container, args any) (*core.Directory, error) { return parent.RootFS(ctx) } type containerExecArgs struct { core.ContainerExecOpts } func (s *containerSchema) withExec(ctx context.Context, parent *core.Container, args containerExecArgs) (*core.Container, error) { return parent.WithExec(ctx, s.bk, s.progSockPath, s.APIServer.platform, args.ContainerExecOpts) } func (s *containerSchema) stdout(ctx context.Context, parent *core.Container, _ any) (string, error) { return parent.MetaFileContents(ctx, s.bk, s.svcs, s.progSockPath, "stdout") } func (s *containerSchema) stderr(ctx context.Context, parent *core.Container, _ any) (string, error) { return parent.MetaFileContents(ctx, s.bk, s.svcs, s.progSockPath, "stderr") } type containerGpuArgs struct {
closed
dagger/dagger
https://github.com/dagger/dagger
3,284
Use `withoutEntrypoint`, `withoutWorkdir`, `withoutUser` and `withoutDefaultArgs` to remove
Currently, passing nil or empty arguments to those function reinit the values. It's not that explicit and clear. It will make more API endpoints, but it's gonna be clearer.
https://github.com/dagger/dagger/issues/3284
https://github.com/dagger/dagger/pull/6278
568d802bb892f1e074cf74cfce2a551989418964
cd825bde699a0beb0adb5c2529da5469118a172b
2022-10-07T15:00:07Z
go
2023-12-19T13:11:01Z
core/schema/container.go
core.ContainerGPUOpts } func (s *containerSchema) withGPU(ctx context.Context, parent *core.Container, args containerGpuArgs) (*core.Container, error) { return parent.WithGPU(ctx, args.ContainerGPUOpts) } func (s *containerSchema) withAllGPUs(ctx context.Context, parent *core.Container, args containerGpuArgs) (*core.Container, error) { return parent.WithGPU(ctx, core.ContainerGPUOpts{Devices: []string{"all"}}) } type containerWithEntrypointArgs struct { Args []string } func (s *containerSchema) withEntrypoint(ctx context.Context, parent *core.Container, args containerWithEntrypointArgs) (*core.Container, error) { return parent.UpdateImageConfig(ctx, func(cfg specs.ImageConfig) specs.ImageConfig { cfg.Entrypoint = args.Args return cfg }) } func (s *containerSchema) entrypoint(ctx context.Context, parent *core.Container, args containerWithVariableArgs) ([]string, error) { cfg, err := parent.ImageConfig(ctx) if err != nil { return nil, err } return cfg.Entrypoint, nil } type containerWithDefaultArgs struct {
closed
dagger/dagger
https://github.com/dagger/dagger
3,284
Use `withoutEntrypoint`, `withoutWorkdir`, `withoutUser` and `withoutDefaultArgs` to remove
Currently, passing nil or empty arguments to those function reinit the values. It's not that explicit and clear. It will make more API endpoints, but it's gonna be clearer.
https://github.com/dagger/dagger/issues/3284
https://github.com/dagger/dagger/pull/6278
568d802bb892f1e074cf74cfce2a551989418964
cd825bde699a0beb0adb5c2529da5469118a172b
2022-10-07T15:00:07Z
go
2023-12-19T13:11:01Z
core/schema/container.go
Args *[]string } func (s *containerSchema) withDefaultArgs(ctx context.Context, parent *core.Container, args containerWithDefaultArgs) (*core.Container, error) { return parent.UpdateImageConfig(ctx, func(cfg specs.ImageConfig) specs.ImageConfig { if args.Args == nil { cfg.Cmd = []string{} return cfg } cfg.Cmd = *args.Args return cfg }) } func (s *containerSchema) defaultArgs(ctx context.Context, parent *core.Container, args any) ([]string, error) { cfg, err := parent.ImageConfig(ctx) if err != nil { return nil, err } return cfg.Cmd, nil } type containerWithUserArgs struct {
closed
dagger/dagger
https://github.com/dagger/dagger
3,284
Use `withoutEntrypoint`, `withoutWorkdir`, `withoutUser` and `withoutDefaultArgs` to remove
Currently, passing nil or empty arguments to those function reinit the values. It's not that explicit and clear. It will make more API endpoints, but it's gonna be clearer.
https://github.com/dagger/dagger/issues/3284
https://github.com/dagger/dagger/pull/6278
568d802bb892f1e074cf74cfce2a551989418964
cd825bde699a0beb0adb5c2529da5469118a172b
2022-10-07T15:00:07Z
go
2023-12-19T13:11:01Z
core/schema/container.go
Name string } func (s *containerSchema) withUser(ctx context.Context, parent *core.Container, args containerWithUserArgs) (*core.Container, error) { return parent.UpdateImageConfig(ctx, func(cfg specs.ImageConfig) specs.ImageConfig { cfg.User = args.Name return cfg }) } func (s *containerSchema) user(ctx context.Context, parent *core.Container, args containerWithVariableArgs) (string, error) { cfg, err := parent.ImageConfig(ctx) if err != nil { return "", err } return cfg.User, nil } type containerWithWorkdirArgs struct {
closed
dagger/dagger
https://github.com/dagger/dagger
3,284
Use `withoutEntrypoint`, `withoutWorkdir`, `withoutUser` and `withoutDefaultArgs` to remove
Currently, passing nil or empty arguments to those function reinit the values. It's not that explicit and clear. It will make more API endpoints, but it's gonna be clearer.
https://github.com/dagger/dagger/issues/3284
https://github.com/dagger/dagger/pull/6278
568d802bb892f1e074cf74cfce2a551989418964
cd825bde699a0beb0adb5c2529da5469118a172b
2022-10-07T15:00:07Z
go
2023-12-19T13:11:01Z
core/schema/container.go
Path string } func (s *containerSchema) withWorkdir(ctx context.Context, parent *core.Container, args containerWithWorkdirArgs) (*core.Container, error) { return parent.UpdateImageConfig(ctx, func(cfg specs.ImageConfig) specs.ImageConfig { cfg.WorkingDir = absPath(cfg.WorkingDir, args.Path) return cfg }) } func (s *containerSchema) workdir(ctx context.Context, parent *core.Container, args containerWithVariableArgs) (string, error) { cfg, err := parent.ImageConfig(ctx) if err != nil { return "", err } return cfg.WorkingDir, nil } type containerWithVariableArgs struct {
closed
dagger/dagger
https://github.com/dagger/dagger
3,284
Use `withoutEntrypoint`, `withoutWorkdir`, `withoutUser` and `withoutDefaultArgs` to remove
Currently, passing nil or empty arguments to those function reinit the values. It's not that explicit and clear. It will make more API endpoints, but it's gonna be clearer.
https://github.com/dagger/dagger/issues/3284
https://github.com/dagger/dagger/pull/6278
568d802bb892f1e074cf74cfce2a551989418964
cd825bde699a0beb0adb5c2529da5469118a172b
2022-10-07T15:00:07Z
go
2023-12-19T13:11:01Z
core/schema/container.go
Name string Value string Expand bool } func (s *containerSchema) withEnvVariable(ctx context.Context, parent *core.Container, args containerWithVariableArgs) (*core.Container, error) { return parent.UpdateImageConfig(ctx, func(cfg specs.ImageConfig) specs.ImageConfig { value := args.Value if args.Expand { value = os.Expand(value, func(k string) string { v, _ := core.LookupEnv(cfg.Env, k) return v }) } cfg.Env = core.AddEnv(cfg.Env, args.Name, value) return cfg }) } type containerWithoutVariableArgs struct {
closed
dagger/dagger
https://github.com/dagger/dagger
3,284
Use `withoutEntrypoint`, `withoutWorkdir`, `withoutUser` and `withoutDefaultArgs` to remove
Currently, passing nil or empty arguments to those function reinit the values. It's not that explicit and clear. It will make more API endpoints, but it's gonna be clearer.
https://github.com/dagger/dagger/issues/3284
https://github.com/dagger/dagger/pull/6278
568d802bb892f1e074cf74cfce2a551989418964
cd825bde699a0beb0adb5c2529da5469118a172b
2022-10-07T15:00:07Z
go
2023-12-19T13:11:01Z
core/schema/container.go
Name string } func (s *containerSchema) withoutEnvVariable(ctx context.Context, parent *core.Container, args containerWithoutVariableArgs) (*core.Container, error) { return parent.UpdateImageConfig(ctx, func(cfg specs.ImageConfig) specs.ImageConfig { newEnv := []string{} core.WalkEnv(cfg.Env, func(k, _, env string) { if !shell.EqualEnvKeys(k, args.Name) { newEnv = append(newEnv, env) } }) cfg.Env = newEnv return cfg }) } type EnvVariable struct {
closed
dagger/dagger
https://github.com/dagger/dagger
3,284
Use `withoutEntrypoint`, `withoutWorkdir`, `withoutUser` and `withoutDefaultArgs` to remove
Currently, passing nil or empty arguments to those function reinit the values. It's not that explicit and clear. It will make more API endpoints, but it's gonna be clearer.
https://github.com/dagger/dagger/issues/3284
https://github.com/dagger/dagger/pull/6278
568d802bb892f1e074cf74cfce2a551989418964
cd825bde699a0beb0adb5c2529da5469118a172b
2022-10-07T15:00:07Z
go
2023-12-19T13:11:01Z
core/schema/container.go
Name string `json:"name"` Value string `json:"value"` } func (s *containerSchema) envVariables(ctx context.Context, parent *core.Container, args any) ([]EnvVariable, error) { cfg, err := parent.ImageConfig(ctx) if err != nil { return nil, err } vars := make([]EnvVariable, 0, len(cfg.Env)) core.WalkEnv(cfg.Env, func(k, v, _ string) { vars = append(vars, EnvVariable{Name: k, Value: v}) }) return vars, nil } type containerVariableArgs struct { Name string } func (s *containerSchema) envVariable(ctx context.Context, parent *core.Container, args containerVariableArgs) (*string, error) { cfg, err := parent.ImageConfig(ctx) if err != nil { return nil, err } if val, ok := core.LookupEnv(cfg.Env, args.Name); ok { return &val, nil } return nil, nil } type Label struct {
closed
dagger/dagger
https://github.com/dagger/dagger
3,284
Use `withoutEntrypoint`, `withoutWorkdir`, `withoutUser` and `withoutDefaultArgs` to remove
Currently, passing nil or empty arguments to those function reinit the values. It's not that explicit and clear. It will make more API endpoints, but it's gonna be clearer.
https://github.com/dagger/dagger/issues/3284
https://github.com/dagger/dagger/pull/6278
568d802bb892f1e074cf74cfce2a551989418964
cd825bde699a0beb0adb5c2529da5469118a172b
2022-10-07T15:00:07Z
go
2023-12-19T13:11:01Z
core/schema/container.go
Name string `json:"name"` Value string `json:"value"` } func (s *containerSchema) labels(ctx context.Context, parent *core.Container, args any) ([]Label, error) { cfg, err := parent.ImageConfig(ctx) if err != nil { return nil, err } labels := make([]Label, 0, len(cfg.Labels)) for name, value := range cfg.Labels { label := Label{ Name: name, Value: value, } labels = append(labels, label) } return labels, nil } type containerLabelArgs struct {
closed
dagger/dagger
https://github.com/dagger/dagger
3,284
Use `withoutEntrypoint`, `withoutWorkdir`, `withoutUser` and `withoutDefaultArgs` to remove
Currently, passing nil or empty arguments to those function reinit the values. It's not that explicit and clear. It will make more API endpoints, but it's gonna be clearer.
https://github.com/dagger/dagger/issues/3284
https://github.com/dagger/dagger/pull/6278
568d802bb892f1e074cf74cfce2a551989418964
cd825bde699a0beb0adb5c2529da5469118a172b
2022-10-07T15:00:07Z
go
2023-12-19T13:11:01Z
core/schema/container.go
Name string } func (s *containerSchema) label(ctx context.Context, parent *core.Container, args containerLabelArgs) (*string, error) { cfg, err := parent.ImageConfig(ctx) if err != nil { return nil, err } if val, ok := cfg.Labels[args.Name]; ok { return &val, nil } return nil, nil } type containerWithMountedDirectoryArgs struct { Path string Source core.DirectoryID Owner string } func (s *containerSchema) withMountedDirectory(ctx context.Context, parent *core.Container, args containerWithMountedDirectoryArgs) (*core.Container, error) { dir, err := args.Source.Decode() if err != nil { return nil, err } return parent.WithMountedDirectory(ctx, s.bk, args.Path, dir, args.Owner, false) } type containerPublishArgs struct {
closed
dagger/dagger
https://github.com/dagger/dagger
3,284
Use `withoutEntrypoint`, `withoutWorkdir`, `withoutUser` and `withoutDefaultArgs` to remove
Currently, passing nil or empty arguments to those function reinit the values. It's not that explicit and clear. It will make more API endpoints, but it's gonna be clearer.
https://github.com/dagger/dagger/issues/3284
https://github.com/dagger/dagger/pull/6278
568d802bb892f1e074cf74cfce2a551989418964
cd825bde699a0beb0adb5c2529da5469118a172b
2022-10-07T15:00:07Z
go
2023-12-19T13:11:01Z
core/schema/container.go
Address string PlatformVariants []core.ContainerID ForcedCompression core.ImageLayerCompression MediaTypes core.ImageMediaTypes } func (s *containerSchema) publish(ctx context.Context, parent *core.Container, args containerPublishArgs) (string, error) { return parent.Publish(ctx, s.bk, s.svcs, args.Address, args.PlatformVariants, args.ForcedCompression, args.MediaTypes) } type containerWithMountedFileArgs struct { Path string Source core.FileID Owner string } func (s *containerSchema) withMountedFile(ctx context.Context, parent *core.Container, args containerWithMountedFileArgs) (*core.Container, error) { file, err := args.Source.Decode() if err != nil { return nil, err } return parent.WithMountedFile(ctx, s.bk, args.Path, file, args.Owner, false) } type containerWithMountedCacheArgs struct {
closed
dagger/dagger
https://github.com/dagger/dagger
3,284
Use `withoutEntrypoint`, `withoutWorkdir`, `withoutUser` and `withoutDefaultArgs` to remove
Currently, passing nil or empty arguments to those function reinit the values. It's not that explicit and clear. It will make more API endpoints, but it's gonna be clearer.
https://github.com/dagger/dagger/issues/3284
https://github.com/dagger/dagger/pull/6278
568d802bb892f1e074cf74cfce2a551989418964
cd825bde699a0beb0adb5c2529da5469118a172b
2022-10-07T15:00:07Z
go
2023-12-19T13:11:01Z
core/schema/container.go
Path string Cache core.CacheVolumeID Source core.DirectoryID Concurrency core.CacheSharingMode Owner string } func (s *containerSchema) withMountedCache(ctx context.Context, parent *core.Container, args containerWithMountedCacheArgs) (*core.Container, error) { var dir *core.Directory if args.Source != "" { var err error dir, err = args.Source.Decode() if err != nil { return nil, err } } cache, err := args.Cache.Decode() if err != nil { return nil, err } return parent.WithMountedCache(ctx, s.bk, args.Path, cache, dir, args.Concurrency, args.Owner) } type containerWithMountedTempArgs struct {
closed
dagger/dagger
https://github.com/dagger/dagger
3,284
Use `withoutEntrypoint`, `withoutWorkdir`, `withoutUser` and `withoutDefaultArgs` to remove
Currently, passing nil or empty arguments to those function reinit the values. It's not that explicit and clear. It will make more API endpoints, but it's gonna be clearer.
https://github.com/dagger/dagger/issues/3284
https://github.com/dagger/dagger/pull/6278
568d802bb892f1e074cf74cfce2a551989418964
cd825bde699a0beb0adb5c2529da5469118a172b
2022-10-07T15:00:07Z
go
2023-12-19T13:11:01Z
core/schema/container.go
Path string } func (s *containerSchema) withMountedTemp(ctx context.Context, parent *core.Container, args containerWithMountedTempArgs) (*core.Container, error) { return parent.WithMountedTemp(ctx, args.Path) } type containerWithoutMountArgs struct { Path string } func (s *containerSchema) withoutMount(ctx context.Context, parent *core.Container, args containerWithoutMountArgs) (*core.Container, error) { return parent.WithoutMount(ctx, args.Path) } func (s *containerSchema) mounts(ctx context.Context, parent *core.Container, _ any) ([]string, error) { return parent.MountTargets(ctx) } type containerWithLabelArgs struct {
closed
dagger/dagger
https://github.com/dagger/dagger
3,284
Use `withoutEntrypoint`, `withoutWorkdir`, `withoutUser` and `withoutDefaultArgs` to remove
Currently, passing nil or empty arguments to those function reinit the values. It's not that explicit and clear. It will make more API endpoints, but it's gonna be clearer.
https://github.com/dagger/dagger/issues/3284
https://github.com/dagger/dagger/pull/6278
568d802bb892f1e074cf74cfce2a551989418964
cd825bde699a0beb0adb5c2529da5469118a172b
2022-10-07T15:00:07Z
go
2023-12-19T13:11:01Z
core/schema/container.go
Name string Value string } func (s *containerSchema) withLabel(ctx context.Context, parent *core.Container, args containerWithLabelArgs) (*core.Container, error) { return parent.UpdateImageConfig(ctx, func(cfg specs.ImageConfig) specs.ImageConfig { if cfg.Labels == nil { cfg.Labels = make(map[string]string) } cfg.Labels[args.Name] = args.Value return cfg }) } type containerWithoutLabelArgs struct { Name string } func (s *containerSchema) withoutLabel(ctx context.Context, parent *core.Container, args containerWithoutLabelArgs) (*core.Container, error) { return parent.UpdateImageConfig(ctx, func(cfg specs.ImageConfig) specs.ImageConfig { delete(cfg.Labels, args.Name) return cfg }) } type containerDirectoryArgs struct { Path string } func (s *containerSchema) directory(ctx context.Context, parent *core.Container, args containerDirectoryArgs) (*core.Directory, error) { return parent.Directory(ctx, s.bk, s.svcs, args.Path) } type containerFileArgs struct {
closed
dagger/dagger
https://github.com/dagger/dagger
3,284
Use `withoutEntrypoint`, `withoutWorkdir`, `withoutUser` and `withoutDefaultArgs` to remove
Currently, passing nil or empty arguments to those function reinit the values. It's not that explicit and clear. It will make more API endpoints, but it's gonna be clearer.
https://github.com/dagger/dagger/issues/3284
https://github.com/dagger/dagger/pull/6278
568d802bb892f1e074cf74cfce2a551989418964
cd825bde699a0beb0adb5c2529da5469118a172b
2022-10-07T15:00:07Z
go
2023-12-19T13:11:01Z
core/schema/container.go
Path string } func (s *containerSchema) file(ctx context.Context, parent *core.Container, args containerFileArgs) (*core.File, error) { return parent.File(ctx, s.bk, s.svcs, args.Path) } func absPath(workDir string, containerPath string) string { if path.IsAbs(containerPath) { return containerPath } if workDir == "" { workDir = "/" } return path.Join(workDir, containerPath) } type containerWithSecretVariableArgs struct { Name string Secret core.SecretID } func (s *containerSchema) withSecretVariable(ctx context.Context, parent *core.Container, args containerWithSecretVariableArgs) (*core.Container, error) { secret, err := args.Secret.Decode() if err != nil { return nil, err } return parent.WithSecretVariable(ctx, args.Name, secret) } type containerWithMountedSecretArgs struct {
closed
dagger/dagger
https://github.com/dagger/dagger
3,284
Use `withoutEntrypoint`, `withoutWorkdir`, `withoutUser` and `withoutDefaultArgs` to remove
Currently, passing nil or empty arguments to those function reinit the values. It's not that explicit and clear. It will make more API endpoints, but it's gonna be clearer.
https://github.com/dagger/dagger/issues/3284
https://github.com/dagger/dagger/pull/6278
568d802bb892f1e074cf74cfce2a551989418964
cd825bde699a0beb0adb5c2529da5469118a172b
2022-10-07T15:00:07Z
go
2023-12-19T13:11:01Z
core/schema/container.go
Path string Source core.SecretID Owner string Mode *int } func (s *containerSchema) withMountedSecret(ctx context.Context, parent *core.Container, args containerWithMountedSecretArgs) (*core.Container, error) { secret, err := args.Source.Decode() if err != nil { return nil, err } return parent.WithMountedSecret(ctx, s.bk, args.Path, secret, args.Owner, args.Mode) } type containerWithDirectoryArgs struct { withDirectoryArgs Owner string } func (s *containerSchema) withDirectory(ctx context.Context, parent *core.Container, args containerWithDirectoryArgs) (*core.Container, error) { dir, err := args.Directory.Decode() if err != nil { return nil, err } return parent.WithDirectory(ctx, s.bk, args.Path, dir, args.CopyFilter, args.Owner) } type containerWithFileArgs struct {
closed
dagger/dagger
https://github.com/dagger/dagger
3,284
Use `withoutEntrypoint`, `withoutWorkdir`, `withoutUser` and `withoutDefaultArgs` to remove
Currently, passing nil or empty arguments to those function reinit the values. It's not that explicit and clear. It will make more API endpoints, but it's gonna be clearer.
https://github.com/dagger/dagger/issues/3284
https://github.com/dagger/dagger/pull/6278
568d802bb892f1e074cf74cfce2a551989418964
cd825bde699a0beb0adb5c2529da5469118a172b
2022-10-07T15:00:07Z
go
2023-12-19T13:11:01Z
core/schema/container.go
withFileArgs Owner string } func (s *containerSchema) withFile(ctx context.Context, parent *core.Container, args containerWithFileArgs) (*core.Container, error) { file, err := args.Source.Decode() if err != nil { return nil, err } return parent.WithFile(ctx, s.bk, args.Path, file, args.Permissions, args.Owner) } type containerWithNewFileArgs struct { withNewFileArgs Owner string } func (s *containerSchema) withNewFile(ctx context.Context, parent *core.Container, args containerWithNewFileArgs) (*core.Container, error) { return parent.WithNewFile(ctx, s.bk, args.Path, []byte(args.Contents), args.Permissions, args.Owner) } type containerWithUnixSocketArgs struct { Path string Source socket.ID Owner string } func (s *containerSchema) withUnixSocket(ctx context.Context, parent *core.Container, args containerWithUnixSocketArgs) (*core.Container, error) { socket, err := args.Source.Decode() if err != nil { return nil, err } return parent.WithUnixSocket(ctx, s.bk, args.Path, socket, args.Owner) } type containerWithoutUnixSocketArgs struct {
closed
dagger/dagger
https://github.com/dagger/dagger
3,284
Use `withoutEntrypoint`, `withoutWorkdir`, `withoutUser` and `withoutDefaultArgs` to remove
Currently, passing nil or empty arguments to those function reinit the values. It's not that explicit and clear. It will make more API endpoints, but it's gonna be clearer.
https://github.com/dagger/dagger/issues/3284
https://github.com/dagger/dagger/pull/6278
568d802bb892f1e074cf74cfce2a551989418964
cd825bde699a0beb0adb5c2529da5469118a172b
2022-10-07T15:00:07Z
go
2023-12-19T13:11:01Z
core/schema/container.go
Path string } func (s *containerSchema) withoutUnixSocket(ctx context.Context, parent *core.Container, args containerWithoutUnixSocketArgs) (*core.Container, error) { return parent.WithoutUnixSocket(ctx, args.Path) } func (s *containerSchema) platform(ctx context.Context, parent *core.Container, args any) (specs.Platform, error) { return parent.Platform, nil } type containerExportArgs struct { Path string PlatformVariants []core.ContainerID ForcedCompression core.ImageLayerCompression MediaTypes core.ImageMediaTypes } func (s *containerSchema) export(ctx context.Context, parent *core.Container, args containerExportArgs) (bool, error) { if err := parent.Export(ctx, s.bk, s.svcs, args.Path, args.PlatformVariants, args.ForcedCompression, args.MediaTypes); err != nil { return false, err } return true, nil } type containerAsTarballArgs struct {
closed
dagger/dagger
https://github.com/dagger/dagger
3,284
Use `withoutEntrypoint`, `withoutWorkdir`, `withoutUser` and `withoutDefaultArgs` to remove
Currently, passing nil or empty arguments to those function reinit the values. It's not that explicit and clear. It will make more API endpoints, but it's gonna be clearer.
https://github.com/dagger/dagger/issues/3284
https://github.com/dagger/dagger/pull/6278
568d802bb892f1e074cf74cfce2a551989418964
cd825bde699a0beb0adb5c2529da5469118a172b
2022-10-07T15:00:07Z
go
2023-12-19T13:11:01Z
core/schema/container.go
PlatformVariants []core.ContainerID ForcedCompression core.ImageLayerCompression MediaTypes core.ImageMediaTypes } func (s *containerSchema) asTarball(ctx context.Context, parent *core.Container, args containerAsTarballArgs) (*core.File, error) { return parent.AsTarball(ctx, s.bk, s.APIServer.platform, s.svcs, args.PlatformVariants, args.ForcedCompression, args.MediaTypes) } type containerImportArgs struct { Source core.FileID Tag string } func (s *containerSchema) import_(ctx context.Context, parent *core.Container, args containerImportArgs) (*core.Container, error) { return parent.Import( ctx, args.Source, args.Tag, s.bk, s.host, s.svcs, s.importCache, s.ociStore, s.leaseManager, ) } type containerWithRegistryAuthArgs struct {
closed
dagger/dagger
https://github.com/dagger/dagger
3,284
Use `withoutEntrypoint`, `withoutWorkdir`, `withoutUser` and `withoutDefaultArgs` to remove
Currently, passing nil or empty arguments to those function reinit the values. It's not that explicit and clear. It will make more API endpoints, but it's gonna be clearer.
https://github.com/dagger/dagger/issues/3284
https://github.com/dagger/dagger/pull/6278
568d802bb892f1e074cf74cfce2a551989418964
cd825bde699a0beb0adb5c2529da5469118a172b
2022-10-07T15:00:07Z
go
2023-12-19T13:11:01Z
core/schema/container.go
Address string `json:"address"` Username string `json:"username"` Secret core.SecretID `json:"secret"` } func (s *containerSchema) withRegistryAuth(ctx context.Context, parents *core.Container, args containerWithRegistryAuthArgs) (*core.Container, error) { secretBytes, err := s.secrets.GetSecret(ctx, args.Secret.String()) if err != nil { return nil, err } if err := s.auth.AddCredential(args.Address, args.Username, string(secretBytes)); err != nil { return nil, err } return parents, nil } type containerWithoutRegistryAuthArgs struct { Address string } func (s *containerSchema) withoutRegistryAuth(_ context.Context, parents *core.Container, args containerWithoutRegistryAuthArgs) (*core.Container, error) { if err := s.auth.RemoveCredential(args.Address); err != nil { return nil, err } return parents, nil } func (s *containerSchema) imageRef(ctx context.Context, parent *core.Container, args containerWithVariableArgs) (string, error) { return parent.ImageRefOrErr(ctx, s.bk) } type containerWithServiceBindingArgs struct {
closed
dagger/dagger
https://github.com/dagger/dagger
3,284
Use `withoutEntrypoint`, `withoutWorkdir`, `withoutUser` and `withoutDefaultArgs` to remove
Currently, passing nil or empty arguments to those function reinit the values. It's not that explicit and clear. It will make more API endpoints, but it's gonna be clearer.
https://github.com/dagger/dagger/issues/3284
https://github.com/dagger/dagger/pull/6278
568d802bb892f1e074cf74cfce2a551989418964
cd825bde699a0beb0adb5c2529da5469118a172b
2022-10-07T15:00:07Z
go
2023-12-19T13:11:01Z
core/schema/container.go
Service core.ServiceID Alias string } func (s *containerSchema) withServiceBinding(ctx context.Context, parent *core.Container, args containerWithServiceBindingArgs) (*core.Container, error) { svc, err := args.Service.Decode() if err != nil { return nil, err } return parent.WithServiceBinding(ctx, s.svcs, svc, args.Alias) } type containerWithExposedPortArgs struct { Protocol core.NetworkProtocol Port int Description *string } func (s *containerSchema) withExposedPort(ctx context.Context, parent *core.Container, args containerWithExposedPortArgs) (*core.Container, error) { return parent.WithExposedPort(core.Port{ Protocol: args.Protocol, Port: args.Port, Description: args.Description, }) } type containerWithoutExposedPortArgs struct { Protocol core.NetworkProtocol Port int } func (s *containerSchema) withoutExposedPort(ctx context.Context, parent *core.Container, args containerWithoutExposedPortArgs) (*core.Container, error) { return parent.WithoutExposedPort(args.Port, args.Protocol) } type ExposedPort struct {
closed
dagger/dagger
https://github.com/dagger/dagger
3,284
Use `withoutEntrypoint`, `withoutWorkdir`, `withoutUser` and `withoutDefaultArgs` to remove
Currently, passing nil or empty arguments to those function reinit the values. It's not that explicit and clear. It will make more API endpoints, but it's gonna be clearer.
https://github.com/dagger/dagger/issues/3284
https://github.com/dagger/dagger/pull/6278
568d802bb892f1e074cf74cfce2a551989418964
cd825bde699a0beb0adb5c2529da5469118a172b
2022-10-07T15:00:07Z
go
2023-12-19T13:11:01Z
core/schema/container.go
Port int `json:"port"` Protocol string `json:"protocol"` Description *string `json:"description,omitempty"` } func (s *containerSchema) exposedPorts(ctx context.Context, parent *core.Container, args any) ([]ExposedPort, error) { ports := make(map[string]ExposedPort, len(parent.Ports)) for _, p := range parent.Ports { ociPort := fmt.Sprintf("%d/%s", p.Port, p.Protocol.Network()) ports[ociPort] = ExposedPort{ Port: p.Port, Protocol: string(p.Protocol), Description: p.Description, } } exposedPorts := []ExposedPort{} for ociPort := range parent.Config.ExposedPorts { p, exists := ports[ociPort] if !exists { port, proto, ok := strings.Cut(ociPort, "/") if !ok { continue } portNr, err := strconv.Atoi(port) if err != nil { continue }
closed
dagger/dagger
https://github.com/dagger/dagger
3,284
Use `withoutEntrypoint`, `withoutWorkdir`, `withoutUser` and `withoutDefaultArgs` to remove
Currently, passing nil or empty arguments to those function reinit the values. It's not that explicit and clear. It will make more API endpoints, but it's gonna be clearer.
https://github.com/dagger/dagger/issues/3284
https://github.com/dagger/dagger/pull/6278
568d802bb892f1e074cf74cfce2a551989418964
cd825bde699a0beb0adb5c2529da5469118a172b
2022-10-07T15:00:07Z
go
2023-12-19T13:11:01Z
core/schema/container.go
p = ExposedPort{ Port: portNr, Protocol: strings.ToUpper(proto), } } exposedPorts = append(exposedPorts, p) } return exposedPorts, nil } func (s *containerSchema) withFocus(ctx context.Context, parent *core.Container, args any) (*core.Container, error) { child := parent.Clone() child.Focused = true return child, nil } func (s *containerSchema) withoutFocus(ctx context.Context, parent *core.Container, args any) (*core.Container, error) { child := parent.Clone() child.Focused = false return child, nil } func (s *containerSchema) shellEndpoint(ctx context.Context, parent *core.Container, args any) (string, error) { endpoint, handler, err := parent.ShellEndpoint(s.bk, s.progSockPath, s.services) if err != nil { return "", err } if err := s.MuxEndpoint(ctx, path.Join("/", endpoint), handler); err != nil { return "", err } return "ws://dagger/" + endpoint, nil }
closed
dagger/dagger
https://github.com/dagger/dagger
3,284
Use `withoutEntrypoint`, `withoutWorkdir`, `withoutUser` and `withoutDefaultArgs` to remove
Currently, passing nil or empty arguments to those function reinit the values. It's not that explicit and clear. It will make more API endpoints, but it's gonna be clearer.
https://github.com/dagger/dagger/issues/3284
https://github.com/dagger/dagger/pull/6278
568d802bb892f1e074cf74cfce2a551989418964
cd825bde699a0beb0adb5c2529da5469118a172b
2022-10-07T15:00:07Z
go
2023-12-19T13:11:01Z
sdk/go/dagger.gen.go
package dagger import ( "context" "encoding/json" "fmt" "reflect" "github.com/Khan/genqlient/graphql" "dagger.io/dagger/querybuilder" ) func assertNotNil(argName string, value any) { if reflect.ValueOf(value).IsNil() { panic(fmt.Sprintf("unexpected nil pointer for argument %q", argName)) } } func ptr[T any](v T) *T { return &v } type Optional[T any] struct {