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
6,359
CLI: update handling of various core types
As described in [this comment](https://github.com/dagger/dagger/issues/6229#issuecomment-1863649336) (and that issue generally), we need to make some adjustments to the CLIs behavior when `dagger call` ends in various core types. There's a handful of related adjustments needed here. Creating as a checklist for now to save issue spam; can break down into more issues if useful though. I'm including my initial suggestions on how to handle these, but to be clear these are not finalized decisions and the final call can be made as part of implementing this - [ ] Handle arbitrary user objects - Print fields (as in `TypeDef` fields, so just trivially resolvable values) as a json object - [x] Handle container - call `sync` only, rely on progress output for anything else - [x] Handle directory - call `sync` only, rely on progress output for anything else - [x] Handle file - call `sync` only, rely on progress output for anything else - [ ] Handle IDs returned by `sync` (i.e. the case where the user explicitly chains `sync`) - just rely on progress output, don't show the id
https://github.com/dagger/dagger/issues/6359
https://github.com/dagger/dagger/pull/6482
2999573c5a34e85b8baac8c0150881d9c08a86b8
d91ac42c196873830c2e0876b251f3bf4d62ea49
2024-01-03T20:19:06Z
go
2024-01-26T18:48:04Z
core/integration/module_test.go
class Foo { @func myFunction(): X { return new X("foo", "now", "user", "admin"); } } `, }, } { tc := tc t.Run(tc.sdk, func(t *testing.T) { t.Parallel() modGen := c.Container().From(golangImage). WithMountedFile(testCLIBinPath, daggerCliFile(t, c)). WithWorkdir("/work"). With(daggerExec("mod", "init", "--name=foo", "--sdk="+tc.sdk)). With(sdkSource(tc.sdk, tc.source)) if tc.sdk == "go" { logGen(ctx, t, modGen.Directory(".")) } out, err := modGen.With(daggerQuery(`{foo{myFunction{message, recipient, from, timestamp}}}`)).Stdout(ctx) require.NoError(t, err) require.JSONEq(t, `{"foo":{"myFunction":{"message":"foo", "recipient":"user", "from":"admin", "timestamp":"now"}}}`, out) }) } } func TestModuleReturnNestedObject(t *testing.T) { t.Parallel() c, ctx := connect(t) type testCase struct {
closed
dagger/dagger
https://github.com/dagger/dagger
6,359
CLI: update handling of various core types
As described in [this comment](https://github.com/dagger/dagger/issues/6229#issuecomment-1863649336) (and that issue generally), we need to make some adjustments to the CLIs behavior when `dagger call` ends in various core types. There's a handful of related adjustments needed here. Creating as a checklist for now to save issue spam; can break down into more issues if useful though. I'm including my initial suggestions on how to handle these, but to be clear these are not finalized decisions and the final call can be made as part of implementing this - [ ] Handle arbitrary user objects - Print fields (as in `TypeDef` fields, so just trivially resolvable values) as a json object - [x] Handle container - call `sync` only, rely on progress output for anything else - [x] Handle directory - call `sync` only, rely on progress output for anything else - [x] Handle file - call `sync` only, rely on progress output for anything else - [ ] Handle IDs returned by `sync` (i.e. the case where the user explicitly chains `sync`) - just rely on progress output, don't show the id
https://github.com/dagger/dagger/issues/6359
https://github.com/dagger/dagger/pull/6482
2999573c5a34e85b8baac8c0150881d9c08a86b8
d91ac42c196873830c2e0876b251f3bf4d62ea49
2024-01-03T20:19:06Z
go
2024-01-26T18:48:04Z
core/integration/module_test.go
sdk string source string } for _, tc := range []testCase{ { sdk: "go", source: `package main type Playground struct{} type Foo struct { MsgContainer Bar } type Bar struct { Msg string } func (m *Playground) MyFunction() Foo { return Foo{MsgContainer: Bar{Msg: "hello world"}} } `, }, { sdk: "python", source: `from dagger import field, function, object_type @object_type class Bar: msg: str = field() @object_type class Foo: msg_container: Bar = field() @object_type
closed
dagger/dagger
https://github.com/dagger/dagger
6,359
CLI: update handling of various core types
As described in [this comment](https://github.com/dagger/dagger/issues/6229#issuecomment-1863649336) (and that issue generally), we need to make some adjustments to the CLIs behavior when `dagger call` ends in various core types. There's a handful of related adjustments needed here. Creating as a checklist for now to save issue spam; can break down into more issues if useful though. I'm including my initial suggestions on how to handle these, but to be clear these are not finalized decisions and the final call can be made as part of implementing this - [ ] Handle arbitrary user objects - Print fields (as in `TypeDef` fields, so just trivially resolvable values) as a json object - [x] Handle container - call `sync` only, rely on progress output for anything else - [x] Handle directory - call `sync` only, rely on progress output for anything else - [x] Handle file - call `sync` only, rely on progress output for anything else - [ ] Handle IDs returned by `sync` (i.e. the case where the user explicitly chains `sync`) - just rely on progress output, don't show the id
https://github.com/dagger/dagger/issues/6359
https://github.com/dagger/dagger/pull/6482
2999573c5a34e85b8baac8c0150881d9c08a86b8
d91ac42c196873830c2e0876b251f3bf4d62ea49
2024-01-03T20:19:06Z
go
2024-01-26T18:48:04Z
core/integration/module_test.go
class Playground: @function def my_function(self) -> Foo: return Foo(msg_container=Bar(msg="hello world")) `, }, { sdk: "typescript", source: ` import { object, func, field } from "@dagger.io/dagger" @object class Bar { @field msg: string; constructor(msg: string) { this.msg = msg; } } @object class Foo { @field msgContainer: Bar; constructor(msgContainer: Bar) { this.msgContainer = msgContainer; } } @object class Playground { @func myFunction(): Foo {
closed
dagger/dagger
https://github.com/dagger/dagger
6,359
CLI: update handling of various core types
As described in [this comment](https://github.com/dagger/dagger/issues/6229#issuecomment-1863649336) (and that issue generally), we need to make some adjustments to the CLIs behavior when `dagger call` ends in various core types. There's a handful of related adjustments needed here. Creating as a checklist for now to save issue spam; can break down into more issues if useful though. I'm including my initial suggestions on how to handle these, but to be clear these are not finalized decisions and the final call can be made as part of implementing this - [ ] Handle arbitrary user objects - Print fields (as in `TypeDef` fields, so just trivially resolvable values) as a json object - [x] Handle container - call `sync` only, rely on progress output for anything else - [x] Handle directory - call `sync` only, rely on progress output for anything else - [x] Handle file - call `sync` only, rely on progress output for anything else - [ ] Handle IDs returned by `sync` (i.e. the case where the user explicitly chains `sync`) - just rely on progress output, don't show the id
https://github.com/dagger/dagger/issues/6359
https://github.com/dagger/dagger/pull/6482
2999573c5a34e85b8baac8c0150881d9c08a86b8
d91ac42c196873830c2e0876b251f3bf4d62ea49
2024-01-03T20:19:06Z
go
2024-01-26T18:48:04Z
core/integration/module_test.go
return new Foo(new Bar("hello world")); } } `, }, } { tc := tc t.Run(tc.sdk, func(t *testing.T) { t.Parallel() modGen := c.Container().From(golangImage). WithMountedFile(testCLIBinPath, daggerCliFile(t, c)). WithWorkdir("/work"). With(daggerExec("mod", "init", "--name=playground", "--sdk="+tc.sdk)). With(sdkSource(tc.sdk, tc.source)) if tc.sdk == "go" { logGen(ctx, t, modGen.Directory(".")) } out, err := modGen.With(daggerQuery(`{playground{myFunction{msgContainer{msg}}}}`)).Stdout(ctx) require.NoError(t, err) require.JSONEq(t, `{"playground":{"myFunction":{"msgContainer":{"msg": "hello world"}}}}`, out) }) } } func TestModuleReturnCompositeCore(t *testing.T) { t.Parallel() c, ctx := connect(t) type testCase struct { sdk string source string }
closed
dagger/dagger
https://github.com/dagger/dagger
6,359
CLI: update handling of various core types
As described in [this comment](https://github.com/dagger/dagger/issues/6229#issuecomment-1863649336) (and that issue generally), we need to make some adjustments to the CLIs behavior when `dagger call` ends in various core types. There's a handful of related adjustments needed here. Creating as a checklist for now to save issue spam; can break down into more issues if useful though. I'm including my initial suggestions on how to handle these, but to be clear these are not finalized decisions and the final call can be made as part of implementing this - [ ] Handle arbitrary user objects - Print fields (as in `TypeDef` fields, so just trivially resolvable values) as a json object - [x] Handle container - call `sync` only, rely on progress output for anything else - [x] Handle directory - call `sync` only, rely on progress output for anything else - [x] Handle file - call `sync` only, rely on progress output for anything else - [ ] Handle IDs returned by `sync` (i.e. the case where the user explicitly chains `sync`) - just rely on progress output, don't show the id
https://github.com/dagger/dagger/issues/6359
https://github.com/dagger/dagger/pull/6482
2999573c5a34e85b8baac8c0150881d9c08a86b8
d91ac42c196873830c2e0876b251f3bf4d62ea49
2024-01-03T20:19:06Z
go
2024-01-26T18:48:04Z
core/integration/module_test.go
for _, tc := range []testCase{ { sdk: "go", source: `package main type Playground struct{} func (m *Playground) MySlice() []*Container { return []*Container{dag.Container().From("alpine:latest").WithExec([]string{"echo", "hello world"})} } type Foo struct { Con *Container // verify fields can remain nil w/out error too UnsetFile *File } func (m *Playground) MyStruct() *Foo { return &Foo{Con: dag.Container().From("alpine:latest").WithExec([]string{"echo", "hello world"})} } `, }, { sdk: "python", source: `import dagger from dagger import dag, field, function, object_type @object_type class Foo: con: dagger.Container = field() unset_file: dagger.File | None = field(default=None) @object_type class Playground: @function def my_slice(self) -> list[dagger.Container]:
closed
dagger/dagger
https://github.com/dagger/dagger
6,359
CLI: update handling of various core types
As described in [this comment](https://github.com/dagger/dagger/issues/6229#issuecomment-1863649336) (and that issue generally), we need to make some adjustments to the CLIs behavior when `dagger call` ends in various core types. There's a handful of related adjustments needed here. Creating as a checklist for now to save issue spam; can break down into more issues if useful though. I'm including my initial suggestions on how to handle these, but to be clear these are not finalized decisions and the final call can be made as part of implementing this - [ ] Handle arbitrary user objects - Print fields (as in `TypeDef` fields, so just trivially resolvable values) as a json object - [x] Handle container - call `sync` only, rely on progress output for anything else - [x] Handle directory - call `sync` only, rely on progress output for anything else - [x] Handle file - call `sync` only, rely on progress output for anything else - [ ] Handle IDs returned by `sync` (i.e. the case where the user explicitly chains `sync`) - just rely on progress output, don't show the id
https://github.com/dagger/dagger/issues/6359
https://github.com/dagger/dagger/pull/6482
2999573c5a34e85b8baac8c0150881d9c08a86b8
d91ac42c196873830c2e0876b251f3bf4d62ea49
2024-01-03T20:19:06Z
go
2024-01-26T18:48:04Z
core/integration/module_test.go
return [dag.container().from_("alpine:latest").with_exec(["echo", "hello world"])] @function def my_struct(self) -> Foo: return Foo(con=dag.container().from_("alpine:latest").with_exec(["echo", "hello world"])) `, }, { sdk: "typescript", source: ` import { dag, Container, File, object, func, field } from "@dagger.io/dagger" @object class Foo { @field con: Container @field unsetFile?: File constructor(con: Container, usetFile?: File) { this.con = con this.usetFile = usetFile } } @object class Playground { @func mySlice(): Container[] { return [ dag.container().from("alpine:latest").withExec(["echo", "hello world"]) ] } @func
closed
dagger/dagger
https://github.com/dagger/dagger
6,359
CLI: update handling of various core types
As described in [this comment](https://github.com/dagger/dagger/issues/6229#issuecomment-1863649336) (and that issue generally), we need to make some adjustments to the CLIs behavior when `dagger call` ends in various core types. There's a handful of related adjustments needed here. Creating as a checklist for now to save issue spam; can break down into more issues if useful though. I'm including my initial suggestions on how to handle these, but to be clear these are not finalized decisions and the final call can be made as part of implementing this - [ ] Handle arbitrary user objects - Print fields (as in `TypeDef` fields, so just trivially resolvable values) as a json object - [x] Handle container - call `sync` only, rely on progress output for anything else - [x] Handle directory - call `sync` only, rely on progress output for anything else - [x] Handle file - call `sync` only, rely on progress output for anything else - [ ] Handle IDs returned by `sync` (i.e. the case where the user explicitly chains `sync`) - just rely on progress output, don't show the id
https://github.com/dagger/dagger/issues/6359
https://github.com/dagger/dagger/pull/6482
2999573c5a34e85b8baac8c0150881d9c08a86b8
d91ac42c196873830c2e0876b251f3bf4d62ea49
2024-01-03T20:19:06Z
go
2024-01-26T18:48:04Z
core/integration/module_test.go
myStruct(): Foo { return new Foo( dag.container().from("alpine:latest").withExec(["echo", "hello world"]) ) } } `, }, } { tc := tc t.Run(tc.sdk, func(t *testing.T) { t.Parallel() modGen := c.Container().From(golangImage). WithMountedFile(testCLIBinPath, daggerCliFile(t, c)). WithWorkdir("/work"). With(daggerExec("mod", "init", "--name=playground", "--sdk="+tc.sdk)). With(sdkSource(tc.sdk, tc.source)) if tc.sdk == "go" { logGen(ctx, t, modGen.Directory(".")) } out, err := modGen.With(daggerQuery(`{playground{mySlice{stdout}}}`)).Stdout(ctx) require.NoError(t, err) require.JSONEq(t, `{"playground":{"mySlice":[{"stdout":"hello world\n"}]}}`, out) out, err = modGen.With(daggerQuery(`{playground{myStruct{con{stdout}}}}`)).Stdout(ctx) require.NoError(t, err) require.JSONEq(t, `{"playground":{"myStruct":{"con":{"stdout":"hello world\n"}}}}`, out) }) } } func TestModuleReturnComplexThing(t *testing.T) {
closed
dagger/dagger
https://github.com/dagger/dagger
6,359
CLI: update handling of various core types
As described in [this comment](https://github.com/dagger/dagger/issues/6229#issuecomment-1863649336) (and that issue generally), we need to make some adjustments to the CLIs behavior when `dagger call` ends in various core types. There's a handful of related adjustments needed here. Creating as a checklist for now to save issue spam; can break down into more issues if useful though. I'm including my initial suggestions on how to handle these, but to be clear these are not finalized decisions and the final call can be made as part of implementing this - [ ] Handle arbitrary user objects - Print fields (as in `TypeDef` fields, so just trivially resolvable values) as a json object - [x] Handle container - call `sync` only, rely on progress output for anything else - [x] Handle directory - call `sync` only, rely on progress output for anything else - [x] Handle file - call `sync` only, rely on progress output for anything else - [ ] Handle IDs returned by `sync` (i.e. the case where the user explicitly chains `sync`) - just rely on progress output, don't show the id
https://github.com/dagger/dagger/issues/6359
https://github.com/dagger/dagger/pull/6482
2999573c5a34e85b8baac8c0150881d9c08a86b8
d91ac42c196873830c2e0876b251f3bf4d62ea49
2024-01-03T20:19:06Z
go
2024-01-26T18:48:04Z
core/integration/module_test.go
t.Parallel() c, ctx := connect(t) type testCase struct { sdk string source string } for _, tc := range []testCase{ { sdk: "go", source: `package main type Playground struct{} type ScanResult struct { Containers []*Container ` + "`json:\"targets\"`" + ` Report ScanReport } type ScanReport struct { Contents string ` + "`json:\"contents\"`" + ` Authors []string ` + "`json:\"Authors\"`" + ` } func (m *Playground) Scan() ScanResult { return ScanResult{ Containers: []*Container{ dag.Container().From("alpine:latest").WithExec([]string{"echo", "hello world"}), }, Report: ScanReport{ Contents: "hello world", Authors: []string{"foo", "bar"}, },
closed
dagger/dagger
https://github.com/dagger/dagger
6,359
CLI: update handling of various core types
As described in [this comment](https://github.com/dagger/dagger/issues/6229#issuecomment-1863649336) (and that issue generally), we need to make some adjustments to the CLIs behavior when `dagger call` ends in various core types. There's a handful of related adjustments needed here. Creating as a checklist for now to save issue spam; can break down into more issues if useful though. I'm including my initial suggestions on how to handle these, but to be clear these are not finalized decisions and the final call can be made as part of implementing this - [ ] Handle arbitrary user objects - Print fields (as in `TypeDef` fields, so just trivially resolvable values) as a json object - [x] Handle container - call `sync` only, rely on progress output for anything else - [x] Handle directory - call `sync` only, rely on progress output for anything else - [x] Handle file - call `sync` only, rely on progress output for anything else - [ ] Handle IDs returned by `sync` (i.e. the case where the user explicitly chains `sync`) - just rely on progress output, don't show the id
https://github.com/dagger/dagger/issues/6359
https://github.com/dagger/dagger/pull/6482
2999573c5a34e85b8baac8c0150881d9c08a86b8
d91ac42c196873830c2e0876b251f3bf4d62ea49
2024-01-03T20:19:06Z
go
2024-01-26T18:48:04Z
core/integration/module_test.go
} } `, }, { sdk: "python", source: `import dagger from dagger import dag, field, function, object_type @object_type class ScanReport: contents: str = field() authors: list[str] = field() @object_type class ScanResult: containers: list[dagger.Container] = field(name="targets") report: ScanReport = field() @object_type class Playground: @function def scan(self) -> ScanResult: return ScanResult( containers=[ dag.container().from_("alpine:latest").with_exec(["echo", "hello world"]), ], report=ScanReport( contents="hello world", authors=["foo", "bar"], ), ) `,
closed
dagger/dagger
https://github.com/dagger/dagger
6,359
CLI: update handling of various core types
As described in [this comment](https://github.com/dagger/dagger/issues/6229#issuecomment-1863649336) (and that issue generally), we need to make some adjustments to the CLIs behavior when `dagger call` ends in various core types. There's a handful of related adjustments needed here. Creating as a checklist for now to save issue spam; can break down into more issues if useful though. I'm including my initial suggestions on how to handle these, but to be clear these are not finalized decisions and the final call can be made as part of implementing this - [ ] Handle arbitrary user objects - Print fields (as in `TypeDef` fields, so just trivially resolvable values) as a json object - [x] Handle container - call `sync` only, rely on progress output for anything else - [x] Handle directory - call `sync` only, rely on progress output for anything else - [x] Handle file - call `sync` only, rely on progress output for anything else - [ ] Handle IDs returned by `sync` (i.e. the case where the user explicitly chains `sync`) - just rely on progress output, don't show the id
https://github.com/dagger/dagger/issues/6359
https://github.com/dagger/dagger/pull/6482
2999573c5a34e85b8baac8c0150881d9c08a86b8
d91ac42c196873830c2e0876b251f3bf4d62ea49
2024-01-03T20:19:06Z
go
2024-01-26T18:48:04Z
core/integration/module_test.go
}, { sdk: "typescript", source: ` import { dag, Container, object, func, field } from "@dagger.io/dagger" @object class ScanReport { @field contents: string @field authors: string[] constructor(contents: string, authors: string[]) { this.contents = contents this.authors = authors } } @object class ScanResult { @field targets: Container[] @field report: ScanReport constructor(containers: Container[], report: ScanReport) { this.targets = containers this.report = report } } @object class Playground { @func
closed
dagger/dagger
https://github.com/dagger/dagger
6,359
CLI: update handling of various core types
As described in [this comment](https://github.com/dagger/dagger/issues/6229#issuecomment-1863649336) (and that issue generally), we need to make some adjustments to the CLIs behavior when `dagger call` ends in various core types. There's a handful of related adjustments needed here. Creating as a checklist for now to save issue spam; can break down into more issues if useful though. I'm including my initial suggestions on how to handle these, but to be clear these are not finalized decisions and the final call can be made as part of implementing this - [ ] Handle arbitrary user objects - Print fields (as in `TypeDef` fields, so just trivially resolvable values) as a json object - [x] Handle container - call `sync` only, rely on progress output for anything else - [x] Handle directory - call `sync` only, rely on progress output for anything else - [x] Handle file - call `sync` only, rely on progress output for anything else - [ ] Handle IDs returned by `sync` (i.e. the case where the user explicitly chains `sync`) - just rely on progress output, don't show the id
https://github.com/dagger/dagger/issues/6359
https://github.com/dagger/dagger/pull/6482
2999573c5a34e85b8baac8c0150881d9c08a86b8
d91ac42c196873830c2e0876b251f3bf4d62ea49
2024-01-03T20:19:06Z
go
2024-01-26T18:48:04Z
core/integration/module_test.go
async scan(): Promise<ScanResult> { return new ScanResult( [ dag.container().from("alpine:latest").withExec(["echo", "hello world"]) ], new ScanReport("hello world", ["foo", "bar"]) ) } } `, }, } { tc := tc t.Run(tc.sdk, func(t *testing.T) { t.Parallel() modGen := c.Container().From(golangImage). WithMountedFile(testCLIBinPath, daggerCliFile(t, c)). WithWorkdir("/work"). With(daggerExec("mod", "init", "--name=playground", "--sdk="+tc.sdk)). With(sdkSource(tc.sdk, tc.source)) if tc.sdk == "go" { logGen(ctx, t, modGen.Directory(".")) } out, err := modGen.With(daggerQuery(`{playground{scan{targets{stdout},report{contents,authors}}}}`)).Stdout(ctx) require.NoError(t, err) require.JSONEq(t, `{"playground":{"scan":{"targets":[{"stdout":"hello world\n"}],"report":{"contents":"hello world","authors":["foo","bar"]}}}}`, out) }) } } func TestModulePythonReturnSelf(t *testing.T) {
closed
dagger/dagger
https://github.com/dagger/dagger
6,359
CLI: update handling of various core types
As described in [this comment](https://github.com/dagger/dagger/issues/6229#issuecomment-1863649336) (and that issue generally), we need to make some adjustments to the CLIs behavior when `dagger call` ends in various core types. There's a handful of related adjustments needed here. Creating as a checklist for now to save issue spam; can break down into more issues if useful though. I'm including my initial suggestions on how to handle these, but to be clear these are not finalized decisions and the final call can be made as part of implementing this - [ ] Handle arbitrary user objects - Print fields (as in `TypeDef` fields, so just trivially resolvable values) as a json object - [x] Handle container - call `sync` only, rely on progress output for anything else - [x] Handle directory - call `sync` only, rely on progress output for anything else - [x] Handle file - call `sync` only, rely on progress output for anything else - [ ] Handle IDs returned by `sync` (i.e. the case where the user explicitly chains `sync`) - just rely on progress output, don't show the id
https://github.com/dagger/dagger/issues/6359
https://github.com/dagger/dagger/pull/6482
2999573c5a34e85b8baac8c0150881d9c08a86b8
d91ac42c196873830c2e0876b251f3bf4d62ea49
2024-01-03T20:19:06Z
go
2024-01-26T18:48:04Z
core/integration/module_test.go
t.Parallel() c, ctx := connect(t) modGen := c.Container().From(golangImage). WithMountedFile(testCLIBinPath, daggerCliFile(t, c)). WithWorkdir("/work"). With(daggerExec("mod", "init", "--name=foo", "--sdk=python")). WithNewFile("src/main.py", dagger.ContainerWithNewFileOpts{ Contents: `from typing import Self from dagger import field, function, object_type @object_type class Foo: message: str = field(default="") @function def bar(self) -> Self: self.message = "foobar" return self `, }) out, err := modGen.With(daggerQuery(`{foo{bar{message}}}`)).Stdout(ctx) require.NoError(t, err) require.JSONEq(t, `{"foo":{"bar":{"message":"foobar"}}}`, out) } func TestModuleGlobalVarDAG(t *testing.T) { t.Parallel() c, ctx := connect(t) type testCase struct {
closed
dagger/dagger
https://github.com/dagger/dagger
6,359
CLI: update handling of various core types
As described in [this comment](https://github.com/dagger/dagger/issues/6229#issuecomment-1863649336) (and that issue generally), we need to make some adjustments to the CLIs behavior when `dagger call` ends in various core types. There's a handful of related adjustments needed here. Creating as a checklist for now to save issue spam; can break down into more issues if useful though. I'm including my initial suggestions on how to handle these, but to be clear these are not finalized decisions and the final call can be made as part of implementing this - [ ] Handle arbitrary user objects - Print fields (as in `TypeDef` fields, so just trivially resolvable values) as a json object - [x] Handle container - call `sync` only, rely on progress output for anything else - [x] Handle directory - call `sync` only, rely on progress output for anything else - [x] Handle file - call `sync` only, rely on progress output for anything else - [ ] Handle IDs returned by `sync` (i.e. the case where the user explicitly chains `sync`) - just rely on progress output, don't show the id
https://github.com/dagger/dagger/issues/6359
https://github.com/dagger/dagger/pull/6482
2999573c5a34e85b8baac8c0150881d9c08a86b8
d91ac42c196873830c2e0876b251f3bf4d62ea49
2024-01-03T20:19:06Z
go
2024-01-26T18:48:04Z
core/integration/module_test.go
sdk string source string } for _, tc := range []testCase{ { sdk: "go", source: `package main import "context" type Foo struct {} var someDefault = dag.Container().From("alpine:latest") func (m *Foo) Fn(ctx context.Context) (string, error) { return someDefault.WithExec([]string{"echo", "foo"}).Stdout(ctx) } `, }, { sdk: "python", source: `from dagger import dag, function, object_type SOME_DEFAULT = dag.container().from_("alpine:latest") @object_type class Foo: @function async def fn(self) -> str: return await SOME_DEFAULT.with_exec(["echo", "foo"]).stdout() `, }, { sdk: "typescript", source: `
closed
dagger/dagger
https://github.com/dagger/dagger
6,359
CLI: update handling of various core types
As described in [this comment](https://github.com/dagger/dagger/issues/6229#issuecomment-1863649336) (and that issue generally), we need to make some adjustments to the CLIs behavior when `dagger call` ends in various core types. There's a handful of related adjustments needed here. Creating as a checklist for now to save issue spam; can break down into more issues if useful though. I'm including my initial suggestions on how to handle these, but to be clear these are not finalized decisions and the final call can be made as part of implementing this - [ ] Handle arbitrary user objects - Print fields (as in `TypeDef` fields, so just trivially resolvable values) as a json object - [x] Handle container - call `sync` only, rely on progress output for anything else - [x] Handle directory - call `sync` only, rely on progress output for anything else - [x] Handle file - call `sync` only, rely on progress output for anything else - [ ] Handle IDs returned by `sync` (i.e. the case where the user explicitly chains `sync`) - just rely on progress output, don't show the id
https://github.com/dagger/dagger/issues/6359
https://github.com/dagger/dagger/pull/6482
2999573c5a34e85b8baac8c0150881d9c08a86b8
d91ac42c196873830c2e0876b251f3bf4d62ea49
2024-01-03T20:19:06Z
go
2024-01-26T18:48:04Z
core/integration/module_test.go
import { dag, object, func } from "@dagger.io/dagger" var someDefault = dag.container().from("alpine:latest") @object class Foo { @func async fn(): Promise<string> { return someDefault.withExec(["echo", "foo"]).stdout() } } `, }, } { tc := tc t.Run(tc.sdk, func(t *testing.T) { t.Parallel() modGen := c.Container().From(golangImage). WithMountedFile(testCLIBinPath, daggerCliFile(t, c)). WithWorkdir("/work"). With(daggerExec("mod", "init", "--name=foo", "--sdk="+tc.sdk)). With(sdkSource(tc.sdk, tc.source)) if tc.sdk == "go" { logGen(ctx, t, modGen.Directory(".")) } out, err := modGen.With(daggerQuery(`{foo{fn}}`)).Stdout(ctx) require.NoError(t, err) require.JSONEq(t, `{"foo":{"fn":"foo\n"}}`, out) }) } } func TestModuleIDableType(t *testing.T) {
closed
dagger/dagger
https://github.com/dagger/dagger
6,359
CLI: update handling of various core types
As described in [this comment](https://github.com/dagger/dagger/issues/6229#issuecomment-1863649336) (and that issue generally), we need to make some adjustments to the CLIs behavior when `dagger call` ends in various core types. There's a handful of related adjustments needed here. Creating as a checklist for now to save issue spam; can break down into more issues if useful though. I'm including my initial suggestions on how to handle these, but to be clear these are not finalized decisions and the final call can be made as part of implementing this - [ ] Handle arbitrary user objects - Print fields (as in `TypeDef` fields, so just trivially resolvable values) as a json object - [x] Handle container - call `sync` only, rely on progress output for anything else - [x] Handle directory - call `sync` only, rely on progress output for anything else - [x] Handle file - call `sync` only, rely on progress output for anything else - [ ] Handle IDs returned by `sync` (i.e. the case where the user explicitly chains `sync`) - just rely on progress output, don't show the id
https://github.com/dagger/dagger/issues/6359
https://github.com/dagger/dagger/pull/6482
2999573c5a34e85b8baac8c0150881d9c08a86b8
d91ac42c196873830c2e0876b251f3bf4d62ea49
2024-01-03T20:19:06Z
go
2024-01-26T18:48:04Z
core/integration/module_test.go
t.Parallel() c, ctx := connect(t) type testCase struct { sdk string source string } for _, tc := range []testCase{ { sdk: "go", source: `package main type Foo struct { Data string } func (m *Foo) Set(data string) *Foo { m.Data = data return m } func (m *Foo) Get() string { return m.Data } `, }, { sdk: "python", source: `from typing import Self from dagger import field, function, object_type @object_type
closed
dagger/dagger
https://github.com/dagger/dagger
6,359
CLI: update handling of various core types
As described in [this comment](https://github.com/dagger/dagger/issues/6229#issuecomment-1863649336) (and that issue generally), we need to make some adjustments to the CLIs behavior when `dagger call` ends in various core types. There's a handful of related adjustments needed here. Creating as a checklist for now to save issue spam; can break down into more issues if useful though. I'm including my initial suggestions on how to handle these, but to be clear these are not finalized decisions and the final call can be made as part of implementing this - [ ] Handle arbitrary user objects - Print fields (as in `TypeDef` fields, so just trivially resolvable values) as a json object - [x] Handle container - call `sync` only, rely on progress output for anything else - [x] Handle directory - call `sync` only, rely on progress output for anything else - [x] Handle file - call `sync` only, rely on progress output for anything else - [ ] Handle IDs returned by `sync` (i.e. the case where the user explicitly chains `sync`) - just rely on progress output, don't show the id
https://github.com/dagger/dagger/issues/6359
https://github.com/dagger/dagger/pull/6482
2999573c5a34e85b8baac8c0150881d9c08a86b8
d91ac42c196873830c2e0876b251f3bf4d62ea49
2024-01-03T20:19:06Z
go
2024-01-26T18:48:04Z
core/integration/module_test.go
class Foo: data: str = "" @function def set(self, data: str) -> Self: self.data = data return self @function def get(self) -> str: return self.data `, }, { sdk: "typescript", source: ` import { object, func } from "@dagger.io/dagger" @object class Foo { data: string = "" @func set(data: string): Foo { this.data = data return this } @func get(): string { return this.data } } `, },
closed
dagger/dagger
https://github.com/dagger/dagger
6,359
CLI: update handling of various core types
As described in [this comment](https://github.com/dagger/dagger/issues/6229#issuecomment-1863649336) (and that issue generally), we need to make some adjustments to the CLIs behavior when `dagger call` ends in various core types. There's a handful of related adjustments needed here. Creating as a checklist for now to save issue spam; can break down into more issues if useful though. I'm including my initial suggestions on how to handle these, but to be clear these are not finalized decisions and the final call can be made as part of implementing this - [ ] Handle arbitrary user objects - Print fields (as in `TypeDef` fields, so just trivially resolvable values) as a json object - [x] Handle container - call `sync` only, rely on progress output for anything else - [x] Handle directory - call `sync` only, rely on progress output for anything else - [x] Handle file - call `sync` only, rely on progress output for anything else - [ ] Handle IDs returned by `sync` (i.e. the case where the user explicitly chains `sync`) - just rely on progress output, don't show the id
https://github.com/dagger/dagger/issues/6359
https://github.com/dagger/dagger/pull/6482
2999573c5a34e85b8baac8c0150881d9c08a86b8
d91ac42c196873830c2e0876b251f3bf4d62ea49
2024-01-03T20:19:06Z
go
2024-01-26T18:48:04Z
core/integration/module_test.go
} { tc := tc t.Run(tc.sdk, func(t *testing.T) { t.Parallel() modGen := c.Container().From(golangImage). WithMountedFile(testCLIBinPath, daggerCliFile(t, c)). WithWorkdir("/work"). With(daggerExec("mod", "init", "--name=foo", "--sdk="+tc.sdk)). With(sdkSource(tc.sdk, tc.source)) if tc.sdk == "go" { logGen(ctx, t, modGen.Directory(".")) } out, err := modGen.With(daggerQuery(`{foo{set(data: "abc"){get}}}`)).Stdout(ctx) require.NoError(t, err) require.JSONEq(t, `{"foo":{"set":{"get": "abc"}}}`, out) out, err = modGen.With(daggerQuery(`{foo{set(data: "abc"){id}}}`)).Stdout(ctx) require.NoError(t, err) id := gjson.Get(out, "foo.set.id").String() var idp idproto.ID err = idp.Decode(id) require.NoError(t, err) require.Equal(t, idp.Display(), `foo.set(data: "abc"): Foo!`) out, err = modGen.With(daggerQuery(`{loadFooFromID(id: "%s"){get}}`, id)).Stdout(ctx) require.NoError(t, err) require.JSONEq(t, `{"loadFooFromID":{"get": "abc"}}`, out) }) } } func TestModuleArgOwnType(t *testing.T) {
closed
dagger/dagger
https://github.com/dagger/dagger
6,359
CLI: update handling of various core types
As described in [this comment](https://github.com/dagger/dagger/issues/6229#issuecomment-1863649336) (and that issue generally), we need to make some adjustments to the CLIs behavior when `dagger call` ends in various core types. There's a handful of related adjustments needed here. Creating as a checklist for now to save issue spam; can break down into more issues if useful though. I'm including my initial suggestions on how to handle these, but to be clear these are not finalized decisions and the final call can be made as part of implementing this - [ ] Handle arbitrary user objects - Print fields (as in `TypeDef` fields, so just trivially resolvable values) as a json object - [x] Handle container - call `sync` only, rely on progress output for anything else - [x] Handle directory - call `sync` only, rely on progress output for anything else - [x] Handle file - call `sync` only, rely on progress output for anything else - [ ] Handle IDs returned by `sync` (i.e. the case where the user explicitly chains `sync`) - just rely on progress output, don't show the id
https://github.com/dagger/dagger/issues/6359
https://github.com/dagger/dagger/pull/6482
2999573c5a34e85b8baac8c0150881d9c08a86b8
d91ac42c196873830c2e0876b251f3bf4d62ea49
2024-01-03T20:19:06Z
go
2024-01-26T18:48:04Z
core/integration/module_test.go
t.Parallel() c, ctx := connect(t) type testCase struct { sdk string source string } for _, tc := range []testCase{ { sdk: "go", source: `package main import "strings" type Foo struct{} type Message struct { Content string } func (m *Foo) SayHello(name string) Message { return Message{Content: "hello " + name} } func (m *Foo) Upper(msg Message) Message { msg.Content = strings.ToUpper(msg.Content) return msg } func (m *Foo) Uppers(msg []Message) []Message {
closed
dagger/dagger
https://github.com/dagger/dagger
6,359
CLI: update handling of various core types
As described in [this comment](https://github.com/dagger/dagger/issues/6229#issuecomment-1863649336) (and that issue generally), we need to make some adjustments to the CLIs behavior when `dagger call` ends in various core types. There's a handful of related adjustments needed here. Creating as a checklist for now to save issue spam; can break down into more issues if useful though. I'm including my initial suggestions on how to handle these, but to be clear these are not finalized decisions and the final call can be made as part of implementing this - [ ] Handle arbitrary user objects - Print fields (as in `TypeDef` fields, so just trivially resolvable values) as a json object - [x] Handle container - call `sync` only, rely on progress output for anything else - [x] Handle directory - call `sync` only, rely on progress output for anything else - [x] Handle file - call `sync` only, rely on progress output for anything else - [ ] Handle IDs returned by `sync` (i.e. the case where the user explicitly chains `sync`) - just rely on progress output, don't show the id
https://github.com/dagger/dagger/issues/6359
https://github.com/dagger/dagger/pull/6482
2999573c5a34e85b8baac8c0150881d9c08a86b8
d91ac42c196873830c2e0876b251f3bf4d62ea49
2024-01-03T20:19:06Z
go
2024-01-26T18:48:04Z
core/integration/module_test.go
for i := range msg { msg[i].Content = strings.ToUpper(msg[i].Content) } return msg }`, }, { sdk: "python", source: `from dagger import field, function, object_type @object_type class Message: content: str = field() @object_type class Foo: @function def say_hello(self, name: str) -> Message: return Message(content=f"hello {name}") @function def upper(self, msg: Message) -> Message: msg.content = msg.content.upper() return msg @function def uppers(self, msg: list[Message]) -> list[Message]: for m in msg: m.content = m.content.upper() return msg `, }, { sdk: "typescript",
closed
dagger/dagger
https://github.com/dagger/dagger
6,359
CLI: update handling of various core types
As described in [this comment](https://github.com/dagger/dagger/issues/6229#issuecomment-1863649336) (and that issue generally), we need to make some adjustments to the CLIs behavior when `dagger call` ends in various core types. There's a handful of related adjustments needed here. Creating as a checklist for now to save issue spam; can break down into more issues if useful though. I'm including my initial suggestions on how to handle these, but to be clear these are not finalized decisions and the final call can be made as part of implementing this - [ ] Handle arbitrary user objects - Print fields (as in `TypeDef` fields, so just trivially resolvable values) as a json object - [x] Handle container - call `sync` only, rely on progress output for anything else - [x] Handle directory - call `sync` only, rely on progress output for anything else - [x] Handle file - call `sync` only, rely on progress output for anything else - [ ] Handle IDs returned by `sync` (i.e. the case where the user explicitly chains `sync`) - just rely on progress output, don't show the id
https://github.com/dagger/dagger/issues/6359
https://github.com/dagger/dagger/pull/6482
2999573c5a34e85b8baac8c0150881d9c08a86b8
d91ac42c196873830c2e0876b251f3bf4d62ea49
2024-01-03T20:19:06Z
go
2024-01-26T18:48:04Z
core/integration/module_test.go
source: ` import { object, func, field } from "@dagger.io/dagger" @object class Message { @field content: string constructor(content: string) { this.content = content } } @object class Foo { @func sayHello(name: string): Message { return new Message("hello " + name) } @func upper(msg: Message): Message { msg.content = msg.content.toUpperCase() return msg } @func uppers(msg: Message[]): Message[] { for (let i = 0; i < msg.length; i++) { msg[i].content = msg[i].content.toUpperCase() } return msg } } `,
closed
dagger/dagger
https://github.com/dagger/dagger
6,359
CLI: update handling of various core types
As described in [this comment](https://github.com/dagger/dagger/issues/6229#issuecomment-1863649336) (and that issue generally), we need to make some adjustments to the CLIs behavior when `dagger call` ends in various core types. There's a handful of related adjustments needed here. Creating as a checklist for now to save issue spam; can break down into more issues if useful though. I'm including my initial suggestions on how to handle these, but to be clear these are not finalized decisions and the final call can be made as part of implementing this - [ ] Handle arbitrary user objects - Print fields (as in `TypeDef` fields, so just trivially resolvable values) as a json object - [x] Handle container - call `sync` only, rely on progress output for anything else - [x] Handle directory - call `sync` only, rely on progress output for anything else - [x] Handle file - call `sync` only, rely on progress output for anything else - [ ] Handle IDs returned by `sync` (i.e. the case where the user explicitly chains `sync`) - just rely on progress output, don't show the id
https://github.com/dagger/dagger/issues/6359
https://github.com/dagger/dagger/pull/6482
2999573c5a34e85b8baac8c0150881d9c08a86b8
d91ac42c196873830c2e0876b251f3bf4d62ea49
2024-01-03T20:19:06Z
go
2024-01-26T18:48:04Z
core/integration/module_test.go
}, } { tc := tc t.Run(tc.sdk, func(t *testing.T) { t.Parallel() modGen := c.Container().From(golangImage). WithMountedFile(testCLIBinPath, daggerCliFile(t, c)). WithWorkdir("/work"). With(daggerExec("mod", "init", "--name=foo", "--sdk="+tc.sdk)). With(sdkSource(tc.sdk, tc.source)) if tc.sdk == "go" { logGen(ctx, t, modGen.Directory(".")) } out, err := modGen.With(daggerQuery(`{foo{sayHello(name: "world"){id}}}`)).Stdout(ctx) require.NoError(t, err) id := gjson.Get(out, "foo.sayHello.id").String() var idp idproto.ID err = idp.Decode(id) require.NoError(t, err) require.Equal(t, idp.Display(), `foo.sayHello(name: "world"): FooMessage!`) out, err = modGen.With(daggerQuery(`{foo{upper(msg:"%s"){content}}}`, id)).Stdout(ctx) require.NoError(t, err) require.JSONEq(t, `{"foo":{"upper":{"content": "HELLO WORLD"}}}`, out) out, err = modGen.With(daggerQuery(`{foo{uppers(msg:["%s", "%s"]){content}}}`, id, id)).Stdout(ctx) require.NoError(t, err) require.JSONEq(t, `{"foo":{"uppers":[{"content": "HELLO WORLD"}, {"content": "HELLO WORLD"}]}}`, out) }) } } func TestModuleConflictingSameNameDeps(t *testing.T) {
closed
dagger/dagger
https://github.com/dagger/dagger
6,359
CLI: update handling of various core types
As described in [this comment](https://github.com/dagger/dagger/issues/6229#issuecomment-1863649336) (and that issue generally), we need to make some adjustments to the CLIs behavior when `dagger call` ends in various core types. There's a handful of related adjustments needed here. Creating as a checklist for now to save issue spam; can break down into more issues if useful though. I'm including my initial suggestions on how to handle these, but to be clear these are not finalized decisions and the final call can be made as part of implementing this - [ ] Handle arbitrary user objects - Print fields (as in `TypeDef` fields, so just trivially resolvable values) as a json object - [x] Handle container - call `sync` only, rely on progress output for anything else - [x] Handle directory - call `sync` only, rely on progress output for anything else - [x] Handle file - call `sync` only, rely on progress output for anything else - [ ] Handle IDs returned by `sync` (i.e. the case where the user explicitly chains `sync`) - just rely on progress output, don't show the id
https://github.com/dagger/dagger/issues/6359
https://github.com/dagger/dagger/pull/6482
2999573c5a34e85b8baac8c0150881d9c08a86b8
d91ac42c196873830c2e0876b251f3bf4d62ea49
2024-01-03T20:19:06Z
go
2024-01-26T18:48:04Z
core/integration/module_test.go
t.Parallel() c, ctx := connect(t) ctr := c.Container().From(golangImage). WithMountedFile(testCLIBinPath, daggerCliFile(t, c)). WithWorkdir("/work/dstr"). With(daggerExec("mod", "init", "--name=d", "--sdk=go")). WithNewFile("main.go", dagger.ContainerWithNewFileOpts{ Contents: `package main type D struct{} type Obj struct { Foo string }
closed
dagger/dagger
https://github.com/dagger/dagger
6,359
CLI: update handling of various core types
As described in [this comment](https://github.com/dagger/dagger/issues/6229#issuecomment-1863649336) (and that issue generally), we need to make some adjustments to the CLIs behavior when `dagger call` ends in various core types. There's a handful of related adjustments needed here. Creating as a checklist for now to save issue spam; can break down into more issues if useful though. I'm including my initial suggestions on how to handle these, but to be clear these are not finalized decisions and the final call can be made as part of implementing this - [ ] Handle arbitrary user objects - Print fields (as in `TypeDef` fields, so just trivially resolvable values) as a json object - [x] Handle container - call `sync` only, rely on progress output for anything else - [x] Handle directory - call `sync` only, rely on progress output for anything else - [x] Handle file - call `sync` only, rely on progress output for anything else - [ ] Handle IDs returned by `sync` (i.e. the case where the user explicitly chains `sync`) - just rely on progress output, don't show the id
https://github.com/dagger/dagger/issues/6359
https://github.com/dagger/dagger/pull/6482
2999573c5a34e85b8baac8c0150881d9c08a86b8
d91ac42c196873830c2e0876b251f3bf4d62ea49
2024-01-03T20:19:06Z
go
2024-01-26T18:48:04Z
core/integration/module_test.go
func (m *D) Fn(foo string) Obj { return Obj{Foo: foo} } `, }) ctr = ctr. WithMountedFile(testCLIBinPath, daggerCliFile(t, c)). WithWorkdir("/work/dint"). With(daggerExec("mod", "init", "--name=d", "--sdk=go")). WithNewFile("main.go", dagger.ContainerWithNewFileOpts{ Contents: `package main type D struct{} type Obj struct { Foo int } func (m *D) Fn(foo int) Obj { return Obj{Foo: foo} } `, }) ctr = ctr. WithWorkdir("/work/c"). With(daggerExec("mod", "init", "--name=c", "--sdk=go", "--root=..")). With(daggerExec("mod", "install", "../dstr")). WithNewFile("main.go", dagger.ContainerWithNewFileOpts{ Contents: `package main import ( "context" ) type C struct{}
closed
dagger/dagger
https://github.com/dagger/dagger
6,359
CLI: update handling of various core types
As described in [this comment](https://github.com/dagger/dagger/issues/6229#issuecomment-1863649336) (and that issue generally), we need to make some adjustments to the CLIs behavior when `dagger call` ends in various core types. There's a handful of related adjustments needed here. Creating as a checklist for now to save issue spam; can break down into more issues if useful though. I'm including my initial suggestions on how to handle these, but to be clear these are not finalized decisions and the final call can be made as part of implementing this - [ ] Handle arbitrary user objects - Print fields (as in `TypeDef` fields, so just trivially resolvable values) as a json object - [x] Handle container - call `sync` only, rely on progress output for anything else - [x] Handle directory - call `sync` only, rely on progress output for anything else - [x] Handle file - call `sync` only, rely on progress output for anything else - [ ] Handle IDs returned by `sync` (i.e. the case where the user explicitly chains `sync`) - just rely on progress output, don't show the id
https://github.com/dagger/dagger/issues/6359
https://github.com/dagger/dagger/pull/6482
2999573c5a34e85b8baac8c0150881d9c08a86b8
d91ac42c196873830c2e0876b251f3bf4d62ea49
2024-01-03T20:19:06Z
go
2024-01-26T18:48:04Z
core/integration/module_test.go
func (m *C) Fn(ctx context.Context, foo string) (string, error) { return dag.D().Fn(foo).Foo(ctx) } `, }) ctr = ctr. WithWorkdir("/work/b"). With(daggerExec("mod", "init", "--name=b", "--sdk=go", "--root=..")). With(daggerExec("mod", "install", "../dint")). WithNewFile("main.go", dagger.ContainerWithNewFileOpts{ Contents: `package main import ( "context" ) type B struct{} func (m *B) Fn(ctx context.Context, foo int) (int, error) { return dag.D().Fn(foo).Foo(ctx) } `, }) ctr = ctr. WithWorkdir("/work/a"). With(daggerExec("mod", "init", "--name=a", "--sdk=go", "--root=..")). With(daggerExec("mod", "install", "../b")). With(daggerExec("mod", "install", "../c")). WithNewFile("main.go", dagger.ContainerWithNewFileOpts{ Contents: `package main import ( "context" "strconv"
closed
dagger/dagger
https://github.com/dagger/dagger
6,359
CLI: update handling of various core types
As described in [this comment](https://github.com/dagger/dagger/issues/6229#issuecomment-1863649336) (and that issue generally), we need to make some adjustments to the CLIs behavior when `dagger call` ends in various core types. There's a handful of related adjustments needed here. Creating as a checklist for now to save issue spam; can break down into more issues if useful though. I'm including my initial suggestions on how to handle these, but to be clear these are not finalized decisions and the final call can be made as part of implementing this - [ ] Handle arbitrary user objects - Print fields (as in `TypeDef` fields, so just trivially resolvable values) as a json object - [x] Handle container - call `sync` only, rely on progress output for anything else - [x] Handle directory - call `sync` only, rely on progress output for anything else - [x] Handle file - call `sync` only, rely on progress output for anything else - [ ] Handle IDs returned by `sync` (i.e. the case where the user explicitly chains `sync`) - just rely on progress output, don't show the id
https://github.com/dagger/dagger/issues/6359
https://github.com/dagger/dagger/pull/6482
2999573c5a34e85b8baac8c0150881d9c08a86b8
d91ac42c196873830c2e0876b251f3bf4d62ea49
2024-01-03T20:19:06Z
go
2024-01-26T18:48:04Z
core/integration/module_test.go
) type A struct{} func (m *A) Fn(ctx context.Context) (string, error) { fooStr, err := dag.C().Fn(ctx, "foo") if err != nil { return "", err } fooInt, err := dag.B().Fn(ctx, 123) if err != nil { return "", err } return fooStr + strconv.Itoa(fooInt), nil } `, }) out, err := ctr.With(daggerQuery(`{a{fn}}`)).Stdout(ctx) require.NoError(t, err) require.JSONEq(t, `{"a":{"fn": "foo123"}}`, out) types := currentSchema(ctx, t, ctr).Types require.NotNil(t, types.Get("A")) require.Nil(t, types.Get("B")) require.Nil(t, types.Get("C")) require.Nil(t, types.Get("D")) } func TestModuleSelfAPICall(t *testing.T) { t.Parallel() c, ctx := connect(t) out, err := c.Container().From(golangImage). WithMountedFile(testCLIBinPath, daggerCliFile(t, c)).
closed
dagger/dagger
https://github.com/dagger/dagger
6,359
CLI: update handling of various core types
As described in [this comment](https://github.com/dagger/dagger/issues/6229#issuecomment-1863649336) (and that issue generally), we need to make some adjustments to the CLIs behavior when `dagger call` ends in various core types. There's a handful of related adjustments needed here. Creating as a checklist for now to save issue spam; can break down into more issues if useful though. I'm including my initial suggestions on how to handle these, but to be clear these are not finalized decisions and the final call can be made as part of implementing this - [ ] Handle arbitrary user objects - Print fields (as in `TypeDef` fields, so just trivially resolvable values) as a json object - [x] Handle container - call `sync` only, rely on progress output for anything else - [x] Handle directory - call `sync` only, rely on progress output for anything else - [x] Handle file - call `sync` only, rely on progress output for anything else - [ ] Handle IDs returned by `sync` (i.e. the case where the user explicitly chains `sync`) - just rely on progress output, don't show the id
https://github.com/dagger/dagger/issues/6359
https://github.com/dagger/dagger/pull/6482
2999573c5a34e85b8baac8c0150881d9c08a86b8
d91ac42c196873830c2e0876b251f3bf4d62ea49
2024-01-03T20:19:06Z
go
2024-01-26T18:48:04Z
core/integration/module_test.go
WithWorkdir("/work"). With(daggerExec("mod", "init", "--name=test", "--sdk=go")). WithNewFile("main.go", dagger.ContainerWithNewFileOpts{ Contents: `package main import ( "context" "github.com/Khan/genqlient/graphql" ) type Test struct{} func (m *Test) FnA(ctx context.Context) (string, error) { resp := &graphql.Response{} err := dag.c.MakeRequest(ctx, &graphql.Request{ Query: "{test{fnB}}", }, resp) if err != nil { return "", err } return resp.Data.(map[string]any)["test"].(map[string]any)["fnB"].(string), nil } func (m *Test) FnB() string { return "hi from b" } `, }). With(daggerQuery(`{test{fnA}}`)). Stdout(ctx) require.NoError(t, err) require.JSONEq(t, `{"test":{"fnA": "hi from b"}}`, out) } func TestModuleGoWithOtherModuleTypes(t *testing.T) {
closed
dagger/dagger
https://github.com/dagger/dagger
6,359
CLI: update handling of various core types
As described in [this comment](https://github.com/dagger/dagger/issues/6229#issuecomment-1863649336) (and that issue generally), we need to make some adjustments to the CLIs behavior when `dagger call` ends in various core types. There's a handful of related adjustments needed here. Creating as a checklist for now to save issue spam; can break down into more issues if useful though. I'm including my initial suggestions on how to handle these, but to be clear these are not finalized decisions and the final call can be made as part of implementing this - [ ] Handle arbitrary user objects - Print fields (as in `TypeDef` fields, so just trivially resolvable values) as a json object - [x] Handle container - call `sync` only, rely on progress output for anything else - [x] Handle directory - call `sync` only, rely on progress output for anything else - [x] Handle file - call `sync` only, rely on progress output for anything else - [ ] Handle IDs returned by `sync` (i.e. the case where the user explicitly chains `sync`) - just rely on progress output, don't show the id
https://github.com/dagger/dagger/issues/6359
https://github.com/dagger/dagger/pull/6482
2999573c5a34e85b8baac8c0150881d9c08a86b8
d91ac42c196873830c2e0876b251f3bf4d62ea49
2024-01-03T20:19:06Z
go
2024-01-26T18:48:04Z
core/integration/module_test.go
t.Parallel() c, ctx := connect(t) ctr := c.Container().From(golangImage). WithMountedFile(testCLIBinPath, daggerCliFile(t, c)). WithWorkdir("/work/dep"). With(daggerExec("mod", "init", "--name=dep", "--sdk=go")). WithNewFile("main.go", dagger.ContainerWithNewFileOpts{ Contents: `package main type Dep struct{} type Obj struct { Foo string } func (m *Dep) Fn() Obj { return Obj{Foo: "foo"} } `, }). WithWorkdir("/work/test"). With(daggerExec("mod", "init", "--name=test", "--sdk=go", "--root=..")). With(daggerExec("mod", "install", "../dep")) t.Run("return as other module object", func(t *testing.T) { t.Parallel() t.Run("direct", func(t *testing.T) { t.Parallel() _, err := ctr. WithNewFile("main.go", dagger.ContainerWithNewFileOpts{ Contents: `package main type Test struct{} func (m *Test) Fn() (*DepObj, error) {
closed
dagger/dagger
https://github.com/dagger/dagger
6,359
CLI: update handling of various core types
As described in [this comment](https://github.com/dagger/dagger/issues/6229#issuecomment-1863649336) (and that issue generally), we need to make some adjustments to the CLIs behavior when `dagger call` ends in various core types. There's a handful of related adjustments needed here. Creating as a checklist for now to save issue spam; can break down into more issues if useful though. I'm including my initial suggestions on how to handle these, but to be clear these are not finalized decisions and the final call can be made as part of implementing this - [ ] Handle arbitrary user objects - Print fields (as in `TypeDef` fields, so just trivially resolvable values) as a json object - [x] Handle container - call `sync` only, rely on progress output for anything else - [x] Handle directory - call `sync` only, rely on progress output for anything else - [x] Handle file - call `sync` only, rely on progress output for anything else - [ ] Handle IDs returned by `sync` (i.e. the case where the user explicitly chains `sync`) - just rely on progress output, don't show the id
https://github.com/dagger/dagger/issues/6359
https://github.com/dagger/dagger/pull/6482
2999573c5a34e85b8baac8c0150881d9c08a86b8
d91ac42c196873830c2e0876b251f3bf4d62ea49
2024-01-03T20:19:06Z
go
2024-01-26T18:48:04Z
core/integration/module_test.go
return nil, nil } `, }). With(daggerFunctions()). Stdout(ctx) require.Error(t, err) require.ErrorContains(t, err, fmt.Sprintf( "object %q function %q cannot return external type from dependency module %q", "Test", "Fn", "dep", )) }) t.Run("list", func(t *testing.T) { t.Parallel() _, err := ctr. WithNewFile("main.go", dagger.ContainerWithNewFileOpts{ Contents: `package main type Test struct{} func (m *Test) Fn() ([]*DepObj, error) { return nil, nil } `, }). With(daggerFunctions()). Stdout(ctx) require.Error(t, err) require.ErrorContains(t, err, fmt.Sprintf( "object %q function %q cannot return external type from dependency module %q", "Test", "Fn", "dep", ))
closed
dagger/dagger
https://github.com/dagger/dagger
6,359
CLI: update handling of various core types
As described in [this comment](https://github.com/dagger/dagger/issues/6229#issuecomment-1863649336) (and that issue generally), we need to make some adjustments to the CLIs behavior when `dagger call` ends in various core types. There's a handful of related adjustments needed here. Creating as a checklist for now to save issue spam; can break down into more issues if useful though. I'm including my initial suggestions on how to handle these, but to be clear these are not finalized decisions and the final call can be made as part of implementing this - [ ] Handle arbitrary user objects - Print fields (as in `TypeDef` fields, so just trivially resolvable values) as a json object - [x] Handle container - call `sync` only, rely on progress output for anything else - [x] Handle directory - call `sync` only, rely on progress output for anything else - [x] Handle file - call `sync` only, rely on progress output for anything else - [ ] Handle IDs returned by `sync` (i.e. the case where the user explicitly chains `sync`) - just rely on progress output, don't show the id
https://github.com/dagger/dagger/issues/6359
https://github.com/dagger/dagger/pull/6482
2999573c5a34e85b8baac8c0150881d9c08a86b8
d91ac42c196873830c2e0876b251f3bf4d62ea49
2024-01-03T20:19:06Z
go
2024-01-26T18:48:04Z
core/integration/module_test.go
}) }) t.Run("arg as other module object", func(t *testing.T) { t.Parallel() t.Run("direct", func(t *testing.T) { t.Parallel() _, err := ctr.WithNewFile("main.go", dagger.ContainerWithNewFileOpts{ Contents: `package main type Test struct{} func (m *Test) Fn(obj *DepObj) error { return nil } `, }). With(daggerFunctions()). Stdout(ctx) require.Error(t, err) require.ErrorContains(t, err, fmt.Sprintf( "object %q function %q arg %q cannot reference external type from dependency module %q", "Test", "Fn", "obj", "dep", )) }) t.Run("list", func(t *testing.T) { t.Parallel() _, err := ctr.WithNewFile("main.go", dagger.ContainerWithNewFileOpts{ Contents: `package main type Test struct{} func (m *Test) Fn(obj []*DepObj) error { return nil }
closed
dagger/dagger
https://github.com/dagger/dagger
6,359
CLI: update handling of various core types
As described in [this comment](https://github.com/dagger/dagger/issues/6229#issuecomment-1863649336) (and that issue generally), we need to make some adjustments to the CLIs behavior when `dagger call` ends in various core types. There's a handful of related adjustments needed here. Creating as a checklist for now to save issue spam; can break down into more issues if useful though. I'm including my initial suggestions on how to handle these, but to be clear these are not finalized decisions and the final call can be made as part of implementing this - [ ] Handle arbitrary user objects - Print fields (as in `TypeDef` fields, so just trivially resolvable values) as a json object - [x] Handle container - call `sync` only, rely on progress output for anything else - [x] Handle directory - call `sync` only, rely on progress output for anything else - [x] Handle file - call `sync` only, rely on progress output for anything else - [ ] Handle IDs returned by `sync` (i.e. the case where the user explicitly chains `sync`) - just rely on progress output, don't show the id
https://github.com/dagger/dagger/issues/6359
https://github.com/dagger/dagger/pull/6482
2999573c5a34e85b8baac8c0150881d9c08a86b8
d91ac42c196873830c2e0876b251f3bf4d62ea49
2024-01-03T20:19:06Z
go
2024-01-26T18:48:04Z
core/integration/module_test.go
`, }). With(daggerFunctions()). Stdout(ctx) require.Error(t, err) require.ErrorContains(t, err, fmt.Sprintf( "object %q function %q arg %q cannot reference external type from dependency module %q", "Test", "Fn", "obj", "dep", )) }) }) t.Run("field as other module object", func(t *testing.T) { t.Parallel() t.Run("direct", func(t *testing.T) { t.Parallel() _, err := ctr. WithNewFile("main.go", dagger.ContainerWithNewFileOpts{ Contents: `package main type Test struct{} type Obj struct { Foo *DepObj } func (m *Test) Fn() (*Obj, error) { return nil, nil } `, }). With(daggerFunctions()). Stdout(ctx) require.Error(t, err)
closed
dagger/dagger
https://github.com/dagger/dagger
6,359
CLI: update handling of various core types
As described in [this comment](https://github.com/dagger/dagger/issues/6229#issuecomment-1863649336) (and that issue generally), we need to make some adjustments to the CLIs behavior when `dagger call` ends in various core types. There's a handful of related adjustments needed here. Creating as a checklist for now to save issue spam; can break down into more issues if useful though. I'm including my initial suggestions on how to handle these, but to be clear these are not finalized decisions and the final call can be made as part of implementing this - [ ] Handle arbitrary user objects - Print fields (as in `TypeDef` fields, so just trivially resolvable values) as a json object - [x] Handle container - call `sync` only, rely on progress output for anything else - [x] Handle directory - call `sync` only, rely on progress output for anything else - [x] Handle file - call `sync` only, rely on progress output for anything else - [ ] Handle IDs returned by `sync` (i.e. the case where the user explicitly chains `sync`) - just rely on progress output, don't show the id
https://github.com/dagger/dagger/issues/6359
https://github.com/dagger/dagger/pull/6482
2999573c5a34e85b8baac8c0150881d9c08a86b8
d91ac42c196873830c2e0876b251f3bf4d62ea49
2024-01-03T20:19:06Z
go
2024-01-26T18:48:04Z
core/integration/module_test.go
require.ErrorContains(t, err, fmt.Sprintf( "object %q field %q cannot reference external type from dependency module %q", "Obj", "Foo", "dep", )) }) t.Run("list", func(t *testing.T) { t.Parallel() _, err := ctr. WithNewFile("main.go", dagger.ContainerWithNewFileOpts{ Contents: `package main type Test struct{} type Obj struct { Foo []*DepObj } func (m *Test) Fn() (*Obj, error) { return nil, nil } `, }). With(daggerFunctions()). Stdout(ctx) require.Error(t, err) require.ErrorContains(t, err, fmt.Sprintf( "object %q field %q cannot reference external type from dependency module %q", "Obj", "Foo", "dep", )) }) }) } func TestModulePythonWithOtherModuleTypes(t *testing.T) {
closed
dagger/dagger
https://github.com/dagger/dagger
6,359
CLI: update handling of various core types
As described in [this comment](https://github.com/dagger/dagger/issues/6229#issuecomment-1863649336) (and that issue generally), we need to make some adjustments to the CLIs behavior when `dagger call` ends in various core types. There's a handful of related adjustments needed here. Creating as a checklist for now to save issue spam; can break down into more issues if useful though. I'm including my initial suggestions on how to handle these, but to be clear these are not finalized decisions and the final call can be made as part of implementing this - [ ] Handle arbitrary user objects - Print fields (as in `TypeDef` fields, so just trivially resolvable values) as a json object - [x] Handle container - call `sync` only, rely on progress output for anything else - [x] Handle directory - call `sync` only, rely on progress output for anything else - [x] Handle file - call `sync` only, rely on progress output for anything else - [ ] Handle IDs returned by `sync` (i.e. the case where the user explicitly chains `sync`) - just rely on progress output, don't show the id
https://github.com/dagger/dagger/issues/6359
https://github.com/dagger/dagger/pull/6482
2999573c5a34e85b8baac8c0150881d9c08a86b8
d91ac42c196873830c2e0876b251f3bf4d62ea49
2024-01-03T20:19:06Z
go
2024-01-26T18:48:04Z
core/integration/module_test.go
t.Parallel() c, ctx := connect(t) ctr := c.Container().From(golangImage). WithMountedFile(testCLIBinPath, daggerCliFile(t, c)). WithWorkdir("/work/dep"). With(daggerExec("mod", "init", "--name=dep", "--sdk=python")). WithNewFile("src/main.py", dagger.ContainerWithNewFileOpts{ Contents: `from dagger import field, function, object_type @object_type class Foo: ... @object_type class Obj: foo: str = field() @object_type class Dep: @function def fn(self) -> Obj: return Obj(foo="foo") `, }). WithWorkdir("/work/test"). With(daggerExec("mod", "init", "--name=test", "--sdk=python", "--root=..")). With(daggerExec("mod", "install", "../dep")) t.Run("return as other module object", func(t *testing.T) { t.Parallel()
closed
dagger/dagger
https://github.com/dagger/dagger
6,359
CLI: update handling of various core types
As described in [this comment](https://github.com/dagger/dagger/issues/6229#issuecomment-1863649336) (and that issue generally), we need to make some adjustments to the CLIs behavior when `dagger call` ends in various core types. There's a handful of related adjustments needed here. Creating as a checklist for now to save issue spam; can break down into more issues if useful though. I'm including my initial suggestions on how to handle these, but to be clear these are not finalized decisions and the final call can be made as part of implementing this - [ ] Handle arbitrary user objects - Print fields (as in `TypeDef` fields, so just trivially resolvable values) as a json object - [x] Handle container - call `sync` only, rely on progress output for anything else - [x] Handle directory - call `sync` only, rely on progress output for anything else - [x] Handle file - call `sync` only, rely on progress output for anything else - [ ] Handle IDs returned by `sync` (i.e. the case where the user explicitly chains `sync`) - just rely on progress output, don't show the id
https://github.com/dagger/dagger/issues/6359
https://github.com/dagger/dagger/pull/6482
2999573c5a34e85b8baac8c0150881d9c08a86b8
d91ac42c196873830c2e0876b251f3bf4d62ea49
2024-01-03T20:19:06Z
go
2024-01-26T18:48:04Z
core/integration/module_test.go
t.Run("direct", func(t *testing.T) { t.Parallel() _, err := ctr. WithNewFile("src/main.py", dagger.ContainerWithNewFileOpts{ Contents: `import dagger @dagger.object_type class Test: @dagger.function def fn(self) -> dagger.DepObj: ... `, }). With(daggerFunctions()). Stdout(ctx) require.Error(t, err) require.Regexp(t, fmt.Sprintf( `object\s+%q\s+function\s+%q\s+cannot\s+return\s+external\s+type\s+from\s+dependency\s+module\s+%q`, "Test", "fn", "dep", ), err.Error()) }) t.Run("list", func(t *testing.T) { t.Parallel() _, err := ctr. WithNewFile("src/main.py", dagger.ContainerWithNewFileOpts{ Contents: `import dagger @dagger.object_type class Test: @dagger.function def fn(self) -> list[dagger.DepObj]: ...
closed
dagger/dagger
https://github.com/dagger/dagger
6,359
CLI: update handling of various core types
As described in [this comment](https://github.com/dagger/dagger/issues/6229#issuecomment-1863649336) (and that issue generally), we need to make some adjustments to the CLIs behavior when `dagger call` ends in various core types. There's a handful of related adjustments needed here. Creating as a checklist for now to save issue spam; can break down into more issues if useful though. I'm including my initial suggestions on how to handle these, but to be clear these are not finalized decisions and the final call can be made as part of implementing this - [ ] Handle arbitrary user objects - Print fields (as in `TypeDef` fields, so just trivially resolvable values) as a json object - [x] Handle container - call `sync` only, rely on progress output for anything else - [x] Handle directory - call `sync` only, rely on progress output for anything else - [x] Handle file - call `sync` only, rely on progress output for anything else - [ ] Handle IDs returned by `sync` (i.e. the case where the user explicitly chains `sync`) - just rely on progress output, don't show the id
https://github.com/dagger/dagger/issues/6359
https://github.com/dagger/dagger/pull/6482
2999573c5a34e85b8baac8c0150881d9c08a86b8
d91ac42c196873830c2e0876b251f3bf4d62ea49
2024-01-03T20:19:06Z
go
2024-01-26T18:48:04Z
core/integration/module_test.go
`, }). With(daggerFunctions()). Stdout(ctx) require.Error(t, err) require.Regexp(t, fmt.Sprintf( `object\s+%q\s+function\s+%q\s+cannot\s+return\s+external\s+type\s+from\s+dependency\s+module\s+%q`, "Test", "fn", "dep", ), err.Error()) }) }) t.Run("arg as other module object", func(t *testing.T) { t.Parallel() t.Run("direct", func(t *testing.T) { t.Parallel() _, err := ctr.WithNewFile("src/main.py", dagger.ContainerWithNewFileOpts{ Contents: `import dagger @dagger.object_type class Test: @dagger.function def fn(self, obj: dagger.DepObj): ... `, }). With(daggerFunctions()). Stdout(ctx) require.Error(t, err) require.Regexp(t, fmt.Sprintf( `object\s+%q\s+function\s+%q\s+arg\s+%q\s+cannot\s+reference\s+external\s+type\s+from\s+dependency\s+module\s+%q`, "Test", "fn", "obj", "dep",
closed
dagger/dagger
https://github.com/dagger/dagger
6,359
CLI: update handling of various core types
As described in [this comment](https://github.com/dagger/dagger/issues/6229#issuecomment-1863649336) (and that issue generally), we need to make some adjustments to the CLIs behavior when `dagger call` ends in various core types. There's a handful of related adjustments needed here. Creating as a checklist for now to save issue spam; can break down into more issues if useful though. I'm including my initial suggestions on how to handle these, but to be clear these are not finalized decisions and the final call can be made as part of implementing this - [ ] Handle arbitrary user objects - Print fields (as in `TypeDef` fields, so just trivially resolvable values) as a json object - [x] Handle container - call `sync` only, rely on progress output for anything else - [x] Handle directory - call `sync` only, rely on progress output for anything else - [x] Handle file - call `sync` only, rely on progress output for anything else - [ ] Handle IDs returned by `sync` (i.e. the case where the user explicitly chains `sync`) - just rely on progress output, don't show the id
https://github.com/dagger/dagger/issues/6359
https://github.com/dagger/dagger/pull/6482
2999573c5a34e85b8baac8c0150881d9c08a86b8
d91ac42c196873830c2e0876b251f3bf4d62ea49
2024-01-03T20:19:06Z
go
2024-01-26T18:48:04Z
core/integration/module_test.go
), err.Error()) }) t.Run("list", func(t *testing.T) { t.Parallel() _, err := ctr.WithNewFile("src/main.py", dagger.ContainerWithNewFileOpts{ Contents: `import dagger @dagger.object_type class Test: @dagger.function def fn(self, obj: list[dagger.DepObj]): ... `, }). With(daggerFunctions()). Stdout(ctx) require.Error(t, err) require.Regexp(t, fmt.Sprintf( `object\s+%q\s+function\s+%q\s+arg\s+%q\s+cannot\s+reference\s+external\s+type\s+from\s+dependency\s+module\s+%q`, "Test", "fn", "obj", "dep", ), err.Error()) }) }) t.Run("field as other module object", func(t *testing.T) { t.Parallel() t.Run("direct", func(t *testing.T) { t.Parallel() _, err := ctr. WithNewFile("src/main.py", dagger.ContainerWithNewFileOpts{ Contents: `import dagger @dagger.object_type
closed
dagger/dagger
https://github.com/dagger/dagger
6,359
CLI: update handling of various core types
As described in [this comment](https://github.com/dagger/dagger/issues/6229#issuecomment-1863649336) (and that issue generally), we need to make some adjustments to the CLIs behavior when `dagger call` ends in various core types. There's a handful of related adjustments needed here. Creating as a checklist for now to save issue spam; can break down into more issues if useful though. I'm including my initial suggestions on how to handle these, but to be clear these are not finalized decisions and the final call can be made as part of implementing this - [ ] Handle arbitrary user objects - Print fields (as in `TypeDef` fields, so just trivially resolvable values) as a json object - [x] Handle container - call `sync` only, rely on progress output for anything else - [x] Handle directory - call `sync` only, rely on progress output for anything else - [x] Handle file - call `sync` only, rely on progress output for anything else - [ ] Handle IDs returned by `sync` (i.e. the case where the user explicitly chains `sync`) - just rely on progress output, don't show the id
https://github.com/dagger/dagger/issues/6359
https://github.com/dagger/dagger/pull/6482
2999573c5a34e85b8baac8c0150881d9c08a86b8
d91ac42c196873830c2e0876b251f3bf4d62ea49
2024-01-03T20:19:06Z
go
2024-01-26T18:48:04Z
core/integration/module_test.go
class Obj: foo: dagger.DepObj = dagger.field() @dagger.object_type class Test: @dagger.function def fn(self) -> Obj: ... `, }). With(daggerFunctions()). Stdout(ctx) require.Error(t, err) require.Regexp(t, fmt.Sprintf( `object\s+%q\s+field\s+%q\s+cannot\s+reference\s+external\s+type\s+from\s+dependency\s+module\s+%q`, "Obj", "foo", "dep", ), err.Error()) }) t.Run("list", func(t *testing.T) { t.Parallel() _, err := ctr. WithNewFile("src/main.py", dagger.ContainerWithNewFileOpts{ Contents: `import dagger @dagger.object_type class Obj: foo: list[dagger.DepObj] = dagger.field() @dagger.object_type class Test: @dagger.function def fn(self) -> list[Obj]: ...
closed
dagger/dagger
https://github.com/dagger/dagger
6,359
CLI: update handling of various core types
As described in [this comment](https://github.com/dagger/dagger/issues/6229#issuecomment-1863649336) (and that issue generally), we need to make some adjustments to the CLIs behavior when `dagger call` ends in various core types. There's a handful of related adjustments needed here. Creating as a checklist for now to save issue spam; can break down into more issues if useful though. I'm including my initial suggestions on how to handle these, but to be clear these are not finalized decisions and the final call can be made as part of implementing this - [ ] Handle arbitrary user objects - Print fields (as in `TypeDef` fields, so just trivially resolvable values) as a json object - [x] Handle container - call `sync` only, rely on progress output for anything else - [x] Handle directory - call `sync` only, rely on progress output for anything else - [x] Handle file - call `sync` only, rely on progress output for anything else - [ ] Handle IDs returned by `sync` (i.e. the case where the user explicitly chains `sync`) - just rely on progress output, don't show the id
https://github.com/dagger/dagger/issues/6359
https://github.com/dagger/dagger/pull/6482
2999573c5a34e85b8baac8c0150881d9c08a86b8
d91ac42c196873830c2e0876b251f3bf4d62ea49
2024-01-03T20:19:06Z
go
2024-01-26T18:48:04Z
core/integration/module_test.go
`, }). With(daggerFunctions()). Stdout(ctx) require.Error(t, err) require.Regexp(t, fmt.Sprintf( `object\s+%q\s+field\s+%q\s+cannot\s+reference\s+external\s+type\s+from\s+dependency\s+module\s+%q`, "Obj", "foo", "dep", ), err.Error()) }) }) } var useInner = `package main type Dep struct{} func (m *Dep) Hello() string { return "hello" } ` var useGoOuter = `package main import "context" type Use struct{} func (m *Use) UseHello(ctx context.Context) (string, error) { return dag.Dep().Hello(ctx) } ` var usePythonOuter = `from dagger import dag, function @function def use_hello() -> str: return dag.dep().hello() `
closed
dagger/dagger
https://github.com/dagger/dagger
6,359
CLI: update handling of various core types
As described in [this comment](https://github.com/dagger/dagger/issues/6229#issuecomment-1863649336) (and that issue generally), we need to make some adjustments to the CLIs behavior when `dagger call` ends in various core types. There's a handful of related adjustments needed here. Creating as a checklist for now to save issue spam; can break down into more issues if useful though. I'm including my initial suggestions on how to handle these, but to be clear these are not finalized decisions and the final call can be made as part of implementing this - [ ] Handle arbitrary user objects - Print fields (as in `TypeDef` fields, so just trivially resolvable values) as a json object - [x] Handle container - call `sync` only, rely on progress output for anything else - [x] Handle directory - call `sync` only, rely on progress output for anything else - [x] Handle file - call `sync` only, rely on progress output for anything else - [ ] Handle IDs returned by `sync` (i.e. the case where the user explicitly chains `sync`) - just rely on progress output, don't show the id
https://github.com/dagger/dagger/issues/6359
https://github.com/dagger/dagger/pull/6482
2999573c5a34e85b8baac8c0150881d9c08a86b8
d91ac42c196873830c2e0876b251f3bf4d62ea49
2024-01-03T20:19:06Z
go
2024-01-26T18:48:04Z
core/integration/module_test.go
var useTSOuter = ` import { dag, object, func } from '@dagger.io/dagger' @object class Use { @func async useHello(): Promise<string> { return dag.dep().hello() } } ` func TestModuleUseLocal(t *testing.T) { t.Parallel() c, ctx := connect(t) type testCase struct { sdk string source string } for _, tc := range []testCase{ { sdk: "go", source: useGoOuter, }, { sdk: "python", source: usePythonOuter, }, { sdk: "typescript", source: useTSOuter, },
closed
dagger/dagger
https://github.com/dagger/dagger
6,359
CLI: update handling of various core types
As described in [this comment](https://github.com/dagger/dagger/issues/6229#issuecomment-1863649336) (and that issue generally), we need to make some adjustments to the CLIs behavior when `dagger call` ends in various core types. There's a handful of related adjustments needed here. Creating as a checklist for now to save issue spam; can break down into more issues if useful though. I'm including my initial suggestions on how to handle these, but to be clear these are not finalized decisions and the final call can be made as part of implementing this - [ ] Handle arbitrary user objects - Print fields (as in `TypeDef` fields, so just trivially resolvable values) as a json object - [x] Handle container - call `sync` only, rely on progress output for anything else - [x] Handle directory - call `sync` only, rely on progress output for anything else - [x] Handle file - call `sync` only, rely on progress output for anything else - [ ] Handle IDs returned by `sync` (i.e. the case where the user explicitly chains `sync`) - just rely on progress output, don't show the id
https://github.com/dagger/dagger/issues/6359
https://github.com/dagger/dagger/pull/6482
2999573c5a34e85b8baac8c0150881d9c08a86b8
d91ac42c196873830c2e0876b251f3bf4d62ea49
2024-01-03T20:19:06Z
go
2024-01-26T18:48:04Z
core/integration/module_test.go
} { tc := tc t.Run(fmt.Sprintf("%s uses go", tc.sdk), func(t *testing.T) { t.Parallel() modGen := c.Container().From(golangImage). WithMountedFile(testCLIBinPath, daggerCliFile(t, c)). WithWorkdir("/work/dep"). With(daggerExec("mod", "init", "--name=dep", "--sdk=go")). With(sdkSource("go", useInner)). WithWorkdir("/work"). With(daggerExec("mod", "init", "--name=use", "--sdk="+tc.sdk)). With(sdkSource(tc.sdk, tc.source)). With(daggerExec("mod", "install", "./dep")) if tc.sdk == "go" { logGen(ctx, t, modGen.Directory(".")) } out, err := modGen.With(daggerQuery(`{use{useHello}}`)).Stdout(ctx) require.NoError(t, err) require.JSONEq(t, `{"use":{"useHello":"hello"}}`, out) _, err = modGen.With(daggerQuery(`{dep{hello}}`)).Stdout(ctx) require.Error(t, err) require.ErrorContains(t, err, `Query has no such field: "dep"`) }) } } func TestModuleCodegenOnDepChange(t *testing.T) { t.Parallel() c, ctx := connect(t) type testCase struct {
closed
dagger/dagger
https://github.com/dagger/dagger
6,359
CLI: update handling of various core types
As described in [this comment](https://github.com/dagger/dagger/issues/6229#issuecomment-1863649336) (and that issue generally), we need to make some adjustments to the CLIs behavior when `dagger call` ends in various core types. There's a handful of related adjustments needed here. Creating as a checklist for now to save issue spam; can break down into more issues if useful though. I'm including my initial suggestions on how to handle these, but to be clear these are not finalized decisions and the final call can be made as part of implementing this - [ ] Handle arbitrary user objects - Print fields (as in `TypeDef` fields, so just trivially resolvable values) as a json object - [x] Handle container - call `sync` only, rely on progress output for anything else - [x] Handle directory - call `sync` only, rely on progress output for anything else - [x] Handle file - call `sync` only, rely on progress output for anything else - [ ] Handle IDs returned by `sync` (i.e. the case where the user explicitly chains `sync`) - just rely on progress output, don't show the id
https://github.com/dagger/dagger/issues/6359
https://github.com/dagger/dagger/pull/6482
2999573c5a34e85b8baac8c0150881d9c08a86b8
d91ac42c196873830c2e0876b251f3bf4d62ea49
2024-01-03T20:19:06Z
go
2024-01-26T18:48:04Z
core/integration/module_test.go
sdk string source string changed string expected string } for _, tc := range []testCase{ { sdk: "go", source: useGoOuter, expected: "Hellov2", changed: strings.ReplaceAll(useGoOuter, `Hello(ctx)`, `Hellov2(ctx)`), }, { sdk: "python", source: usePythonOuter, expected: "hellov2", changed: strings.ReplaceAll(usePythonOuter, `.hello()`, `.hellov2()`), }, { sdk: "typescript", source: useTSOuter, expected: "hellov2", changed: strings.ReplaceAll(useTSOuter, `.hello()`, `.hellov2()`), }, } { tc := tc t.Run(fmt.Sprintf("%s uses go", tc.sdk), func(t *testing.T) { t.Parallel() modGen := c.Container().From(golangImage). WithMountedFile(testCLIBinPath, daggerCliFile(t, c)).
closed
dagger/dagger
https://github.com/dagger/dagger
6,359
CLI: update handling of various core types
As described in [this comment](https://github.com/dagger/dagger/issues/6229#issuecomment-1863649336) (and that issue generally), we need to make some adjustments to the CLIs behavior when `dagger call` ends in various core types. There's a handful of related adjustments needed here. Creating as a checklist for now to save issue spam; can break down into more issues if useful though. I'm including my initial suggestions on how to handle these, but to be clear these are not finalized decisions and the final call can be made as part of implementing this - [ ] Handle arbitrary user objects - Print fields (as in `TypeDef` fields, so just trivially resolvable values) as a json object - [x] Handle container - call `sync` only, rely on progress output for anything else - [x] Handle directory - call `sync` only, rely on progress output for anything else - [x] Handle file - call `sync` only, rely on progress output for anything else - [ ] Handle IDs returned by `sync` (i.e. the case where the user explicitly chains `sync`) - just rely on progress output, don't show the id
https://github.com/dagger/dagger/issues/6359
https://github.com/dagger/dagger/pull/6482
2999573c5a34e85b8baac8c0150881d9c08a86b8
d91ac42c196873830c2e0876b251f3bf4d62ea49
2024-01-03T20:19:06Z
go
2024-01-26T18:48:04Z
core/integration/module_test.go
WithWorkdir("/work/dep"). With(daggerExec("mod", "init", "--name=dep", "--sdk=go")). With(sdkSource("go", useInner)). WithWorkdir("/work"). With(daggerExec("mod", "init", "--name=use", "--sdk="+tc.sdk)). With(sdkSource(tc.sdk, tc.source)). With(daggerExec("mod", "install", "./dep")) if tc.sdk == "go" { logGen(ctx, t, modGen.Directory(".")) } out, err := modGen.With(daggerQuery(`{use{useHello}}`)).Stdout(ctx) require.NoError(t, err) require.JSONEq(t, `{"use":{"useHello":"hello"}}`, out) newInner := strings.ReplaceAll(useInner, `Hello()`, `Hellov2()`) modGen = modGen. WithWorkdir("/work/dep"). With(sdkSource("go", newInner)). WithWorkdir("/work"). With(daggerExec("mod", "sync")) codegenContents, err := modGen.File(sdkCodegenFile(t, tc.sdk)).Contents(ctx) require.NoError(t, err) require.Contains(t, codegenContents, tc.expected) modGen = modGen.With(sdkSource(tc.sdk, tc.changed)) out, err = modGen.With(daggerQuery(`{use{useHello}}`)).Stdout(ctx) require.NoError(t, err) require.JSONEq(t, `{"use":{"useHello":"hello"}}`, out) }) } }
closed
dagger/dagger
https://github.com/dagger/dagger
6,359
CLI: update handling of various core types
As described in [this comment](https://github.com/dagger/dagger/issues/6229#issuecomment-1863649336) (and that issue generally), we need to make some adjustments to the CLIs behavior when `dagger call` ends in various core types. There's a handful of related adjustments needed here. Creating as a checklist for now to save issue spam; can break down into more issues if useful though. I'm including my initial suggestions on how to handle these, but to be clear these are not finalized decisions and the final call can be made as part of implementing this - [ ] Handle arbitrary user objects - Print fields (as in `TypeDef` fields, so just trivially resolvable values) as a json object - [x] Handle container - call `sync` only, rely on progress output for anything else - [x] Handle directory - call `sync` only, rely on progress output for anything else - [x] Handle file - call `sync` only, rely on progress output for anything else - [ ] Handle IDs returned by `sync` (i.e. the case where the user explicitly chains `sync`) - just rely on progress output, don't show the id
https://github.com/dagger/dagger/issues/6359
https://github.com/dagger/dagger/pull/6482
2999573c5a34e85b8baac8c0150881d9c08a86b8
d91ac42c196873830c2e0876b251f3bf4d62ea49
2024-01-03T20:19:06Z
go
2024-01-26T18:48:04Z
core/integration/module_test.go
func TestModuleSyncDeps(t *testing.T) { t.Parallel() c, ctx := connect(t) type testCase struct { sdk string source string } for _, tc := range []testCase{ { sdk: "go", source: useGoOuter, }, { sdk: "python", source: usePythonOuter, }, { sdk: "typescript", source: useTSOuter, }, } { tc := tc t.Run(fmt.Sprintf("%s uses go", tc.sdk), func(t *testing.T) { t.Parallel() modGen := c.Container().From(golangImage). WithMountedFile(testCLIBinPath, daggerCliFile(t, c)). WithWorkdir("/work/dep"). With(daggerExec("mod", "init", "--name=dep", "--sdk=go")). With(sdkSource("go", useInner)).
closed
dagger/dagger
https://github.com/dagger/dagger
6,359
CLI: update handling of various core types
As described in [this comment](https://github.com/dagger/dagger/issues/6229#issuecomment-1863649336) (and that issue generally), we need to make some adjustments to the CLIs behavior when `dagger call` ends in various core types. There's a handful of related adjustments needed here. Creating as a checklist for now to save issue spam; can break down into more issues if useful though. I'm including my initial suggestions on how to handle these, but to be clear these are not finalized decisions and the final call can be made as part of implementing this - [ ] Handle arbitrary user objects - Print fields (as in `TypeDef` fields, so just trivially resolvable values) as a json object - [x] Handle container - call `sync` only, rely on progress output for anything else - [x] Handle directory - call `sync` only, rely on progress output for anything else - [x] Handle file - call `sync` only, rely on progress output for anything else - [ ] Handle IDs returned by `sync` (i.e. the case where the user explicitly chains `sync`) - just rely on progress output, don't show the id
https://github.com/dagger/dagger/issues/6359
https://github.com/dagger/dagger/pull/6482
2999573c5a34e85b8baac8c0150881d9c08a86b8
d91ac42c196873830c2e0876b251f3bf4d62ea49
2024-01-03T20:19:06Z
go
2024-01-26T18:48:04Z
core/integration/module_test.go
WithWorkdir("/work"). With(daggerExec("mod", "init", "--name=use", "--sdk="+tc.sdk)). With(sdkSource(tc.sdk, tc.source)). With(daggerExec("mod", "install", "./dep")) if tc.sdk == "go" { logGen(ctx, t, modGen.Directory(".")) } modGen = modGen.With(daggerQuery(`{use{useHello}}`)) out, err := modGen.Stdout(ctx) require.NoError(t, err) require.JSONEq(t, `{"use":{"useHello":"hello"}}`, out) newInner := strings.ReplaceAll(useInner, `"hello"`, `"goodbye"`) modGen = modGen. WithWorkdir("/work/dep"). With(sdkSource("go", newInner)). WithWorkdir("/work"). With(daggerExec("mod", "sync")) if tc.sdk == "go" { logGen(ctx, t, modGen.Directory(".")) } out, err = modGen.With(daggerQuery(`{use{useHello}}`)).Stdout(ctx) require.NoError(t, err) require.JSONEq(t, `{"use":{"useHello":"goodbye"}}`, out) }) } } func TestModuleUseLocalMulti(t *testing.T) { t.Parallel() c, ctx := connect(t) type testCase struct {
closed
dagger/dagger
https://github.com/dagger/dagger
6,359
CLI: update handling of various core types
As described in [this comment](https://github.com/dagger/dagger/issues/6229#issuecomment-1863649336) (and that issue generally), we need to make some adjustments to the CLIs behavior when `dagger call` ends in various core types. There's a handful of related adjustments needed here. Creating as a checklist for now to save issue spam; can break down into more issues if useful though. I'm including my initial suggestions on how to handle these, but to be clear these are not finalized decisions and the final call can be made as part of implementing this - [ ] Handle arbitrary user objects - Print fields (as in `TypeDef` fields, so just trivially resolvable values) as a json object - [x] Handle container - call `sync` only, rely on progress output for anything else - [x] Handle directory - call `sync` only, rely on progress output for anything else - [x] Handle file - call `sync` only, rely on progress output for anything else - [ ] Handle IDs returned by `sync` (i.e. the case where the user explicitly chains `sync`) - just rely on progress output, don't show the id
https://github.com/dagger/dagger/issues/6359
https://github.com/dagger/dagger/pull/6482
2999573c5a34e85b8baac8c0150881d9c08a86b8
d91ac42c196873830c2e0876b251f3bf4d62ea49
2024-01-03T20:19:06Z
go
2024-01-26T18:48:04Z
core/integration/module_test.go
sdk string source string } for _, tc := range []testCase{ { sdk: "go", source: `package main import "context" import "fmt" type Use struct {} func (m *Use) Names(ctx context.Context) ([]string, error) { fooName, err := dag.Foo().Name(ctx) if err != nil { return nil, fmt.Errorf("foo.name: %w", err) } barName, err := dag.Bar().Name(ctx) if err != nil { return nil, fmt.Errorf("bar.name: %w", err) } return []string{fooName, barName}, nil } `, }, { sdk: "python", source: `from dagger import dag, function @function async def names() -> list[str]:
closed
dagger/dagger
https://github.com/dagger/dagger
6,359
CLI: update handling of various core types
As described in [this comment](https://github.com/dagger/dagger/issues/6229#issuecomment-1863649336) (and that issue generally), we need to make some adjustments to the CLIs behavior when `dagger call` ends in various core types. There's a handful of related adjustments needed here. Creating as a checklist for now to save issue spam; can break down into more issues if useful though. I'm including my initial suggestions on how to handle these, but to be clear these are not finalized decisions and the final call can be made as part of implementing this - [ ] Handle arbitrary user objects - Print fields (as in `TypeDef` fields, so just trivially resolvable values) as a json object - [x] Handle container - call `sync` only, rely on progress output for anything else - [x] Handle directory - call `sync` only, rely on progress output for anything else - [x] Handle file - call `sync` only, rely on progress output for anything else - [ ] Handle IDs returned by `sync` (i.e. the case where the user explicitly chains `sync`) - just rely on progress output, don't show the id
https://github.com/dagger/dagger/issues/6359
https://github.com/dagger/dagger/pull/6482
2999573c5a34e85b8baac8c0150881d9c08a86b8
d91ac42c196873830c2e0876b251f3bf4d62ea49
2024-01-03T20:19:06Z
go
2024-01-26T18:48:04Z
core/integration/module_test.go
return [ await dag.foo().name(), await dag.bar().name(), ] `, }, { sdk: "typescript", source: ` import { dag, object, func } from '@dagger.io/dagger' @object class Use { @func async names(): Promise<string[]> { return [await dag.foo().name(), await dag.bar().name()] } } `, }, } { tc := tc t.Run(fmt.Sprintf("%s uses go", tc.sdk), func(t *testing.T) { t.Parallel() modGen := c.Container().From(golangImage). WithMountedFile(testCLIBinPath, daggerCliFile(t, c)). WithWorkdir("/work/foo"). WithNewFile("/work/foo/main.go", dagger.ContainerWithNewFileOpts{ Contents: `package main type Foo struct {} func (m *Foo) Name() string { return "foo" }
closed
dagger/dagger
https://github.com/dagger/dagger
6,359
CLI: update handling of various core types
As described in [this comment](https://github.com/dagger/dagger/issues/6229#issuecomment-1863649336) (and that issue generally), we need to make some adjustments to the CLIs behavior when `dagger call` ends in various core types. There's a handful of related adjustments needed here. Creating as a checklist for now to save issue spam; can break down into more issues if useful though. I'm including my initial suggestions on how to handle these, but to be clear these are not finalized decisions and the final call can be made as part of implementing this - [ ] Handle arbitrary user objects - Print fields (as in `TypeDef` fields, so just trivially resolvable values) as a json object - [x] Handle container - call `sync` only, rely on progress output for anything else - [x] Handle directory - call `sync` only, rely on progress output for anything else - [x] Handle file - call `sync` only, rely on progress output for anything else - [ ] Handle IDs returned by `sync` (i.e. the case where the user explicitly chains `sync`) - just rely on progress output, don't show the id
https://github.com/dagger/dagger/issues/6359
https://github.com/dagger/dagger/pull/6482
2999573c5a34e85b8baac8c0150881d9c08a86b8
d91ac42c196873830c2e0876b251f3bf4d62ea49
2024-01-03T20:19:06Z
go
2024-01-26T18:48:04Z
core/integration/module_test.go
`, }). With(daggerExec("mod", "init", "--name=foo", "--sdk=go")). WithWorkdir("/work/bar"). WithNewFile("/work/bar/main.go", dagger.ContainerWithNewFileOpts{ Contents: `package main type Bar struct {} func (m *Bar) Name() string { return "bar" } `, }). With(daggerExec("mod", "init", "--name=bar", "--sdk=go")). WithWorkdir("/work"). With(daggerExec("mod", "init", "--name=use", "--sdk="+tc.sdk)). With(daggerExec("mod", "install", "./foo")). With(daggerExec("mod", "install", "./bar")). With(sdkSource(tc.sdk, tc.source)). WithEnvVariable("BUST", identity.NewID()) if tc.sdk == "go" { logGen(ctx, t, modGen.Directory(".")) } out, err := modGen.With(daggerQuery(`{use{names}}`)).Stdout(ctx) require.NoError(t, err) require.JSONEq(t, `{"use":{"names":["foo", "bar"]}}`, out) }) } } func TestModuleConstructor(t *testing.T) { t.Parallel() c, ctx := connect(t) type testCase struct {
closed
dagger/dagger
https://github.com/dagger/dagger
6,359
CLI: update handling of various core types
As described in [this comment](https://github.com/dagger/dagger/issues/6229#issuecomment-1863649336) (and that issue generally), we need to make some adjustments to the CLIs behavior when `dagger call` ends in various core types. There's a handful of related adjustments needed here. Creating as a checklist for now to save issue spam; can break down into more issues if useful though. I'm including my initial suggestions on how to handle these, but to be clear these are not finalized decisions and the final call can be made as part of implementing this - [ ] Handle arbitrary user objects - Print fields (as in `TypeDef` fields, so just trivially resolvable values) as a json object - [x] Handle container - call `sync` only, rely on progress output for anything else - [x] Handle directory - call `sync` only, rely on progress output for anything else - [x] Handle file - call `sync` only, rely on progress output for anything else - [ ] Handle IDs returned by `sync` (i.e. the case where the user explicitly chains `sync`) - just rely on progress output, don't show the id
https://github.com/dagger/dagger/issues/6359
https://github.com/dagger/dagger/pull/6482
2999573c5a34e85b8baac8c0150881d9c08a86b8
d91ac42c196873830c2e0876b251f3bf4d62ea49
2024-01-03T20:19:06Z
go
2024-01-26T18:48:04Z
core/integration/module_test.go
sdk string source string } t.Run("basic", func(t *testing.T) { t.Parallel() for _, tc := range []testCase{ { sdk: "go", source: `package main import ( "context" ) func New( ctx context.Context, foo string, bar Optional[int], baz []string, dir *Directory, ) *Test { return &Test{ Foo: foo,
closed
dagger/dagger
https://github.com/dagger/dagger
6,359
CLI: update handling of various core types
As described in [this comment](https://github.com/dagger/dagger/issues/6229#issuecomment-1863649336) (and that issue generally), we need to make some adjustments to the CLIs behavior when `dagger call` ends in various core types. There's a handful of related adjustments needed here. Creating as a checklist for now to save issue spam; can break down into more issues if useful though. I'm including my initial suggestions on how to handle these, but to be clear these are not finalized decisions and the final call can be made as part of implementing this - [ ] Handle arbitrary user objects - Print fields (as in `TypeDef` fields, so just trivially resolvable values) as a json object - [x] Handle container - call `sync` only, rely on progress output for anything else - [x] Handle directory - call `sync` only, rely on progress output for anything else - [x] Handle file - call `sync` only, rely on progress output for anything else - [ ] Handle IDs returned by `sync` (i.e. the case where the user explicitly chains `sync`) - just rely on progress output, don't show the id
https://github.com/dagger/dagger/issues/6359
https://github.com/dagger/dagger/pull/6482
2999573c5a34e85b8baac8c0150881d9c08a86b8
d91ac42c196873830c2e0876b251f3bf4d62ea49
2024-01-03T20:19:06Z
go
2024-01-26T18:48:04Z
core/integration/module_test.go
Bar: bar.GetOr(42), Baz: baz, Dir: dir, } } type Test struct { Foo string Bar int Baz []string Dir *Directory NeverSetDir *Directory } func (m *Test) GimmeFoo() string { return m.Foo } func (m *Test) GimmeBar() int { return m.Bar } func (m *Test) GimmeBaz() []string { return m.Baz } func (m *Test) GimmeDirEnts(ctx context.Context) ([]string, error) { return m.Dir.Entries(ctx) } `, }, { sdk: "python", source: `import dagger from dagger import field, function, object_type
closed
dagger/dagger
https://github.com/dagger/dagger
6,359
CLI: update handling of various core types
As described in [this comment](https://github.com/dagger/dagger/issues/6229#issuecomment-1863649336) (and that issue generally), we need to make some adjustments to the CLIs behavior when `dagger call` ends in various core types. There's a handful of related adjustments needed here. Creating as a checklist for now to save issue spam; can break down into more issues if useful though. I'm including my initial suggestions on how to handle these, but to be clear these are not finalized decisions and the final call can be made as part of implementing this - [ ] Handle arbitrary user objects - Print fields (as in `TypeDef` fields, so just trivially resolvable values) as a json object - [x] Handle container - call `sync` only, rely on progress output for anything else - [x] Handle directory - call `sync` only, rely on progress output for anything else - [x] Handle file - call `sync` only, rely on progress output for anything else - [ ] Handle IDs returned by `sync` (i.e. the case where the user explicitly chains `sync`) - just rely on progress output, don't show the id
https://github.com/dagger/dagger/issues/6359
https://github.com/dagger/dagger/pull/6482
2999573c5a34e85b8baac8c0150881d9c08a86b8
d91ac42c196873830c2e0876b251f3bf4d62ea49
2024-01-03T20:19:06Z
go
2024-01-26T18:48:04Z
core/integration/module_test.go
@object_type class Test: foo: str = field() dir: dagger.Directory = field() bar: int = field(default=42) baz: list[str] = field(default=list) never_set_dir: dagger.Directory | None = field(default=None) @function def gimme_foo(self) -> str: return self.foo @function def gimme_bar(self) -> int: return self.bar @function def gimme_baz(self) -> list[str]: return self.baz @function async def gimme_dir_ents(self) -> list[str]: return await self.dir.entries() `, }, { sdk: "typescript", source: ` import { Directory, object, func, field } from '@dagger.io/dagger'; @object class Test { @field foo: string @field
closed
dagger/dagger
https://github.com/dagger/dagger
6,359
CLI: update handling of various core types
As described in [this comment](https://github.com/dagger/dagger/issues/6229#issuecomment-1863649336) (and that issue generally), we need to make some adjustments to the CLIs behavior when `dagger call` ends in various core types. There's a handful of related adjustments needed here. Creating as a checklist for now to save issue spam; can break down into more issues if useful though. I'm including my initial suggestions on how to handle these, but to be clear these are not finalized decisions and the final call can be made as part of implementing this - [ ] Handle arbitrary user objects - Print fields (as in `TypeDef` fields, so just trivially resolvable values) as a json object - [x] Handle container - call `sync` only, rely on progress output for anything else - [x] Handle directory - call `sync` only, rely on progress output for anything else - [x] Handle file - call `sync` only, rely on progress output for anything else - [ ] Handle IDs returned by `sync` (i.e. the case where the user explicitly chains `sync`) - just rely on progress output, don't show the id
https://github.com/dagger/dagger/issues/6359
https://github.com/dagger/dagger/pull/6482
2999573c5a34e85b8baac8c0150881d9c08a86b8
d91ac42c196873830c2e0876b251f3bf4d62ea49
2024-01-03T20:19:06Z
go
2024-01-26T18:48:04Z
core/integration/module_test.go
dir: Directory @field bar: number @field baz: string[] @field neverSetDir?: Directory constructor(foo: string, dir: Directory, bar = 42, baz: string[] = []) { this.foo = foo; this.dir = dir; this.bar = bar; this.baz = baz; } @func gimmeFoo(): string { return this.foo; } @func gimmeBar(): number { return this.bar; } @func gimmeBaz(): string[] { return this.baz; } @func async gimmeDirEnts(): Promise<string[]> { return this.dir.entries(); } }
closed
dagger/dagger
https://github.com/dagger/dagger
6,359
CLI: update handling of various core types
As described in [this comment](https://github.com/dagger/dagger/issues/6229#issuecomment-1863649336) (and that issue generally), we need to make some adjustments to the CLIs behavior when `dagger call` ends in various core types. There's a handful of related adjustments needed here. Creating as a checklist for now to save issue spam; can break down into more issues if useful though. I'm including my initial suggestions on how to handle these, but to be clear these are not finalized decisions and the final call can be made as part of implementing this - [ ] Handle arbitrary user objects - Print fields (as in `TypeDef` fields, so just trivially resolvable values) as a json object - [x] Handle container - call `sync` only, rely on progress output for anything else - [x] Handle directory - call `sync` only, rely on progress output for anything else - [x] Handle file - call `sync` only, rely on progress output for anything else - [ ] Handle IDs returned by `sync` (i.e. the case where the user explicitly chains `sync`) - just rely on progress output, don't show the id
https://github.com/dagger/dagger/issues/6359
https://github.com/dagger/dagger/pull/6482
2999573c5a34e85b8baac8c0150881d9c08a86b8
d91ac42c196873830c2e0876b251f3bf4d62ea49
2024-01-03T20:19:06Z
go
2024-01-26T18:48:04Z
core/integration/module_test.go
`, }, } { tc := tc t.Run(tc.sdk, func(t *testing.T) { t.Parallel() ctr := c.Container().From(golangImage). WithMountedFile(testCLIBinPath, daggerCliFile(t, c)). WithWorkdir("/work/test"). With(daggerExec("mod", "init", "--name=test", "--sdk="+tc.sdk)). With(sdkSource(tc.sdk, tc.source)) out, err := ctr.With(daggerCall("--foo=abc", "--baz=x,y,z", "--dir=.", "foo")).Stdout(ctx) require.NoError(t, err) require.Equal(t, strings.TrimSpace(out), "abc") out, err = ctr.With(daggerCall("--foo=abc", "--baz=x,y,z", "--dir=.", "gimme-foo")).Stdout(ctx) require.NoError(t, err) require.Equal(t, strings.TrimSpace(out), "abc") out, err = ctr.With(daggerCall("--foo=abc", "--baz=x,y,z", "--dir=.", "bar")).Stdout(ctx) require.NoError(t, err) require.Equal(t, strings.TrimSpace(out), "42") out, err = ctr.With(daggerCall("--foo=abc", "--baz=x,y,z", "--dir=.", "gimme-bar")).Stdout(ctx) require.NoError(t, err) require.Equal(t, strings.TrimSpace(out), "42") out, err = ctr.With(daggerCall("--foo=abc", "--bar=123", "--baz=x,y,z", "--dir=.", "bar")).Stdout(ctx) require.NoError(t, err) require.Equal(t, strings.TrimSpace(out), "123") out, err = ctr.With(daggerCall("--foo=abc", "--bar=123", "--baz=x,y,z", "--dir=.", "gimme-bar")).Stdout(ctx) require.NoError(t, err) require.Equal(t, strings.TrimSpace(out), "123") out, err = ctr.With(daggerCall("--foo=abc", "--bar=123", "--baz=x,y,z", "--dir=.", "baz")).Stdout(ctx)
closed
dagger/dagger
https://github.com/dagger/dagger
6,359
CLI: update handling of various core types
As described in [this comment](https://github.com/dagger/dagger/issues/6229#issuecomment-1863649336) (and that issue generally), we need to make some adjustments to the CLIs behavior when `dagger call` ends in various core types. There's a handful of related adjustments needed here. Creating as a checklist for now to save issue spam; can break down into more issues if useful though. I'm including my initial suggestions on how to handle these, but to be clear these are not finalized decisions and the final call can be made as part of implementing this - [ ] Handle arbitrary user objects - Print fields (as in `TypeDef` fields, so just trivially resolvable values) as a json object - [x] Handle container - call `sync` only, rely on progress output for anything else - [x] Handle directory - call `sync` only, rely on progress output for anything else - [x] Handle file - call `sync` only, rely on progress output for anything else - [ ] Handle IDs returned by `sync` (i.e. the case where the user explicitly chains `sync`) - just rely on progress output, don't show the id
https://github.com/dagger/dagger/issues/6359
https://github.com/dagger/dagger/pull/6482
2999573c5a34e85b8baac8c0150881d9c08a86b8
d91ac42c196873830c2e0876b251f3bf4d62ea49
2024-01-03T20:19:06Z
go
2024-01-26T18:48:04Z
core/integration/module_test.go
require.NoError(t, err) require.Equal(t, strings.TrimSpace(out), "x\ny\nz") out, err = ctr.With(daggerCall("--foo=abc", "--bar=123", "--baz=x,y,z", "--dir=.", "gimme-baz")).Stdout(ctx) require.NoError(t, err) require.Equal(t, strings.TrimSpace(out), "x\ny\nz") out, err = ctr.With(daggerCall("--foo=abc", "--bar=123", "--baz=x,y,z", "--dir=.", "gimme-dir-ents")).Stdout(ctx) require.NoError(t, err) require.Contains(t, strings.TrimSpace(out), "dagger.json") }) } }) t.Run("fields only", func(t *testing.T) { t.Parallel() for _, tc := range []testCase{ { sdk: "go", source: `package main import ( "context" ) func New(ctx context.Context) (Test, error) { v, err := dag.Container().From("alpine:3.18.4").File("/etc/alpine-release").Contents(ctx) if err != nil { return Test{}, err } return Test{ AlpineVersion: v, }, nil } type Test struct {
closed
dagger/dagger
https://github.com/dagger/dagger
6,359
CLI: update handling of various core types
As described in [this comment](https://github.com/dagger/dagger/issues/6229#issuecomment-1863649336) (and that issue generally), we need to make some adjustments to the CLIs behavior when `dagger call` ends in various core types. There's a handful of related adjustments needed here. Creating as a checklist for now to save issue spam; can break down into more issues if useful though. I'm including my initial suggestions on how to handle these, but to be clear these are not finalized decisions and the final call can be made as part of implementing this - [ ] Handle arbitrary user objects - Print fields (as in `TypeDef` fields, so just trivially resolvable values) as a json object - [x] Handle container - call `sync` only, rely on progress output for anything else - [x] Handle directory - call `sync` only, rely on progress output for anything else - [x] Handle file - call `sync` only, rely on progress output for anything else - [ ] Handle IDs returned by `sync` (i.e. the case where the user explicitly chains `sync`) - just rely on progress output, don't show the id
https://github.com/dagger/dagger/issues/6359
https://github.com/dagger/dagger/pull/6482
2999573c5a34e85b8baac8c0150881d9c08a86b8
d91ac42c196873830c2e0876b251f3bf4d62ea49
2024-01-03T20:19:06Z
go
2024-01-26T18:48:04Z
core/integration/module_test.go
AlpineVersion string } `, }, { sdk: "python", source: `from dagger import dag, field, function, object_type @object_type class Test: alpine_version: str = field() @classmethod async def create(cls) -> "Test": return cls(alpine_version=await ( dag.container() .from_("alpine:3.18.4") .file("/etc/alpine-release") .contents() )) `, }, { sdk: "typescript", source: ` import { dag, object, field } from "@dagger.io/dagger" @object class Test { @field alpineVersion: string // NOTE: this is standard to do async operations in the constructor. // This is only for testing purpose but it shouldn't be done in real usage.
closed
dagger/dagger
https://github.com/dagger/dagger
6,359
CLI: update handling of various core types
As described in [this comment](https://github.com/dagger/dagger/issues/6229#issuecomment-1863649336) (and that issue generally), we need to make some adjustments to the CLIs behavior when `dagger call` ends in various core types. There's a handful of related adjustments needed here. Creating as a checklist for now to save issue spam; can break down into more issues if useful though. I'm including my initial suggestions on how to handle these, but to be clear these are not finalized decisions and the final call can be made as part of implementing this - [ ] Handle arbitrary user objects - Print fields (as in `TypeDef` fields, so just trivially resolvable values) as a json object - [x] Handle container - call `sync` only, rely on progress output for anything else - [x] Handle directory - call `sync` only, rely on progress output for anything else - [x] Handle file - call `sync` only, rely on progress output for anything else - [ ] Handle IDs returned by `sync` (i.e. the case where the user explicitly chains `sync`) - just rely on progress output, don't show the id
https://github.com/dagger/dagger/issues/6359
https://github.com/dagger/dagger/pull/6482
2999573c5a34e85b8baac8c0150881d9c08a86b8
d91ac42c196873830c2e0876b251f3bf4d62ea49
2024-01-03T20:19:06Z
go
2024-01-26T18:48:04Z
core/integration/module_test.go
constructor() { return (async () => { this.alpineVersion = await dag.container().from("alpine:3.18.4").file("/etc/alpine-release").contents() return this; // Return the newly-created instance })(); } } `, }, } { tc := tc t.Run(tc.sdk, func(t *testing.T) { t.Parallel() ctr := c.Container().From(golangImage). WithMountedFile(testCLIBinPath, daggerCliFile(t, c)). WithWorkdir("/work/test"). With(daggerExec("mod", "init", "--name=test", "--sdk="+tc.sdk)). With(sdkSource(tc.sdk, tc.source)) out, err := ctr.With(daggerCall("alpine-version")).Stdout(ctx) require.NoError(t, err) require.Equal(t, strings.TrimSpace(out), "3.18.4") }) } }) t.Run("return error", func(t *testing.T) { t.Parallel() for _, tc := range []testCase{ { sdk: "go", source: `package main
closed
dagger/dagger
https://github.com/dagger/dagger
6,359
CLI: update handling of various core types
As described in [this comment](https://github.com/dagger/dagger/issues/6229#issuecomment-1863649336) (and that issue generally), we need to make some adjustments to the CLIs behavior when `dagger call` ends in various core types. There's a handful of related adjustments needed here. Creating as a checklist for now to save issue spam; can break down into more issues if useful though. I'm including my initial suggestions on how to handle these, but to be clear these are not finalized decisions and the final call can be made as part of implementing this - [ ] Handle arbitrary user objects - Print fields (as in `TypeDef` fields, so just trivially resolvable values) as a json object - [x] Handle container - call `sync` only, rely on progress output for anything else - [x] Handle directory - call `sync` only, rely on progress output for anything else - [x] Handle file - call `sync` only, rely on progress output for anything else - [ ] Handle IDs returned by `sync` (i.e. the case where the user explicitly chains `sync`) - just rely on progress output, don't show the id
https://github.com/dagger/dagger/issues/6359
https://github.com/dagger/dagger/pull/6482
2999573c5a34e85b8baac8c0150881d9c08a86b8
d91ac42c196873830c2e0876b251f3bf4d62ea49
2024-01-03T20:19:06Z
go
2024-01-26T18:48:04Z
core/integration/module_test.go
import ( "fmt" ) func New() (*Test, error) { return nil, fmt.Errorf("too bad") } type Test struct { Foo string } `, }, { sdk: "python", source: `from dagger import object_type, field @object_type class Test: foo: str = field() def __init__(self): raise ValueError("too bad") `, }, { sdk: "typescript", source: ` import { object, field } from "@dagger.io/dagger" @object class Test { @field foo: string constructor() {
closed
dagger/dagger
https://github.com/dagger/dagger
6,359
CLI: update handling of various core types
As described in [this comment](https://github.com/dagger/dagger/issues/6229#issuecomment-1863649336) (and that issue generally), we need to make some adjustments to the CLIs behavior when `dagger call` ends in various core types. There's a handful of related adjustments needed here. Creating as a checklist for now to save issue spam; can break down into more issues if useful though. I'm including my initial suggestions on how to handle these, but to be clear these are not finalized decisions and the final call can be made as part of implementing this - [ ] Handle arbitrary user objects - Print fields (as in `TypeDef` fields, so just trivially resolvable values) as a json object - [x] Handle container - call `sync` only, rely on progress output for anything else - [x] Handle directory - call `sync` only, rely on progress output for anything else - [x] Handle file - call `sync` only, rely on progress output for anything else - [ ] Handle IDs returned by `sync` (i.e. the case where the user explicitly chains `sync`) - just rely on progress output, don't show the id
https://github.com/dagger/dagger/issues/6359
https://github.com/dagger/dagger/pull/6482
2999573c5a34e85b8baac8c0150881d9c08a86b8
d91ac42c196873830c2e0876b251f3bf4d62ea49
2024-01-03T20:19:06Z
go
2024-01-26T18:48:04Z
core/integration/module_test.go
throw new Error("too bad") } } `, }, } { tc := tc t.Run(tc.sdk, func(t *testing.T) { t.Parallel() var logs safeBuffer c, ctx := connect(t, dagger.WithLogOutput(&logs)) ctr := c.Container().From(golangImage). WithMountedFile(testCLIBinPath, daggerCliFile(t, c)). WithWorkdir("/work/test"). With(daggerExec("mod", "init", "--name=test", "--sdk="+tc.sdk)). With(sdkSource(tc.sdk, tc.source)) _, err := ctr.With(daggerCall("foo")).Stdout(ctx) require.Error(t, err) require.NoError(t, c.Close()) t.Log(logs.String()) require.Contains(t, logs.String(), "too bad") }) } }) t.Run("python: with default factory", func(t *testing.T) { t.Parallel() content := identity.NewID() ctr := c.Container().From(golangImage). WithMountedFile(testCLIBinPath, daggerCliFile(t, c)). WithWorkdir("/work/test").
closed
dagger/dagger
https://github.com/dagger/dagger
6,359
CLI: update handling of various core types
As described in [this comment](https://github.com/dagger/dagger/issues/6229#issuecomment-1863649336) (and that issue generally), we need to make some adjustments to the CLIs behavior when `dagger call` ends in various core types. There's a handful of related adjustments needed here. Creating as a checklist for now to save issue spam; can break down into more issues if useful though. I'm including my initial suggestions on how to handle these, but to be clear these are not finalized decisions and the final call can be made as part of implementing this - [ ] Handle arbitrary user objects - Print fields (as in `TypeDef` fields, so just trivially resolvable values) as a json object - [x] Handle container - call `sync` only, rely on progress output for anything else - [x] Handle directory - call `sync` only, rely on progress output for anything else - [x] Handle file - call `sync` only, rely on progress output for anything else - [ ] Handle IDs returned by `sync` (i.e. the case where the user explicitly chains `sync`) - just rely on progress output, don't show the id
https://github.com/dagger/dagger/issues/6359
https://github.com/dagger/dagger/pull/6482
2999573c5a34e85b8baac8c0150881d9c08a86b8
d91ac42c196873830c2e0876b251f3bf4d62ea49
2024-01-03T20:19:06Z
go
2024-01-26T18:48:04Z
core/integration/module_test.go
With(daggerExec("mod", "init", "--name=test", "--sdk=python")). With(sdkSource("python", fmt.Sprintf(`import dagger from dagger import dag, object_type, field @object_type class Test: foo: dagger.File = field(default=lambda: ( dag.directory() .with_new_file("foo.txt", contents="%s") .file("foo.txt") )) bar: list[str] = field(default=list) `, content), )) out, err := ctr.With(daggerCall("foo")).Stdout(ctx) require.NoError(t, err) require.Equal(t, strings.TrimSpace(out), content) out, err = ctr.With(daggerCall("--foo=dagger.json", "foo")).Stdout(ctx) require.NoError(t, err) require.Contains(t, out, `"sdk": "python"`) _, err = ctr.With(daggerCall("bar")).Sync(ctx) require.NoError(t, err) }) t.Run("typescript: with default factory", func(t *testing.T) { t.Parallel() content := identity.NewID() ctr := c.Container().From(golangImage). WithMountedFile(testCLIBinPath, daggerCliFile(t, c)). WithWorkdir("/work/test"). With(daggerExec("mod", "init", "--name=test", "--sdk=typescript")). With(sdkSource("typescript", fmt.Sprintf(`
closed
dagger/dagger
https://github.com/dagger/dagger
6,359
CLI: update handling of various core types
As described in [this comment](https://github.com/dagger/dagger/issues/6229#issuecomment-1863649336) (and that issue generally), we need to make some adjustments to the CLIs behavior when `dagger call` ends in various core types. There's a handful of related adjustments needed here. Creating as a checklist for now to save issue spam; can break down into more issues if useful though. I'm including my initial suggestions on how to handle these, but to be clear these are not finalized decisions and the final call can be made as part of implementing this - [ ] Handle arbitrary user objects - Print fields (as in `TypeDef` fields, so just trivially resolvable values) as a json object - [x] Handle container - call `sync` only, rely on progress output for anything else - [x] Handle directory - call `sync` only, rely on progress output for anything else - [x] Handle file - call `sync` only, rely on progress output for anything else - [ ] Handle IDs returned by `sync` (i.e. the case where the user explicitly chains `sync`) - just rely on progress output, don't show the id
https://github.com/dagger/dagger/issues/6359
https://github.com/dagger/dagger/pull/6482
2999573c5a34e85b8baac8c0150881d9c08a86b8
d91ac42c196873830c2e0876b251f3bf4d62ea49
2024-01-03T20:19:06Z
go
2024-01-26T18:48:04Z
core/integration/module_test.go
import { dag, File, object, field } from "@dagger.io/dagger" @object class Test { @field foo: File = dag.directory().withNewFile("foo.txt", "%s").file("foo.txt") @field bar: string[] = [] // Allow foo to be set through the constructor constructor(foo?: File) { if (foo) { this.foo = foo } } } `, content), )) out, err := ctr.With(daggerCall("foo")).Stdout(ctx) require.NoError(t, err) require.Equal(t, strings.TrimSpace(out), content) out, err = ctr.With(daggerCall("--foo=dagger.json", "foo")).Stdout(ctx) require.NoError(t, err) require.Contains(t, out, `"sdk": "typescript"`) _, err = ctr.With(daggerCall("bar")).Sync(ctx) require.NoError(t, err) }) } func TestModuleWrapping(t *testing.T) { t.Parallel() c, ctx := connect(t) type testCase struct {
closed
dagger/dagger
https://github.com/dagger/dagger
6,359
CLI: update handling of various core types
As described in [this comment](https://github.com/dagger/dagger/issues/6229#issuecomment-1863649336) (and that issue generally), we need to make some adjustments to the CLIs behavior when `dagger call` ends in various core types. There's a handful of related adjustments needed here. Creating as a checklist for now to save issue spam; can break down into more issues if useful though. I'm including my initial suggestions on how to handle these, but to be clear these are not finalized decisions and the final call can be made as part of implementing this - [ ] Handle arbitrary user objects - Print fields (as in `TypeDef` fields, so just trivially resolvable values) as a json object - [x] Handle container - call `sync` only, rely on progress output for anything else - [x] Handle directory - call `sync` only, rely on progress output for anything else - [x] Handle file - call `sync` only, rely on progress output for anything else - [ ] Handle IDs returned by `sync` (i.e. the case where the user explicitly chains `sync`) - just rely on progress output, don't show the id
https://github.com/dagger/dagger/issues/6359
https://github.com/dagger/dagger/pull/6482
2999573c5a34e85b8baac8c0150881d9c08a86b8
d91ac42c196873830c2e0876b251f3bf4d62ea49
2024-01-03T20:19:06Z
go
2024-01-26T18:48:04Z
core/integration/module_test.go
sdk string source string } for _, tc := range []testCase{ { sdk: "go", source: `package main type Wrapper struct{} func (m *Wrapper) Container() *WrappedContainer { return &WrappedContainer{ dag.Container().From("alpine"), } } type WrappedContainer struct { Unwrap *Container` + "`" + `json:"unwrap"` + "`" + ` } func (c *WrappedContainer) Echo(msg string) *WrappedContainer { return &WrappedContainer{ c.Unwrap.WithExec([]string{"echo", "-n", msg}), } } `, }, { sdk: "python", source: `from typing import Self import dagger from dagger import dag, field, function, object_type @object_type class WrappedContainer:
closed
dagger/dagger
https://github.com/dagger/dagger
6,359
CLI: update handling of various core types
As described in [this comment](https://github.com/dagger/dagger/issues/6229#issuecomment-1863649336) (and that issue generally), we need to make some adjustments to the CLIs behavior when `dagger call` ends in various core types. There's a handful of related adjustments needed here. Creating as a checklist for now to save issue spam; can break down into more issues if useful though. I'm including my initial suggestions on how to handle these, but to be clear these are not finalized decisions and the final call can be made as part of implementing this - [ ] Handle arbitrary user objects - Print fields (as in `TypeDef` fields, so just trivially resolvable values) as a json object - [x] Handle container - call `sync` only, rely on progress output for anything else - [x] Handle directory - call `sync` only, rely on progress output for anything else - [x] Handle file - call `sync` only, rely on progress output for anything else - [ ] Handle IDs returned by `sync` (i.e. the case where the user explicitly chains `sync`) - just rely on progress output, don't show the id
https://github.com/dagger/dagger/issues/6359
https://github.com/dagger/dagger/pull/6482
2999573c5a34e85b8baac8c0150881d9c08a86b8
d91ac42c196873830c2e0876b251f3bf4d62ea49
2024-01-03T20:19:06Z
go
2024-01-26T18:48:04Z
core/integration/module_test.go
unwrap: dagger.Container = field() @function def echo(self, msg: str) -> Self: return WrappedContainer(unwrap=self.unwrap.with_exec(["echo", "-n", msg])) @object_type class Wrapper: @function def container(self) -> WrappedContainer: return WrappedContainer(unwrap=dag.container().from_("alpine")) `, }, { sdk: "typescript", source: ` import { dag, Container, object, func, field } from "@dagger.io/dagger" @object class WrappedContainer { @field unwrap: Container constructor(unwrap: Container) { this.unwrap = unwrap } @func echo(msg: string): WrappedContainer { return new WrappedContainer(this.unwrap.withExec(["echo", "-n", msg])) } } @object class Wrapper { @func
closed
dagger/dagger
https://github.com/dagger/dagger
6,359
CLI: update handling of various core types
As described in [this comment](https://github.com/dagger/dagger/issues/6229#issuecomment-1863649336) (and that issue generally), we need to make some adjustments to the CLIs behavior when `dagger call` ends in various core types. There's a handful of related adjustments needed here. Creating as a checklist for now to save issue spam; can break down into more issues if useful though. I'm including my initial suggestions on how to handle these, but to be clear these are not finalized decisions and the final call can be made as part of implementing this - [ ] Handle arbitrary user objects - Print fields (as in `TypeDef` fields, so just trivially resolvable values) as a json object - [x] Handle container - call `sync` only, rely on progress output for anything else - [x] Handle directory - call `sync` only, rely on progress output for anything else - [x] Handle file - call `sync` only, rely on progress output for anything else - [ ] Handle IDs returned by `sync` (i.e. the case where the user explicitly chains `sync`) - just rely on progress output, don't show the id
https://github.com/dagger/dagger/issues/6359
https://github.com/dagger/dagger/pull/6482
2999573c5a34e85b8baac8c0150881d9c08a86b8
d91ac42c196873830c2e0876b251f3bf4d62ea49
2024-01-03T20:19:06Z
go
2024-01-26T18:48:04Z
core/integration/module_test.go
container(): WrappedContainer { return new WrappedContainer(dag.container().from("alpine")) } } `, }, } { tc := tc t.Run(tc.sdk, func(t *testing.T) { t.Parallel() modGen := c.Container().From(golangImage). WithMountedFile(testCLIBinPath, daggerCliFile(t, c)). WithWorkdir("/work"). With(daggerExec("mod", "init", "--name=wrapper", "--sdk="+tc.sdk)). With(sdkSource(tc.sdk, tc.source)) if tc.sdk == "go" { logGen(ctx, t, modGen.Directory(".")) } id := identity.NewID() out, err := modGen.With(daggerQuery( fmt.Sprintf(`{wrapper{container{echo(msg:%q){unwrap{stdout}}}}}`, id), )).Stdout(ctx) require.NoError(t, err) require.JSONEq(t, fmt.Sprintf(`{"wrapper":{"container":{"echo":{"unwrap":{"stdout":%q}}}}}`, id), out) }) } } func TestModuleConfigAPI(t *testing.T) {
closed
dagger/dagger
https://github.com/dagger/dagger
6,359
CLI: update handling of various core types
As described in [this comment](https://github.com/dagger/dagger/issues/6229#issuecomment-1863649336) (and that issue generally), we need to make some adjustments to the CLIs behavior when `dagger call` ends in various core types. There's a handful of related adjustments needed here. Creating as a checklist for now to save issue spam; can break down into more issues if useful though. I'm including my initial suggestions on how to handle these, but to be clear these are not finalized decisions and the final call can be made as part of implementing this - [ ] Handle arbitrary user objects - Print fields (as in `TypeDef` fields, so just trivially resolvable values) as a json object - [x] Handle container - call `sync` only, rely on progress output for anything else - [x] Handle directory - call `sync` only, rely on progress output for anything else - [x] Handle file - call `sync` only, rely on progress output for anything else - [ ] Handle IDs returned by `sync` (i.e. the case where the user explicitly chains `sync`) - just rely on progress output, don't show the id
https://github.com/dagger/dagger/issues/6359
https://github.com/dagger/dagger/pull/6482
2999573c5a34e85b8baac8c0150881d9c08a86b8
d91ac42c196873830c2e0876b251f3bf4d62ea49
2024-01-03T20:19:06Z
go
2024-01-26T18:48:04Z
core/integration/module_test.go
t.Parallel() c, ctx := connect(t) moduleDir := c.Container().From(golangImage). WithMountedFile(testCLIBinPath, daggerCliFile(t, c)). WithWorkdir("/work/subdir"). With(daggerExec("mod", "init", "--name=test", "--sdk=go", "--root=..")). Directory("/work") cfg := c.ModuleConfig(moduleDir, dagger.ModuleConfigOpts{Subpath: "subdir"}) name, err := cfg.Name(ctx) require.NoError(t, err) require.Equal(t, "test", name) sdk, err := cfg.SDK(ctx) require.NoError(t, err) require.Equal(t, "go", sdk) root, err := cfg.Root(ctx) require.NoError(t, err) require.Equal(t, "..", root) } func TestModuleTypescriptInit(t *testing.T) { t.Run("from scratch", func(t *testing.T) { t.Parallel() c, ctx := connect(t) modGen := c.Container().From(golangImage). WithMountedFile(testCLIBinPath, daggerCliFile(t, c)). WithWorkdir("/work"). With(daggerExec("mod", "init", "--name=bare", "--sdk=typescript")) out, err := modGen. With(daggerQuery(`{bare{containerEcho(stringArg:"hello"){stdout}}}`)). Stdout(ctx)
closed
dagger/dagger
https://github.com/dagger/dagger
6,359
CLI: update handling of various core types
As described in [this comment](https://github.com/dagger/dagger/issues/6229#issuecomment-1863649336) (and that issue generally), we need to make some adjustments to the CLIs behavior when `dagger call` ends in various core types. There's a handful of related adjustments needed here. Creating as a checklist for now to save issue spam; can break down into more issues if useful though. I'm including my initial suggestions on how to handle these, but to be clear these are not finalized decisions and the final call can be made as part of implementing this - [ ] Handle arbitrary user objects - Print fields (as in `TypeDef` fields, so just trivially resolvable values) as a json object - [x] Handle container - call `sync` only, rely on progress output for anything else - [x] Handle directory - call `sync` only, rely on progress output for anything else - [x] Handle file - call `sync` only, rely on progress output for anything else - [ ] Handle IDs returned by `sync` (i.e. the case where the user explicitly chains `sync`) - just rely on progress output, don't show the id
https://github.com/dagger/dagger/issues/6359
https://github.com/dagger/dagger/pull/6482
2999573c5a34e85b8baac8c0150881d9c08a86b8
d91ac42c196873830c2e0876b251f3bf4d62ea49
2024-01-03T20:19:06Z
go
2024-01-26T18:48:04Z
core/integration/module_test.go
require.NoError(t, err) require.JSONEq(t, `{"bare":{"containerEcho":{"stdout":"hello\n"}}}`, out) }) t.Run("with different root", func(t *testing.T) { t.Parallel() c, ctx := connect(t) modGen := c.Container().From(golangImage). WithMountedFile(testCLIBinPath, daggerCliFile(t, c)). WithWorkdir("/work/child"). With(daggerExec("mod", "init", "--name=bare", "--sdk=typescript", "--root=..")) out, err := modGen. With(daggerQuery(`{bare{containerEcho(stringArg:"hello"){stdout}}}`)). Stdout(ctx) require.NoError(t, err) require.JSONEq(t, `{"bare":{"containerEcho":{"stdout":"hello\n"}}}`, out) }) t.Run("camel-cases Dagger module name", func(t *testing.T) { t.Parallel() c, ctx := connect(t) modGen := c.Container().From(golangImage). WithMountedFile(testCLIBinPath, daggerCliFile(t, c)). WithWorkdir("/work"). With(daggerExec("mod", "init", "--name=My-Module", "--sdk=typescript")) out, err := modGen. With(daggerQuery(`{myModule{containerEcho(stringArg:"hello"){stdout}}}`)). Stdout(ctx) require.NoError(t, err) require.JSONEq(t, `{"myModule":{"containerEcho":{"stdout":"hello\n"}}}`, out) }) t.Run("respect existing package.json", func(t *testing.T) {
closed
dagger/dagger
https://github.com/dagger/dagger
6,359
CLI: update handling of various core types
As described in [this comment](https://github.com/dagger/dagger/issues/6229#issuecomment-1863649336) (and that issue generally), we need to make some adjustments to the CLIs behavior when `dagger call` ends in various core types. There's a handful of related adjustments needed here. Creating as a checklist for now to save issue spam; can break down into more issues if useful though. I'm including my initial suggestions on how to handle these, but to be clear these are not finalized decisions and the final call can be made as part of implementing this - [ ] Handle arbitrary user objects - Print fields (as in `TypeDef` fields, so just trivially resolvable values) as a json object - [x] Handle container - call `sync` only, rely on progress output for anything else - [x] Handle directory - call `sync` only, rely on progress output for anything else - [x] Handle file - call `sync` only, rely on progress output for anything else - [ ] Handle IDs returned by `sync` (i.e. the case where the user explicitly chains `sync`) - just rely on progress output, don't show the id
https://github.com/dagger/dagger/issues/6359
https://github.com/dagger/dagger/pull/6482
2999573c5a34e85b8baac8c0150881d9c08a86b8
d91ac42c196873830c2e0876b251f3bf4d62ea49
2024-01-03T20:19:06Z
go
2024-01-26T18:48:04Z
core/integration/module_test.go
t.Parallel() c, ctx := connect(t) modGen := c.Container().From(golangImage). WithMountedFile(testCLIBinPath, daggerCliFile(t, c)). WithWorkdir("/work"). WithNewFile("/work/package.json", dagger.ContainerWithNewFileOpts{ Contents: `{ "name": "my-module", "version": "1.0.0", "description": "My module", "main": "index.js", "scripts": { "test": "echo \"Error: no test specified\" && exit 1" }, "author": "John doe", "license": "MIT" }`, }). With(daggerExec("mod", "init", "--name=hasPkgJson", "--sdk=typescript")) out, err := modGen. With(daggerQuery(`{hasPkgJson{containerEcho(stringArg:"hello"){stdout}}}`)). Stdout(ctx) require.NoError(t, err) require.JSONEq(t, `{"hasPkgJson":{"containerEcho":{"stdout":"hello\n"}}}`, out) t.Run("Add dagger dependencies to the existing package.json", func(t *testing.T) { pkgJSON, err := modGen.File("/work/package.json").Contents(ctx) require.NoError(t, err) require.Contains(t, pkgJSON, `"@dagger.io/dagger":`) require.Contains(t, pkgJSON, `"name": "my-module"`) })
closed
dagger/dagger
https://github.com/dagger/dagger
6,359
CLI: update handling of various core types
As described in [this comment](https://github.com/dagger/dagger/issues/6229#issuecomment-1863649336) (and that issue generally), we need to make some adjustments to the CLIs behavior when `dagger call` ends in various core types. There's a handful of related adjustments needed here. Creating as a checklist for now to save issue spam; can break down into more issues if useful though. I'm including my initial suggestions on how to handle these, but to be clear these are not finalized decisions and the final call can be made as part of implementing this - [ ] Handle arbitrary user objects - Print fields (as in `TypeDef` fields, so just trivially resolvable values) as a json object - [x] Handle container - call `sync` only, rely on progress output for anything else - [x] Handle directory - call `sync` only, rely on progress output for anything else - [x] Handle file - call `sync` only, rely on progress output for anything else - [ ] Handle IDs returned by `sync` (i.e. the case where the user explicitly chains `sync`) - just rely on progress output, don't show the id
https://github.com/dagger/dagger/issues/6359
https://github.com/dagger/dagger/pull/6482
2999573c5a34e85b8baac8c0150881d9c08a86b8
d91ac42c196873830c2e0876b251f3bf4d62ea49
2024-01-03T20:19:06Z
go
2024-01-26T18:48:04Z
core/integration/module_test.go
}) t.Run("respect existing tsconfig.json", func(t *testing.T) { t.Parallel() c, ctx := connect(t) modGen := c.Container().From(golangImage). WithMountedFile(testCLIBinPath, daggerCliFile(t, c)). WithWorkdir("/work"). WithNewFile("/work/tsconfig.json", dagger.ContainerWithNewFileOpts{ Contents: `{ "compilerOptions": { "target": "ES2022", "moduleResolution": "Node", "experimentalDecorators": true } }`, }). With(daggerExec("mod", "init", "--name=hasTsConfig", "--sdk=typescript")) out, err := modGen. With(daggerQuery(`{hasTsConfig{containerEcho(stringArg:"hello"){stdout}}}`)). Stdout(ctx) require.NoError(t, err) require.JSONEq(t, `{"hasTsConfig":{"containerEcho":{"stdout":"hello\n"}}}`, out) t.Run("Add dagger paths to the existing tsconfig.json", func(t *testing.T) { tsConfig, err := modGen.File("/work/tsconfig.json").Contents(ctx) require.NoError(t, err) require.Contains(t, tsConfig, `"@dagger.io/dagger":`) }) }) t.Run("respect existing src/index.ts", func(t *testing.T) { t.Parallel()
closed
dagger/dagger
https://github.com/dagger/dagger
6,359
CLI: update handling of various core types
As described in [this comment](https://github.com/dagger/dagger/issues/6229#issuecomment-1863649336) (and that issue generally), we need to make some adjustments to the CLIs behavior when `dagger call` ends in various core types. There's a handful of related adjustments needed here. Creating as a checklist for now to save issue spam; can break down into more issues if useful though. I'm including my initial suggestions on how to handle these, but to be clear these are not finalized decisions and the final call can be made as part of implementing this - [ ] Handle arbitrary user objects - Print fields (as in `TypeDef` fields, so just trivially resolvable values) as a json object - [x] Handle container - call `sync` only, rely on progress output for anything else - [x] Handle directory - call `sync` only, rely on progress output for anything else - [x] Handle file - call `sync` only, rely on progress output for anything else - [ ] Handle IDs returned by `sync` (i.e. the case where the user explicitly chains `sync`) - just rely on progress output, don't show the id
https://github.com/dagger/dagger/issues/6359
https://github.com/dagger/dagger/pull/6482
2999573c5a34e85b8baac8c0150881d9c08a86b8
d91ac42c196873830c2e0876b251f3bf4d62ea49
2024-01-03T20:19:06Z
go
2024-01-26T18:48:04Z
core/integration/module_test.go
c, ctx := connect(t) modGen := c.Container().From(golangImage). WithMountedFile(testCLIBinPath, daggerCliFile(t, c)). WithWorkdir("/work"). WithDirectory("/work/src", c.Directory()). WithNewFile("/work/src/index.ts", dagger.ContainerWithNewFileOpts{ Contents: ` import { dag, Container, object, func } from "@dagger.io/dagger" @object // eslint-disable-next-line @typescript-eslint/no-unused-vars class ExistingSource { /** * example usage: "dagger call container-echo --string-arg yo" */ @func helloWorld(stringArg: string): Container { return dag.container().from("alpine:latest").withExec(["echo", stringArg]) } } `, }). With(daggerExec("mod", "init", "--name=existingSource", "--sdk=typescript")) out, err := modGen. With(daggerQuery(`{existingSource{helloWorld(stringArg:"hello"){stdout}}}`)). Stdout(ctx) require.NoError(t, err) require.JSONEq(t, `{"existingSource":{"helloWorld":{"stdout":"hello\n"}}}`, out) }) } func TestModuleLotsOfFunctions(t *testing.T) {
closed
dagger/dagger
https://github.com/dagger/dagger
6,359
CLI: update handling of various core types
As described in [this comment](https://github.com/dagger/dagger/issues/6229#issuecomment-1863649336) (and that issue generally), we need to make some adjustments to the CLIs behavior when `dagger call` ends in various core types. There's a handful of related adjustments needed here. Creating as a checklist for now to save issue spam; can break down into more issues if useful though. I'm including my initial suggestions on how to handle these, but to be clear these are not finalized decisions and the final call can be made as part of implementing this - [ ] Handle arbitrary user objects - Print fields (as in `TypeDef` fields, so just trivially resolvable values) as a json object - [x] Handle container - call `sync` only, rely on progress output for anything else - [x] Handle directory - call `sync` only, rely on progress output for anything else - [x] Handle file - call `sync` only, rely on progress output for anything else - [ ] Handle IDs returned by `sync` (i.e. the case where the user explicitly chains `sync`) - just rely on progress output, don't show the id
https://github.com/dagger/dagger/issues/6359
https://github.com/dagger/dagger/pull/6482
2999573c5a34e85b8baac8c0150881d9c08a86b8
d91ac42c196873830c2e0876b251f3bf4d62ea49
2024-01-03T20:19:06Z
go
2024-01-26T18:48:04Z
core/integration/module_test.go
t.Parallel() const funcCount = 100 t.Run("go sdk", func(t *testing.T) { t.Parallel() c, ctx := connect(t) mainSrc := ` package main type PotatoSack struct {} ` for i := 0; i < funcCount; i++ { mainSrc += fmt.Sprintf(` func (m *PotatoSack) Potato%d() string { return "potato #%d" } `, i, i) } modGen := c.Container().From(golangImage). WithMountedFile(testCLIBinPath, daggerCliFile(t, c)). WithWorkdir("/work"). WithNewFile("/work/main.go", dagger.ContainerWithNewFileOpts{ Contents: mainSrc, }). With(daggerExec("mod", "init", "--name=potatoSack", "--sdk=go")) logGen(ctx, t, modGen.Directory(".")) var eg errgroup.Group for i := 0; i < funcCount; i++ { i := i
closed
dagger/dagger
https://github.com/dagger/dagger
6,359
CLI: update handling of various core types
As described in [this comment](https://github.com/dagger/dagger/issues/6229#issuecomment-1863649336) (and that issue generally), we need to make some adjustments to the CLIs behavior when `dagger call` ends in various core types. There's a handful of related adjustments needed here. Creating as a checklist for now to save issue spam; can break down into more issues if useful though. I'm including my initial suggestions on how to handle these, but to be clear these are not finalized decisions and the final call can be made as part of implementing this - [ ] Handle arbitrary user objects - Print fields (as in `TypeDef` fields, so just trivially resolvable values) as a json object - [x] Handle container - call `sync` only, rely on progress output for anything else - [x] Handle directory - call `sync` only, rely on progress output for anything else - [x] Handle file - call `sync` only, rely on progress output for anything else - [ ] Handle IDs returned by `sync` (i.e. the case where the user explicitly chains `sync`) - just rely on progress output, don't show the id
https://github.com/dagger/dagger/issues/6359
https://github.com/dagger/dagger/pull/6482
2999573c5a34e85b8baac8c0150881d9c08a86b8
d91ac42c196873830c2e0876b251f3bf4d62ea49
2024-01-03T20:19:06Z
go
2024-01-26T18:48:04Z
core/integration/module_test.go
if i%10 != 0 { continue } eg.Go(func() error { _, err := modGen. With(daggerCall(fmt.Sprintf("potato%d", i))). Sync(ctx) return err }) } require.NoError(t, eg.Wait()) }) t.Run("python sdk", func(t *testing.T) { t.Parallel() c, ctx := connect(t) mainSrc := `from dagger import function ` for i := 0; i < funcCount; i++ { mainSrc += fmt.Sprintf(` @function def potato_%d() -> str: return "potato #%d" `, i, i) } modGen := c.Container().From(golangImage). WithMountedFile(testCLIBinPath, daggerCliFile(t, c)). WithWorkdir("/work"). WithNewFile("./src/main.py", dagger.ContainerWithNewFileOpts{ Contents: mainSrc,
closed
dagger/dagger
https://github.com/dagger/dagger
6,359
CLI: update handling of various core types
As described in [this comment](https://github.com/dagger/dagger/issues/6229#issuecomment-1863649336) (and that issue generally), we need to make some adjustments to the CLIs behavior when `dagger call` ends in various core types. There's a handful of related adjustments needed here. Creating as a checklist for now to save issue spam; can break down into more issues if useful though. I'm including my initial suggestions on how to handle these, but to be clear these are not finalized decisions and the final call can be made as part of implementing this - [ ] Handle arbitrary user objects - Print fields (as in `TypeDef` fields, so just trivially resolvable values) as a json object - [x] Handle container - call `sync` only, rely on progress output for anything else - [x] Handle directory - call `sync` only, rely on progress output for anything else - [x] Handle file - call `sync` only, rely on progress output for anything else - [ ] Handle IDs returned by `sync` (i.e. the case where the user explicitly chains `sync`) - just rely on progress output, don't show the id
https://github.com/dagger/dagger/issues/6359
https://github.com/dagger/dagger/pull/6482
2999573c5a34e85b8baac8c0150881d9c08a86b8
d91ac42c196873830c2e0876b251f3bf4d62ea49
2024-01-03T20:19:06Z
go
2024-01-26T18:48:04Z
core/integration/module_test.go
}). With(daggerExec("mod", "init", "--name=potatoSack", "--sdk=python")) var eg errgroup.Group for i := 0; i < funcCount; i++ { i := i if i%10 != 0 { continue } eg.Go(func() error { _, err := modGen. With(daggerCall(fmt.Sprintf("potato%d", i))). Sync(ctx) return err }) } require.NoError(t, eg.Wait()) }) t.Run("typescript sdk", func(t *testing.T) { t.Parallel() c, ctx := connect(t) mainSrc := ` import { object, func } from "@dagger.io/dagger" @object class PotatoSack { ` for i := 0; i < funcCount; i++ { mainSrc += fmt.Sprintf(` @func potato_%d(): string {
closed
dagger/dagger
https://github.com/dagger/dagger
6,359
CLI: update handling of various core types
As described in [this comment](https://github.com/dagger/dagger/issues/6229#issuecomment-1863649336) (and that issue generally), we need to make some adjustments to the CLIs behavior when `dagger call` ends in various core types. There's a handful of related adjustments needed here. Creating as a checklist for now to save issue spam; can break down into more issues if useful though. I'm including my initial suggestions on how to handle these, but to be clear these are not finalized decisions and the final call can be made as part of implementing this - [ ] Handle arbitrary user objects - Print fields (as in `TypeDef` fields, so just trivially resolvable values) as a json object - [x] Handle container - call `sync` only, rely on progress output for anything else - [x] Handle directory - call `sync` only, rely on progress output for anything else - [x] Handle file - call `sync` only, rely on progress output for anything else - [ ] Handle IDs returned by `sync` (i.e. the case where the user explicitly chains `sync`) - just rely on progress output, don't show the id
https://github.com/dagger/dagger/issues/6359
https://github.com/dagger/dagger/pull/6482
2999573c5a34e85b8baac8c0150881d9c08a86b8
d91ac42c196873830c2e0876b251f3bf4d62ea49
2024-01-03T20:19:06Z
go
2024-01-26T18:48:04Z
core/integration/module_test.go
return "potato #%d" } `, i, i) } mainSrc += "\n}" modGen := c. Container(). From(golangImage). WithMountedFile(testCLIBinPath, daggerCliFile(t, c)). WithWorkdir("/work"). With(sdkSource("typescript", mainSrc)). With(daggerExec("mod", "init", "--name=potatoSack", "--sdk=typescript")) var eg errgroup.Group for i := 0; i < funcCount; i++ { i := i if i%10 != 0 { continue } eg.Go(func() error { _, err := modGen. With(daggerCall(fmt.Sprintf("potato%d", i))). Sync(ctx) return err }) } require.NoError(t, eg.Wait()) }) } func TestModuleLotsOfDeps(t *testing.T) {
closed
dagger/dagger
https://github.com/dagger/dagger
6,359
CLI: update handling of various core types
As described in [this comment](https://github.com/dagger/dagger/issues/6229#issuecomment-1863649336) (and that issue generally), we need to make some adjustments to the CLIs behavior when `dagger call` ends in various core types. There's a handful of related adjustments needed here. Creating as a checklist for now to save issue spam; can break down into more issues if useful though. I'm including my initial suggestions on how to handle these, but to be clear these are not finalized decisions and the final call can be made as part of implementing this - [ ] Handle arbitrary user objects - Print fields (as in `TypeDef` fields, so just trivially resolvable values) as a json object - [x] Handle container - call `sync` only, rely on progress output for anything else - [x] Handle directory - call `sync` only, rely on progress output for anything else - [x] Handle file - call `sync` only, rely on progress output for anything else - [ ] Handle IDs returned by `sync` (i.e. the case where the user explicitly chains `sync`) - just rely on progress output, don't show the id
https://github.com/dagger/dagger/issues/6359
https://github.com/dagger/dagger/pull/6482
2999573c5a34e85b8baac8c0150881d9c08a86b8
d91ac42c196873830c2e0876b251f3bf4d62ea49
2024-01-03T20:19:06Z
go
2024-01-26T18:48:04Z
core/integration/module_test.go
t.Parallel() c, ctx := connect(t) modGen := c.Container().From(golangImage). WithMountedFile(testCLIBinPath, daggerCliFile(t, c)). WithWorkdir("/work") modCount := 0 getModMainSrc := func(name string, depNames []string) string { t.Helper() mainSrc := fmt.Sprintf(`package main import "context" type %s struct {} func (m *%s) Fn(ctx context.Context) (string, error) { s := "%s" var depS string _ = depS var err error _ = err `, strcase.ToCamel(name), strcase.ToCamel(name), name) for _, depName := range depNames { mainSrc += fmt.Sprintf(` depS, err = dag.%s().Fn(ctx) if err != nil { return "", err
closed
dagger/dagger
https://github.com/dagger/dagger
6,359
CLI: update handling of various core types
As described in [this comment](https://github.com/dagger/dagger/issues/6229#issuecomment-1863649336) (and that issue generally), we need to make some adjustments to the CLIs behavior when `dagger call` ends in various core types. There's a handful of related adjustments needed here. Creating as a checklist for now to save issue spam; can break down into more issues if useful though. I'm including my initial suggestions on how to handle these, but to be clear these are not finalized decisions and the final call can be made as part of implementing this - [ ] Handle arbitrary user objects - Print fields (as in `TypeDef` fields, so just trivially resolvable values) as a json object - [x] Handle container - call `sync` only, rely on progress output for anything else - [x] Handle directory - call `sync` only, rely on progress output for anything else - [x] Handle file - call `sync` only, rely on progress output for anything else - [ ] Handle IDs returned by `sync` (i.e. the case where the user explicitly chains `sync`) - just rely on progress output, don't show the id
https://github.com/dagger/dagger/issues/6359
https://github.com/dagger/dagger/pull/6482
2999573c5a34e85b8baac8c0150881d9c08a86b8
d91ac42c196873830c2e0876b251f3bf4d62ea49
2024-01-03T20:19:06Z
go
2024-01-26T18:48:04Z
core/integration/module_test.go
} s += depS `, strcase.ToCamel(depName)) } mainSrc += "return s, nil\n}\n" fmted, err := format.Source([]byte(mainSrc)) require.NoError(t, err) return string(fmted) } getModDaggerConfig := func(name string, depNames []string) string { t.Helper() var depVals []string for _, depName := range depNames { depVals = append(depVals, "../"+depName) } cfg := modules.Config{ Name: name, Root: "..", SDK: "go", Dependencies: depVals, } bs, err := json.Marshal(cfg) require.NoError(t, err) return string(bs) } addModulesWithDeps := func(newMods int, depNames []string) []string { t.Helper() var newModNames []string
closed
dagger/dagger
https://github.com/dagger/dagger
6,359
CLI: update handling of various core types
As described in [this comment](https://github.com/dagger/dagger/issues/6229#issuecomment-1863649336) (and that issue generally), we need to make some adjustments to the CLIs behavior when `dagger call` ends in various core types. There's a handful of related adjustments needed here. Creating as a checklist for now to save issue spam; can break down into more issues if useful though. I'm including my initial suggestions on how to handle these, but to be clear these are not finalized decisions and the final call can be made as part of implementing this - [ ] Handle arbitrary user objects - Print fields (as in `TypeDef` fields, so just trivially resolvable values) as a json object - [x] Handle container - call `sync` only, rely on progress output for anything else - [x] Handle directory - call `sync` only, rely on progress output for anything else - [x] Handle file - call `sync` only, rely on progress output for anything else - [ ] Handle IDs returned by `sync` (i.e. the case where the user explicitly chains `sync`) - just rely on progress output, don't show the id
https://github.com/dagger/dagger/issues/6359
https://github.com/dagger/dagger/pull/6482
2999573c5a34e85b8baac8c0150881d9c08a86b8
d91ac42c196873830c2e0876b251f3bf4d62ea49
2024-01-03T20:19:06Z
go
2024-01-26T18:48:04Z
core/integration/module_test.go
for i := 0; i < newMods; i++ { name := fmt.Sprintf("mod%d", modCount) modCount++ newModNames = append(newModNames, name) modGen = modGen. WithWorkdir("/work/"+name). WithNewFile("./main.go", dagger.ContainerWithNewFileOpts{ Contents: getModMainSrc(name, depNames), }). WithNewFile("./dagger.json", dagger.ContainerWithNewFileOpts{ Contents: getModDaggerConfig(name, depNames), }) } return newModNames } curDeps := addModulesWithDeps(1, nil) for i := 0; i < 6; i++ { curDeps = addModulesWithDeps(len(curDeps)+1, curDeps) } addModulesWithDeps(1, curDeps) _, err := modGen.With(daggerCall("fn")).Stdout(ctx) require.NoError(t, err) } func TestModuleNamespacing(t *testing.T) {
closed
dagger/dagger
https://github.com/dagger/dagger
6,359
CLI: update handling of various core types
As described in [this comment](https://github.com/dagger/dagger/issues/6229#issuecomment-1863649336) (and that issue generally), we need to make some adjustments to the CLIs behavior when `dagger call` ends in various core types. There's a handful of related adjustments needed here. Creating as a checklist for now to save issue spam; can break down into more issues if useful though. I'm including my initial suggestions on how to handle these, but to be clear these are not finalized decisions and the final call can be made as part of implementing this - [ ] Handle arbitrary user objects - Print fields (as in `TypeDef` fields, so just trivially resolvable values) as a json object - [x] Handle container - call `sync` only, rely on progress output for anything else - [x] Handle directory - call `sync` only, rely on progress output for anything else - [x] Handle file - call `sync` only, rely on progress output for anything else - [ ] Handle IDs returned by `sync` (i.e. the case where the user explicitly chains `sync`) - just rely on progress output, don't show the id
https://github.com/dagger/dagger/issues/6359
https://github.com/dagger/dagger/pull/6482
2999573c5a34e85b8baac8c0150881d9c08a86b8
d91ac42c196873830c2e0876b251f3bf4d62ea49
2024-01-03T20:19:06Z
go
2024-01-26T18:48:04Z
core/integration/module_test.go
t.Parallel() c, ctx := connect(t) moduleSrcPath, err := filepath.Abs("./testdata/modules/go/namespacing") require.NoError(t, err) ctr := c.Container().From(alpineImage). WithMountedFile(testCLIBinPath, daggerCliFile(t, c)). WithMountedDirectory("/work", c.Host().Directory(moduleSrcPath)). WithWorkdir("/work") out, err := ctr. With(daggerQuery(`{test{fn(s:"yo")}}`)). Stdout(ctx) require.NoError(t, err) require.JSONEq(t, `{"test":{"fn":["*main.Sub1Obj made 1:yo", "*main.Sub2Obj made 2:yo"]}}`, out) } func TestModuleRoots(t *testing.T) {
closed
dagger/dagger
https://github.com/dagger/dagger
6,359
CLI: update handling of various core types
As described in [this comment](https://github.com/dagger/dagger/issues/6229#issuecomment-1863649336) (and that issue generally), we need to make some adjustments to the CLIs behavior when `dagger call` ends in various core types. There's a handful of related adjustments needed here. Creating as a checklist for now to save issue spam; can break down into more issues if useful though. I'm including my initial suggestions on how to handle these, but to be clear these are not finalized decisions and the final call can be made as part of implementing this - [ ] Handle arbitrary user objects - Print fields (as in `TypeDef` fields, so just trivially resolvable values) as a json object - [x] Handle container - call `sync` only, rely on progress output for anything else - [x] Handle directory - call `sync` only, rely on progress output for anything else - [x] Handle file - call `sync` only, rely on progress output for anything else - [ ] Handle IDs returned by `sync` (i.e. the case where the user explicitly chains `sync`) - just rely on progress output, don't show the id
https://github.com/dagger/dagger/issues/6359
https://github.com/dagger/dagger/pull/6482
2999573c5a34e85b8baac8c0150881d9c08a86b8
d91ac42c196873830c2e0876b251f3bf4d62ea49
2024-01-03T20:19:06Z
go
2024-01-26T18:48:04Z
core/integration/module_test.go
t.Parallel() c, ctx := connect(t) moduleSrcPath, err := filepath.Abs("./testdata/modules/go/roots") require.NoError(t, err) entries, err := os.ReadDir(moduleSrcPath) require.NoError(t, err) ctr := c.Container().From(alpineImage). WithMountedFile(testCLIBinPath, daggerCliFile(t, c)). WithMountedDirectory("/work", c.Host().Directory(moduleSrcPath)) for _, entry := range entries { entry := entry t.Run(entry.Name(), func(t *testing.T) { t.Parallel() ctr := ctr.WithWorkdir("/work/" + entry.Name()) out, err := ctr. With(daggerQuery(fmt.Sprintf(`{%s{hello}}`, strcase.ToLowerCamel(entry.Name())))). Stdout(ctx) if strings.HasPrefix(entry.Name(), "good-") { require.NoError(t, err) require.JSONEq(t, fmt.Sprintf(`{"%s":{"hello": "hello"}}`, strcase.ToLowerCamel(entry.Name())), out) } else if strings.HasPrefix(entry.Name(), "bad-") { require.Error(t, err) require.Regexp(t, "is not under( module)? root", err.Error()) } }) } } func TestModuleLoops(t *testing.T) {
closed
dagger/dagger
https://github.com/dagger/dagger
6,359
CLI: update handling of various core types
As described in [this comment](https://github.com/dagger/dagger/issues/6229#issuecomment-1863649336) (and that issue generally), we need to make some adjustments to the CLIs behavior when `dagger call` ends in various core types. There's a handful of related adjustments needed here. Creating as a checklist for now to save issue spam; can break down into more issues if useful though. I'm including my initial suggestions on how to handle these, but to be clear these are not finalized decisions and the final call can be made as part of implementing this - [ ] Handle arbitrary user objects - Print fields (as in `TypeDef` fields, so just trivially resolvable values) as a json object - [x] Handle container - call `sync` only, rely on progress output for anything else - [x] Handle directory - call `sync` only, rely on progress output for anything else - [x] Handle file - call `sync` only, rely on progress output for anything else - [ ] Handle IDs returned by `sync` (i.e. the case where the user explicitly chains `sync`) - just rely on progress output, don't show the id
https://github.com/dagger/dagger/issues/6359
https://github.com/dagger/dagger/pull/6482
2999573c5a34e85b8baac8c0150881d9c08a86b8
d91ac42c196873830c2e0876b251f3bf4d62ea49
2024-01-03T20:19:06Z
go
2024-01-26T18:48:04Z
core/integration/module_test.go
t.Parallel() c, ctx := connect(t) _, err := c.Container().From(golangImage). WithMountedFile(testCLIBinPath, daggerCliFile(t, c)). WithWorkdir("/work/depA"). With(daggerExec("mod", "init", "--name=depA", "--sdk=go", "--root=..")). WithWorkdir("/work/depB"). With(daggerExec("mod", "init", "--name=depB", "--sdk=go", "--root=..")). With(daggerExec("mod", "install", "../depA")). WithWorkdir("/work/depC"). With(daggerExec("mod", "init", "--name=depC", "--sdk=go", "--root=..")). With(daggerExec("mod", "install", "../depB")). WithWorkdir("/work/depA"). With(daggerExec("mod", "install", "../depC")). Sync(ctx) require.ErrorContains(t, err, "module depA has a circular dependency") } var badIDArgGoSrc string var badIDArgPySrc string var badIDArgTSSrc string var badIDFieldGoSrc string var badIDFieldTSSrc string var badIDFnGoSrc string var badIDFnPySrc string var badIDFnTSSrc string func TestModuleReservedWords(t *testing.T) {
closed
dagger/dagger
https://github.com/dagger/dagger
6,359
CLI: update handling of various core types
As described in [this comment](https://github.com/dagger/dagger/issues/6229#issuecomment-1863649336) (and that issue generally), we need to make some adjustments to the CLIs behavior when `dagger call` ends in various core types. There's a handful of related adjustments needed here. Creating as a checklist for now to save issue spam; can break down into more issues if useful though. I'm including my initial suggestions on how to handle these, but to be clear these are not finalized decisions and the final call can be made as part of implementing this - [ ] Handle arbitrary user objects - Print fields (as in `TypeDef` fields, so just trivially resolvable values) as a json object - [x] Handle container - call `sync` only, rely on progress output for anything else - [x] Handle directory - call `sync` only, rely on progress output for anything else - [x] Handle file - call `sync` only, rely on progress output for anything else - [ ] Handle IDs returned by `sync` (i.e. the case where the user explicitly chains `sync`) - just rely on progress output, don't show the id
https://github.com/dagger/dagger/issues/6359
https://github.com/dagger/dagger/pull/6482
2999573c5a34e85b8baac8c0150881d9c08a86b8
d91ac42c196873830c2e0876b251f3bf4d62ea49
2024-01-03T20:19:06Z
go
2024-01-26T18:48:04Z
core/integration/module_test.go
t.Parallel() c, ctx := connect(t) type testCase struct { sdk string source string } t.Run("id", func(t *testing.T) { t.Parallel()
closed
dagger/dagger
https://github.com/dagger/dagger
6,359
CLI: update handling of various core types
As described in [this comment](https://github.com/dagger/dagger/issues/6229#issuecomment-1863649336) (and that issue generally), we need to make some adjustments to the CLIs behavior when `dagger call` ends in various core types. There's a handful of related adjustments needed here. Creating as a checklist for now to save issue spam; can break down into more issues if useful though. I'm including my initial suggestions on how to handle these, but to be clear these are not finalized decisions and the final call can be made as part of implementing this - [ ] Handle arbitrary user objects - Print fields (as in `TypeDef` fields, so just trivially resolvable values) as a json object - [x] Handle container - call `sync` only, rely on progress output for anything else - [x] Handle directory - call `sync` only, rely on progress output for anything else - [x] Handle file - call `sync` only, rely on progress output for anything else - [ ] Handle IDs returned by `sync` (i.e. the case where the user explicitly chains `sync`) - just rely on progress output, don't show the id
https://github.com/dagger/dagger/issues/6359
https://github.com/dagger/dagger/pull/6482
2999573c5a34e85b8baac8c0150881d9c08a86b8
d91ac42c196873830c2e0876b251f3bf4d62ea49
2024-01-03T20:19:06Z
go
2024-01-26T18:48:04Z
core/integration/module_test.go
t.Run("arg", func(t *testing.T) { t.Parallel() for _, tc := range []testCase{ { sdk: "go", source: badIDArgGoSrc, }, { sdk: "python", source: badIDArgPySrc, }, { sdk: "typescript", source: badIDArgTSSrc, }, } { tc := tc t.Run(tc.sdk, func(t *testing.T) { t.Parallel() _, err := c.Container().From(golangImage). WithMountedFile(testCLIBinPath, daggerCliFile(t, c)). WithWorkdir("/work"). With(daggerExec("mod", "init", "--name=test", "--sdk="+tc.sdk)). With(sdkSource(tc.sdk, tc.source)). With(daggerQuery(`{test{fn(id:"no")}}`)). Sync(ctx) require.ErrorContains(t, err, "cannot define argument with reserved name \"id\"") }) } })
closed
dagger/dagger
https://github.com/dagger/dagger
6,359
CLI: update handling of various core types
As described in [this comment](https://github.com/dagger/dagger/issues/6229#issuecomment-1863649336) (and that issue generally), we need to make some adjustments to the CLIs behavior when `dagger call` ends in various core types. There's a handful of related adjustments needed here. Creating as a checklist for now to save issue spam; can break down into more issues if useful though. I'm including my initial suggestions on how to handle these, but to be clear these are not finalized decisions and the final call can be made as part of implementing this - [ ] Handle arbitrary user objects - Print fields (as in `TypeDef` fields, so just trivially resolvable values) as a json object - [x] Handle container - call `sync` only, rely on progress output for anything else - [x] Handle directory - call `sync` only, rely on progress output for anything else - [x] Handle file - call `sync` only, rely on progress output for anything else - [ ] Handle IDs returned by `sync` (i.e. the case where the user explicitly chains `sync`) - just rely on progress output, don't show the id
https://github.com/dagger/dagger/issues/6359
https://github.com/dagger/dagger/pull/6482
2999573c5a34e85b8baac8c0150881d9c08a86b8
d91ac42c196873830c2e0876b251f3bf4d62ea49
2024-01-03T20:19:06Z
go
2024-01-26T18:48:04Z
core/integration/module_test.go
t.Run("field", func(t *testing.T) { t.Parallel() for _, tc := range []testCase{ { sdk: "go", source: badIDFieldGoSrc, }, { sdk: "typescript", source: badIDFieldTSSrc, }, } { tc := tc t.Run(tc.sdk, func(t *testing.T) { t.Parallel() _, err := c.Container().From(golangImage). WithMountedFile(testCLIBinPath, daggerCliFile(t, c)). WithWorkdir("/work"). With(daggerExec("mod", "init", "--name=test", "--sdk="+tc.sdk)). With(sdkSource(tc.sdk, tc.source)). With(daggerQuery(`{test{fn{id}}}`)). Sync(ctx) require.ErrorContains(t, err, "cannot define field with reserved name \"id\"") }) } }) t.Run("fn", func(t *testing.T) { t.Parallel() for _, tc := range []testCase{ {
closed
dagger/dagger
https://github.com/dagger/dagger
6,359
CLI: update handling of various core types
As described in [this comment](https://github.com/dagger/dagger/issues/6229#issuecomment-1863649336) (and that issue generally), we need to make some adjustments to the CLIs behavior when `dagger call` ends in various core types. There's a handful of related adjustments needed here. Creating as a checklist for now to save issue spam; can break down into more issues if useful though. I'm including my initial suggestions on how to handle these, but to be clear these are not finalized decisions and the final call can be made as part of implementing this - [ ] Handle arbitrary user objects - Print fields (as in `TypeDef` fields, so just trivially resolvable values) as a json object - [x] Handle container - call `sync` only, rely on progress output for anything else - [x] Handle directory - call `sync` only, rely on progress output for anything else - [x] Handle file - call `sync` only, rely on progress output for anything else - [ ] Handle IDs returned by `sync` (i.e. the case where the user explicitly chains `sync`) - just rely on progress output, don't show the id
https://github.com/dagger/dagger/issues/6359
https://github.com/dagger/dagger/pull/6482
2999573c5a34e85b8baac8c0150881d9c08a86b8
d91ac42c196873830c2e0876b251f3bf4d62ea49
2024-01-03T20:19:06Z
go
2024-01-26T18:48:04Z
core/integration/module_test.go
sdk: "go", source: badIDFnGoSrc, }, { sdk: "python", source: badIDFnPySrc, }, { sdk: "typescript", source: badIDFnTSSrc, }, } { tc := tc t.Run(tc.sdk, func(t *testing.T) { t.Parallel() _, err := c.Container().From(golangImage). WithMountedFile(testCLIBinPath, daggerCliFile(t, c)). WithWorkdir("/work"). With(daggerExec("mod", "init", "--name=test", "--sdk="+tc.sdk)). With(sdkSource(tc.sdk, tc.source)). With(daggerQuery(`{test{id}}`)). Sync(ctx) require.ErrorContains(t, err, "cannot define function with reserved name \"id\"") }) } }) }) } var tsSyntax string func TestModuleTypescriptSyntaxSupport(t *testing.T) {
closed
dagger/dagger
https://github.com/dagger/dagger
6,359
CLI: update handling of various core types
As described in [this comment](https://github.com/dagger/dagger/issues/6229#issuecomment-1863649336) (and that issue generally), we need to make some adjustments to the CLIs behavior when `dagger call` ends in various core types. There's a handful of related adjustments needed here. Creating as a checklist for now to save issue spam; can break down into more issues if useful though. I'm including my initial suggestions on how to handle these, but to be clear these are not finalized decisions and the final call can be made as part of implementing this - [ ] Handle arbitrary user objects - Print fields (as in `TypeDef` fields, so just trivially resolvable values) as a json object - [x] Handle container - call `sync` only, rely on progress output for anything else - [x] Handle directory - call `sync` only, rely on progress output for anything else - [x] Handle file - call `sync` only, rely on progress output for anything else - [ ] Handle IDs returned by `sync` (i.e. the case where the user explicitly chains `sync`) - just rely on progress output, don't show the id
https://github.com/dagger/dagger/issues/6359
https://github.com/dagger/dagger/pull/6482
2999573c5a34e85b8baac8c0150881d9c08a86b8
d91ac42c196873830c2e0876b251f3bf4d62ea49
2024-01-03T20:19:06Z
go
2024-01-26T18:48:04Z
core/integration/module_test.go
t.Parallel() c, ctx := connect(t) modGen := c.Container().From(golangImage). WithMountedFile(testCLIBinPath, daggerCliFile(t, c)). WithWorkdir("/work"). With(daggerExec("mod", "init", "--name=syntax", "--sdk=typescript")). WithNewFile("src/index.ts", dagger.ContainerWithNewFileOpts{ Contents: tsSyntax, }) t.Run("singleQuoteDefaultArgHello(msg: string = 'world'): string", func(t *testing.T) { t.Parallel() defaultOut, err := modGen.With(daggerQuery(`{syntax{singleQuoteDefaultArgHello}}`)).Stdout(ctx) require.NoError(t, err) require.JSONEq(t, `{"syntax":{"singleQuoteDefaultArgHello":"hello world"}}`, defaultOut) out, err := modGen.With(daggerQuery(`{syntax{singleQuoteDefaultArgHello(msg: "dagger")}}`)).Stdout(ctx) require.NoError(t, err) require.JSONEq(t, `{"syntax":{"singleQuoteDefaultArgHello":"hello dagger"}}`, out) }) t.Run("doubleQuotesDefaultArgHello(msg: string = \"world\"): string", func(t *testing.T) { t.Parallel() defaultOut, err := modGen.With(daggerQuery(`{syntax{doubleQuotesDefaultArgHello}}`)).Stdout(ctx) require.NoError(t, err) require.JSONEq(t, `{"syntax":{"doubleQuotesDefaultArgHello":"hello world"}}`, defaultOut) out, err := modGen.With(daggerQuery(`{syntax{doubleQuotesDefaultArgHello(msg: "dagger")}}`)).Stdout(ctx) require.NoError(t, err) require.JSONEq(t, `{"syntax":{"doubleQuotesDefaultArgHello":"hello dagger"}}`, out) }) } func TestModuleExecError(t *testing.T) {
closed
dagger/dagger
https://github.com/dagger/dagger
6,359
CLI: update handling of various core types
As described in [this comment](https://github.com/dagger/dagger/issues/6229#issuecomment-1863649336) (and that issue generally), we need to make some adjustments to the CLIs behavior when `dagger call` ends in various core types. There's a handful of related adjustments needed here. Creating as a checklist for now to save issue spam; can break down into more issues if useful though. I'm including my initial suggestions on how to handle these, but to be clear these are not finalized decisions and the final call can be made as part of implementing this - [ ] Handle arbitrary user objects - Print fields (as in `TypeDef` fields, so just trivially resolvable values) as a json object - [x] Handle container - call `sync` only, rely on progress output for anything else - [x] Handle directory - call `sync` only, rely on progress output for anything else - [x] Handle file - call `sync` only, rely on progress output for anything else - [ ] Handle IDs returned by `sync` (i.e. the case where the user explicitly chains `sync`) - just rely on progress output, don't show the id
https://github.com/dagger/dagger/issues/6359
https://github.com/dagger/dagger/pull/6482
2999573c5a34e85b8baac8c0150881d9c08a86b8
d91ac42c196873830c2e0876b251f3bf4d62ea49
2024-01-03T20:19:06Z
go
2024-01-26T18:48:04Z
core/integration/module_test.go
t.Parallel() c, ctx := connect(t) modGen := c.Container().From(alpineImage). WithMountedFile(testCLIBinPath, daggerCliFile(t, c)). WithWorkdir("/work"). With(daggerExec("mod", "init", "--name=playground", "--sdk=go")). WithNewFile("main.go", dagger.ContainerWithNewFileOpts{ Contents: ` package main
closed
dagger/dagger
https://github.com/dagger/dagger
6,359
CLI: update handling of various core types
As described in [this comment](https://github.com/dagger/dagger/issues/6229#issuecomment-1863649336) (and that issue generally), we need to make some adjustments to the CLIs behavior when `dagger call` ends in various core types. There's a handful of related adjustments needed here. Creating as a checklist for now to save issue spam; can break down into more issues if useful though. I'm including my initial suggestions on how to handle these, but to be clear these are not finalized decisions and the final call can be made as part of implementing this - [ ] Handle arbitrary user objects - Print fields (as in `TypeDef` fields, so just trivially resolvable values) as a json object - [x] Handle container - call `sync` only, rely on progress output for anything else - [x] Handle directory - call `sync` only, rely on progress output for anything else - [x] Handle file - call `sync` only, rely on progress output for anything else - [ ] Handle IDs returned by `sync` (i.e. the case where the user explicitly chains `sync`) - just rely on progress output, don't show the id
https://github.com/dagger/dagger/issues/6359
https://github.com/dagger/dagger/pull/6482
2999573c5a34e85b8baac8c0150881d9c08a86b8
d91ac42c196873830c2e0876b251f3bf4d62ea49
2024-01-03T20:19:06Z
go
2024-01-26T18:48:04Z
core/integration/module_test.go
import ( "context" "errors" ) type Playground struct{} func (p *Playground) DoThing(ctx context.Context) error { _, err := dag.Container().From("alpine").WithExec([]string{"sh", "-c", "exit 5"}).Sync(ctx) var e *ExecError if errors.As(err, &e) { if e.ExitCode == 5 { return nil } } panic("yikes") } `}) logGen(ctx, t, modGen.Directory(".")) _, err := modGen. With(daggerQuery(`{playground{doThing}}`)). Stdout(ctx) require.NoError(t, err) } func daggerExec(args ...string) dagger.WithContainerFunc { return func(c *dagger.Container) *dagger.Container { return c.WithExec(append([]string{"dagger", "--debug"}, args...), dagger.ContainerWithExecOpts{ ExperimentalPrivilegedNesting: true, }) } } func daggerQuery(query string, args ...any) dagger.WithContainerFunc {
closed
dagger/dagger
https://github.com/dagger/dagger
6,359
CLI: update handling of various core types
As described in [this comment](https://github.com/dagger/dagger/issues/6229#issuecomment-1863649336) (and that issue generally), we need to make some adjustments to the CLIs behavior when `dagger call` ends in various core types. There's a handful of related adjustments needed here. Creating as a checklist for now to save issue spam; can break down into more issues if useful though. I'm including my initial suggestions on how to handle these, but to be clear these are not finalized decisions and the final call can be made as part of implementing this - [ ] Handle arbitrary user objects - Print fields (as in `TypeDef` fields, so just trivially resolvable values) as a json object - [x] Handle container - call `sync` only, rely on progress output for anything else - [x] Handle directory - call `sync` only, rely on progress output for anything else - [x] Handle file - call `sync` only, rely on progress output for anything else - [ ] Handle IDs returned by `sync` (i.e. the case where the user explicitly chains `sync`) - just rely on progress output, don't show the id
https://github.com/dagger/dagger/issues/6359
https://github.com/dagger/dagger/pull/6482
2999573c5a34e85b8baac8c0150881d9c08a86b8
d91ac42c196873830c2e0876b251f3bf4d62ea49
2024-01-03T20:19:06Z
go
2024-01-26T18:48:04Z
core/integration/module_test.go
query = fmt.Sprintf(query, args...) return func(c *dagger.Container) *dagger.Container { return c.WithExec([]string{"dagger", "--debug", "query"}, dagger.ContainerWithExecOpts{ Stdin: query, ExperimentalPrivilegedNesting: true, }) } } func daggerCall(args ...string) dagger.WithContainerFunc { return func(c *dagger.Container) *dagger.Container { return c.WithExec(append([]string{"dagger", "--debug", "call"}, args...), dagger.ContainerWithExecOpts{ ExperimentalPrivilegedNesting: true, }) } } func daggerFunctions(args ...string) dagger.WithContainerFunc { return func(c *dagger.Container) *dagger.Container { return c.WithExec(append([]string{"dagger", "--debug", "functions"}, args...), dagger.ContainerWithExecOpts{ ExperimentalPrivilegedNesting: true, }) } } func hostDaggerCommand(ctx context.Context, t testing.TB, workdir string, args ...string) *exec.Cmd { t.Helper() cmd := exec.CommandContext(ctx, daggerCliPath(t), args...) cmd.Dir = workdir return cmd } func hostDaggerExec(ctx context.Context, t testing.TB, workdir string, args ...string) ([]byte, error) {
closed
dagger/dagger
https://github.com/dagger/dagger
6,359
CLI: update handling of various core types
As described in [this comment](https://github.com/dagger/dagger/issues/6229#issuecomment-1863649336) (and that issue generally), we need to make some adjustments to the CLIs behavior when `dagger call` ends in various core types. There's a handful of related adjustments needed here. Creating as a checklist for now to save issue spam; can break down into more issues if useful though. I'm including my initial suggestions on how to handle these, but to be clear these are not finalized decisions and the final call can be made as part of implementing this - [ ] Handle arbitrary user objects - Print fields (as in `TypeDef` fields, so just trivially resolvable values) as a json object - [x] Handle container - call `sync` only, rely on progress output for anything else - [x] Handle directory - call `sync` only, rely on progress output for anything else - [x] Handle file - call `sync` only, rely on progress output for anything else - [ ] Handle IDs returned by `sync` (i.e. the case where the user explicitly chains `sync`) - just rely on progress output, don't show the id
https://github.com/dagger/dagger/issues/6359
https://github.com/dagger/dagger/pull/6482
2999573c5a34e85b8baac8c0150881d9c08a86b8
d91ac42c196873830c2e0876b251f3bf4d62ea49
2024-01-03T20:19:06Z
go
2024-01-26T18:48:04Z
core/integration/module_test.go
t.Helper() cmd := hostDaggerCommand(ctx, t, workdir, args...) output, err := cmd.CombinedOutput() if err != nil { err = fmt.Errorf("%s: %w", string(output), err) } return output, err } func sdkSource(sdk, contents string) dagger.WithContainerFunc { return func(c *dagger.Container) *dagger.Container { var sourcePath string switch sdk { case "go": sourcePath = "main.go" case "python": sourcePath = "src/main.py" case "typescript": sourcePath = "src/index.ts" default: return c } return c.WithNewFile(sourcePath, dagger.ContainerWithNewFileOpts{ Contents: contents, }) } } func sdkCodegenFile(t *testing.T, sdk string) string {
closed
dagger/dagger
https://github.com/dagger/dagger
6,359
CLI: update handling of various core types
As described in [this comment](https://github.com/dagger/dagger/issues/6229#issuecomment-1863649336) (and that issue generally), we need to make some adjustments to the CLIs behavior when `dagger call` ends in various core types. There's a handful of related adjustments needed here. Creating as a checklist for now to save issue spam; can break down into more issues if useful though. I'm including my initial suggestions on how to handle these, but to be clear these are not finalized decisions and the final call can be made as part of implementing this - [ ] Handle arbitrary user objects - Print fields (as in `TypeDef` fields, so just trivially resolvable values) as a json object - [x] Handle container - call `sync` only, rely on progress output for anything else - [x] Handle directory - call `sync` only, rely on progress output for anything else - [x] Handle file - call `sync` only, rely on progress output for anything else - [ ] Handle IDs returned by `sync` (i.e. the case where the user explicitly chains `sync`) - just rely on progress output, don't show the id
https://github.com/dagger/dagger/issues/6359
https://github.com/dagger/dagger/pull/6482
2999573c5a34e85b8baac8c0150881d9c08a86b8
d91ac42c196873830c2e0876b251f3bf4d62ea49
2024-01-03T20:19:06Z
go
2024-01-26T18:48:04Z
core/integration/module_test.go
t.Helper() switch sdk { case "go": return "dagger.gen.go" case "python": return "sdk/src/dagger/client/gen.py" case "typescript": return "sdk/api/client.gen.ts" default: return "" } } func currentSchema(ctx context.Context, t *testing.T, ctr *dagger.Container) *introspection.Schema {
closed
dagger/dagger
https://github.com/dagger/dagger
6,359
CLI: update handling of various core types
As described in [this comment](https://github.com/dagger/dagger/issues/6229#issuecomment-1863649336) (and that issue generally), we need to make some adjustments to the CLIs behavior when `dagger call` ends in various core types. There's a handful of related adjustments needed here. Creating as a checklist for now to save issue spam; can break down into more issues if useful though. I'm including my initial suggestions on how to handle these, but to be clear these are not finalized decisions and the final call can be made as part of implementing this - [ ] Handle arbitrary user objects - Print fields (as in `TypeDef` fields, so just trivially resolvable values) as a json object - [x] Handle container - call `sync` only, rely on progress output for anything else - [x] Handle directory - call `sync` only, rely on progress output for anything else - [x] Handle file - call `sync` only, rely on progress output for anything else - [ ] Handle IDs returned by `sync` (i.e. the case where the user explicitly chains `sync`) - just rely on progress output, don't show the id
https://github.com/dagger/dagger/issues/6359
https://github.com/dagger/dagger/pull/6482
2999573c5a34e85b8baac8c0150881d9c08a86b8
d91ac42c196873830c2e0876b251f3bf4d62ea49
2024-01-03T20:19:06Z
go
2024-01-26T18:48:04Z
core/integration/module_test.go
t.Helper() out, err := ctr.With(daggerQuery(introspection.Query)).Stdout(ctx) require.NoError(t, err) var schemaResp introspection.Response err = json.Unmarshal([]byte(out), &schemaResp) require.NoError(t, err) return schemaResp.Schema } func goGitBase(t *testing.T, c *dagger.Client) *dagger.Container { t.Helper() return c.Container().From(golangImage). WithExec([]string{"apk", "add", "git"}). WithExec([]string{"git", "config", "--global", "user.email", "dagger@example.com"}). WithExec([]string{"git", "config", "--global", "user.name", "Dagger Tests"}). WithMountedFile(testCLIBinPath, daggerCliFile(t, c)). WithWorkdir("/work"). WithExec([]string{"git", "init"}) } func logGen(ctx context.Context, t *testing.T, modSrc *dagger.Directory) {
closed
dagger/dagger
https://github.com/dagger/dagger
6,359
CLI: update handling of various core types
As described in [this comment](https://github.com/dagger/dagger/issues/6229#issuecomment-1863649336) (and that issue generally), we need to make some adjustments to the CLIs behavior when `dagger call` ends in various core types. There's a handful of related adjustments needed here. Creating as a checklist for now to save issue spam; can break down into more issues if useful though. I'm including my initial suggestions on how to handle these, but to be clear these are not finalized decisions and the final call can be made as part of implementing this - [ ] Handle arbitrary user objects - Print fields (as in `TypeDef` fields, so just trivially resolvable values) as a json object - [x] Handle container - call `sync` only, rely on progress output for anything else - [x] Handle directory - call `sync` only, rely on progress output for anything else - [x] Handle file - call `sync` only, rely on progress output for anything else - [ ] Handle IDs returned by `sync` (i.e. the case where the user explicitly chains `sync`) - just rely on progress output, don't show the id
https://github.com/dagger/dagger/issues/6359
https://github.com/dagger/dagger/pull/6482
2999573c5a34e85b8baac8c0150881d9c08a86b8
d91ac42c196873830c2e0876b251f3bf4d62ea49
2024-01-03T20:19:06Z
go
2024-01-26T18:48:04Z
core/integration/module_test.go
t.Helper() generated, err := modSrc.File("dagger.gen.go").Contents(ctx) require.NoError(t, err) t.Cleanup(func() { t.Name() fileName := filepath.Join( os.TempDir(), t.Name(), fmt.Sprintf("dagger.gen.%d.go", time.Now().Unix()), ) if err := os.MkdirAll(filepath.Dir(fileName), 0o755); err != nil { t.Logf("failed to create temp dir for generated code: %v", err) return } if err := os.WriteFile(fileName, []byte(generated), 0644); err != nil { t.Logf("failed to write generated code to %s: %v", fileName, err) } else { t.Logf("wrote generated code to %s", fileName) } }) }
closed
dagger/dagger
https://github.com/dagger/dagger
6,501
🐞 Logs are duplicated when a vertex is used multiple times
### What is the issue? This issue is only on `main`; the current release, v0.9.7, is not affected. If you run a pipeline with a vertex that is used multiple times in the same session, the log output will be duplicated, possibly with each extra use (i.e. cache hit). ### Dagger version main ### Steps to reproduce Once #6456 is merged, run a function that calls another function twice; you should see duplicate logs in its `codegen` vertex. ### Log output `main`: ![image](https://uploads.linear.app/0b2a9228-3827-45ff-bb20-ccd34f57f694/3f8aa9f9-2a55-464f-88fa-b720b81b0243/5b2f333b-937b-4f83-9c32-498524dd1c66?signature=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJwYXRoIjoiLzBiMmE5MjI4LTM4MjctNDVmZi1iYjIwLWNjZDM0ZjU3ZjY5NC8zZjhhYTlmOS0yYTU1LTQ2NGYtODhmYS1iNzIwYjgxYjAyNDMvNWIyZjMzM2ItOTM3Yi00ZjgzLTljMzItNDk4NTI0ZGQxYzY2IiwiaWF0IjoxNzA2MjM3NTE0LCJleHAiOjMzMjc2Nzk3NTE0fQ.7DzuNYrqSTg645n0iILYM_7rx7FVC_CjoPN0saIQre8) `v0.9.7`: ![image](https://uploads.linear.app/0b2a9228-3827-45ff-bb20-ccd34f57f694/1286bdec-e70a-46a3-858a-356ebfa69020/513d034f-3b15-4555-b767-23dde6f09f06?signature=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJwYXRoIjoiLzBiMmE5MjI4LTM4MjctNDVmZi1iYjIwLWNjZDM0ZjU3ZjY5NC8xMjg2YmRlYy1lNzBhLTQ2YTMtODU4YS0zNTZlYmZhNjkwMjAvNTEzZDAzNGYtM2IxNS00NTU1LWI3NjctMjNkZGU2ZjA5ZjA2IiwiaWF0IjoxNzA2MjM3NTE0LCJleHAiOjMzMjc2Nzk3NTE0fQ.-jrW8WycCYXyQsjxVMjHHXYdQ8HD_wD-\_cKwYIPgWXc)
https://github.com/dagger/dagger/issues/6501
https://github.com/dagger/dagger/pull/6505
53179a064559cf376fa2ad7596e32bd4e4934c74
30b22dd06e4366aed01f8f86d0a1729835b12aec
2024-01-26T02:30:45Z
go
2024-01-29T11:51:30Z
engine/buildkit/client.go
package buildkit import ( "context" "encoding/json" "errors" "fmt" "net" "strings" "sync" "time" "github.com/dagger/dagger/auth"
closed
dagger/dagger
https://github.com/dagger/dagger
6,501
🐞 Logs are duplicated when a vertex is used multiple times
### What is the issue? This issue is only on `main`; the current release, v0.9.7, is not affected. If you run a pipeline with a vertex that is used multiple times in the same session, the log output will be duplicated, possibly with each extra use (i.e. cache hit). ### Dagger version main ### Steps to reproduce Once #6456 is merged, run a function that calls another function twice; you should see duplicate logs in its `codegen` vertex. ### Log output `main`: ![image](https://uploads.linear.app/0b2a9228-3827-45ff-bb20-ccd34f57f694/3f8aa9f9-2a55-464f-88fa-b720b81b0243/5b2f333b-937b-4f83-9c32-498524dd1c66?signature=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJwYXRoIjoiLzBiMmE5MjI4LTM4MjctNDVmZi1iYjIwLWNjZDM0ZjU3ZjY5NC8zZjhhYTlmOS0yYTU1LTQ2NGYtODhmYS1iNzIwYjgxYjAyNDMvNWIyZjMzM2ItOTM3Yi00ZjgzLTljMzItNDk4NTI0ZGQxYzY2IiwiaWF0IjoxNzA2MjM3NTE0LCJleHAiOjMzMjc2Nzk3NTE0fQ.7DzuNYrqSTg645n0iILYM_7rx7FVC_CjoPN0saIQre8) `v0.9.7`: ![image](https://uploads.linear.app/0b2a9228-3827-45ff-bb20-ccd34f57f694/1286bdec-e70a-46a3-858a-356ebfa69020/513d034f-3b15-4555-b767-23dde6f09f06?signature=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJwYXRoIjoiLzBiMmE5MjI4LTM4MjctNDVmZi1iYjIwLWNjZDM0ZjU3ZjY5NC8xMjg2YmRlYy1lNzBhLTQ2YTMtODU4YS0zNTZlYmZhNjkwMjAvNTEzZDAzNGYtM2IxNS00NTU1LWI3NjctMjNkZGU2ZjA5ZjA2IiwiaWF0IjoxNzA2MjM3NTE0LCJleHAiOjMzMjc2Nzk3NTE0fQ.-jrW8WycCYXyQsjxVMjHHXYdQ8HD_wD-\_cKwYIPgWXc)
https://github.com/dagger/dagger/issues/6501
https://github.com/dagger/dagger/pull/6505
53179a064559cf376fa2ad7596e32bd4e4934c74
30b22dd06e4366aed01f8f86d0a1729835b12aec
2024-01-26T02:30:45Z
go
2024-01-29T11:51:30Z
engine/buildkit/client.go
"github.com/dagger/dagger/engine" "github.com/dagger/dagger/engine/session" bkcache "github.com/moby/buildkit/cache" bkcacheconfig "github.com/moby/buildkit/cache/config" "github.com/moby/buildkit/cache/remotecache" bkclient "github.com/moby/buildkit/client" "github.com/moby/buildkit/client/llb" "github.com/moby/buildkit/executor/oci" bkfrontend "github.com/moby/buildkit/frontend" bkgw "github.com/moby/buildkit/frontend/gateway/client" bkcontainer "github.com/moby/buildkit/frontend/gateway/container" "github.com/moby/buildkit/identity" bksession "github.com/moby/buildkit/session" bksecrets "github.com/moby/buildkit/session/secrets" bksolver "github.com/moby/buildkit/solver" "github.com/moby/buildkit/solver/llbsolver" bksolverpb "github.com/moby/buildkit/solver/pb" solverresult "github.com/moby/buildkit/solver/result" "github.com/moby/buildkit/util/bklog" "github.com/moby/buildkit/util/entitlements" bkworker "github.com/moby/buildkit/worker" "github.com/opencontainers/go-digest" "golang.org/x/sync/errgroup" "google.golang.org/grpc/metadata" ) const ( entitlementsJobKey = "llb.entitlements" ) type Opts struct {
closed
dagger/dagger
https://github.com/dagger/dagger
6,501
🐞 Logs are duplicated when a vertex is used multiple times
### What is the issue? This issue is only on `main`; the current release, v0.9.7, is not affected. If you run a pipeline with a vertex that is used multiple times in the same session, the log output will be duplicated, possibly with each extra use (i.e. cache hit). ### Dagger version main ### Steps to reproduce Once #6456 is merged, run a function that calls another function twice; you should see duplicate logs in its `codegen` vertex. ### Log output `main`: ![image](https://uploads.linear.app/0b2a9228-3827-45ff-bb20-ccd34f57f694/3f8aa9f9-2a55-464f-88fa-b720b81b0243/5b2f333b-937b-4f83-9c32-498524dd1c66?signature=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJwYXRoIjoiLzBiMmE5MjI4LTM4MjctNDVmZi1iYjIwLWNjZDM0ZjU3ZjY5NC8zZjhhYTlmOS0yYTU1LTQ2NGYtODhmYS1iNzIwYjgxYjAyNDMvNWIyZjMzM2ItOTM3Yi00ZjgzLTljMzItNDk4NTI0ZGQxYzY2IiwiaWF0IjoxNzA2MjM3NTE0LCJleHAiOjMzMjc2Nzk3NTE0fQ.7DzuNYrqSTg645n0iILYM_7rx7FVC_CjoPN0saIQre8) `v0.9.7`: ![image](https://uploads.linear.app/0b2a9228-3827-45ff-bb20-ccd34f57f694/1286bdec-e70a-46a3-858a-356ebfa69020/513d034f-3b15-4555-b767-23dde6f09f06?signature=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJwYXRoIjoiLzBiMmE5MjI4LTM4MjctNDVmZi1iYjIwLWNjZDM0ZjU3ZjY5NC8xMjg2YmRlYy1lNzBhLTQ2YTMtODU4YS0zNTZlYmZhNjkwMjAvNTEzZDAzNGYtM2IxNS00NTU1LWI3NjctMjNkZGU2ZjA5ZjA2IiwiaWF0IjoxNzA2MjM3NTE0LCJleHAiOjMzMjc2Nzk3NTE0fQ.-jrW8WycCYXyQsjxVMjHHXYdQ8HD_wD-\_cKwYIPgWXc)
https://github.com/dagger/dagger/issues/6501
https://github.com/dagger/dagger/pull/6505
53179a064559cf376fa2ad7596e32bd4e4934c74
30b22dd06e4366aed01f8f86d0a1729835b12aec
2024-01-26T02:30:45Z
go
2024-01-29T11:51:30Z
engine/buildkit/client.go
Worker bkworker.Worker SessionManager *bksession.Manager LLBSolver *llbsolver.Solver GenericSolver *bksolver.Solver SecretStore bksecrets.SecretStore AuthProvider *auth.RegistryAuthProvider PrivilegedExecEnabled bool UpstreamCacheImports []bkgw.CacheOptionsEntry MainClientCaller bksession.Caller DNSConfig *oci.DNSConfig } type ResolveCacheExporterFunc func(ctx context.Context, g bksession.Group) (remotecache.Exporter, error) type Client struct { Opts session *bksession.Session job *bksolver.Job llbBridge bkfrontend.FrontendLLBBridge clientMu sync.RWMutex clientIDToSecretToken map[string]string refs map[*ref]struct{} refsMu sync.Mutex containers map[bkgw.Container]struct{}
closed
dagger/dagger
https://github.com/dagger/dagger
6,501
🐞 Logs are duplicated when a vertex is used multiple times
### What is the issue? This issue is only on `main`; the current release, v0.9.7, is not affected. If you run a pipeline with a vertex that is used multiple times in the same session, the log output will be duplicated, possibly with each extra use (i.e. cache hit). ### Dagger version main ### Steps to reproduce Once #6456 is merged, run a function that calls another function twice; you should see duplicate logs in its `codegen` vertex. ### Log output `main`: ![image](https://uploads.linear.app/0b2a9228-3827-45ff-bb20-ccd34f57f694/3f8aa9f9-2a55-464f-88fa-b720b81b0243/5b2f333b-937b-4f83-9c32-498524dd1c66?signature=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJwYXRoIjoiLzBiMmE5MjI4LTM4MjctNDVmZi1iYjIwLWNjZDM0ZjU3ZjY5NC8zZjhhYTlmOS0yYTU1LTQ2NGYtODhmYS1iNzIwYjgxYjAyNDMvNWIyZjMzM2ItOTM3Yi00ZjgzLTljMzItNDk4NTI0ZGQxYzY2IiwiaWF0IjoxNzA2MjM3NTE0LCJleHAiOjMzMjc2Nzk3NTE0fQ.7DzuNYrqSTg645n0iILYM_7rx7FVC_CjoPN0saIQre8) `v0.9.7`: ![image](https://uploads.linear.app/0b2a9228-3827-45ff-bb20-ccd34f57f694/1286bdec-e70a-46a3-858a-356ebfa69020/513d034f-3b15-4555-b767-23dde6f09f06?signature=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJwYXRoIjoiLzBiMmE5MjI4LTM4MjctNDVmZi1iYjIwLWNjZDM0ZjU3ZjY5NC8xMjg2YmRlYy1lNzBhLTQ2YTMtODU4YS0zNTZlYmZhNjkwMjAvNTEzZDAzNGYtM2IxNS00NTU1LWI3NjctMjNkZGU2ZjA5ZjA2IiwiaWF0IjoxNzA2MjM3NTE0LCJleHAiOjMzMjc2Nzk3NTE0fQ.-jrW8WycCYXyQsjxVMjHHXYdQ8HD_wD-\_cKwYIPgWXc)
https://github.com/dagger/dagger/issues/6501
https://github.com/dagger/dagger/pull/6505
53179a064559cf376fa2ad7596e32bd4e4934c74
30b22dd06e4366aed01f8f86d0a1729835b12aec
2024-01-26T02:30:45Z
go
2024-01-29T11:51:30Z
engine/buildkit/client.go
containersMu sync.Mutex dialer *net.Dialer closeCtx context.Context cancel context.CancelFunc closeMu sync.RWMutex } func NewClient(ctx context.Context, opts Opts) (*Client, error) { closeCtx, cancel := context.WithCancel(context.Background()) client := &Client{ Opts: opts, clientIDToSecretToken: make(map[string]string), refs: make(map[*ref]struct{}), containers: make(map[bkgw.Container]struct{}), closeCtx: closeCtx, cancel: cancel, } session, err := client.newSession(ctx) if err != nil { return nil, err } client.session = session job, err := client.GenericSolver.NewJob(client.ID()) if err != nil { return nil, err } client.job = job client.job.SessionID = client.ID() entitlementSet := entitlements.Set{} if opts.PrivilegedExecEnabled { entitlementSet[entitlements.EntitlementSecurityInsecure] = struct{}{}
closed
dagger/dagger
https://github.com/dagger/dagger
6,501
🐞 Logs are duplicated when a vertex is used multiple times
### What is the issue? This issue is only on `main`; the current release, v0.9.7, is not affected. If you run a pipeline with a vertex that is used multiple times in the same session, the log output will be duplicated, possibly with each extra use (i.e. cache hit). ### Dagger version main ### Steps to reproduce Once #6456 is merged, run a function that calls another function twice; you should see duplicate logs in its `codegen` vertex. ### Log output `main`: ![image](https://uploads.linear.app/0b2a9228-3827-45ff-bb20-ccd34f57f694/3f8aa9f9-2a55-464f-88fa-b720b81b0243/5b2f333b-937b-4f83-9c32-498524dd1c66?signature=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJwYXRoIjoiLzBiMmE5MjI4LTM4MjctNDVmZi1iYjIwLWNjZDM0ZjU3ZjY5NC8zZjhhYTlmOS0yYTU1LTQ2NGYtODhmYS1iNzIwYjgxYjAyNDMvNWIyZjMzM2ItOTM3Yi00ZjgzLTljMzItNDk4NTI0ZGQxYzY2IiwiaWF0IjoxNzA2MjM3NTE0LCJleHAiOjMzMjc2Nzk3NTE0fQ.7DzuNYrqSTg645n0iILYM_7rx7FVC_CjoPN0saIQre8) `v0.9.7`: ![image](https://uploads.linear.app/0b2a9228-3827-45ff-bb20-ccd34f57f694/1286bdec-e70a-46a3-858a-356ebfa69020/513d034f-3b15-4555-b767-23dde6f09f06?signature=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJwYXRoIjoiLzBiMmE5MjI4LTM4MjctNDVmZi1iYjIwLWNjZDM0ZjU3ZjY5NC8xMjg2YmRlYy1lNzBhLTQ2YTMtODU4YS0zNTZlYmZhNjkwMjAvNTEzZDAzNGYtM2IxNS00NTU1LWI3NjctMjNkZGU2ZjA5ZjA2IiwiaWF0IjoxNzA2MjM3NTE0LCJleHAiOjMzMjc2Nzk3NTE0fQ.-jrW8WycCYXyQsjxVMjHHXYdQ8HD_wD-\_cKwYIPgWXc)
https://github.com/dagger/dagger/issues/6501
https://github.com/dagger/dagger/pull/6505
53179a064559cf376fa2ad7596e32bd4e4934c74
30b22dd06e4366aed01f8f86d0a1729835b12aec
2024-01-26T02:30:45Z
go
2024-01-29T11:51:30Z
engine/buildkit/client.go
} client.job.SetValue(entitlementsJobKey, entitlementSet) client.llbBridge = client.LLBSolver.Bridge(client.job) client.llbBridge = recordingGateway{client.llbBridge} client.dialer = &net.Dialer{} if opts.DNSConfig != nil { client.dialer.Resolver = &net.Resolver{ PreferGo: true, Dial: func(ctx context.Context, network, address string) (net.Conn, error) { if len(opts.DNSConfig.Nameservers) == 0 { return nil, errors.New("no nameservers configured") } var errs []error for _, ns := range opts.DNSConfig.Nameservers { conn, err := client.dialer.DialContext(ctx, network, net.JoinHostPort(ns, "53"))
closed
dagger/dagger
https://github.com/dagger/dagger
6,501
🐞 Logs are duplicated when a vertex is used multiple times
### What is the issue? This issue is only on `main`; the current release, v0.9.7, is not affected. If you run a pipeline with a vertex that is used multiple times in the same session, the log output will be duplicated, possibly with each extra use (i.e. cache hit). ### Dagger version main ### Steps to reproduce Once #6456 is merged, run a function that calls another function twice; you should see duplicate logs in its `codegen` vertex. ### Log output `main`: ![image](https://uploads.linear.app/0b2a9228-3827-45ff-bb20-ccd34f57f694/3f8aa9f9-2a55-464f-88fa-b720b81b0243/5b2f333b-937b-4f83-9c32-498524dd1c66?signature=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJwYXRoIjoiLzBiMmE5MjI4LTM4MjctNDVmZi1iYjIwLWNjZDM0ZjU3ZjY5NC8zZjhhYTlmOS0yYTU1LTQ2NGYtODhmYS1iNzIwYjgxYjAyNDMvNWIyZjMzM2ItOTM3Yi00ZjgzLTljMzItNDk4NTI0ZGQxYzY2IiwiaWF0IjoxNzA2MjM3NTE0LCJleHAiOjMzMjc2Nzk3NTE0fQ.7DzuNYrqSTg645n0iILYM_7rx7FVC_CjoPN0saIQre8) `v0.9.7`: ![image](https://uploads.linear.app/0b2a9228-3827-45ff-bb20-ccd34f57f694/1286bdec-e70a-46a3-858a-356ebfa69020/513d034f-3b15-4555-b767-23dde6f09f06?signature=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJwYXRoIjoiLzBiMmE5MjI4LTM4MjctNDVmZi1iYjIwLWNjZDM0ZjU3ZjY5NC8xMjg2YmRlYy1lNzBhLTQ2YTMtODU4YS0zNTZlYmZhNjkwMjAvNTEzZDAzNGYtM2IxNS00NTU1LWI3NjctMjNkZGU2ZjA5ZjA2IiwiaWF0IjoxNzA2MjM3NTE0LCJleHAiOjMzMjc2Nzk3NTE0fQ.-jrW8WycCYXyQsjxVMjHHXYdQ8HD_wD-\_cKwYIPgWXc)
https://github.com/dagger/dagger/issues/6501
https://github.com/dagger/dagger/pull/6505
53179a064559cf376fa2ad7596e32bd4e4934c74
30b22dd06e4366aed01f8f86d0a1729835b12aec
2024-01-26T02:30:45Z
go
2024-01-29T11:51:30Z
engine/buildkit/client.go
if err != nil { errs = append(errs, err) continue } return conn, nil } return nil, errors.Join(errs...) }, } } return client, nil } func (c *Client) ID() string { return c.session.ID() } func (c *Client) Close() error { c.closeMu.Lock() defer c.closeMu.Unlock() select { case <-c.closeCtx.Done(): return nil default: } c.cancel() c.job.Discard() c.job.CloseProgress() c.refsMu.Lock() for rf := range c.refs { if rf != nil {
closed
dagger/dagger
https://github.com/dagger/dagger
6,501
🐞 Logs are duplicated when a vertex is used multiple times
### What is the issue? This issue is only on `main`; the current release, v0.9.7, is not affected. If you run a pipeline with a vertex that is used multiple times in the same session, the log output will be duplicated, possibly with each extra use (i.e. cache hit). ### Dagger version main ### Steps to reproduce Once #6456 is merged, run a function that calls another function twice; you should see duplicate logs in its `codegen` vertex. ### Log output `main`: ![image](https://uploads.linear.app/0b2a9228-3827-45ff-bb20-ccd34f57f694/3f8aa9f9-2a55-464f-88fa-b720b81b0243/5b2f333b-937b-4f83-9c32-498524dd1c66?signature=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJwYXRoIjoiLzBiMmE5MjI4LTM4MjctNDVmZi1iYjIwLWNjZDM0ZjU3ZjY5NC8zZjhhYTlmOS0yYTU1LTQ2NGYtODhmYS1iNzIwYjgxYjAyNDMvNWIyZjMzM2ItOTM3Yi00ZjgzLTljMzItNDk4NTI0ZGQxYzY2IiwiaWF0IjoxNzA2MjM3NTE0LCJleHAiOjMzMjc2Nzk3NTE0fQ.7DzuNYrqSTg645n0iILYM_7rx7FVC_CjoPN0saIQre8) `v0.9.7`: ![image](https://uploads.linear.app/0b2a9228-3827-45ff-bb20-ccd34f57f694/1286bdec-e70a-46a3-858a-356ebfa69020/513d034f-3b15-4555-b767-23dde6f09f06?signature=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJwYXRoIjoiLzBiMmE5MjI4LTM4MjctNDVmZi1iYjIwLWNjZDM0ZjU3ZjY5NC8xMjg2YmRlYy1lNzBhLTQ2YTMtODU4YS0zNTZlYmZhNjkwMjAvNTEzZDAzNGYtM2IxNS00NTU1LWI3NjctMjNkZGU2ZjA5ZjA2IiwiaWF0IjoxNzA2MjM3NTE0LCJleHAiOjMzMjc2Nzk3NTE0fQ.-jrW8WycCYXyQsjxVMjHHXYdQ8HD_wD-\_cKwYIPgWXc)
https://github.com/dagger/dagger/issues/6501
https://github.com/dagger/dagger/pull/6505
53179a064559cf376fa2ad7596e32bd4e4934c74
30b22dd06e4366aed01f8f86d0a1729835b12aec
2024-01-26T02:30:45Z
go
2024-01-29T11:51:30Z
engine/buildkit/client.go
rf.resultProxy.Release(context.Background()) } } c.refs = nil c.refsMu.Unlock() c.containersMu.Lock() var containerReleaseGroup errgroup.Group for ctr := range c.containers { if ctr := ctr; ctr != nil { containerReleaseGroup.Go(func() error { releaseCtx, cancelRelease := context.WithTimeout(context.Background(), 30*time.Second) defer cancelRelease() return ctr.Release(releaseCtx) }) } } err := containerReleaseGroup.Wait() if err != nil { bklog.G(context.Background()).WithError(err).Error("failed to release containers") } c.containers = nil c.containersMu.Unlock() return nil } func (c *Client) withClientCloseCancel(ctx context.Context) (context.Context, context.CancelFunc, error) { c.closeMu.RLock() defer c.closeMu.RUnlock() select {
closed
dagger/dagger
https://github.com/dagger/dagger
6,501
🐞 Logs are duplicated when a vertex is used multiple times
### What is the issue? This issue is only on `main`; the current release, v0.9.7, is not affected. If you run a pipeline with a vertex that is used multiple times in the same session, the log output will be duplicated, possibly with each extra use (i.e. cache hit). ### Dagger version main ### Steps to reproduce Once #6456 is merged, run a function that calls another function twice; you should see duplicate logs in its `codegen` vertex. ### Log output `main`: ![image](https://uploads.linear.app/0b2a9228-3827-45ff-bb20-ccd34f57f694/3f8aa9f9-2a55-464f-88fa-b720b81b0243/5b2f333b-937b-4f83-9c32-498524dd1c66?signature=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJwYXRoIjoiLzBiMmE5MjI4LTM4MjctNDVmZi1iYjIwLWNjZDM0ZjU3ZjY5NC8zZjhhYTlmOS0yYTU1LTQ2NGYtODhmYS1iNzIwYjgxYjAyNDMvNWIyZjMzM2ItOTM3Yi00ZjgzLTljMzItNDk4NTI0ZGQxYzY2IiwiaWF0IjoxNzA2MjM3NTE0LCJleHAiOjMzMjc2Nzk3NTE0fQ.7DzuNYrqSTg645n0iILYM_7rx7FVC_CjoPN0saIQre8) `v0.9.7`: ![image](https://uploads.linear.app/0b2a9228-3827-45ff-bb20-ccd34f57f694/1286bdec-e70a-46a3-858a-356ebfa69020/513d034f-3b15-4555-b767-23dde6f09f06?signature=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJwYXRoIjoiLzBiMmE5MjI4LTM4MjctNDVmZi1iYjIwLWNjZDM0ZjU3ZjY5NC8xMjg2YmRlYy1lNzBhLTQ2YTMtODU4YS0zNTZlYmZhNjkwMjAvNTEzZDAzNGYtM2IxNS00NTU1LWI3NjctMjNkZGU2ZjA5ZjA2IiwiaWF0IjoxNzA2MjM3NTE0LCJleHAiOjMzMjc2Nzk3NTE0fQ.-jrW8WycCYXyQsjxVMjHHXYdQ8HD_wD-\_cKwYIPgWXc)
https://github.com/dagger/dagger/issues/6501
https://github.com/dagger/dagger/pull/6505
53179a064559cf376fa2ad7596e32bd4e4934c74
30b22dd06e4366aed01f8f86d0a1729835b12aec
2024-01-26T02:30:45Z
go
2024-01-29T11:51:30Z
engine/buildkit/client.go
case <-c.closeCtx.Done(): return nil, nil, errors.New("client closed") default: } ctx, cancel := context.WithCancel(ctx) go func() { select { case <-c.closeCtx.Done(): cancel() case <-ctx.Done(): } }() return ctx, cancel, nil } func (c *Client) Solve(ctx context.Context, req bkgw.SolveRequest) (_ *Result, rerr error) { ctx, cancel, err := c.withClientCloseCancel(ctx) if err != nil { return nil, err } defer cancel() ctx = withOutgoingContext(ctx) req.CacheImports = c.UpstreamCacheImports if req.Definition != nil && req.Definition.Def != nil { clientMetadata, err := engine.ClientMetadataFromContext(ctx) if err != nil { return nil, err } dag, err := DefToDAG(req.Definition)
closed
dagger/dagger
https://github.com/dagger/dagger
6,501
🐞 Logs are duplicated when a vertex is used multiple times
### What is the issue? This issue is only on `main`; the current release, v0.9.7, is not affected. If you run a pipeline with a vertex that is used multiple times in the same session, the log output will be duplicated, possibly with each extra use (i.e. cache hit). ### Dagger version main ### Steps to reproduce Once #6456 is merged, run a function that calls another function twice; you should see duplicate logs in its `codegen` vertex. ### Log output `main`: ![image](https://uploads.linear.app/0b2a9228-3827-45ff-bb20-ccd34f57f694/3f8aa9f9-2a55-464f-88fa-b720b81b0243/5b2f333b-937b-4f83-9c32-498524dd1c66?signature=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJwYXRoIjoiLzBiMmE5MjI4LTM4MjctNDVmZi1iYjIwLWNjZDM0ZjU3ZjY5NC8zZjhhYTlmOS0yYTU1LTQ2NGYtODhmYS1iNzIwYjgxYjAyNDMvNWIyZjMzM2ItOTM3Yi00ZjgzLTljMzItNDk4NTI0ZGQxYzY2IiwiaWF0IjoxNzA2MjM3NTE0LCJleHAiOjMzMjc2Nzk3NTE0fQ.7DzuNYrqSTg645n0iILYM_7rx7FVC_CjoPN0saIQre8) `v0.9.7`: ![image](https://uploads.linear.app/0b2a9228-3827-45ff-bb20-ccd34f57f694/1286bdec-e70a-46a3-858a-356ebfa69020/513d034f-3b15-4555-b767-23dde6f09f06?signature=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJwYXRoIjoiLzBiMmE5MjI4LTM4MjctNDVmZi1iYjIwLWNjZDM0ZjU3ZjY5NC8xMjg2YmRlYy1lNzBhLTQ2YTMtODU4YS0zNTZlYmZhNjkwMjAvNTEzZDAzNGYtM2IxNS00NTU1LWI3NjctMjNkZGU2ZjA5ZjA2IiwiaWF0IjoxNzA2MjM3NTE0LCJleHAiOjMzMjc2Nzk3NTE0fQ.-jrW8WycCYXyQsjxVMjHHXYdQ8HD_wD-\_cKwYIPgWXc)
https://github.com/dagger/dagger/issues/6501
https://github.com/dagger/dagger/pull/6505
53179a064559cf376fa2ad7596e32bd4e4934c74
30b22dd06e4366aed01f8f86d0a1729835b12aec
2024-01-26T02:30:45Z
go
2024-01-29T11:51:30Z
engine/buildkit/client.go
if err != nil { return nil, err } if err := dag.Walk(func(dag *OpDAG) error { execOp, ok := dag.AsExec() if !ok { return nil } if execOp.Meta == nil { execOp.Meta = &bksolverpb.Meta{} } if execOp.Meta.ProxyEnv == nil { execOp.Meta.ProxyEnv = &bksolverpb.ProxyEnv{} } execMeta := ContainerExecUncachedMetadata{ ParentClientIDs: clientMetadata.ClientIDs(), ServerID: clientMetadata.ServerID, } var err error execOp.Meta.ProxyEnv.FtpProxy, err = execMeta.ToPBFtpProxyVal() if err != nil { return err } return nil }); err != nil { return nil, err } newDef, err := dag.Marshal() if err != nil { return nil, err
closed
dagger/dagger
https://github.com/dagger/dagger
6,501
🐞 Logs are duplicated when a vertex is used multiple times
### What is the issue? This issue is only on `main`; the current release, v0.9.7, is not affected. If you run a pipeline with a vertex that is used multiple times in the same session, the log output will be duplicated, possibly with each extra use (i.e. cache hit). ### Dagger version main ### Steps to reproduce Once #6456 is merged, run a function that calls another function twice; you should see duplicate logs in its `codegen` vertex. ### Log output `main`: ![image](https://uploads.linear.app/0b2a9228-3827-45ff-bb20-ccd34f57f694/3f8aa9f9-2a55-464f-88fa-b720b81b0243/5b2f333b-937b-4f83-9c32-498524dd1c66?signature=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJwYXRoIjoiLzBiMmE5MjI4LTM4MjctNDVmZi1iYjIwLWNjZDM0ZjU3ZjY5NC8zZjhhYTlmOS0yYTU1LTQ2NGYtODhmYS1iNzIwYjgxYjAyNDMvNWIyZjMzM2ItOTM3Yi00ZjgzLTljMzItNDk4NTI0ZGQxYzY2IiwiaWF0IjoxNzA2MjM3NTE0LCJleHAiOjMzMjc2Nzk3NTE0fQ.7DzuNYrqSTg645n0iILYM_7rx7FVC_CjoPN0saIQre8) `v0.9.7`: ![image](https://uploads.linear.app/0b2a9228-3827-45ff-bb20-ccd34f57f694/1286bdec-e70a-46a3-858a-356ebfa69020/513d034f-3b15-4555-b767-23dde6f09f06?signature=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJwYXRoIjoiLzBiMmE5MjI4LTM4MjctNDVmZi1iYjIwLWNjZDM0ZjU3ZjY5NC8xMjg2YmRlYy1lNzBhLTQ2YTMtODU4YS0zNTZlYmZhNjkwMjAvNTEzZDAzNGYtM2IxNS00NTU1LWI3NjctMjNkZGU2ZjA5ZjA2IiwiaWF0IjoxNzA2MjM3NTE0LCJleHAiOjMzMjc2Nzk3NTE0fQ.-jrW8WycCYXyQsjxVMjHHXYdQ8HD_wD-\_cKwYIPgWXc)
https://github.com/dagger/dagger/issues/6501
https://github.com/dagger/dagger/pull/6505
53179a064559cf376fa2ad7596e32bd4e4934c74
30b22dd06e4366aed01f8f86d0a1729835b12aec
2024-01-26T02:30:45Z
go
2024-01-29T11:51:30Z
engine/buildkit/client.go
} req.Definition = newDef } llbRes, err := c.llbBridge.Solve(ctx, req, c.ID()) if err != nil { return nil, wrapError(ctx, err, c.ID()) } res, err := solverresult.ConvertResult(llbRes, func(rp bksolver.ResultProxy) (*ref, error) { return newRef(rp, c), nil }) if err != nil { llbRes.EachRef(func(rp bksolver.ResultProxy) error { return rp.Release(context.Background()) }) return nil, err } c.refsMu.Lock() defer c.refsMu.Unlock() if res.Ref != nil { c.refs[res.Ref] = struct{}{} } for _, rf := range res.Refs { c.refs[rf] = struct{}{} } return res, nil } func (c *Client) ResolveImageConfig(ctx context.Context, ref string, opt llb.ResolveImageConfigOpt) (string, digest.Digest, []byte, error) { ctx, cancel, err := c.withClientCloseCancel(ctx) if err != nil { return "", "", nil, err
closed
dagger/dagger
https://github.com/dagger/dagger
6,501
🐞 Logs are duplicated when a vertex is used multiple times
### What is the issue? This issue is only on `main`; the current release, v0.9.7, is not affected. If you run a pipeline with a vertex that is used multiple times in the same session, the log output will be duplicated, possibly with each extra use (i.e. cache hit). ### Dagger version main ### Steps to reproduce Once #6456 is merged, run a function that calls another function twice; you should see duplicate logs in its `codegen` vertex. ### Log output `main`: ![image](https://uploads.linear.app/0b2a9228-3827-45ff-bb20-ccd34f57f694/3f8aa9f9-2a55-464f-88fa-b720b81b0243/5b2f333b-937b-4f83-9c32-498524dd1c66?signature=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJwYXRoIjoiLzBiMmE5MjI4LTM4MjctNDVmZi1iYjIwLWNjZDM0ZjU3ZjY5NC8zZjhhYTlmOS0yYTU1LTQ2NGYtODhmYS1iNzIwYjgxYjAyNDMvNWIyZjMzM2ItOTM3Yi00ZjgzLTljMzItNDk4NTI0ZGQxYzY2IiwiaWF0IjoxNzA2MjM3NTE0LCJleHAiOjMzMjc2Nzk3NTE0fQ.7DzuNYrqSTg645n0iILYM_7rx7FVC_CjoPN0saIQre8) `v0.9.7`: ![image](https://uploads.linear.app/0b2a9228-3827-45ff-bb20-ccd34f57f694/1286bdec-e70a-46a3-858a-356ebfa69020/513d034f-3b15-4555-b767-23dde6f09f06?signature=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJwYXRoIjoiLzBiMmE5MjI4LTM4MjctNDVmZi1iYjIwLWNjZDM0ZjU3ZjY5NC8xMjg2YmRlYy1lNzBhLTQ2YTMtODU4YS0zNTZlYmZhNjkwMjAvNTEzZDAzNGYtM2IxNS00NTU1LWI3NjctMjNkZGU2ZjA5ZjA2IiwiaWF0IjoxNzA2MjM3NTE0LCJleHAiOjMzMjc2Nzk3NTE0fQ.-jrW8WycCYXyQsjxVMjHHXYdQ8HD_wD-\_cKwYIPgWXc)
https://github.com/dagger/dagger/issues/6501
https://github.com/dagger/dagger/pull/6505
53179a064559cf376fa2ad7596e32bd4e4934c74
30b22dd06e4366aed01f8f86d0a1729835b12aec
2024-01-26T02:30:45Z
go
2024-01-29T11:51:30Z
engine/buildkit/client.go
} defer cancel() ctx = withOutgoingContext(ctx) return c.llbBridge.ResolveImageConfig(ctx, ref, opt) } func (c *Client) NewContainer(ctx context.Context, req bkgw.NewContainerRequest) (bkgw.Container, error) { ctx, cancel, err := c.withClientCloseCancel(ctx) if err != nil { return nil, err } defer cancel() ctx = withOutgoingContext(ctx) ctrReq := bkcontainer.NewContainerRequest{ ContainerID: identity.NewID(), NetMode: req.NetMode, Hostname: req.Hostname, Mounts: make([]bkcontainer.Mount, len(req.Mounts)), } extraHosts, err := bkcontainer.ParseExtraHosts(req.ExtraHosts) if err != nil { return nil, err } ctrReq.ExtraHosts = extraHosts eg, egctx := errgroup.WithContext(ctx) for i, m := range req.Mounts { i, m := i, m eg.Go(func() error { var workerRef *bkworker.WorkerRef if m.Ref != nil {
closed
dagger/dagger
https://github.com/dagger/dagger
6,501
🐞 Logs are duplicated when a vertex is used multiple times
### What is the issue? This issue is only on `main`; the current release, v0.9.7, is not affected. If you run a pipeline with a vertex that is used multiple times in the same session, the log output will be duplicated, possibly with each extra use (i.e. cache hit). ### Dagger version main ### Steps to reproduce Once #6456 is merged, run a function that calls another function twice; you should see duplicate logs in its `codegen` vertex. ### Log output `main`: ![image](https://uploads.linear.app/0b2a9228-3827-45ff-bb20-ccd34f57f694/3f8aa9f9-2a55-464f-88fa-b720b81b0243/5b2f333b-937b-4f83-9c32-498524dd1c66?signature=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJwYXRoIjoiLzBiMmE5MjI4LTM4MjctNDVmZi1iYjIwLWNjZDM0ZjU3ZjY5NC8zZjhhYTlmOS0yYTU1LTQ2NGYtODhmYS1iNzIwYjgxYjAyNDMvNWIyZjMzM2ItOTM3Yi00ZjgzLTljMzItNDk4NTI0ZGQxYzY2IiwiaWF0IjoxNzA2MjM3NTE0LCJleHAiOjMzMjc2Nzk3NTE0fQ.7DzuNYrqSTg645n0iILYM_7rx7FVC_CjoPN0saIQre8) `v0.9.7`: ![image](https://uploads.linear.app/0b2a9228-3827-45ff-bb20-ccd34f57f694/1286bdec-e70a-46a3-858a-356ebfa69020/513d034f-3b15-4555-b767-23dde6f09f06?signature=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJwYXRoIjoiLzBiMmE5MjI4LTM4MjctNDVmZi1iYjIwLWNjZDM0ZjU3ZjY5NC8xMjg2YmRlYy1lNzBhLTQ2YTMtODU4YS0zNTZlYmZhNjkwMjAvNTEzZDAzNGYtM2IxNS00NTU1LWI3NjctMjNkZGU2ZjA5ZjA2IiwiaWF0IjoxNzA2MjM3NTE0LCJleHAiOjMzMjc2Nzk3NTE0fQ.-jrW8WycCYXyQsjxVMjHHXYdQ8HD_wD-\_cKwYIPgWXc)
https://github.com/dagger/dagger/issues/6501
https://github.com/dagger/dagger/pull/6505
53179a064559cf376fa2ad7596e32bd4e4934c74
30b22dd06e4366aed01f8f86d0a1729835b12aec
2024-01-26T02:30:45Z
go
2024-01-29T11:51:30Z
engine/buildkit/client.go
ref, ok := m.Ref.(*ref) if !ok { return fmt.Errorf("dagger: unexpected ref type: %T", m.Ref) } if ref != nil { res, err := ref.resultProxy.Result(egctx) if err != nil { return fmt.Errorf("result: %w", err) } workerRef, ok = res.Sys().(*bkworker.WorkerRef) if !ok { return fmt.Errorf("invalid res: %T", res.Sys()) } } } ctrReq.Mounts[i] = bkcontainer.Mount{ WorkerRef: workerRef, Mount: &bksolverpb.Mount{ Dest: m.Dest, Selector: m.Selector, Readonly: m.Readonly, MountType: m.MountType, CacheOpt: m.CacheOpt, SecretOpt: m.SecretOpt, SSHOpt: m.SSHOpt, }, } return nil }) }