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,532 | π Confusing error message when `Context` is not the first parameter of a function | ### What is the issue?
Mostly what the title says. The error message I get from putting the `Context` in the wrong place is cryptic.
### Dagger version
dagger v0.9.7
### Steps to reproduce
Create any Zenith module function and put the `context.Context` in any location but the first parameter.
### Log output
```
Error: failed to automate vcs: failed to get vcs ignored paths: input: resolve: module: withSource: failed to get modified source directory for go module sdk codegen: process "/usr/local/bin/codegen --module . --propagate-logs=true --introspection-json-path /schema.json" did not complete successfully: exit code: 1
input: resolve: module: withSource: failed to get modified source directory for go module sdk codegen: process "/usr/local/bin/codegen --module . --propagate-logs=true --introspection-json-path /schema.json" did not complete successfully: exit code: 1
```
This was also in the output
```
Stderr:
internal error during module code generation: runtime error: invalid memory address or nil pointer dereference
``` | https://github.com/dagger/dagger/issues/6532 | https://github.com/dagger/dagger/pull/6551 | 5b273004464711d1efcf427da9cefa7dc389497d | dcee33ec84858610450ef30ddfcad60a9b9be053 | 2024-01-30T19:02:52Z | go | 2024-02-07T17:20:29Z | core/integration/module_test.go | class Foo {
@func()
myFunction(): X {
return new X("foo");
}
}
`,
},
} {
tc := tc
t.Run(tc.sdk, func(t *testing.T) {
t.Parallel()
c, ctx := connect(t)
modGen := c.Container().From(golangImage).
WithMountedFile(testCLIBinPath, daggerCliFile(t, c)).
WithWorkdir("/work").
With(daggerExec("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}}}`)).Stdout(ctx)
require.NoError(t, err)
require.JSONEq(t, `{"foo":{"myFunction":{"message":"foo"}}}`, out)
})
}
}
func TestModuleReturnObject(t *testing.T) {
t.Parallel()
type testCase struct { |
closed | dagger/dagger | https://github.com/dagger/dagger | 6,532 | π Confusing error message when `Context` is not the first parameter of a function | ### What is the issue?
Mostly what the title says. The error message I get from putting the `Context` in the wrong place is cryptic.
### Dagger version
dagger v0.9.7
### Steps to reproduce
Create any Zenith module function and put the `context.Context` in any location but the first parameter.
### Log output
```
Error: failed to automate vcs: failed to get vcs ignored paths: input: resolve: module: withSource: failed to get modified source directory for go module sdk codegen: process "/usr/local/bin/codegen --module . --propagate-logs=true --introspection-json-path /schema.json" did not complete successfully: exit code: 1
input: resolve: module: withSource: failed to get modified source directory for go module sdk codegen: process "/usr/local/bin/codegen --module . --propagate-logs=true --introspection-json-path /schema.json" did not complete successfully: exit code: 1
```
This was also in the output
```
Stderr:
internal error during module code generation: runtime error: invalid memory address or nil pointer dereference
``` | https://github.com/dagger/dagger/issues/6532 | https://github.com/dagger/dagger/pull/6551 | 5b273004464711d1efcf427da9cefa7dc389497d | dcee33ec84858610450ef30ddfcad60a9b9be053 | 2024-01-30T19:02:52Z | go | 2024-02-07T17:20:29Z | core/integration/module_test.go | sdk string
source string
}
for _, tc := range []testCase{
{
sdk: "go",
source: `package main
type Foo struct {}
type X struct {
Message string ` + "`json:\"message\"`" + `
When string ` + "`json:\"Timestamp\"`" + `
To string ` + "`json:\"recipient\"`" + `
From string
}
func (m *Foo) MyFunction() X {
return X{Message: "foo", When: "now", To: "user", From: "admin"}
}
`,
},
{
sdk: "python",
source: `from dagger import field, function, object_type
@object_type
class X:
message: str = field(default="")
when: str = field(default="", name="Timestamp")
to: str = field(default="", name="recipient") |
closed | dagger/dagger | https://github.com/dagger/dagger | 6,532 | π Confusing error message when `Context` is not the first parameter of a function | ### What is the issue?
Mostly what the title says. The error message I get from putting the `Context` in the wrong place is cryptic.
### Dagger version
dagger v0.9.7
### Steps to reproduce
Create any Zenith module function and put the `context.Context` in any location but the first parameter.
### Log output
```
Error: failed to automate vcs: failed to get vcs ignored paths: input: resolve: module: withSource: failed to get modified source directory for go module sdk codegen: process "/usr/local/bin/codegen --module . --propagate-logs=true --introspection-json-path /schema.json" did not complete successfully: exit code: 1
input: resolve: module: withSource: failed to get modified source directory for go module sdk codegen: process "/usr/local/bin/codegen --module . --propagate-logs=true --introspection-json-path /schema.json" did not complete successfully: exit code: 1
```
This was also in the output
```
Stderr:
internal error during module code generation: runtime error: invalid memory address or nil pointer dereference
``` | https://github.com/dagger/dagger/issues/6532 | https://github.com/dagger/dagger/pull/6551 | 5b273004464711d1efcf427da9cefa7dc389497d | dcee33ec84858610450ef30ddfcad60a9b9be053 | 2024-01-30T19:02:52Z | go | 2024-02-07T17:20:29Z | core/integration/module_test.go | from_: str = field(default="", name="from")
@object_type
class Foo:
@function
def my_function(self) -> X:
return X(message="foo", when="now", to="user", from_="admin")
`,
},
{
sdk: "typescript",
source: `
import { object, func, field } from "@dagger.io/dagger"
@object()
class X {
@field()
message: string
@field()
timestamp: string
@field()
recipient: string
@field()
from: string
constructor(message: string, timestamp: string, recipient: string, from: string) {
this.message = message;
this.timestamp = timestamp;
this.recipient = recipient;
this.from = from;
}
}
@object() |
closed | dagger/dagger | https://github.com/dagger/dagger | 6,532 | π Confusing error message when `Context` is not the first parameter of a function | ### What is the issue?
Mostly what the title says. The error message I get from putting the `Context` in the wrong place is cryptic.
### Dagger version
dagger v0.9.7
### Steps to reproduce
Create any Zenith module function and put the `context.Context` in any location but the first parameter.
### Log output
```
Error: failed to automate vcs: failed to get vcs ignored paths: input: resolve: module: withSource: failed to get modified source directory for go module sdk codegen: process "/usr/local/bin/codegen --module . --propagate-logs=true --introspection-json-path /schema.json" did not complete successfully: exit code: 1
input: resolve: module: withSource: failed to get modified source directory for go module sdk codegen: process "/usr/local/bin/codegen --module . --propagate-logs=true --introspection-json-path /schema.json" did not complete successfully: exit code: 1
```
This was also in the output
```
Stderr:
internal error during module code generation: runtime error: invalid memory address or nil pointer dereference
``` | https://github.com/dagger/dagger/issues/6532 | https://github.com/dagger/dagger/pull/6551 | 5b273004464711d1efcf427da9cefa7dc389497d | dcee33ec84858610450ef30ddfcad60a9b9be053 | 2024-01-30T19:02:52Z | go | 2024-02-07T17:20:29Z | 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()
c, ctx := connect(t)
modGen := c.Container().From(golangImage).
WithMountedFile(testCLIBinPath, daggerCliFile(t, c)).
WithWorkdir("/work").
With(daggerExec("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()
type testCase struct { |
closed | dagger/dagger | https://github.com/dagger/dagger | 6,532 | π Confusing error message when `Context` is not the first parameter of a function | ### What is the issue?
Mostly what the title says. The error message I get from putting the `Context` in the wrong place is cryptic.
### Dagger version
dagger v0.9.7
### Steps to reproduce
Create any Zenith module function and put the `context.Context` in any location but the first parameter.
### Log output
```
Error: failed to automate vcs: failed to get vcs ignored paths: input: resolve: module: withSource: failed to get modified source directory for go module sdk codegen: process "/usr/local/bin/codegen --module . --propagate-logs=true --introspection-json-path /schema.json" did not complete successfully: exit code: 1
input: resolve: module: withSource: failed to get modified source directory for go module sdk codegen: process "/usr/local/bin/codegen --module . --propagate-logs=true --introspection-json-path /schema.json" did not complete successfully: exit code: 1
```
This was also in the output
```
Stderr:
internal error during module code generation: runtime error: invalid memory address or nil pointer dereference
``` | https://github.com/dagger/dagger/issues/6532 | https://github.com/dagger/dagger/pull/6551 | 5b273004464711d1efcf427da9cefa7dc389497d | dcee33ec84858610450ef30ddfcad60a9b9be053 | 2024-01-30T19:02:52Z | go | 2024-02-07T17:20:29Z | 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
class Playground: |
closed | dagger/dagger | https://github.com/dagger/dagger | 6,532 | π Confusing error message when `Context` is not the first parameter of a function | ### What is the issue?
Mostly what the title says. The error message I get from putting the `Context` in the wrong place is cryptic.
### Dagger version
dagger v0.9.7
### Steps to reproduce
Create any Zenith module function and put the `context.Context` in any location but the first parameter.
### Log output
```
Error: failed to automate vcs: failed to get vcs ignored paths: input: resolve: module: withSource: failed to get modified source directory for go module sdk codegen: process "/usr/local/bin/codegen --module . --propagate-logs=true --introspection-json-path /schema.json" did not complete successfully: exit code: 1
input: resolve: module: withSource: failed to get modified source directory for go module sdk codegen: process "/usr/local/bin/codegen --module . --propagate-logs=true --introspection-json-path /schema.json" did not complete successfully: exit code: 1
```
This was also in the output
```
Stderr:
internal error during module code generation: runtime error: invalid memory address or nil pointer dereference
``` | https://github.com/dagger/dagger/issues/6532 | https://github.com/dagger/dagger/pull/6551 | 5b273004464711d1efcf427da9cefa7dc389497d | dcee33ec84858610450ef30ddfcad60a9b9be053 | 2024-01-30T19:02:52Z | go | 2024-02-07T17:20:29Z | core/integration/module_test.go | @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 {
return new Foo(new Bar("hello world")); |
closed | dagger/dagger | https://github.com/dagger/dagger | 6,532 | π Confusing error message when `Context` is not the first parameter of a function | ### What is the issue?
Mostly what the title says. The error message I get from putting the `Context` in the wrong place is cryptic.
### Dagger version
dagger v0.9.7
### Steps to reproduce
Create any Zenith module function and put the `context.Context` in any location but the first parameter.
### Log output
```
Error: failed to automate vcs: failed to get vcs ignored paths: input: resolve: module: withSource: failed to get modified source directory for go module sdk codegen: process "/usr/local/bin/codegen --module . --propagate-logs=true --introspection-json-path /schema.json" did not complete successfully: exit code: 1
input: resolve: module: withSource: failed to get modified source directory for go module sdk codegen: process "/usr/local/bin/codegen --module . --propagate-logs=true --introspection-json-path /schema.json" did not complete successfully: exit code: 1
```
This was also in the output
```
Stderr:
internal error during module code generation: runtime error: invalid memory address or nil pointer dereference
``` | https://github.com/dagger/dagger/issues/6532 | https://github.com/dagger/dagger/pull/6551 | 5b273004464711d1efcf427da9cefa7dc389497d | dcee33ec84858610450ef30ddfcad60a9b9be053 | 2024-01-30T19:02:52Z | go | 2024-02-07T17:20:29Z | core/integration/module_test.go | }
}
`,
},
} {
tc := tc
t.Run(tc.sdk, func(t *testing.T) {
t.Parallel()
c, ctx := connect(t)
modGen := c.Container().From(golangImage).
WithMountedFile(testCLIBinPath, daggerCliFile(t, c)).
WithWorkdir("/work").
With(daggerExec("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()
type testCase struct {
sdk string
source string
}
for _, tc := range []testCase{ |
closed | dagger/dagger | https://github.com/dagger/dagger | 6,532 | π Confusing error message when `Context` is not the first parameter of a function | ### What is the issue?
Mostly what the title says. The error message I get from putting the `Context` in the wrong place is cryptic.
### Dagger version
dagger v0.9.7
### Steps to reproduce
Create any Zenith module function and put the `context.Context` in any location but the first parameter.
### Log output
```
Error: failed to automate vcs: failed to get vcs ignored paths: input: resolve: module: withSource: failed to get modified source directory for go module sdk codegen: process "/usr/local/bin/codegen --module . --propagate-logs=true --introspection-json-path /schema.json" did not complete successfully: exit code: 1
input: resolve: module: withSource: failed to get modified source directory for go module sdk codegen: process "/usr/local/bin/codegen --module . --propagate-logs=true --introspection-json-path /schema.json" did not complete successfully: exit code: 1
```
This was also in the output
```
Stderr:
internal error during module code generation: runtime error: invalid memory address or nil pointer dereference
``` | https://github.com/dagger/dagger/issues/6532 | https://github.com/dagger/dagger/pull/6551 | 5b273004464711d1efcf427da9cefa7dc389497d | dcee33ec84858610450ef30ddfcad60a9b9be053 | 2024-01-30T19:02:52Z | go | 2024-02-07T17:20:29Z | core/integration/module_test.go | {
sdk: "go",
source: `package main
type Playground struct{}
func (m *Playground) MySlice() []*Container {
return []*Container{dag.Container().From("` + alpineImage + `").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("` + alpineImage + `").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]:
return [dag.container().from_("` + alpineImage + `").with_exec(["echo", "hello world"])] |
closed | dagger/dagger | https://github.com/dagger/dagger | 6,532 | π Confusing error message when `Context` is not the first parameter of a function | ### What is the issue?
Mostly what the title says. The error message I get from putting the `Context` in the wrong place is cryptic.
### Dagger version
dagger v0.9.7
### Steps to reproduce
Create any Zenith module function and put the `context.Context` in any location but the first parameter.
### Log output
```
Error: failed to automate vcs: failed to get vcs ignored paths: input: resolve: module: withSource: failed to get modified source directory for go module sdk codegen: process "/usr/local/bin/codegen --module . --propagate-logs=true --introspection-json-path /schema.json" did not complete successfully: exit code: 1
input: resolve: module: withSource: failed to get modified source directory for go module sdk codegen: process "/usr/local/bin/codegen --module . --propagate-logs=true --introspection-json-path /schema.json" did not complete successfully: exit code: 1
```
This was also in the output
```
Stderr:
internal error during module code generation: runtime error: invalid memory address or nil pointer dereference
``` | https://github.com/dagger/dagger/issues/6532 | https://github.com/dagger/dagger/pull/6551 | 5b273004464711d1efcf427da9cefa7dc389497d | dcee33ec84858610450ef30ddfcad60a9b9be053 | 2024-01-30T19:02:52Z | go | 2024-02-07T17:20:29Z | core/integration/module_test.go | @function
def my_struct(self) -> Foo:
return Foo(con=dag.container().from_("` + alpineImage + `").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("` + alpineImage + `").withExec(["echo", "hello world"])
]
}
@func()
myStruct(): Foo { |
closed | dagger/dagger | https://github.com/dagger/dagger | 6,532 | π Confusing error message when `Context` is not the first parameter of a function | ### What is the issue?
Mostly what the title says. The error message I get from putting the `Context` in the wrong place is cryptic.
### Dagger version
dagger v0.9.7
### Steps to reproduce
Create any Zenith module function and put the `context.Context` in any location but the first parameter.
### Log output
```
Error: failed to automate vcs: failed to get vcs ignored paths: input: resolve: module: withSource: failed to get modified source directory for go module sdk codegen: process "/usr/local/bin/codegen --module . --propagate-logs=true --introspection-json-path /schema.json" did not complete successfully: exit code: 1
input: resolve: module: withSource: failed to get modified source directory for go module sdk codegen: process "/usr/local/bin/codegen --module . --propagate-logs=true --introspection-json-path /schema.json" did not complete successfully: exit code: 1
```
This was also in the output
```
Stderr:
internal error during module code generation: runtime error: invalid memory address or nil pointer dereference
``` | https://github.com/dagger/dagger/issues/6532 | https://github.com/dagger/dagger/pull/6551 | 5b273004464711d1efcf427da9cefa7dc389497d | dcee33ec84858610450ef30ddfcad60a9b9be053 | 2024-01-30T19:02:52Z | go | 2024-02-07T17:20:29Z | core/integration/module_test.go | return new Foo(
dag.container().from("` + alpineImage + `").withExec(["echo", "hello world"])
)
}
}
`,
},
} {
tc := tc
t.Run(tc.sdk, func(t *testing.T) {
t.Parallel()
c, ctx := connect(t)
modGen := c.Container().From(golangImage).
WithMountedFile(testCLIBinPath, daggerCliFile(t, c)).
WithWorkdir("/work").
With(daggerExec("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,532 | π Confusing error message when `Context` is not the first parameter of a function | ### What is the issue?
Mostly what the title says. The error message I get from putting the `Context` in the wrong place is cryptic.
### Dagger version
dagger v0.9.7
### Steps to reproduce
Create any Zenith module function and put the `context.Context` in any location but the first parameter.
### Log output
```
Error: failed to automate vcs: failed to get vcs ignored paths: input: resolve: module: withSource: failed to get modified source directory for go module sdk codegen: process "/usr/local/bin/codegen --module . --propagate-logs=true --introspection-json-path /schema.json" did not complete successfully: exit code: 1
input: resolve: module: withSource: failed to get modified source directory for go module sdk codegen: process "/usr/local/bin/codegen --module . --propagate-logs=true --introspection-json-path /schema.json" did not complete successfully: exit code: 1
```
This was also in the output
```
Stderr:
internal error during module code generation: runtime error: invalid memory address or nil pointer dereference
``` | https://github.com/dagger/dagger/issues/6532 | https://github.com/dagger/dagger/pull/6551 | 5b273004464711d1efcf427da9cefa7dc389497d | dcee33ec84858610450ef30ddfcad60a9b9be053 | 2024-01-30T19:02:52Z | go | 2024-02-07T17:20:29Z | core/integration/module_test.go | t.Parallel()
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("` + alpineImage + `").WithExec([]string{"echo", "hello world"}),
},
Report: ScanReport{
Contents: "hello world",
Authors: []string{"foo", "bar"},
},
}
}
`, |
closed | dagger/dagger | https://github.com/dagger/dagger | 6,532 | π Confusing error message when `Context` is not the first parameter of a function | ### What is the issue?
Mostly what the title says. The error message I get from putting the `Context` in the wrong place is cryptic.
### Dagger version
dagger v0.9.7
### Steps to reproduce
Create any Zenith module function and put the `context.Context` in any location but the first parameter.
### Log output
```
Error: failed to automate vcs: failed to get vcs ignored paths: input: resolve: module: withSource: failed to get modified source directory for go module sdk codegen: process "/usr/local/bin/codegen --module . --propagate-logs=true --introspection-json-path /schema.json" did not complete successfully: exit code: 1
input: resolve: module: withSource: failed to get modified source directory for go module sdk codegen: process "/usr/local/bin/codegen --module . --propagate-logs=true --introspection-json-path /schema.json" did not complete successfully: exit code: 1
```
This was also in the output
```
Stderr:
internal error during module code generation: runtime error: invalid memory address or nil pointer dereference
``` | https://github.com/dagger/dagger/issues/6532 | https://github.com/dagger/dagger/pull/6551 | 5b273004464711d1efcf427da9cefa7dc389497d | dcee33ec84858610450ef30ddfcad60a9b9be053 | 2024-01-30T19:02:52Z | go | 2024-02-07T17:20:29Z | 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_("` + alpineImage + `").with_exec(["echo", "hello world"]),
],
report=ScanReport(
contents="hello world",
authors=["foo", "bar"],
),
)
`,
},
{
sdk: "typescript", |
closed | dagger/dagger | https://github.com/dagger/dagger | 6,532 | π Confusing error message when `Context` is not the first parameter of a function | ### What is the issue?
Mostly what the title says. The error message I get from putting the `Context` in the wrong place is cryptic.
### Dagger version
dagger v0.9.7
### Steps to reproduce
Create any Zenith module function and put the `context.Context` in any location but the first parameter.
### Log output
```
Error: failed to automate vcs: failed to get vcs ignored paths: input: resolve: module: withSource: failed to get modified source directory for go module sdk codegen: process "/usr/local/bin/codegen --module . --propagate-logs=true --introspection-json-path /schema.json" did not complete successfully: exit code: 1
input: resolve: module: withSource: failed to get modified source directory for go module sdk codegen: process "/usr/local/bin/codegen --module . --propagate-logs=true --introspection-json-path /schema.json" did not complete successfully: exit code: 1
```
This was also in the output
```
Stderr:
internal error during module code generation: runtime error: invalid memory address or nil pointer dereference
``` | https://github.com/dagger/dagger/issues/6532 | https://github.com/dagger/dagger/pull/6551 | 5b273004464711d1efcf427da9cefa7dc389497d | dcee33ec84858610450ef30ddfcad60a9b9be053 | 2024-01-30T19:02:52Z | go | 2024-02-07T17:20:29Z | core/integration/module_test.go | 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")
containers: Container[]
@field()
report: ScanReport
constructor(containers: Container[], report: ScanReport) {
this.containers = containers
this.report = report
}
}
@object()
class Playground {
@func()
async scan(): Promise<ScanResult> {
return new ScanResult(
[ |
closed | dagger/dagger | https://github.com/dagger/dagger | 6,532 | π Confusing error message when `Context` is not the first parameter of a function | ### What is the issue?
Mostly what the title says. The error message I get from putting the `Context` in the wrong place is cryptic.
### Dagger version
dagger v0.9.7
### Steps to reproduce
Create any Zenith module function and put the `context.Context` in any location but the first parameter.
### Log output
```
Error: failed to automate vcs: failed to get vcs ignored paths: input: resolve: module: withSource: failed to get modified source directory for go module sdk codegen: process "/usr/local/bin/codegen --module . --propagate-logs=true --introspection-json-path /schema.json" did not complete successfully: exit code: 1
input: resolve: module: withSource: failed to get modified source directory for go module sdk codegen: process "/usr/local/bin/codegen --module . --propagate-logs=true --introspection-json-path /schema.json" did not complete successfully: exit code: 1
```
This was also in the output
```
Stderr:
internal error during module code generation: runtime error: invalid memory address or nil pointer dereference
``` | https://github.com/dagger/dagger/issues/6532 | https://github.com/dagger/dagger/pull/6551 | 5b273004464711d1efcf427da9cefa7dc389497d | dcee33ec84858610450ef30ddfcad60a9b9be053 | 2024-01-30T19:02:52Z | go | 2024-02-07T17:20:29Z | core/integration/module_test.go | dag.container().from("` + alpineImage + `").withExec(["echo", "hello world"])
],
new ScanReport("hello world", ["foo", "bar"])
)
}
}
`,
},
} {
tc := tc
t.Run(tc.sdk, func(t *testing.T) {
t.Parallel()
c, ctx := connect(t)
modGen := c.Container().From(golangImage).
WithMountedFile(testCLIBinPath, daggerCliFile(t, c)).
WithWorkdir("/work").
With(daggerExec("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 TestModuleGlobalVarDAG(t *testing.T) {
t.Parallel()
type testCase struct { |
closed | dagger/dagger | https://github.com/dagger/dagger | 6,532 | π Confusing error message when `Context` is not the first parameter of a function | ### What is the issue?
Mostly what the title says. The error message I get from putting the `Context` in the wrong place is cryptic.
### Dagger version
dagger v0.9.7
### Steps to reproduce
Create any Zenith module function and put the `context.Context` in any location but the first parameter.
### Log output
```
Error: failed to automate vcs: failed to get vcs ignored paths: input: resolve: module: withSource: failed to get modified source directory for go module sdk codegen: process "/usr/local/bin/codegen --module . --propagate-logs=true --introspection-json-path /schema.json" did not complete successfully: exit code: 1
input: resolve: module: withSource: failed to get modified source directory for go module sdk codegen: process "/usr/local/bin/codegen --module . --propagate-logs=true --introspection-json-path /schema.json" did not complete successfully: exit code: 1
```
This was also in the output
```
Stderr:
internal error during module code generation: runtime error: invalid memory address or nil pointer dereference
``` | https://github.com/dagger/dagger/issues/6532 | https://github.com/dagger/dagger/pull/6551 | 5b273004464711d1efcf427da9cefa7dc389497d | dcee33ec84858610450ef30ddfcad60a9b9be053 | 2024-01-30T19:02:52Z | go | 2024-02-07T17:20:29Z | 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("` + alpineImage + `")
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_("` + alpineImage + `")
@object_type
class Foo:
@function
async def fn(self) -> str:
return await SOME_DEFAULT.with_exec(["echo", "foo"]).stdout()
`,
},
{
sdk: "typescript",
source: `
import { dag, object, func } from "@dagger.io/dagger" |
closed | dagger/dagger | https://github.com/dagger/dagger | 6,532 | π Confusing error message when `Context` is not the first parameter of a function | ### What is the issue?
Mostly what the title says. The error message I get from putting the `Context` in the wrong place is cryptic.
### Dagger version
dagger v0.9.7
### Steps to reproduce
Create any Zenith module function and put the `context.Context` in any location but the first parameter.
### Log output
```
Error: failed to automate vcs: failed to get vcs ignored paths: input: resolve: module: withSource: failed to get modified source directory for go module sdk codegen: process "/usr/local/bin/codegen --module . --propagate-logs=true --introspection-json-path /schema.json" did not complete successfully: exit code: 1
input: resolve: module: withSource: failed to get modified source directory for go module sdk codegen: process "/usr/local/bin/codegen --module . --propagate-logs=true --introspection-json-path /schema.json" did not complete successfully: exit code: 1
```
This was also in the output
```
Stderr:
internal error during module code generation: runtime error: invalid memory address or nil pointer dereference
``` | https://github.com/dagger/dagger/issues/6532 | https://github.com/dagger/dagger/pull/6551 | 5b273004464711d1efcf427da9cefa7dc389497d | dcee33ec84858610450ef30ddfcad60a9b9be053 | 2024-01-30T19:02:52Z | go | 2024-02-07T17:20:29Z | core/integration/module_test.go | var someDefault = dag.container().from("` + alpineImage + `")
@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()
c, ctx := connect(t)
modGen := c.Container().From(golangImage).
WithMountedFile(testCLIBinPath, daggerCliFile(t, c)).
WithWorkdir("/work").
With(daggerExec("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,532 | π Confusing error message when `Context` is not the first parameter of a function | ### What is the issue?
Mostly what the title says. The error message I get from putting the `Context` in the wrong place is cryptic.
### Dagger version
dagger v0.9.7
### Steps to reproduce
Create any Zenith module function and put the `context.Context` in any location but the first parameter.
### Log output
```
Error: failed to automate vcs: failed to get vcs ignored paths: input: resolve: module: withSource: failed to get modified source directory for go module sdk codegen: process "/usr/local/bin/codegen --module . --propagate-logs=true --introspection-json-path /schema.json" did not complete successfully: exit code: 1
input: resolve: module: withSource: failed to get modified source directory for go module sdk codegen: process "/usr/local/bin/codegen --module . --propagate-logs=true --introspection-json-path /schema.json" did not complete successfully: exit code: 1
```
This was also in the output
```
Stderr:
internal error during module code generation: runtime error: invalid memory address or nil pointer dereference
``` | https://github.com/dagger/dagger/issues/6532 | https://github.com/dagger/dagger/pull/6551 | 5b273004464711d1efcf427da9cefa7dc389497d | dcee33ec84858610450ef30ddfcad60a9b9be053 | 2024-01-30T19:02:52Z | go | 2024-02-07T17:20:29Z | core/integration/module_test.go | t.Parallel()
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
class Foo: |
closed | dagger/dagger | https://github.com/dagger/dagger | 6,532 | π Confusing error message when `Context` is not the first parameter of a function | ### What is the issue?
Mostly what the title says. The error message I get from putting the `Context` in the wrong place is cryptic.
### Dagger version
dagger v0.9.7
### Steps to reproduce
Create any Zenith module function and put the `context.Context` in any location but the first parameter.
### Log output
```
Error: failed to automate vcs: failed to get vcs ignored paths: input: resolve: module: withSource: failed to get modified source directory for go module sdk codegen: process "/usr/local/bin/codegen --module . --propagate-logs=true --introspection-json-path /schema.json" did not complete successfully: exit code: 1
input: resolve: module: withSource: failed to get modified source directory for go module sdk codegen: process "/usr/local/bin/codegen --module . --propagate-logs=true --introspection-json-path /schema.json" did not complete successfully: exit code: 1
```
This was also in the output
```
Stderr:
internal error during module code generation: runtime error: invalid memory address or nil pointer dereference
``` | https://github.com/dagger/dagger/issues/6532 | https://github.com/dagger/dagger/pull/6551 | 5b273004464711d1efcf427da9cefa7dc389497d | dcee33ec84858610450ef30ddfcad60a9b9be053 | 2024-01-30T19:02:52Z | go | 2024-02-07T17:20:29Z | core/integration/module_test.go | 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,532 | π Confusing error message when `Context` is not the first parameter of a function | ### What is the issue?
Mostly what the title says. The error message I get from putting the `Context` in the wrong place is cryptic.
### Dagger version
dagger v0.9.7
### Steps to reproduce
Create any Zenith module function and put the `context.Context` in any location but the first parameter.
### Log output
```
Error: failed to automate vcs: failed to get vcs ignored paths: input: resolve: module: withSource: failed to get modified source directory for go module sdk codegen: process "/usr/local/bin/codegen --module . --propagate-logs=true --introspection-json-path /schema.json" did not complete successfully: exit code: 1
input: resolve: module: withSource: failed to get modified source directory for go module sdk codegen: process "/usr/local/bin/codegen --module . --propagate-logs=true --introspection-json-path /schema.json" did not complete successfully: exit code: 1
```
This was also in the output
```
Stderr:
internal error during module code generation: runtime error: invalid memory address or nil pointer dereference
``` | https://github.com/dagger/dagger/issues/6532 | https://github.com/dagger/dagger/pull/6551 | 5b273004464711d1efcf427da9cefa7dc389497d | dcee33ec84858610450ef30ddfcad60a9b9be053 | 2024-01-30T19:02:52Z | go | 2024-02-07T17:20:29Z | core/integration/module_test.go | tc := tc
t.Run(tc.sdk, func(t *testing.T) {
t.Parallel()
c, ctx := connect(t)
modGen := c.Container().From(golangImage).
WithMountedFile(testCLIBinPath, daggerCliFile(t, c)).
WithWorkdir("/work").
With(daggerExec("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,532 | π Confusing error message when `Context` is not the first parameter of a function | ### What is the issue?
Mostly what the title says. The error message I get from putting the `Context` in the wrong place is cryptic.
### Dagger version
dagger v0.9.7
### Steps to reproduce
Create any Zenith module function and put the `context.Context` in any location but the first parameter.
### Log output
```
Error: failed to automate vcs: failed to get vcs ignored paths: input: resolve: module: withSource: failed to get modified source directory for go module sdk codegen: process "/usr/local/bin/codegen --module . --propagate-logs=true --introspection-json-path /schema.json" did not complete successfully: exit code: 1
input: resolve: module: withSource: failed to get modified source directory for go module sdk codegen: process "/usr/local/bin/codegen --module . --propagate-logs=true --introspection-json-path /schema.json" did not complete successfully: exit code: 1
```
This was also in the output
```
Stderr:
internal error during module code generation: runtime error: invalid memory address or nil pointer dereference
``` | https://github.com/dagger/dagger/issues/6532 | https://github.com/dagger/dagger/pull/6551 | 5b273004464711d1efcf427da9cefa7dc389497d | dcee33ec84858610450ef30ddfcad60a9b9be053 | 2024-01-30T19:02:52Z | go | 2024-02-07T17:20:29Z | core/integration/module_test.go | t.Parallel()
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 {
for i := range msg { |
closed | dagger/dagger | https://github.com/dagger/dagger | 6,532 | π Confusing error message when `Context` is not the first parameter of a function | ### What is the issue?
Mostly what the title says. The error message I get from putting the `Context` in the wrong place is cryptic.
### Dagger version
dagger v0.9.7
### Steps to reproduce
Create any Zenith module function and put the `context.Context` in any location but the first parameter.
### Log output
```
Error: failed to automate vcs: failed to get vcs ignored paths: input: resolve: module: withSource: failed to get modified source directory for go module sdk codegen: process "/usr/local/bin/codegen --module . --propagate-logs=true --introspection-json-path /schema.json" did not complete successfully: exit code: 1
input: resolve: module: withSource: failed to get modified source directory for go module sdk codegen: process "/usr/local/bin/codegen --module . --propagate-logs=true --introspection-json-path /schema.json" did not complete successfully: exit code: 1
```
This was also in the output
```
Stderr:
internal error during module code generation: runtime error: invalid memory address or nil pointer dereference
``` | https://github.com/dagger/dagger/issues/6532 | https://github.com/dagger/dagger/pull/6551 | 5b273004464711d1efcf427da9cefa7dc389497d | dcee33ec84858610450ef30ddfcad60a9b9be053 | 2024-01-30T19:02:52Z | go | 2024-02-07T17:20:29Z | core/integration/module_test.go | 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",
source: ` |
closed | dagger/dagger | https://github.com/dagger/dagger | 6,532 | π Confusing error message when `Context` is not the first parameter of a function | ### What is the issue?
Mostly what the title says. The error message I get from putting the `Context` in the wrong place is cryptic.
### Dagger version
dagger v0.9.7
### Steps to reproduce
Create any Zenith module function and put the `context.Context` in any location but the first parameter.
### Log output
```
Error: failed to automate vcs: failed to get vcs ignored paths: input: resolve: module: withSource: failed to get modified source directory for go module sdk codegen: process "/usr/local/bin/codegen --module . --propagate-logs=true --introspection-json-path /schema.json" did not complete successfully: exit code: 1
input: resolve: module: withSource: failed to get modified source directory for go module sdk codegen: process "/usr/local/bin/codegen --module . --propagate-logs=true --introspection-json-path /schema.json" did not complete successfully: exit code: 1
```
This was also in the output
```
Stderr:
internal error during module code generation: runtime error: invalid memory address or nil pointer dereference
``` | https://github.com/dagger/dagger/issues/6532 | https://github.com/dagger/dagger/pull/6551 | 5b273004464711d1efcf427da9cefa7dc389497d | dcee33ec84858610450ef30ddfcad60a9b9be053 | 2024-01-30T19:02:52Z | go | 2024-02-07T17:20:29Z | core/integration/module_test.go | 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,532 | π Confusing error message when `Context` is not the first parameter of a function | ### What is the issue?
Mostly what the title says. The error message I get from putting the `Context` in the wrong place is cryptic.
### Dagger version
dagger v0.9.7
### Steps to reproduce
Create any Zenith module function and put the `context.Context` in any location but the first parameter.
### Log output
```
Error: failed to automate vcs: failed to get vcs ignored paths: input: resolve: module: withSource: failed to get modified source directory for go module sdk codegen: process "/usr/local/bin/codegen --module . --propagate-logs=true --introspection-json-path /schema.json" did not complete successfully: exit code: 1
input: resolve: module: withSource: failed to get modified source directory for go module sdk codegen: process "/usr/local/bin/codegen --module . --propagate-logs=true --introspection-json-path /schema.json" did not complete successfully: exit code: 1
```
This was also in the output
```
Stderr:
internal error during module code generation: runtime error: invalid memory address or nil pointer dereference
``` | https://github.com/dagger/dagger/issues/6532 | https://github.com/dagger/dagger/pull/6551 | 5b273004464711d1efcf427da9cefa7dc389497d | dcee33ec84858610450ef30ddfcad60a9b9be053 | 2024-01-30T19:02:52Z | go | 2024-02-07T17:20:29Z | core/integration/module_test.go | } {
tc := tc
t.Run(tc.sdk, func(t *testing.T) {
t.Parallel()
c, ctx := connect(t)
modGen := c.Container().From(golangImage).
WithMountedFile(testCLIBinPath, daggerCliFile(t, c)).
WithWorkdir("/work").
With(daggerExec("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,532 | π Confusing error message when `Context` is not the first parameter of a function | ### What is the issue?
Mostly what the title says. The error message I get from putting the `Context` in the wrong place is cryptic.
### Dagger version
dagger v0.9.7
### Steps to reproduce
Create any Zenith module function and put the `context.Context` in any location but the first parameter.
### Log output
```
Error: failed to automate vcs: failed to get vcs ignored paths: input: resolve: module: withSource: failed to get modified source directory for go module sdk codegen: process "/usr/local/bin/codegen --module . --propagate-logs=true --introspection-json-path /schema.json" did not complete successfully: exit code: 1
input: resolve: module: withSource: failed to get modified source directory for go module sdk codegen: process "/usr/local/bin/codegen --module . --propagate-logs=true --introspection-json-path /schema.json" did not complete successfully: exit code: 1
```
This was also in the output
```
Stderr:
internal error during module code generation: runtime error: invalid memory address or nil pointer dereference
``` | https://github.com/dagger/dagger/issues/6532 | https://github.com/dagger/dagger/pull/6551 | 5b273004464711d1efcf427da9cefa7dc389497d | dcee33ec84858610450ef30ddfcad60a9b9be053 | 2024-01-30T19:02:52Z | go | 2024-02-07T17:20:29Z | 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("init", "--name=d", "--sdk=go")).
WithNewFile("main.go", dagger.ContainerWithNewFileOpts{
Contents: `package main
type D struct{}
type Obj struct { |
closed | dagger/dagger | https://github.com/dagger/dagger | 6,532 | π Confusing error message when `Context` is not the first parameter of a function | ### What is the issue?
Mostly what the title says. The error message I get from putting the `Context` in the wrong place is cryptic.
### Dagger version
dagger v0.9.7
### Steps to reproduce
Create any Zenith module function and put the `context.Context` in any location but the first parameter.
### Log output
```
Error: failed to automate vcs: failed to get vcs ignored paths: input: resolve: module: withSource: failed to get modified source directory for go module sdk codegen: process "/usr/local/bin/codegen --module . --propagate-logs=true --introspection-json-path /schema.json" did not complete successfully: exit code: 1
input: resolve: module: withSource: failed to get modified source directory for go module sdk codegen: process "/usr/local/bin/codegen --module . --propagate-logs=true --introspection-json-path /schema.json" did not complete successfully: exit code: 1
```
This was also in the output
```
Stderr:
internal error during module code generation: runtime error: invalid memory address or nil pointer dereference
``` | https://github.com/dagger/dagger/issues/6532 | https://github.com/dagger/dagger/pull/6551 | 5b273004464711d1efcf427da9cefa7dc389497d | dcee33ec84858610450ef30ddfcad60a9b9be053 | 2024-01-30T19:02:52Z | go | 2024-02-07T17:20:29Z | core/integration/module_test.go | Foo string
}
func (m *D) Fn(foo string) Obj {
return Obj{Foo: foo}
}
`,
})
ctr = ctr.
WithMountedFile(testCLIBinPath, daggerCliFile(t, c)).
WithWorkdir("/work/dint").
With(daggerExec("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").
With(daggerExec("init", "--name=c", "--sdk=go", "c")).
WithWorkdir("/work/c").
With(daggerExec("install", "../dstr")).
WithNewFile("main.go", dagger.ContainerWithNewFileOpts{
Contents: `package main
import ( |
closed | dagger/dagger | https://github.com/dagger/dagger | 6,532 | π Confusing error message when `Context` is not the first parameter of a function | ### What is the issue?
Mostly what the title says. The error message I get from putting the `Context` in the wrong place is cryptic.
### Dagger version
dagger v0.9.7
### Steps to reproduce
Create any Zenith module function and put the `context.Context` in any location but the first parameter.
### Log output
```
Error: failed to automate vcs: failed to get vcs ignored paths: input: resolve: module: withSource: failed to get modified source directory for go module sdk codegen: process "/usr/local/bin/codegen --module . --propagate-logs=true --introspection-json-path /schema.json" did not complete successfully: exit code: 1
input: resolve: module: withSource: failed to get modified source directory for go module sdk codegen: process "/usr/local/bin/codegen --module . --propagate-logs=true --introspection-json-path /schema.json" did not complete successfully: exit code: 1
```
This was also in the output
```
Stderr:
internal error during module code generation: runtime error: invalid memory address or nil pointer dereference
``` | https://github.com/dagger/dagger/issues/6532 | https://github.com/dagger/dagger/pull/6551 | 5b273004464711d1efcf427da9cefa7dc389497d | dcee33ec84858610450ef30ddfcad60a9b9be053 | 2024-01-30T19:02:52Z | go | 2024-02-07T17:20:29Z | core/integration/module_test.go | "context"
)
type C struct{}
func (m *C) Fn(ctx context.Context, foo string) (string, error) {
return dag.D().Fn(foo).Foo(ctx)
}
`,
})
ctr = ctr.
WithWorkdir("/work").
With(daggerExec("init", "--name=b", "--sdk=go", "b")).
With(daggerExec("install", "-m=b", "./dint")).
WithNewFile("/work/b/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").
With(daggerExec("init", "--name=a", "--sdk=go", "a")).
WithWorkdir("/work/a").
With(daggerExec("install", "../b")).
With(daggerExec("install", "../c")).
WithNewFile("main.go", dagger.ContainerWithNewFileOpts{ |
closed | dagger/dagger | https://github.com/dagger/dagger | 6,532 | π Confusing error message when `Context` is not the first parameter of a function | ### What is the issue?
Mostly what the title says. The error message I get from putting the `Context` in the wrong place is cryptic.
### Dagger version
dagger v0.9.7
### Steps to reproduce
Create any Zenith module function and put the `context.Context` in any location but the first parameter.
### Log output
```
Error: failed to automate vcs: failed to get vcs ignored paths: input: resolve: module: withSource: failed to get modified source directory for go module sdk codegen: process "/usr/local/bin/codegen --module . --propagate-logs=true --introspection-json-path /schema.json" did not complete successfully: exit code: 1
input: resolve: module: withSource: failed to get modified source directory for go module sdk codegen: process "/usr/local/bin/codegen --module . --propagate-logs=true --introspection-json-path /schema.json" did not complete successfully: exit code: 1
```
This was also in the output
```
Stderr:
internal error during module code generation: runtime error: invalid memory address or nil pointer dereference
``` | https://github.com/dagger/dagger/issues/6532 | https://github.com/dagger/dagger/pull/6551 | 5b273004464711d1efcf427da9cefa7dc389497d | dcee33ec84858610450ef30ddfcad60a9b9be053 | 2024-01-30T19:02:52Z | go | 2024-02-07T17:20:29Z | core/integration/module_test.go | Contents: `package main
import (
"context"
"strconv"
)
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) { |
closed | dagger/dagger | https://github.com/dagger/dagger | 6,532 | π Confusing error message when `Context` is not the first parameter of a function | ### What is the issue?
Mostly what the title says. The error message I get from putting the `Context` in the wrong place is cryptic.
### Dagger version
dagger v0.9.7
### Steps to reproduce
Create any Zenith module function and put the `context.Context` in any location but the first parameter.
### Log output
```
Error: failed to automate vcs: failed to get vcs ignored paths: input: resolve: module: withSource: failed to get modified source directory for go module sdk codegen: process "/usr/local/bin/codegen --module . --propagate-logs=true --introspection-json-path /schema.json" did not complete successfully: exit code: 1
input: resolve: module: withSource: failed to get modified source directory for go module sdk codegen: process "/usr/local/bin/codegen --module . --propagate-logs=true --introspection-json-path /schema.json" did not complete successfully: exit code: 1
```
This was also in the output
```
Stderr:
internal error during module code generation: runtime error: invalid memory address or nil pointer dereference
``` | https://github.com/dagger/dagger/issues/6532 | https://github.com/dagger/dagger/pull/6551 | 5b273004464711d1efcf427da9cefa7dc389497d | dcee33ec84858610450ef30ddfcad60a9b9be053 | 2024-01-30T19:02:52Z | go | 2024-02-07T17:20:29Z | core/integration/module_test.go | t.Parallel()
c, ctx := connect(t)
out, err := c.Container().From(golangImage).
WithMountedFile(testCLIBinPath, daggerCliFile(t, c)).
WithWorkdir("/work").
With(daggerExec("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" |
closed | dagger/dagger | https://github.com/dagger/dagger | 6,532 | π Confusing error message when `Context` is not the first parameter of a function | ### What is the issue?
Mostly what the title says. The error message I get from putting the `Context` in the wrong place is cryptic.
### Dagger version
dagger v0.9.7
### Steps to reproduce
Create any Zenith module function and put the `context.Context` in any location but the first parameter.
### Log output
```
Error: failed to automate vcs: failed to get vcs ignored paths: input: resolve: module: withSource: failed to get modified source directory for go module sdk codegen: process "/usr/local/bin/codegen --module . --propagate-logs=true --introspection-json-path /schema.json" did not complete successfully: exit code: 1
input: resolve: module: withSource: failed to get modified source directory for go module sdk codegen: process "/usr/local/bin/codegen --module . --propagate-logs=true --introspection-json-path /schema.json" did not complete successfully: exit code: 1
```
This was also in the output
```
Stderr:
internal error during module code generation: runtime error: invalid memory address or nil pointer dereference
``` | https://github.com/dagger/dagger/issues/6532 | https://github.com/dagger/dagger/pull/6551 | 5b273004464711d1efcf427da9cefa7dc389497d | dcee33ec84858610450ef30ddfcad60a9b9be053 | 2024-01-30T19:02:52Z | go | 2024-02-07T17:20:29Z | core/integration/module_test.go | }
`,
}).
With(daggerQuery(`{test{fnA}}`)).
Stdout(ctx)
require.NoError(t, err)
require.JSONEq(t, `{"test":{"fnA": "hi from b"}}`, out)
}
func TestModuleGoWithOtherModuleTypes(t *testing.T) {
t.Parallel()
c, ctx := connect(t)
ctr := c.Container().From(golangImage).
WithMountedFile(testCLIBinPath, daggerCliFile(t, c)).
WithWorkdir("/work/dep").
With(daggerExec("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").
With(daggerExec("init", "--name=test", "--sdk=go", "test")).
With(daggerExec("install", "-m=test", "./dep")).
WithWorkdir("/work/test") |
closed | dagger/dagger | https://github.com/dagger/dagger | 6,532 | π Confusing error message when `Context` is not the first parameter of a function | ### What is the issue?
Mostly what the title says. The error message I get from putting the `Context` in the wrong place is cryptic.
### Dagger version
dagger v0.9.7
### Steps to reproduce
Create any Zenith module function and put the `context.Context` in any location but the first parameter.
### Log output
```
Error: failed to automate vcs: failed to get vcs ignored paths: input: resolve: module: withSource: failed to get modified source directory for go module sdk codegen: process "/usr/local/bin/codegen --module . --propagate-logs=true --introspection-json-path /schema.json" did not complete successfully: exit code: 1
input: resolve: module: withSource: failed to get modified source directory for go module sdk codegen: process "/usr/local/bin/codegen --module . --propagate-logs=true --introspection-json-path /schema.json" did not complete successfully: exit code: 1
```
This was also in the output
```
Stderr:
internal error during module code generation: runtime error: invalid memory address or nil pointer dereference
``` | https://github.com/dagger/dagger/issues/6532 | https://github.com/dagger/dagger/pull/6551 | 5b273004464711d1efcf427da9cefa7dc389497d | dcee33ec84858610450ef30ddfcad60a9b9be053 | 2024-01-30T19:02:52Z | go | 2024-02-07T17:20:29Z | core/integration/module_test.go | t.Run("return as other module object", func(t *testing.T) {
t.Run("direct", func(t *testing.T) {
_, 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",
))
})
t.Run("list", func(t *testing.T) {
_, err := ctr.
WithNewFile("main.go", dagger.ContainerWithNewFileOpts{
Contents: `package main
type Test struct{}
func (m *Test) Fn() ([]*DepObj, error) {
return nil, nil
}
`,
}).
With(daggerFunctions()). |
closed | dagger/dagger | https://github.com/dagger/dagger | 6,532 | π Confusing error message when `Context` is not the first parameter of a function | ### What is the issue?
Mostly what the title says. The error message I get from putting the `Context` in the wrong place is cryptic.
### Dagger version
dagger v0.9.7
### Steps to reproduce
Create any Zenith module function and put the `context.Context` in any location but the first parameter.
### Log output
```
Error: failed to automate vcs: failed to get vcs ignored paths: input: resolve: module: withSource: failed to get modified source directory for go module sdk codegen: process "/usr/local/bin/codegen --module . --propagate-logs=true --introspection-json-path /schema.json" did not complete successfully: exit code: 1
input: resolve: module: withSource: failed to get modified source directory for go module sdk codegen: process "/usr/local/bin/codegen --module . --propagate-logs=true --introspection-json-path /schema.json" did not complete successfully: exit code: 1
```
This was also in the output
```
Stderr:
internal error during module code generation: runtime error: invalid memory address or nil pointer dereference
``` | https://github.com/dagger/dagger/issues/6532 | https://github.com/dagger/dagger/pull/6551 | 5b273004464711d1efcf427da9cefa7dc389497d | dcee33ec84858610450ef30ddfcad60a9b9be053 | 2024-01-30T19:02:52Z | go | 2024-02-07T17:20:29Z | core/integration/module_test.go | 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("arg as other module object", func(t *testing.T) {
t.Run("direct", func(t *testing.T) {
_, 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) {
_, err := ctr.WithNewFile("main.go", dagger.ContainerWithNewFileOpts{
Contents: `package main
type Test struct{} |
closed | dagger/dagger | https://github.com/dagger/dagger | 6,532 | π Confusing error message when `Context` is not the first parameter of a function | ### What is the issue?
Mostly what the title says. The error message I get from putting the `Context` in the wrong place is cryptic.
### Dagger version
dagger v0.9.7
### Steps to reproduce
Create any Zenith module function and put the `context.Context` in any location but the first parameter.
### Log output
```
Error: failed to automate vcs: failed to get vcs ignored paths: input: resolve: module: withSource: failed to get modified source directory for go module sdk codegen: process "/usr/local/bin/codegen --module . --propagate-logs=true --introspection-json-path /schema.json" did not complete successfully: exit code: 1
input: resolve: module: withSource: failed to get modified source directory for go module sdk codegen: process "/usr/local/bin/codegen --module . --propagate-logs=true --introspection-json-path /schema.json" did not complete successfully: exit code: 1
```
This was also in the output
```
Stderr:
internal error during module code generation: runtime error: invalid memory address or nil pointer dereference
``` | https://github.com/dagger/dagger/issues/6532 | https://github.com/dagger/dagger/pull/6551 | 5b273004464711d1efcf427da9cefa7dc389497d | dcee33ec84858610450ef30ddfcad60a9b9be053 | 2024-01-30T19:02:52Z | go | 2024-02-07T17:20:29Z | core/integration/module_test.go | 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("field as other module object", func(t *testing.T) {
t.Run("direct", func(t *testing.T) {
_, 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) |
closed | dagger/dagger | https://github.com/dagger/dagger | 6,532 | π Confusing error message when `Context` is not the first parameter of a function | ### What is the issue?
Mostly what the title says. The error message I get from putting the `Context` in the wrong place is cryptic.
### Dagger version
dagger v0.9.7
### Steps to reproduce
Create any Zenith module function and put the `context.Context` in any location but the first parameter.
### Log output
```
Error: failed to automate vcs: failed to get vcs ignored paths: input: resolve: module: withSource: failed to get modified source directory for go module sdk codegen: process "/usr/local/bin/codegen --module . --propagate-logs=true --introspection-json-path /schema.json" did not complete successfully: exit code: 1
input: resolve: module: withSource: failed to get modified source directory for go module sdk codegen: process "/usr/local/bin/codegen --module . --propagate-logs=true --introspection-json-path /schema.json" did not complete successfully: exit code: 1
```
This was also in the output
```
Stderr:
internal error during module code generation: runtime error: invalid memory address or nil pointer dereference
``` | https://github.com/dagger/dagger/issues/6532 | https://github.com/dagger/dagger/pull/6551 | 5b273004464711d1efcf427da9cefa7dc389497d | dcee33ec84858610450ef30ddfcad60a9b9be053 | 2024-01-30T19:02:52Z | go | 2024-02-07T17:20:29Z | core/integration/module_test.go | 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",
))
})
t.Run("list", func(t *testing.T) {
_, 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",
))
})
})
}
var useInner = `package main |
closed | dagger/dagger | https://github.com/dagger/dagger | 6,532 | π Confusing error message when `Context` is not the first parameter of a function | ### What is the issue?
Mostly what the title says. The error message I get from putting the `Context` in the wrong place is cryptic.
### Dagger version
dagger v0.9.7
### Steps to reproduce
Create any Zenith module function and put the `context.Context` in any location but the first parameter.
### Log output
```
Error: failed to automate vcs: failed to get vcs ignored paths: input: resolve: module: withSource: failed to get modified source directory for go module sdk codegen: process "/usr/local/bin/codegen --module . --propagate-logs=true --introspection-json-path /schema.json" did not complete successfully: exit code: 1
input: resolve: module: withSource: failed to get modified source directory for go module sdk codegen: process "/usr/local/bin/codegen --module . --propagate-logs=true --introspection-json-path /schema.json" did not complete successfully: exit code: 1
```
This was also in the output
```
Stderr:
internal error during module code generation: runtime error: invalid memory address or nil pointer dereference
``` | https://github.com/dagger/dagger/issues/6532 | https://github.com/dagger/dagger/pull/6551 | 5b273004464711d1efcf427da9cefa7dc389497d | dcee33ec84858610450ef30ddfcad60a9b9be053 | 2024-01-30T19:02:52Z | go | 2024-02-07T17:20:29Z | core/integration/module_test.go | 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()
`
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()
type testCase struct { |
closed | dagger/dagger | https://github.com/dagger/dagger | 6,532 | π Confusing error message when `Context` is not the first parameter of a function | ### What is the issue?
Mostly what the title says. The error message I get from putting the `Context` in the wrong place is cryptic.
### Dagger version
dagger v0.9.7
### Steps to reproduce
Create any Zenith module function and put the `context.Context` in any location but the first parameter.
### Log output
```
Error: failed to automate vcs: failed to get vcs ignored paths: input: resolve: module: withSource: failed to get modified source directory for go module sdk codegen: process "/usr/local/bin/codegen --module . --propagate-logs=true --introspection-json-path /schema.json" did not complete successfully: exit code: 1
input: resolve: module: withSource: failed to get modified source directory for go module sdk codegen: process "/usr/local/bin/codegen --module . --propagate-logs=true --introspection-json-path /schema.json" did not complete successfully: exit code: 1
```
This was also in the output
```
Stderr:
internal error during module code generation: runtime error: invalid memory address or nil pointer dereference
``` | https://github.com/dagger/dagger/issues/6532 | https://github.com/dagger/dagger/pull/6551 | 5b273004464711d1efcf427da9cefa7dc389497d | dcee33ec84858610450ef30ddfcad60a9b9be053 | 2024-01-30T19:02:52Z | go | 2024-02-07T17:20:29Z | core/integration/module_test.go | 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,532 | π Confusing error message when `Context` is not the first parameter of a function | ### What is the issue?
Mostly what the title says. The error message I get from putting the `Context` in the wrong place is cryptic.
### Dagger version
dagger v0.9.7
### Steps to reproduce
Create any Zenith module function and put the `context.Context` in any location but the first parameter.
### Log output
```
Error: failed to automate vcs: failed to get vcs ignored paths: input: resolve: module: withSource: failed to get modified source directory for go module sdk codegen: process "/usr/local/bin/codegen --module . --propagate-logs=true --introspection-json-path /schema.json" did not complete successfully: exit code: 1
input: resolve: module: withSource: failed to get modified source directory for go module sdk codegen: process "/usr/local/bin/codegen --module . --propagate-logs=true --introspection-json-path /schema.json" did not complete successfully: exit code: 1
```
This was also in the output
```
Stderr:
internal error during module code generation: runtime error: invalid memory address or nil pointer dereference
``` | https://github.com/dagger/dagger/issues/6532 | https://github.com/dagger/dagger/pull/6551 | 5b273004464711d1efcf427da9cefa7dc389497d | dcee33ec84858610450ef30ddfcad60a9b9be053 | 2024-01-30T19:02:52Z | go | 2024-02-07T17:20:29Z | core/integration/module_test.go | } {
tc := tc
t.Run(fmt.Sprintf("%s uses go", tc.sdk), func(t *testing.T) {
t.Parallel()
c, ctx := connect(t)
modGen := c.Container().From(golangImage).
WithMountedFile(testCLIBinPath, daggerCliFile(t, c)).
WithWorkdir("/work/dep").
With(daggerExec("init", "--name=dep", "--sdk=go")).
With(sdkSource("go", useInner)).
WithWorkdir("/work").
With(daggerExec("init", "--name=use", "--sdk="+tc.sdk)).
With(sdkSource(tc.sdk, tc.source)).
With(daggerExec("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()
type testCase struct { |
closed | dagger/dagger | https://github.com/dagger/dagger | 6,532 | π Confusing error message when `Context` is not the first parameter of a function | ### What is the issue?
Mostly what the title says. The error message I get from putting the `Context` in the wrong place is cryptic.
### Dagger version
dagger v0.9.7
### Steps to reproduce
Create any Zenith module function and put the `context.Context` in any location but the first parameter.
### Log output
```
Error: failed to automate vcs: failed to get vcs ignored paths: input: resolve: module: withSource: failed to get modified source directory for go module sdk codegen: process "/usr/local/bin/codegen --module . --propagate-logs=true --introspection-json-path /schema.json" did not complete successfully: exit code: 1
input: resolve: module: withSource: failed to get modified source directory for go module sdk codegen: process "/usr/local/bin/codegen --module . --propagate-logs=true --introspection-json-path /schema.json" did not complete successfully: exit code: 1
```
This was also in the output
```
Stderr:
internal error during module code generation: runtime error: invalid memory address or nil pointer dereference
``` | https://github.com/dagger/dagger/issues/6532 | https://github.com/dagger/dagger/pull/6551 | 5b273004464711d1efcf427da9cefa7dc389497d | dcee33ec84858610450ef30ddfcad60a9b9be053 | 2024-01-30T19:02:52Z | go | 2024-02-07T17:20:29Z | 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()
c, ctx := connect(t)
modGen := c.Container().From(golangImage). |
closed | dagger/dagger | https://github.com/dagger/dagger | 6,532 | π Confusing error message when `Context` is not the first parameter of a function | ### What is the issue?
Mostly what the title says. The error message I get from putting the `Context` in the wrong place is cryptic.
### Dagger version
dagger v0.9.7
### Steps to reproduce
Create any Zenith module function and put the `context.Context` in any location but the first parameter.
### Log output
```
Error: failed to automate vcs: failed to get vcs ignored paths: input: resolve: module: withSource: failed to get modified source directory for go module sdk codegen: process "/usr/local/bin/codegen --module . --propagate-logs=true --introspection-json-path /schema.json" did not complete successfully: exit code: 1
input: resolve: module: withSource: failed to get modified source directory for go module sdk codegen: process "/usr/local/bin/codegen --module . --propagate-logs=true --introspection-json-path /schema.json" did not complete successfully: exit code: 1
```
This was also in the output
```
Stderr:
internal error during module code generation: runtime error: invalid memory address or nil pointer dereference
``` | https://github.com/dagger/dagger/issues/6532 | https://github.com/dagger/dagger/pull/6551 | 5b273004464711d1efcf427da9cefa7dc389497d | dcee33ec84858610450ef30ddfcad60a9b9be053 | 2024-01-30T19:02:52Z | go | 2024-02-07T17:20:29Z | core/integration/module_test.go | WithMountedFile(testCLIBinPath, daggerCliFile(t, c)).
WithWorkdir("/work/dep").
With(daggerExec("init", "--name=dep", "--sdk=go")).
With(sdkSource("go", useInner)).
WithWorkdir("/work").
With(daggerExec("init", "--name=use", "--sdk="+tc.sdk)).
With(sdkSource(tc.sdk, tc.source)).
With(daggerExec("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("develop"))
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,532 | π Confusing error message when `Context` is not the first parameter of a function | ### What is the issue?
Mostly what the title says. The error message I get from putting the `Context` in the wrong place is cryptic.
### Dagger version
dagger v0.9.7
### Steps to reproduce
Create any Zenith module function and put the `context.Context` in any location but the first parameter.
### Log output
```
Error: failed to automate vcs: failed to get vcs ignored paths: input: resolve: module: withSource: failed to get modified source directory for go module sdk codegen: process "/usr/local/bin/codegen --module . --propagate-logs=true --introspection-json-path /schema.json" did not complete successfully: exit code: 1
input: resolve: module: withSource: failed to get modified source directory for go module sdk codegen: process "/usr/local/bin/codegen --module . --propagate-logs=true --introspection-json-path /schema.json" did not complete successfully: exit code: 1
```
This was also in the output
```
Stderr:
internal error during module code generation: runtime error: invalid memory address or nil pointer dereference
``` | https://github.com/dagger/dagger/issues/6532 | https://github.com/dagger/dagger/pull/6551 | 5b273004464711d1efcf427da9cefa7dc389497d | dcee33ec84858610450ef30ddfcad60a9b9be053 | 2024-01-30T19:02:52Z | go | 2024-02-07T17:20:29Z | core/integration/module_test.go | }
func TestModuleSyncDeps(t *testing.T) {
t.Parallel()
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()
c, ctx := connect(t)
modGen := c.Container().From(golangImage).
WithMountedFile(testCLIBinPath, daggerCliFile(t, c)).
WithWorkdir("/work/dep").
With(daggerExec("init", "--name=dep", "--sdk=go")). |
closed | dagger/dagger | https://github.com/dagger/dagger | 6,532 | π Confusing error message when `Context` is not the first parameter of a function | ### What is the issue?
Mostly what the title says. The error message I get from putting the `Context` in the wrong place is cryptic.
### Dagger version
dagger v0.9.7
### Steps to reproduce
Create any Zenith module function and put the `context.Context` in any location but the first parameter.
### Log output
```
Error: failed to automate vcs: failed to get vcs ignored paths: input: resolve: module: withSource: failed to get modified source directory for go module sdk codegen: process "/usr/local/bin/codegen --module . --propagate-logs=true --introspection-json-path /schema.json" did not complete successfully: exit code: 1
input: resolve: module: withSource: failed to get modified source directory for go module sdk codegen: process "/usr/local/bin/codegen --module . --propagate-logs=true --introspection-json-path /schema.json" did not complete successfully: exit code: 1
```
This was also in the output
```
Stderr:
internal error during module code generation: runtime error: invalid memory address or nil pointer dereference
``` | https://github.com/dagger/dagger/issues/6532 | https://github.com/dagger/dagger/pull/6551 | 5b273004464711d1efcf427da9cefa7dc389497d | dcee33ec84858610450ef30ddfcad60a9b9be053 | 2024-01-30T19:02:52Z | go | 2024-02-07T17:20:29Z | core/integration/module_test.go | With(sdkSource("go", useInner)).
WithWorkdir("/work").
With(daggerExec("init", "--name=use", "--sdk="+tc.sdk)).
With(sdkSource(tc.sdk, tc.source)).
With(daggerExec("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("develop"))
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()
type testCase struct { |
closed | dagger/dagger | https://github.com/dagger/dagger | 6,532 | π Confusing error message when `Context` is not the first parameter of a function | ### What is the issue?
Mostly what the title says. The error message I get from putting the `Context` in the wrong place is cryptic.
### Dagger version
dagger v0.9.7
### Steps to reproduce
Create any Zenith module function and put the `context.Context` in any location but the first parameter.
### Log output
```
Error: failed to automate vcs: failed to get vcs ignored paths: input: resolve: module: withSource: failed to get modified source directory for go module sdk codegen: process "/usr/local/bin/codegen --module . --propagate-logs=true --introspection-json-path /schema.json" did not complete successfully: exit code: 1
input: resolve: module: withSource: failed to get modified source directory for go module sdk codegen: process "/usr/local/bin/codegen --module . --propagate-logs=true --introspection-json-path /schema.json" did not complete successfully: exit code: 1
```
This was also in the output
```
Stderr:
internal error during module code generation: runtime error: invalid memory address or nil pointer dereference
``` | https://github.com/dagger/dagger/issues/6532 | https://github.com/dagger/dagger/pull/6551 | 5b273004464711d1efcf427da9cefa7dc389497d | dcee33ec84858610450ef30ddfcad60a9b9be053 | 2024-01-30T19:02:52Z | go | 2024-02-07T17:20:29Z | 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,532 | π Confusing error message when `Context` is not the first parameter of a function | ### What is the issue?
Mostly what the title says. The error message I get from putting the `Context` in the wrong place is cryptic.
### Dagger version
dagger v0.9.7
### Steps to reproduce
Create any Zenith module function and put the `context.Context` in any location but the first parameter.
### Log output
```
Error: failed to automate vcs: failed to get vcs ignored paths: input: resolve: module: withSource: failed to get modified source directory for go module sdk codegen: process "/usr/local/bin/codegen --module . --propagate-logs=true --introspection-json-path /schema.json" did not complete successfully: exit code: 1
input: resolve: module: withSource: failed to get modified source directory for go module sdk codegen: process "/usr/local/bin/codegen --module . --propagate-logs=true --introspection-json-path /schema.json" did not complete successfully: exit code: 1
```
This was also in the output
```
Stderr:
internal error during module code generation: runtime error: invalid memory address or nil pointer dereference
``` | https://github.com/dagger/dagger/issues/6532 | https://github.com/dagger/dagger/pull/6551 | 5b273004464711d1efcf427da9cefa7dc389497d | dcee33ec84858610450ef30ddfcad60a9b9be053 | 2024-01-30T19:02:52Z | go | 2024-02-07T17:20:29Z | 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()
c, ctx := connect(t)
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 {} |
closed | dagger/dagger | https://github.com/dagger/dagger | 6,532 | π Confusing error message when `Context` is not the first parameter of a function | ### What is the issue?
Mostly what the title says. The error message I get from putting the `Context` in the wrong place is cryptic.
### Dagger version
dagger v0.9.7
### Steps to reproduce
Create any Zenith module function and put the `context.Context` in any location but the first parameter.
### Log output
```
Error: failed to automate vcs: failed to get vcs ignored paths: input: resolve: module: withSource: failed to get modified source directory for go module sdk codegen: process "/usr/local/bin/codegen --module . --propagate-logs=true --introspection-json-path /schema.json" did not complete successfully: exit code: 1
input: resolve: module: withSource: failed to get modified source directory for go module sdk codegen: process "/usr/local/bin/codegen --module . --propagate-logs=true --introspection-json-path /schema.json" did not complete successfully: exit code: 1
```
This was also in the output
```
Stderr:
internal error during module code generation: runtime error: invalid memory address or nil pointer dereference
``` | https://github.com/dagger/dagger/issues/6532 | https://github.com/dagger/dagger/pull/6551 | 5b273004464711d1efcf427da9cefa7dc389497d | dcee33ec84858610450ef30ddfcad60a9b9be053 | 2024-01-30T19:02:52Z | go | 2024-02-07T17:20:29Z | core/integration/module_test.go | func (m *Foo) Name() string { return "foo" }
`,
}).
With(daggerExec("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("init", "--name=bar", "--sdk=go")).
WithWorkdir("/work").
With(daggerExec("init", "--name=use", "--sdk="+tc.sdk)).
With(daggerExec("install", "./foo")).
With(daggerExec("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()
type testCase struct { |
closed | dagger/dagger | https://github.com/dagger/dagger | 6,532 | π Confusing error message when `Context` is not the first parameter of a function | ### What is the issue?
Mostly what the title says. The error message I get from putting the `Context` in the wrong place is cryptic.
### Dagger version
dagger v0.9.7
### Steps to reproduce
Create any Zenith module function and put the `context.Context` in any location but the first parameter.
### Log output
```
Error: failed to automate vcs: failed to get vcs ignored paths: input: resolve: module: withSource: failed to get modified source directory for go module sdk codegen: process "/usr/local/bin/codegen --module . --propagate-logs=true --introspection-json-path /schema.json" did not complete successfully: exit code: 1
input: resolve: module: withSource: failed to get modified source directory for go module sdk codegen: process "/usr/local/bin/codegen --module . --propagate-logs=true --introspection-json-path /schema.json" did not complete successfully: exit code: 1
```
This was also in the output
```
Stderr:
internal error during module code generation: runtime error: invalid memory address or nil pointer dereference
``` | https://github.com/dagger/dagger/issues/6532 | https://github.com/dagger/dagger/pull/6551 | 5b273004464711d1efcf427da9cefa7dc389497d | dcee33ec84858610450ef30ddfcad60a9b9be053 | 2024-01-30T19:02:52Z | go | 2024-02-07T17:20:29Z | 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{ |
closed | dagger/dagger | https://github.com/dagger/dagger | 6,532 | π Confusing error message when `Context` is not the first parameter of a function | ### What is the issue?
Mostly what the title says. The error message I get from putting the `Context` in the wrong place is cryptic.
### Dagger version
dagger v0.9.7
### Steps to reproduce
Create any Zenith module function and put the `context.Context` in any location but the first parameter.
### Log output
```
Error: failed to automate vcs: failed to get vcs ignored paths: input: resolve: module: withSource: failed to get modified source directory for go module sdk codegen: process "/usr/local/bin/codegen --module . --propagate-logs=true --introspection-json-path /schema.json" did not complete successfully: exit code: 1
input: resolve: module: withSource: failed to get modified source directory for go module sdk codegen: process "/usr/local/bin/codegen --module . --propagate-logs=true --introspection-json-path /schema.json" did not complete successfully: exit code: 1
```
This was also in the output
```
Stderr:
internal error during module code generation: runtime error: invalid memory address or nil pointer dereference
``` | https://github.com/dagger/dagger/issues/6532 | https://github.com/dagger/dagger/pull/6551 | 5b273004464711d1efcf427da9cefa7dc389497d | dcee33ec84858610450ef30ddfcad60a9b9be053 | 2024-01-30T19:02:52Z | go | 2024-02-07T17:20:29Z | core/integration/module_test.go | Foo: foo,
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 |
closed | dagger/dagger | https://github.com/dagger/dagger | 6,532 | π Confusing error message when `Context` is not the first parameter of a function | ### What is the issue?
Mostly what the title says. The error message I get from putting the `Context` in the wrong place is cryptic.
### Dagger version
dagger v0.9.7
### Steps to reproduce
Create any Zenith module function and put the `context.Context` in any location but the first parameter.
### Log output
```
Error: failed to automate vcs: failed to get vcs ignored paths: input: resolve: module: withSource: failed to get modified source directory for go module sdk codegen: process "/usr/local/bin/codegen --module . --propagate-logs=true --introspection-json-path /schema.json" did not complete successfully: exit code: 1
input: resolve: module: withSource: failed to get modified source directory for go module sdk codegen: process "/usr/local/bin/codegen --module . --propagate-logs=true --introspection-json-path /schema.json" did not complete successfully: exit code: 1
```
This was also in the output
```
Stderr:
internal error during module code generation: runtime error: invalid memory address or nil pointer dereference
``` | https://github.com/dagger/dagger/issues/6532 | https://github.com/dagger/dagger/pull/6551 | 5b273004464711d1efcf427da9cefa7dc389497d | dcee33ec84858610450ef30ddfcad60a9b9be053 | 2024-01-30T19:02:52Z | go | 2024-02-07T17:20:29Z | core/integration/module_test.go | from dagger import field, function, object_type
@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 |
closed | dagger/dagger | https://github.com/dagger/dagger | 6,532 | π Confusing error message when `Context` is not the first parameter of a function | ### What is the issue?
Mostly what the title says. The error message I get from putting the `Context` in the wrong place is cryptic.
### Dagger version
dagger v0.9.7
### Steps to reproduce
Create any Zenith module function and put the `context.Context` in any location but the first parameter.
### Log output
```
Error: failed to automate vcs: failed to get vcs ignored paths: input: resolve: module: withSource: failed to get modified source directory for go module sdk codegen: process "/usr/local/bin/codegen --module . --propagate-logs=true --introspection-json-path /schema.json" did not complete successfully: exit code: 1
input: resolve: module: withSource: failed to get modified source directory for go module sdk codegen: process "/usr/local/bin/codegen --module . --propagate-logs=true --introspection-json-path /schema.json" did not complete successfully: exit code: 1
```
This was also in the output
```
Stderr:
internal error during module code generation: runtime error: invalid memory address or nil pointer dereference
``` | https://github.com/dagger/dagger/issues/6532 | https://github.com/dagger/dagger/pull/6551 | 5b273004464711d1efcf427da9cefa7dc389497d | dcee33ec84858610450ef30ddfcad60a9b9be053 | 2024-01-30T19:02:52Z | go | 2024-02-07T17:20:29Z | core/integration/module_test.go | @field()
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,532 | π Confusing error message when `Context` is not the first parameter of a function | ### What is the issue?
Mostly what the title says. The error message I get from putting the `Context` in the wrong place is cryptic.
### Dagger version
dagger v0.9.7
### Steps to reproduce
Create any Zenith module function and put the `context.Context` in any location but the first parameter.
### Log output
```
Error: failed to automate vcs: failed to get vcs ignored paths: input: resolve: module: withSource: failed to get modified source directory for go module sdk codegen: process "/usr/local/bin/codegen --module . --propagate-logs=true --introspection-json-path /schema.json" did not complete successfully: exit code: 1
input: resolve: module: withSource: failed to get modified source directory for go module sdk codegen: process "/usr/local/bin/codegen --module . --propagate-logs=true --introspection-json-path /schema.json" did not complete successfully: exit code: 1
```
This was also in the output
```
Stderr:
internal error during module code generation: runtime error: invalid memory address or nil pointer dereference
``` | https://github.com/dagger/dagger/issues/6532 | https://github.com/dagger/dagger/pull/6551 | 5b273004464711d1efcf427da9cefa7dc389497d | dcee33ec84858610450ef30ddfcad60a9b9be053 | 2024-01-30T19:02:52Z | go | 2024-02-07T17:20:29Z | core/integration/module_test.go | }
`,
},
} {
tc := tc
t.Run(tc.sdk, func(t *testing.T) {
t.Parallel()
c, ctx := connect(t)
ctr := modInit(ctx, t, c, 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)
require.NoError(t, err)
require.Equal(t, strings.TrimSpace(out), "x\ny\nz") |
closed | dagger/dagger | https://github.com/dagger/dagger | 6,532 | π Confusing error message when `Context` is not the first parameter of a function | ### What is the issue?
Mostly what the title says. The error message I get from putting the `Context` in the wrong place is cryptic.
### Dagger version
dagger v0.9.7
### Steps to reproduce
Create any Zenith module function and put the `context.Context` in any location but the first parameter.
### Log output
```
Error: failed to automate vcs: failed to get vcs ignored paths: input: resolve: module: withSource: failed to get modified source directory for go module sdk codegen: process "/usr/local/bin/codegen --module . --propagate-logs=true --introspection-json-path /schema.json" did not complete successfully: exit code: 1
input: resolve: module: withSource: failed to get modified source directory for go module sdk codegen: process "/usr/local/bin/codegen --module . --propagate-logs=true --introspection-json-path /schema.json" did not complete successfully: exit code: 1
```
This was also in the output
```
Stderr:
internal error during module code generation: runtime error: invalid memory address or nil pointer dereference
``` | https://github.com/dagger/dagger/issues/6532 | https://github.com/dagger/dagger/pull/6551 | 5b273004464711d1efcf427da9cefa7dc389497d | dcee33ec84858610450ef30ddfcad60a9b9be053 | 2024-01-30T19:02:52Z | go | 2024-02-07T17:20:29Z | core/integration/module_test.go | 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 {
AlpineVersion string
} |
closed | dagger/dagger | https://github.com/dagger/dagger | 6,532 | π Confusing error message when `Context` is not the first parameter of a function | ### What is the issue?
Mostly what the title says. The error message I get from putting the `Context` in the wrong place is cryptic.
### Dagger version
dagger v0.9.7
### Steps to reproduce
Create any Zenith module function and put the `context.Context` in any location but the first parameter.
### Log output
```
Error: failed to automate vcs: failed to get vcs ignored paths: input: resolve: module: withSource: failed to get modified source directory for go module sdk codegen: process "/usr/local/bin/codegen --module . --propagate-logs=true --introspection-json-path /schema.json" did not complete successfully: exit code: 1
input: resolve: module: withSource: failed to get modified source directory for go module sdk codegen: process "/usr/local/bin/codegen --module . --propagate-logs=true --introspection-json-path /schema.json" did not complete successfully: exit code: 1
```
This was also in the output
```
Stderr:
internal error during module code generation: runtime error: invalid memory address or nil pointer dereference
``` | https://github.com/dagger/dagger/issues/6532 | https://github.com/dagger/dagger/pull/6551 | 5b273004464711d1efcf427da9cefa7dc389497d | dcee33ec84858610450ef30ddfcad60a9b9be053 | 2024-01-30T19:02:52Z | go | 2024-02-07T17:20:29Z | core/integration/module_test.go | `,
},
{
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 not standard to do async operations in the constructor.
// This is only for testing purpose but it shouldn't be done in real usage.
constructor() {
return (async () => { |
closed | dagger/dagger | https://github.com/dagger/dagger | 6,532 | π Confusing error message when `Context` is not the first parameter of a function | ### What is the issue?
Mostly what the title says. The error message I get from putting the `Context` in the wrong place is cryptic.
### Dagger version
dagger v0.9.7
### Steps to reproduce
Create any Zenith module function and put the `context.Context` in any location but the first parameter.
### Log output
```
Error: failed to automate vcs: failed to get vcs ignored paths: input: resolve: module: withSource: failed to get modified source directory for go module sdk codegen: process "/usr/local/bin/codegen --module . --propagate-logs=true --introspection-json-path /schema.json" did not complete successfully: exit code: 1
input: resolve: module: withSource: failed to get modified source directory for go module sdk codegen: process "/usr/local/bin/codegen --module . --propagate-logs=true --introspection-json-path /schema.json" did not complete successfully: exit code: 1
```
This was also in the output
```
Stderr:
internal error during module code generation: runtime error: invalid memory address or nil pointer dereference
``` | https://github.com/dagger/dagger/issues/6532 | https://github.com/dagger/dagger/pull/6551 | 5b273004464711d1efcf427da9cefa7dc389497d | dcee33ec84858610450ef30ddfcad60a9b9be053 | 2024-01-30T19:02:52Z | go | 2024-02-07T17:20:29Z | core/integration/module_test.go | 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()
c, ctx := connect(t)
ctr := c.Container().From(golangImage).
WithMountedFile(testCLIBinPath, daggerCliFile(t, c)).
WithWorkdir("/work/test").
With(daggerExec("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
import ( |
closed | dagger/dagger | https://github.com/dagger/dagger | 6,532 | π Confusing error message when `Context` is not the first parameter of a function | ### What is the issue?
Mostly what the title says. The error message I get from putting the `Context` in the wrong place is cryptic.
### Dagger version
dagger v0.9.7
### Steps to reproduce
Create any Zenith module function and put the `context.Context` in any location but the first parameter.
### Log output
```
Error: failed to automate vcs: failed to get vcs ignored paths: input: resolve: module: withSource: failed to get modified source directory for go module sdk codegen: process "/usr/local/bin/codegen --module . --propagate-logs=true --introspection-json-path /schema.json" did not complete successfully: exit code: 1
input: resolve: module: withSource: failed to get modified source directory for go module sdk codegen: process "/usr/local/bin/codegen --module . --propagate-logs=true --introspection-json-path /schema.json" did not complete successfully: exit code: 1
```
This was also in the output
```
Stderr:
internal error during module code generation: runtime error: invalid memory address or nil pointer dereference
``` | https://github.com/dagger/dagger/issues/6532 | https://github.com/dagger/dagger/pull/6551 | 5b273004464711d1efcf427da9cefa7dc389497d | dcee33ec84858610450ef30ddfcad60a9b9be053 | 2024-01-30T19:02:52Z | go | 2024-02-07T17:20:29Z | core/integration/module_test.go | "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() {
throw new Error("too bad") |
closed | dagger/dagger | https://github.com/dagger/dagger | 6,532 | π Confusing error message when `Context` is not the first parameter of a function | ### What is the issue?
Mostly what the title says. The error message I get from putting the `Context` in the wrong place is cryptic.
### Dagger version
dagger v0.9.7
### Steps to reproduce
Create any Zenith module function and put the `context.Context` in any location but the first parameter.
### Log output
```
Error: failed to automate vcs: failed to get vcs ignored paths: input: resolve: module: withSource: failed to get modified source directory for go module sdk codegen: process "/usr/local/bin/codegen --module . --propagate-logs=true --introspection-json-path /schema.json" did not complete successfully: exit code: 1
input: resolve: module: withSource: failed to get modified source directory for go module sdk codegen: process "/usr/local/bin/codegen --module . --propagate-logs=true --introspection-json-path /schema.json" did not complete successfully: exit code: 1
```
This was also in the output
```
Stderr:
internal error during module code generation: runtime error: invalid memory address or nil pointer dereference
``` | https://github.com/dagger/dagger/issues/6532 | https://github.com/dagger/dagger/pull/6551 | 5b273004464711d1efcf427da9cefa7dc389497d | dcee33ec84858610450ef30ddfcad60a9b9be053 | 2024-01-30T19:02:52Z | go | 2024-02-07T17:20:29Z | core/integration/module_test.go | }
}
`,
},
} {
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("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()
c, ctx := connect(t)
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,532 | π Confusing error message when `Context` is not the first parameter of a function | ### What is the issue?
Mostly what the title says. The error message I get from putting the `Context` in the wrong place is cryptic.
### Dagger version
dagger v0.9.7
### Steps to reproduce
Create any Zenith module function and put the `context.Context` in any location but the first parameter.
### Log output
```
Error: failed to automate vcs: failed to get vcs ignored paths: input: resolve: module: withSource: failed to get modified source directory for go module sdk codegen: process "/usr/local/bin/codegen --module . --propagate-logs=true --introspection-json-path /schema.json" did not complete successfully: exit code: 1
input: resolve: module: withSource: failed to get modified source directory for go module sdk codegen: process "/usr/local/bin/codegen --module . --propagate-logs=true --introspection-json-path /schema.json" did not complete successfully: exit code: 1
```
This was also in the output
```
Stderr:
internal error during module code generation: runtime error: invalid memory address or nil pointer dereference
``` | https://github.com/dagger/dagger/issues/6532 | https://github.com/dagger/dagger/pull/6551 | 5b273004464711d1efcf427da9cefa7dc389497d | dcee33ec84858610450ef30ddfcad60a9b9be053 | 2024-01-30T19:02:52Z | go | 2024-02-07T17:20:29Z | core/integration/module_test.go | With(daggerExec("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", "contents")).Stdout(ctx)
require.NoError(t, err)
require.Equal(t, content, strings.TrimSpace(out))
out, err = ctr.With(daggerCall("--foo=dagger.json", "foo", "contents")).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()
c, ctx := connect(t)
content := identity.NewID()
ctr := c.Container().From(golangImage).
WithMountedFile(testCLIBinPath, daggerCliFile(t, c)).
WithWorkdir("/work/test").
With(daggerExec("init", "--name=test", "--sdk=typescript")). |
closed | dagger/dagger | https://github.com/dagger/dagger | 6,532 | π Confusing error message when `Context` is not the first parameter of a function | ### What is the issue?
Mostly what the title says. The error message I get from putting the `Context` in the wrong place is cryptic.
### Dagger version
dagger v0.9.7
### Steps to reproduce
Create any Zenith module function and put the `context.Context` in any location but the first parameter.
### Log output
```
Error: failed to automate vcs: failed to get vcs ignored paths: input: resolve: module: withSource: failed to get modified source directory for go module sdk codegen: process "/usr/local/bin/codegen --module . --propagate-logs=true --introspection-json-path /schema.json" did not complete successfully: exit code: 1
input: resolve: module: withSource: failed to get modified source directory for go module sdk codegen: process "/usr/local/bin/codegen --module . --propagate-logs=true --introspection-json-path /schema.json" did not complete successfully: exit code: 1
```
This was also in the output
```
Stderr:
internal error during module code generation: runtime error: invalid memory address or nil pointer dereference
``` | https://github.com/dagger/dagger/issues/6532 | https://github.com/dagger/dagger/pull/6551 | 5b273004464711d1efcf427da9cefa7dc389497d | dcee33ec84858610450ef30ddfcad60a9b9be053 | 2024-01-30T19:02:52Z | go | 2024-02-07T17:20:29Z | core/integration/module_test.go | With(sdkSource("typescript", fmt.Sprintf(`
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", "contents")).Stdout(ctx)
require.NoError(t, err)
require.Equal(t, content, strings.TrimSpace(out))
out, err = ctr.With(daggerCall("--foo=dagger.json", "foo", "contents")).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()
type testCase struct { |
closed | dagger/dagger | https://github.com/dagger/dagger | 6,532 | π Confusing error message when `Context` is not the first parameter of a function | ### What is the issue?
Mostly what the title says. The error message I get from putting the `Context` in the wrong place is cryptic.
### Dagger version
dagger v0.9.7
### Steps to reproduce
Create any Zenith module function and put the `context.Context` in any location but the first parameter.
### Log output
```
Error: failed to automate vcs: failed to get vcs ignored paths: input: resolve: module: withSource: failed to get modified source directory for go module sdk codegen: process "/usr/local/bin/codegen --module . --propagate-logs=true --introspection-json-path /schema.json" did not complete successfully: exit code: 1
input: resolve: module: withSource: failed to get modified source directory for go module sdk codegen: process "/usr/local/bin/codegen --module . --propagate-logs=true --introspection-json-path /schema.json" did not complete successfully: exit code: 1
```
This was also in the output
```
Stderr:
internal error during module code generation: runtime error: invalid memory address or nil pointer dereference
``` | https://github.com/dagger/dagger/issues/6532 | https://github.com/dagger/dagger/pull/6551 | 5b273004464711d1efcf427da9cefa7dc389497d | dcee33ec84858610450ef30ddfcad60a9b9be053 | 2024-01-30T19:02:52Z | go | 2024-02-07T17:20:29Z | 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("` + alpineImage + `"),
}
}
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 |
closed | dagger/dagger | https://github.com/dagger/dagger | 6,532 | π Confusing error message when `Context` is not the first parameter of a function | ### What is the issue?
Mostly what the title says. The error message I get from putting the `Context` in the wrong place is cryptic.
### Dagger version
dagger v0.9.7
### Steps to reproduce
Create any Zenith module function and put the `context.Context` in any location but the first parameter.
### Log output
```
Error: failed to automate vcs: failed to get vcs ignored paths: input: resolve: module: withSource: failed to get modified source directory for go module sdk codegen: process "/usr/local/bin/codegen --module . --propagate-logs=true --introspection-json-path /schema.json" did not complete successfully: exit code: 1
input: resolve: module: withSource: failed to get modified source directory for go module sdk codegen: process "/usr/local/bin/codegen --module . --propagate-logs=true --introspection-json-path /schema.json" did not complete successfully: exit code: 1
```
This was also in the output
```
Stderr:
internal error during module code generation: runtime error: invalid memory address or nil pointer dereference
``` | https://github.com/dagger/dagger/issues/6532 | https://github.com/dagger/dagger/pull/6551 | 5b273004464711d1efcf427da9cefa7dc389497d | dcee33ec84858610450ef30ddfcad60a9b9be053 | 2024-01-30T19:02:52Z | go | 2024-02-07T17:20:29Z | core/integration/module_test.go | @object_type
class WrappedContainer:
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_("` + alpineImage + `"))
`,
},
{
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() |
closed | dagger/dagger | https://github.com/dagger/dagger | 6,532 | π Confusing error message when `Context` is not the first parameter of a function | ### What is the issue?
Mostly what the title says. The error message I get from putting the `Context` in the wrong place is cryptic.
### Dagger version
dagger v0.9.7
### Steps to reproduce
Create any Zenith module function and put the `context.Context` in any location but the first parameter.
### Log output
```
Error: failed to automate vcs: failed to get vcs ignored paths: input: resolve: module: withSource: failed to get modified source directory for go module sdk codegen: process "/usr/local/bin/codegen --module . --propagate-logs=true --introspection-json-path /schema.json" did not complete successfully: exit code: 1
input: resolve: module: withSource: failed to get modified source directory for go module sdk codegen: process "/usr/local/bin/codegen --module . --propagate-logs=true --introspection-json-path /schema.json" did not complete successfully: exit code: 1
```
This was also in the output
```
Stderr:
internal error during module code generation: runtime error: invalid memory address or nil pointer dereference
``` | https://github.com/dagger/dagger/issues/6532 | https://github.com/dagger/dagger/pull/6551 | 5b273004464711d1efcf427da9cefa7dc389497d | dcee33ec84858610450ef30ddfcad60a9b9be053 | 2024-01-30T19:02:52Z | go | 2024-02-07T17:20:29Z | core/integration/module_test.go | class Wrapper {
@func()
container(): WrappedContainer {
return new WrappedContainer(dag.container().from("` + alpineImage + `"))
}
}
`,
},
} {
tc := tc
t.Run(tc.sdk, func(t *testing.T) {
t.Parallel()
c, ctx := connect(t)
modGen := c.Container().From(golangImage).
WithMountedFile(testCLIBinPath, daggerCliFile(t, c)).
WithWorkdir("/work").
With(daggerExec("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)
}) |
closed | dagger/dagger | https://github.com/dagger/dagger | 6,532 | π Confusing error message when `Context` is not the first parameter of a function | ### What is the issue?
Mostly what the title says. The error message I get from putting the `Context` in the wrong place is cryptic.
### Dagger version
dagger v0.9.7
### Steps to reproduce
Create any Zenith module function and put the `context.Context` in any location but the first parameter.
### Log output
```
Error: failed to automate vcs: failed to get vcs ignored paths: input: resolve: module: withSource: failed to get modified source directory for go module sdk codegen: process "/usr/local/bin/codegen --module . --propagate-logs=true --introspection-json-path /schema.json" did not complete successfully: exit code: 1
input: resolve: module: withSource: failed to get modified source directory for go module sdk codegen: process "/usr/local/bin/codegen --module . --propagate-logs=true --introspection-json-path /schema.json" did not complete successfully: exit code: 1
```
This was also in the output
```
Stderr:
internal error during module code generation: runtime error: invalid memory address or nil pointer dereference
``` | https://github.com/dagger/dagger/issues/6532 | https://github.com/dagger/dagger/pull/6551 | 5b273004464711d1efcf427da9cefa7dc389497d | dcee33ec84858610450ef30ddfcad60a9b9be053 | 2024-01-30T19:02:52Z | go | 2024-02-07T17:20:29Z | core/integration/module_test.go | }
}
func TestModuleLotsOfFunctions(t *testing.T) {
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("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,532 | π Confusing error message when `Context` is not the first parameter of a function | ### What is the issue?
Mostly what the title says. The error message I get from putting the `Context` in the wrong place is cryptic.
### Dagger version
dagger v0.9.7
### Steps to reproduce
Create any Zenith module function and put the `context.Context` in any location but the first parameter.
### Log output
```
Error: failed to automate vcs: failed to get vcs ignored paths: input: resolve: module: withSource: failed to get modified source directory for go module sdk codegen: process "/usr/local/bin/codegen --module . --propagate-logs=true --introspection-json-path /schema.json" did not complete successfully: exit code: 1
input: resolve: module: withSource: failed to get modified source directory for go module sdk codegen: process "/usr/local/bin/codegen --module . --propagate-logs=true --introspection-json-path /schema.json" did not complete successfully: exit code: 1
```
This was also in the output
```
Stderr:
internal error during module code generation: runtime error: invalid memory address or nil pointer dereference
``` | https://github.com/dagger/dagger/issues/6532 | https://github.com/dagger/dagger/pull/6551 | 5b273004464711d1efcf427da9cefa7dc389497d | dcee33ec84858610450ef30ddfcad60a9b9be053 | 2024-01-30T19:02:52Z | go | 2024-02-07T17:20:29Z | 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,532 | π Confusing error message when `Context` is not the first parameter of a function | ### What is the issue?
Mostly what the title says. The error message I get from putting the `Context` in the wrong place is cryptic.
### Dagger version
dagger v0.9.7
### Steps to reproduce
Create any Zenith module function and put the `context.Context` in any location but the first parameter.
### Log output
```
Error: failed to automate vcs: failed to get vcs ignored paths: input: resolve: module: withSource: failed to get modified source directory for go module sdk codegen: process "/usr/local/bin/codegen --module . --propagate-logs=true --introspection-json-path /schema.json" did not complete successfully: exit code: 1
input: resolve: module: withSource: failed to get modified source directory for go module sdk codegen: process "/usr/local/bin/codegen --module . --propagate-logs=true --introspection-json-path /schema.json" did not complete successfully: exit code: 1
```
This was also in the output
```
Stderr:
internal error during module code generation: runtime error: invalid memory address or nil pointer dereference
``` | https://github.com/dagger/dagger/issues/6532 | https://github.com/dagger/dagger/pull/6551 | 5b273004464711d1efcf427da9cefa7dc389497d | dcee33ec84858610450ef30ddfcad60a9b9be053 | 2024-01-30T19:02:52Z | go | 2024-02-07T17:20:29Z | core/integration/module_test.go | }).
With(daggerExec("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,532 | π Confusing error message when `Context` is not the first parameter of a function | ### What is the issue?
Mostly what the title says. The error message I get from putting the `Context` in the wrong place is cryptic.
### Dagger version
dagger v0.9.7
### Steps to reproduce
Create any Zenith module function and put the `context.Context` in any location but the first parameter.
### Log output
```
Error: failed to automate vcs: failed to get vcs ignored paths: input: resolve: module: withSource: failed to get modified source directory for go module sdk codegen: process "/usr/local/bin/codegen --module . --propagate-logs=true --introspection-json-path /schema.json" did not complete successfully: exit code: 1
input: resolve: module: withSource: failed to get modified source directory for go module sdk codegen: process "/usr/local/bin/codegen --module . --propagate-logs=true --introspection-json-path /schema.json" did not complete successfully: exit code: 1
```
This was also in the output
```
Stderr:
internal error during module code generation: runtime error: invalid memory address or nil pointer dereference
``` | https://github.com/dagger/dagger/issues/6532 | https://github.com/dagger/dagger/pull/6551 | 5b273004464711d1efcf427da9cefa7dc389497d | dcee33ec84858610450ef30ddfcad60a9b9be053 | 2024-01-30T19:02:52Z | go | 2024-02-07T17:20:29Z | 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("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,532 | π Confusing error message when `Context` is not the first parameter of a function | ### What is the issue?
Mostly what the title says. The error message I get from putting the `Context` in the wrong place is cryptic.
### Dagger version
dagger v0.9.7
### Steps to reproduce
Create any Zenith module function and put the `context.Context` in any location but the first parameter.
### Log output
```
Error: failed to automate vcs: failed to get vcs ignored paths: input: resolve: module: withSource: failed to get modified source directory for go module sdk codegen: process "/usr/local/bin/codegen --module . --propagate-logs=true --introspection-json-path /schema.json" did not complete successfully: exit code: 1
input: resolve: module: withSource: failed to get modified source directory for go module sdk codegen: process "/usr/local/bin/codegen --module . --propagate-logs=true --introspection-json-path /schema.json" did not complete successfully: exit code: 1
```
This was also in the output
```
Stderr:
internal error during module code generation: runtime error: invalid memory address or nil pointer dereference
``` | https://github.com/dagger/dagger/issues/6532 | https://github.com/dagger/dagger/pull/6551 | 5b273004464711d1efcf427da9cefa7dc389497d | dcee33ec84858610450ef30ddfcad60a9b9be053 | 2024-01-30T19:02:52Z | go | 2024-02-07T17:20:29Z | 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) |
closed | dagger/dagger | https://github.com/dagger/dagger | 6,532 | π Confusing error message when `Context` is not the first parameter of a function | ### What is the issue?
Mostly what the title says. The error message I get from putting the `Context` in the wrong place is cryptic.
### Dagger version
dagger v0.9.7
### Steps to reproduce
Create any Zenith module function and put the `context.Context` in any location but the first parameter.
### Log output
```
Error: failed to automate vcs: failed to get vcs ignored paths: input: resolve: module: withSource: failed to get modified source directory for go module sdk codegen: process "/usr/local/bin/codegen --module . --propagate-logs=true --introspection-json-path /schema.json" did not complete successfully: exit code: 1
input: resolve: module: withSource: failed to get modified source directory for go module sdk codegen: process "/usr/local/bin/codegen --module . --propagate-logs=true --introspection-json-path /schema.json" did not complete successfully: exit code: 1
```
This was also in the output
```
Stderr:
internal error during module code generation: runtime error: invalid memory address or nil pointer dereference
``` | https://github.com/dagger/dagger/issues/6532 | https://github.com/dagger/dagger/pull/6551 | 5b273004464711d1efcf427da9cefa7dc389497d | dcee33ec84858610450ef30ddfcad60a9b9be053 | 2024-01-30T19:02:52Z | go | 2024-02-07T17:20:29Z | core/integration/module_test.go | if err != nil {
return "", err
}
s += depS
`, strcase.ToCamel(depName))
}
mainSrc += "return s, nil\n}\n"
fmted, err := format.Source([]byte(mainSrc))
require.NoError(t, err)
return string(fmted)
}
var rootCfg modules.ModuleConfig
addModulesWithDeps := func(newMods int, depNames []string) []string {
t.Helper()
var newModNames []string
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),
})
var depCfgs []*modules.ModuleConfigDependency
for _, depName := range depNames {
depCfgs = append(depCfgs, &modules.ModuleConfigDependency{
Name: depName, |
closed | dagger/dagger | https://github.com/dagger/dagger | 6,532 | π Confusing error message when `Context` is not the first parameter of a function | ### What is the issue?
Mostly what the title says. The error message I get from putting the `Context` in the wrong place is cryptic.
### Dagger version
dagger v0.9.7
### Steps to reproduce
Create any Zenith module function and put the `context.Context` in any location but the first parameter.
### Log output
```
Error: failed to automate vcs: failed to get vcs ignored paths: input: resolve: module: withSource: failed to get modified source directory for go module sdk codegen: process "/usr/local/bin/codegen --module . --propagate-logs=true --introspection-json-path /schema.json" did not complete successfully: exit code: 1
input: resolve: module: withSource: failed to get modified source directory for go module sdk codegen: process "/usr/local/bin/codegen --module . --propagate-logs=true --introspection-json-path /schema.json" did not complete successfully: exit code: 1
```
This was also in the output
```
Stderr:
internal error during module code generation: runtime error: invalid memory address or nil pointer dereference
``` | https://github.com/dagger/dagger/issues/6532 | https://github.com/dagger/dagger/pull/6551 | 5b273004464711d1efcf427da9cefa7dc389497d | dcee33ec84858610450ef30ddfcad60a9b9be053 | 2024-01-30T19:02:52Z | go | 2024-02-07T17:20:29Z | core/integration/module_test.go | Source: filepath.Join("..", depName),
})
}
modGen = modGen.With(configFile(".", &modules.ModuleConfig{
Name: name,
SDK: "go",
Dependencies: depCfgs,
}))
rootCfg.RootFor = append(rootCfg.RootFor, &modules.ModuleConfigRootFor{
Source: name,
})
}
return newModNames
}
curDeps := addModulesWithDeps(1, nil)
for i := 0; i < 6; i++ {
curDeps = addModulesWithDeps(len(curDeps)+1, curDeps)
}
addModulesWithDeps(1, curDeps)
modGen = modGen.With(configFile("..", &rootCfg))
_, err := modGen.With(daggerCall("fn")).Sync(ctx)
require.NoError(t, err)
}
func TestModuleNamespacing(t *testing.T) { |
closed | dagger/dagger | https://github.com/dagger/dagger | 6,532 | π Confusing error message when `Context` is not the first parameter of a function | ### What is the issue?
Mostly what the title says. The error message I get from putting the `Context` in the wrong place is cryptic.
### Dagger version
dagger v0.9.7
### Steps to reproduce
Create any Zenith module function and put the `context.Context` in any location but the first parameter.
### Log output
```
Error: failed to automate vcs: failed to get vcs ignored paths: input: resolve: module: withSource: failed to get modified source directory for go module sdk codegen: process "/usr/local/bin/codegen --module . --propagate-logs=true --introspection-json-path /schema.json" did not complete successfully: exit code: 1
input: resolve: module: withSource: failed to get modified source directory for go module sdk codegen: process "/usr/local/bin/codegen --module . --propagate-logs=true --introspection-json-path /schema.json" did not complete successfully: exit code: 1
```
This was also in the output
```
Stderr:
internal error during module code generation: runtime error: invalid memory address or nil pointer dereference
``` | https://github.com/dagger/dagger/issues/6532 | https://github.com/dagger/dagger/pull/6551 | 5b273004464711d1efcf427da9cefa7dc389497d | dcee33ec84858610450ef30ddfcad60a9b9be053 | 2024-01-30T19:02:52Z | go | 2024-02-07T17:20:29Z | 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 TestModuleLoops(t *testing.T) { |
closed | dagger/dagger | https://github.com/dagger/dagger | 6,532 | π Confusing error message when `Context` is not the first parameter of a function | ### What is the issue?
Mostly what the title says. The error message I get from putting the `Context` in the wrong place is cryptic.
### Dagger version
dagger v0.9.7
### Steps to reproduce
Create any Zenith module function and put the `context.Context` in any location but the first parameter.
### Log output
```
Error: failed to automate vcs: failed to get vcs ignored paths: input: resolve: module: withSource: failed to get modified source directory for go module sdk codegen: process "/usr/local/bin/codegen --module . --propagate-logs=true --introspection-json-path /schema.json" did not complete successfully: exit code: 1
input: resolve: module: withSource: failed to get modified source directory for go module sdk codegen: process "/usr/local/bin/codegen --module . --propagate-logs=true --introspection-json-path /schema.json" did not complete successfully: exit code: 1
```
This was also in the output
```
Stderr:
internal error during module code generation: runtime error: invalid memory address or nil pointer dereference
``` | https://github.com/dagger/dagger/issues/6532 | https://github.com/dagger/dagger/pull/6551 | 5b273004464711d1efcf427da9cefa7dc389497d | dcee33ec84858610450ef30ddfcad60a9b9be053 | 2024-01-30T19:02:52Z | go | 2024-02-07T17:20:29Z | core/integration/module_test.go | t.Parallel()
c, ctx := connect(t)
_, err := c.Container().From(golangImage).
WithMountedFile(testCLIBinPath, daggerCliFile(t, c)).
With(daggerExec("init", "--name=depA", "--sdk=go", "depA")).
With(daggerExec("init", "--name=depB", "--sdk=go", "depB")).
With(daggerExec("init", "--name=depC", "--sdk=go", "depC")).
With(daggerExec("install", "-m=depC", "./depB")).
With(daggerExec("install", "-m=depB", "./depA")).
With(daggerExec("install", "-m=depA", "./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) {
t.Parallel()
type testCase struct { |
closed | dagger/dagger | https://github.com/dagger/dagger | 6,532 | π Confusing error message when `Context` is not the first parameter of a function | ### What is the issue?
Mostly what the title says. The error message I get from putting the `Context` in the wrong place is cryptic.
### Dagger version
dagger v0.9.7
### Steps to reproduce
Create any Zenith module function and put the `context.Context` in any location but the first parameter.
### Log output
```
Error: failed to automate vcs: failed to get vcs ignored paths: input: resolve: module: withSource: failed to get modified source directory for go module sdk codegen: process "/usr/local/bin/codegen --module . --propagate-logs=true --introspection-json-path /schema.json" did not complete successfully: exit code: 1
input: resolve: module: withSource: failed to get modified source directory for go module sdk codegen: process "/usr/local/bin/codegen --module . --propagate-logs=true --introspection-json-path /schema.json" did not complete successfully: exit code: 1
```
This was also in the output
```
Stderr:
internal error during module code generation: runtime error: invalid memory address or nil pointer dereference
``` | https://github.com/dagger/dagger/issues/6532 | https://github.com/dagger/dagger/pull/6551 | 5b273004464711d1efcf427da9cefa7dc389497d | dcee33ec84858610450ef30ddfcad60a9b9be053 | 2024-01-30T19:02:52Z | go | 2024-02-07T17:20:29Z | core/integration/module_test.go | sdk string
source string
}
t.Run("id", func(t *testing.T) {
t.Parallel()
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) { |
closed | dagger/dagger | https://github.com/dagger/dagger | 6,532 | π Confusing error message when `Context` is not the first parameter of a function | ### What is the issue?
Mostly what the title says. The error message I get from putting the `Context` in the wrong place is cryptic.
### Dagger version
dagger v0.9.7
### Steps to reproduce
Create any Zenith module function and put the `context.Context` in any location but the first parameter.
### Log output
```
Error: failed to automate vcs: failed to get vcs ignored paths: input: resolve: module: withSource: failed to get modified source directory for go module sdk codegen: process "/usr/local/bin/codegen --module . --propagate-logs=true --introspection-json-path /schema.json" did not complete successfully: exit code: 1
input: resolve: module: withSource: failed to get modified source directory for go module sdk codegen: process "/usr/local/bin/codegen --module . --propagate-logs=true --introspection-json-path /schema.json" did not complete successfully: exit code: 1
```
This was also in the output
```
Stderr:
internal error during module code generation: runtime error: invalid memory address or nil pointer dereference
``` | https://github.com/dagger/dagger/issues/6532 | https://github.com/dagger/dagger/pull/6551 | 5b273004464711d1efcf427da9cefa7dc389497d | dcee33ec84858610450ef30ddfcad60a9b9be053 | 2024-01-30T19:02:52Z | go | 2024-02-07T17:20:29Z | core/integration/module_test.go | t.Parallel()
c, ctx := connect(t)
_, err := modInit(ctx, t, c, tc.sdk, tc.source).
With(daggerQuery(`{test{fn(id:"no")}}`)).
Sync(ctx)
require.ErrorContains(t, err, "cannot define argument with reserved name \"id\"")
})
}
})
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()
c, ctx := connect(t)
_, err := c.Container().From(golangImage).
WithMountedFile(testCLIBinPath, daggerCliFile(t, c)).
WithWorkdir("/work").
With(daggerExec("init", "--name=test", "--sdk="+tc.sdk)).
With(sdkSource(tc.sdk, tc.source)). |
closed | dagger/dagger | https://github.com/dagger/dagger | 6,532 | π Confusing error message when `Context` is not the first parameter of a function | ### What is the issue?
Mostly what the title says. The error message I get from putting the `Context` in the wrong place is cryptic.
### Dagger version
dagger v0.9.7
### Steps to reproduce
Create any Zenith module function and put the `context.Context` in any location but the first parameter.
### Log output
```
Error: failed to automate vcs: failed to get vcs ignored paths: input: resolve: module: withSource: failed to get modified source directory for go module sdk codegen: process "/usr/local/bin/codegen --module . --propagate-logs=true --introspection-json-path /schema.json" did not complete successfully: exit code: 1
input: resolve: module: withSource: failed to get modified source directory for go module sdk codegen: process "/usr/local/bin/codegen --module . --propagate-logs=true --introspection-json-path /schema.json" did not complete successfully: exit code: 1
```
This was also in the output
```
Stderr:
internal error during module code generation: runtime error: invalid memory address or nil pointer dereference
``` | https://github.com/dagger/dagger/issues/6532 | https://github.com/dagger/dagger/pull/6551 | 5b273004464711d1efcf427da9cefa7dc389497d | dcee33ec84858610450ef30ddfcad60a9b9be053 | 2024-01-30T19:02:52Z | go | 2024-02-07T17:20:29Z | core/integration/module_test.go | 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{
{
sdk: "go",
source: badIDFnGoSrc,
},
{
sdk: "python",
source: badIDFnPySrc,
},
{
sdk: "typescript",
source: badIDFnTSSrc,
},
} {
tc := tc
t.Run(tc.sdk, func(t *testing.T) {
t.Parallel()
c, ctx := connect(t)
_, err := c.Container().From(golangImage).
WithMountedFile(testCLIBinPath, daggerCliFile(t, c)).
WithWorkdir("/work").
With(daggerExec("init", "--name=test", "--sdk="+tc.sdk)). |
closed | dagger/dagger | https://github.com/dagger/dagger | 6,532 | π Confusing error message when `Context` is not the first parameter of a function | ### What is the issue?
Mostly what the title says. The error message I get from putting the `Context` in the wrong place is cryptic.
### Dagger version
dagger v0.9.7
### Steps to reproduce
Create any Zenith module function and put the `context.Context` in any location but the first parameter.
### Log output
```
Error: failed to automate vcs: failed to get vcs ignored paths: input: resolve: module: withSource: failed to get modified source directory for go module sdk codegen: process "/usr/local/bin/codegen --module . --propagate-logs=true --introspection-json-path /schema.json" did not complete successfully: exit code: 1
input: resolve: module: withSource: failed to get modified source directory for go module sdk codegen: process "/usr/local/bin/codegen --module . --propagate-logs=true --introspection-json-path /schema.json" did not complete successfully: exit code: 1
```
This was also in the output
```
Stderr:
internal error during module code generation: runtime error: invalid memory address or nil pointer dereference
``` | https://github.com/dagger/dagger/issues/6532 | https://github.com/dagger/dagger/pull/6551 | 5b273004464711d1efcf427da9cefa7dc389497d | dcee33ec84858610450ef30ddfcad60a9b9be053 | 2024-01-30T19:02:52Z | go | 2024-02-07T17:20:29Z | core/integration/module_test.go | With(sdkSource(tc.sdk, tc.source)).
With(daggerQuery(`{test{id}}`)).
Sync(ctx)
require.ErrorContains(t, err, "cannot define function with reserved name \"id\"")
})
}
})
})
}
func TestModuleExecError(t *testing.T) {
t.Parallel()
c, ctx := connect(t)
modGen := c.Container().From(alpineImage).
WithMountedFile(testCLIBinPath, daggerCliFile(t, c)).
WithWorkdir("/work").
With(daggerExec("init", "--name=playground", "--sdk=go")).
WithNewFile("main.go", dagger.ContainerWithNewFileOpts{
Contents: `
package main
import (
"context"
"errors"
)
type Playground struct{}
func (p *Playground) DoThing(ctx context.Context) error {
_, err := dag.Container().From("` + alpineImage + `").WithExec([]string{"sh", "-c", "exit 5"}).Sync(ctx)
var e *ExecError
if errors.As(err, &e) {
if e.ExitCode == 5 {
return nil |
closed | dagger/dagger | https://github.com/dagger/dagger | 6,532 | π Confusing error message when `Context` is not the first parameter of a function | ### What is the issue?
Mostly what the title says. The error message I get from putting the `Context` in the wrong place is cryptic.
### Dagger version
dagger v0.9.7
### Steps to reproduce
Create any Zenith module function and put the `context.Context` in any location but the first parameter.
### Log output
```
Error: failed to automate vcs: failed to get vcs ignored paths: input: resolve: module: withSource: failed to get modified source directory for go module sdk codegen: process "/usr/local/bin/codegen --module . --propagate-logs=true --introspection-json-path /schema.json" did not complete successfully: exit code: 1
input: resolve: module: withSource: failed to get modified source directory for go module sdk codegen: process "/usr/local/bin/codegen --module . --propagate-logs=true --introspection-json-path /schema.json" did not complete successfully: exit code: 1
```
This was also in the output
```
Stderr:
internal error during module code generation: runtime error: invalid memory address or nil pointer dereference
``` | https://github.com/dagger/dagger/issues/6532 | https://github.com/dagger/dagger/pull/6551 | 5b273004464711d1efcf427da9cefa7dc389497d | dcee33ec84858610450ef30ddfcad60a9b9be053 | 2024-01-30T19:02:52Z | go | 2024-02-07T17:20:29Z | core/integration/module_test.go | }
}
panic("yikes")
}
`})
logGen(ctx, t, modGen.Directory("."))
_, err := modGen.
With(daggerQuery(`{playground{doThing}}`)).
Stdout(ctx)
require.NoError(t, err)
}
func TestModuleCurrentModuleAPI(t *testing.T) {
t.Parallel()
t.Run("name", func(t *testing.T) {
t.Parallel()
c, ctx := connect(t)
out, err := c.Container().From(golangImage).
WithMountedFile(testCLIBinPath, daggerCliFile(t, c)).
WithWorkdir("/work").
With(daggerExec("init", "--name=WaCkY", "--sdk=go")).
WithNewFile("/work/main.go", dagger.ContainerWithNewFileOpts{
Contents: `package main
import "context"
type WaCkY struct {}
func (m *WaCkY) Fn(ctx context.Context) (string, error) {
return dag.CurrentModule().Name(ctx)
}
`,
}).
With(daggerCall("fn")). |
closed | dagger/dagger | https://github.com/dagger/dagger | 6,532 | π Confusing error message when `Context` is not the first parameter of a function | ### What is the issue?
Mostly what the title says. The error message I get from putting the `Context` in the wrong place is cryptic.
### Dagger version
dagger v0.9.7
### Steps to reproduce
Create any Zenith module function and put the `context.Context` in any location but the first parameter.
### Log output
```
Error: failed to automate vcs: failed to get vcs ignored paths: input: resolve: module: withSource: failed to get modified source directory for go module sdk codegen: process "/usr/local/bin/codegen --module . --propagate-logs=true --introspection-json-path /schema.json" did not complete successfully: exit code: 1
input: resolve: module: withSource: failed to get modified source directory for go module sdk codegen: process "/usr/local/bin/codegen --module . --propagate-logs=true --introspection-json-path /schema.json" did not complete successfully: exit code: 1
```
This was also in the output
```
Stderr:
internal error during module code generation: runtime error: invalid memory address or nil pointer dereference
``` | https://github.com/dagger/dagger/issues/6532 | https://github.com/dagger/dagger/pull/6551 | 5b273004464711d1efcf427da9cefa7dc389497d | dcee33ec84858610450ef30ddfcad60a9b9be053 | 2024-01-30T19:02:52Z | go | 2024-02-07T17:20:29Z | core/integration/module_test.go | Stdout(ctx)
require.NoError(t, err)
require.Equal(t, "WaCkY", strings.TrimSpace(out))
})
t.Run("source", func(t *testing.T) {
t.Parallel()
c, ctx := connect(t)
out, err := c.Container().From(golangImage).
WithMountedFile(testCLIBinPath, daggerCliFile(t, c)).
WithWorkdir("/work").
With(daggerExec("init", "--name=test", "--sdk=go")).
WithNewFile("/work/subdir/coolfile.txt", dagger.ContainerWithNewFileOpts{
Contents: "nice",
}).
WithNewFile("/work/main.go", dagger.ContainerWithNewFileOpts{
Contents: `package main
import "context"
type Test struct {}
func (m *Test) Fn(ctx context.Context) *File {
return dag.CurrentModule().Source().File("subdir/coolfile.txt")
}
`,
}).
With(daggerCall("fn", "contents")).
Stdout(ctx)
require.NoError(t, err)
require.Equal(t, "nice", strings.TrimSpace(out))
})
t.Run("workdir", func(t *testing.T) {
t.Parallel() |
closed | dagger/dagger | https://github.com/dagger/dagger | 6,532 | π Confusing error message when `Context` is not the first parameter of a function | ### What is the issue?
Mostly what the title says. The error message I get from putting the `Context` in the wrong place is cryptic.
### Dagger version
dagger v0.9.7
### Steps to reproduce
Create any Zenith module function and put the `context.Context` in any location but the first parameter.
### Log output
```
Error: failed to automate vcs: failed to get vcs ignored paths: input: resolve: module: withSource: failed to get modified source directory for go module sdk codegen: process "/usr/local/bin/codegen --module . --propagate-logs=true --introspection-json-path /schema.json" did not complete successfully: exit code: 1
input: resolve: module: withSource: failed to get modified source directory for go module sdk codegen: process "/usr/local/bin/codegen --module . --propagate-logs=true --introspection-json-path /schema.json" did not complete successfully: exit code: 1
```
This was also in the output
```
Stderr:
internal error during module code generation: runtime error: invalid memory address or nil pointer dereference
``` | https://github.com/dagger/dagger/issues/6532 | https://github.com/dagger/dagger/pull/6551 | 5b273004464711d1efcf427da9cefa7dc389497d | dcee33ec84858610450ef30ddfcad60a9b9be053 | 2024-01-30T19:02:52Z | go | 2024-02-07T17:20:29Z | core/integration/module_test.go | t.Run("dir", func(t *testing.T) {
t.Parallel()
c, ctx := connect(t)
out, err := c.Container().From(golangImage).
WithMountedFile(testCLIBinPath, daggerCliFile(t, c)).
WithWorkdir("/work").
With(daggerExec("init", "--name=test", "--sdk=go")).
WithNewFile("/work/main.go", dagger.ContainerWithNewFileOpts{
Contents: `package main
import (
"context"
"os"
)
type Test struct {}
func (m *Test) Fn(ctx context.Context) (*Directory, error) {
if err := os.MkdirAll("subdir/moresubdir", 0755); err != nil {
return nil, err
}
if err := os.WriteFile("subdir/moresubdir/coolfile.txt", []byte("nice"), 0644); err != nil {
return nil, err
}
return dag.CurrentModule().Workdir("subdir/moresubdir"), nil
}
`,
}).
With(daggerCall("fn", "file", "--path=coolfile.txt", "contents")).
Stdout(ctx)
require.NoError(t, err)
require.Equal(t, "nice", strings.TrimSpace(out))
}) |
closed | dagger/dagger | https://github.com/dagger/dagger | 6,532 | π Confusing error message when `Context` is not the first parameter of a function | ### What is the issue?
Mostly what the title says. The error message I get from putting the `Context` in the wrong place is cryptic.
### Dagger version
dagger v0.9.7
### Steps to reproduce
Create any Zenith module function and put the `context.Context` in any location but the first parameter.
### Log output
```
Error: failed to automate vcs: failed to get vcs ignored paths: input: resolve: module: withSource: failed to get modified source directory for go module sdk codegen: process "/usr/local/bin/codegen --module . --propagate-logs=true --introspection-json-path /schema.json" did not complete successfully: exit code: 1
input: resolve: module: withSource: failed to get modified source directory for go module sdk codegen: process "/usr/local/bin/codegen --module . --propagate-logs=true --introspection-json-path /schema.json" did not complete successfully: exit code: 1
```
This was also in the output
```
Stderr:
internal error during module code generation: runtime error: invalid memory address or nil pointer dereference
``` | https://github.com/dagger/dagger/issues/6532 | https://github.com/dagger/dagger/pull/6551 | 5b273004464711d1efcf427da9cefa7dc389497d | dcee33ec84858610450ef30ddfcad60a9b9be053 | 2024-01-30T19:02:52Z | go | 2024-02-07T17:20:29Z | core/integration/module_test.go | t.Run("file", func(t *testing.T) {
t.Parallel()
c, ctx := connect(t)
out, err := c.Container().From(golangImage).
WithMountedFile(testCLIBinPath, daggerCliFile(t, c)).
WithWorkdir("/work").
With(daggerExec("init", "--name=test", "--sdk=go")).
WithNewFile("/work/main.go", dagger.ContainerWithNewFileOpts{
Contents: `package main
import (
"context"
"os"
)
type Test struct {}
func (m *Test) Fn(ctx context.Context) (*File, error) {
if err := os.MkdirAll("subdir/moresubdir", 0755); err != nil {
return nil, err
}
if err := os.WriteFile("subdir/moresubdir/coolfile.txt", []byte("nice"), 0644); err != nil {
return nil, err
}
return dag.CurrentModule().WorkdirFile("subdir/moresubdir/coolfile.txt"), nil
}
`,
}).
With(daggerCall("fn", "contents")).
Stdout(ctx)
require.NoError(t, err)
require.Equal(t, "nice", strings.TrimSpace(out))
}) |
closed | dagger/dagger | https://github.com/dagger/dagger | 6,532 | π Confusing error message when `Context` is not the first parameter of a function | ### What is the issue?
Mostly what the title says. The error message I get from putting the `Context` in the wrong place is cryptic.
### Dagger version
dagger v0.9.7
### Steps to reproduce
Create any Zenith module function and put the `context.Context` in any location but the first parameter.
### Log output
```
Error: failed to automate vcs: failed to get vcs ignored paths: input: resolve: module: withSource: failed to get modified source directory for go module sdk codegen: process "/usr/local/bin/codegen --module . --propagate-logs=true --introspection-json-path /schema.json" did not complete successfully: exit code: 1
input: resolve: module: withSource: failed to get modified source directory for go module sdk codegen: process "/usr/local/bin/codegen --module . --propagate-logs=true --introspection-json-path /schema.json" did not complete successfully: exit code: 1
```
This was also in the output
```
Stderr:
internal error during module code generation: runtime error: invalid memory address or nil pointer dereference
``` | https://github.com/dagger/dagger/issues/6532 | https://github.com/dagger/dagger/pull/6551 | 5b273004464711d1efcf427da9cefa7dc389497d | dcee33ec84858610450ef30ddfcad60a9b9be053 | 2024-01-30T19:02:52Z | go | 2024-02-07T17:20:29Z | core/integration/module_test.go | t.Run("error on escape", func(t *testing.T) {
t.Parallel()
c, ctx := connect(t)
ctr := c.Container().From(golangImage).
WithMountedFile(testCLIBinPath, daggerCliFile(t, c)).
WithWorkdir("/work").
With(daggerExec("init", "--name=test", "--sdk=go")).
WithNewFile("/work/main.go", dagger.ContainerWithNewFileOpts{
Contents: `package main
import (
"context"
"os"
)
func New() (*Test, error) {
if err := os.WriteFile("/rootfile.txt", []byte("notnice"), 0644); err != nil {
return nil, err
}
if err := os.MkdirAll("/foo", 0755); err != nil {
return nil, err
}
if err := os.WriteFile("/foo/foofile.txt", []byte("notnice"), 0644); err != nil {
return nil, err
}
return &Test{}, nil
}
type Test struct {}
func (m *Test) EscapeFile(ctx context.Context) *File {
return dag.CurrentModule().WorkdirFile("../rootfile.txt")
}
func (m *Test) EscapeFileAbs(ctx context.Context) *File { |
closed | dagger/dagger | https://github.com/dagger/dagger | 6,532 | π Confusing error message when `Context` is not the first parameter of a function | ### What is the issue?
Mostly what the title says. The error message I get from putting the `Context` in the wrong place is cryptic.
### Dagger version
dagger v0.9.7
### Steps to reproduce
Create any Zenith module function and put the `context.Context` in any location but the first parameter.
### Log output
```
Error: failed to automate vcs: failed to get vcs ignored paths: input: resolve: module: withSource: failed to get modified source directory for go module sdk codegen: process "/usr/local/bin/codegen --module . --propagate-logs=true --introspection-json-path /schema.json" did not complete successfully: exit code: 1
input: resolve: module: withSource: failed to get modified source directory for go module sdk codegen: process "/usr/local/bin/codegen --module . --propagate-logs=true --introspection-json-path /schema.json" did not complete successfully: exit code: 1
```
This was also in the output
```
Stderr:
internal error during module code generation: runtime error: invalid memory address or nil pointer dereference
``` | https://github.com/dagger/dagger/issues/6532 | https://github.com/dagger/dagger/pull/6551 | 5b273004464711d1efcf427da9cefa7dc389497d | dcee33ec84858610450ef30ddfcad60a9b9be053 | 2024-01-30T19:02:52Z | go | 2024-02-07T17:20:29Z | core/integration/module_test.go | return dag.CurrentModule().WorkdirFile("/rootfile.txt")
}
func (m *Test) EscapeDir(ctx context.Context) *Directory {
return dag.CurrentModule().Workdir("../foo")
}
func (m *Test) EscapeDirAbs(ctx context.Context) *Directory {
return dag.CurrentModule().Workdir("/foo")
}
`,
})
_, err := ctr.
With(daggerCall("escape-file", "contents")).
Stdout(ctx)
require.ErrorContains(t, err, `workdir path "../rootfile.txt" escapes workdir`)
_, err = ctr.
With(daggerCall("escape-file-abs", "contents")).
Stdout(ctx)
require.ErrorContains(t, err, `workdir path "/rootfile.txt" escapes workdir`)
_, err = ctr.
With(daggerCall("escape-dir", "entries")).
Stdout(ctx)
require.ErrorContains(t, err, `workdir path "../foo" escapes workdir`)
_, err = ctr.
With(daggerCall("escape-dir-abs", "entries")).
Stdout(ctx)
require.ErrorContains(t, err, `workdir path "/foo" escapes workdir`)
})
})
}
func TestModuleCustomSDK(t *testing.T) { |
closed | dagger/dagger | https://github.com/dagger/dagger | 6,532 | π Confusing error message when `Context` is not the first parameter of a function | ### What is the issue?
Mostly what the title says. The error message I get from putting the `Context` in the wrong place is cryptic.
### Dagger version
dagger v0.9.7
### Steps to reproduce
Create any Zenith module function and put the `context.Context` in any location but the first parameter.
### Log output
```
Error: failed to automate vcs: failed to get vcs ignored paths: input: resolve: module: withSource: failed to get modified source directory for go module sdk codegen: process "/usr/local/bin/codegen --module . --propagate-logs=true --introspection-json-path /schema.json" did not complete successfully: exit code: 1
input: resolve: module: withSource: failed to get modified source directory for go module sdk codegen: process "/usr/local/bin/codegen --module . --propagate-logs=true --introspection-json-path /schema.json" did not complete successfully: exit code: 1
```
This was also in the output
```
Stderr:
internal error during module code generation: runtime error: invalid memory address or nil pointer dereference
``` | https://github.com/dagger/dagger/issues/6532 | https://github.com/dagger/dagger/pull/6551 | 5b273004464711d1efcf427da9cefa7dc389497d | dcee33ec84858610450ef30ddfcad60a9b9be053 | 2024-01-30T19:02:52Z | go | 2024-02-07T17:20:29Z | core/integration/module_test.go | t.Parallel()
c, ctx := connect(t)
ctr := c.Container().From(golangImage).
WithMountedFile(testCLIBinPath, daggerCliFile(t, c)).
WithWorkdir("/work/coolsdk").
With(daggerExec("init", "--name=cool-sdk", "--sdk=go")).
WithNewFile("main.go", dagger.ContainerWithNewFileOpts{
Contents: `package main
type CoolSdk struct {}
func (m *CoolSdk) ModuleRuntime(modSource *ModuleSource, introspectionJson string) *Container {
return modSource.AsModule().WithSDK("go").Initialize().Runtime().WithEnvVariable("COOL", "true")
}
func (m *CoolSdk) Codegen(modSource *ModuleSource, introspectionJson string) *GeneratedCode { |
closed | dagger/dagger | https://github.com/dagger/dagger | 6,532 | π Confusing error message when `Context` is not the first parameter of a function | ### What is the issue?
Mostly what the title says. The error message I get from putting the `Context` in the wrong place is cryptic.
### Dagger version
dagger v0.9.7
### Steps to reproduce
Create any Zenith module function and put the `context.Context` in any location but the first parameter.
### Log output
```
Error: failed to automate vcs: failed to get vcs ignored paths: input: resolve: module: withSource: failed to get modified source directory for go module sdk codegen: process "/usr/local/bin/codegen --module . --propagate-logs=true --introspection-json-path /schema.json" did not complete successfully: exit code: 1
input: resolve: module: withSource: failed to get modified source directory for go module sdk codegen: process "/usr/local/bin/codegen --module . --propagate-logs=true --introspection-json-path /schema.json" did not complete successfully: exit code: 1
```
This was also in the output
```
Stderr:
internal error during module code generation: runtime error: invalid memory address or nil pointer dereference
``` | https://github.com/dagger/dagger/issues/6532 | https://github.com/dagger/dagger/pull/6551 | 5b273004464711d1efcf427da9cefa7dc389497d | dcee33ec84858610450ef30ddfcad60a9b9be053 | 2024-01-30T19:02:52Z | go | 2024-02-07T17:20:29Z | core/integration/module_test.go | existingConfig := modSource.Directory("/").File("dagger.json")
return dag.GeneratedCode(modSource.
Directory("/").
WithoutFile("dagger.json").
AsModule().
WithSDK("go").
GeneratedSourceRootDirectory().
WithFile("dagger.json", existingConfig),
)
}
`,
}).
WithWorkdir("/work").
With(daggerExec("init", "--name=test", "--sdk=coolsdk")).
WithNewFile("main.go", dagger.ContainerWithNewFileOpts{
Contents: `package main
import "os"
type Test struct {}
func (m *Test) Fn() string {
return os.Getenv("COOL")
}
`,
})
out, err := ctr.
With(daggerCall("fn")).
Stdout(ctx)
require.NoError(t, err)
require.Equal(t, "true", strings.TrimSpace(out))
}
func TestModuleHostError(t *testing.T) { |
closed | dagger/dagger | https://github.com/dagger/dagger | 6,532 | π Confusing error message when `Context` is not the first parameter of a function | ### What is the issue?
Mostly what the title says. The error message I get from putting the `Context` in the wrong place is cryptic.
### Dagger version
dagger v0.9.7
### Steps to reproduce
Create any Zenith module function and put the `context.Context` in any location but the first parameter.
### Log output
```
Error: failed to automate vcs: failed to get vcs ignored paths: input: resolve: module: withSource: failed to get modified source directory for go module sdk codegen: process "/usr/local/bin/codegen --module . --propagate-logs=true --introspection-json-path /schema.json" did not complete successfully: exit code: 1
input: resolve: module: withSource: failed to get modified source directory for go module sdk codegen: process "/usr/local/bin/codegen --module . --propagate-logs=true --introspection-json-path /schema.json" did not complete successfully: exit code: 1
```
This was also in the output
```
Stderr:
internal error during module code generation: runtime error: invalid memory address or nil pointer dereference
``` | https://github.com/dagger/dagger/issues/6532 | https://github.com/dagger/dagger/pull/6551 | 5b273004464711d1efcf427da9cefa7dc389497d | dcee33ec84858610450ef30ddfcad60a9b9be053 | 2024-01-30T19:02:52Z | go | 2024-02-07T17:20:29Z | core/integration/module_test.go | t.Parallel()
c, ctx := connect(t)
_, err := c.Container().From(golangImage).
WithMountedFile(testCLIBinPath, daggerCliFile(t, c)).
WithWorkdir("/work").
With(daggerExec("init", "--name=test", "--sdk=go")).
WithNewFile("/work/main.go", dagger.ContainerWithNewFileOpts{
Contents: `package main
import (
"context"
)
type Test struct {}
func (m *Test) Fn(ctx context.Context) *Directory {
return dag.Host().Directory(".")
}
`,
}).
With(daggerCall("fn")).
Sync(ctx)
require.ErrorContains(t, err, "dag.Host undefined")
}
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,532 | π Confusing error message when `Context` is not the first parameter of a function | ### What is the issue?
Mostly what the title says. The error message I get from putting the `Context` in the wrong place is cryptic.
### Dagger version
dagger v0.9.7
### Steps to reproduce
Create any Zenith module function and put the `context.Context` in any location but the first parameter.
### Log output
```
Error: failed to automate vcs: failed to get vcs ignored paths: input: resolve: module: withSource: failed to get modified source directory for go module sdk codegen: process "/usr/local/bin/codegen --module . --propagate-logs=true --introspection-json-path /schema.json" did not complete successfully: exit code: 1
input: resolve: module: withSource: failed to get modified source directory for go module sdk codegen: process "/usr/local/bin/codegen --module . --propagate-logs=true --introspection-json-path /schema.json" did not complete successfully: exit code: 1
```
This was also in the output
```
Stderr:
internal error during module code generation: runtime error: invalid memory address or nil pointer dereference
``` | https://github.com/dagger/dagger/issues/6532 | https://github.com/dagger/dagger/pull/6551 | 5b273004464711d1efcf427da9cefa7dc389497d | dcee33ec84858610450ef30ddfcad60a9b9be053 | 2024-01-30T19:02:52Z | go | 2024-02-07T17:20:29Z | core/integration/module_test.go | return daggerQueryAt("", query, args...)
}
func daggerQueryAt(modPath string, query string, args ...any) dagger.WithContainerFunc {
query = fmt.Sprintf(query, args...)
return func(c *dagger.Container) *dagger.Container {
execArgs := []string{"dagger", "--debug", "query"}
if modPath != "" {
execArgs = append(execArgs, "-m", modPath)
}
return c.WithExec(execArgs, dagger.ContainerWithExecOpts{
Stdin: query,
ExperimentalPrivilegedNesting: true,
})
}
}
func daggerCall(args ...string) dagger.WithContainerFunc {
return daggerCallAt("", args...)
}
func daggerCallAt(modPath string, args ...string) dagger.WithContainerFunc {
return func(c *dagger.Container) *dagger.Container {
execArgs := []string{"dagger", "--debug", "call"}
if modPath != "" {
execArgs = append(execArgs, "-m", modPath)
}
return c.WithExec(append(execArgs, args...), dagger.ContainerWithExecOpts{
ExperimentalPrivilegedNesting: true,
})
}
}
func daggerFunctions(args ...string) dagger.WithContainerFunc { |
closed | dagger/dagger | https://github.com/dagger/dagger | 6,532 | π Confusing error message when `Context` is not the first parameter of a function | ### What is the issue?
Mostly what the title says. The error message I get from putting the `Context` in the wrong place is cryptic.
### Dagger version
dagger v0.9.7
### Steps to reproduce
Create any Zenith module function and put the `context.Context` in any location but the first parameter.
### Log output
```
Error: failed to automate vcs: failed to get vcs ignored paths: input: resolve: module: withSource: failed to get modified source directory for go module sdk codegen: process "/usr/local/bin/codegen --module . --propagate-logs=true --introspection-json-path /schema.json" did not complete successfully: exit code: 1
input: resolve: module: withSource: failed to get modified source directory for go module sdk codegen: process "/usr/local/bin/codegen --module . --propagate-logs=true --introspection-json-path /schema.json" did not complete successfully: exit code: 1
```
This was also in the output
```
Stderr:
internal error during module code generation: runtime error: invalid memory address or nil pointer dereference
``` | https://github.com/dagger/dagger/issues/6532 | https://github.com/dagger/dagger/pull/6551 | 5b273004464711d1efcf427da9cefa7dc389497d | dcee33ec84858610450ef30ddfcad60a9b9be053 | 2024-01-30T19:02:52Z | go | 2024-02-07T17:20:29Z | core/integration/module_test.go | return func(c *dagger.Container) *dagger.Container {
return c.WithExec(append([]string{"dagger", "--debug", "functions"}, args...), dagger.ContainerWithExecOpts{
ExperimentalPrivilegedNesting: true,
})
}
}
func configFile(dirPath string, cfg *modules.ModuleConfig) dagger.WithContainerFunc {
return func(c *dagger.Container) *dagger.Container {
cfgPath := filepath.Join(dirPath, "dagger.json")
cfgBytes, err := json.Marshal(cfg)
if err != nil {
panic(err)
}
return c.WithNewFile(cfgPath, dagger.ContainerWithNewFileOpts{
Contents: string(cfgBytes),
})
}
}
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,532 | π Confusing error message when `Context` is not the first parameter of a function | ### What is the issue?
Mostly what the title says. The error message I get from putting the `Context` in the wrong place is cryptic.
### Dagger version
dagger v0.9.7
### Steps to reproduce
Create any Zenith module function and put the `context.Context` in any location but the first parameter.
### Log output
```
Error: failed to automate vcs: failed to get vcs ignored paths: input: resolve: module: withSource: failed to get modified source directory for go module sdk codegen: process "/usr/local/bin/codegen --module . --propagate-logs=true --introspection-json-path /schema.json" did not complete successfully: exit code: 1
input: resolve: module: withSource: failed to get modified source directory for go module sdk codegen: process "/usr/local/bin/codegen --module . --propagate-logs=true --introspection-json-path /schema.json" did not complete successfully: exit code: 1
```
This was also in the output
```
Stderr:
internal error during module code generation: runtime error: invalid memory address or nil pointer dereference
``` | https://github.com/dagger/dagger/issues/6532 | https://github.com/dagger/dagger/pull/6551 | 5b273004464711d1efcf427da9cefa7dc389497d | dcee33ec84858610450ef30ddfcad60a9b9be053 | 2024-01-30T19:02:52Z | go | 2024-02-07T17:20:29Z | 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: heredoc.Doc(contents),
})
}
}
func sdkCodegenFile(t *testing.T, sdk string) string { |
closed | dagger/dagger | https://github.com/dagger/dagger | 6,532 | π Confusing error message when `Context` is not the first parameter of a function | ### What is the issue?
Mostly what the title says. The error message I get from putting the `Context` in the wrong place is cryptic.
### Dagger version
dagger v0.9.7
### Steps to reproduce
Create any Zenith module function and put the `context.Context` in any location but the first parameter.
### Log output
```
Error: failed to automate vcs: failed to get vcs ignored paths: input: resolve: module: withSource: failed to get modified source directory for go module sdk codegen: process "/usr/local/bin/codegen --module . --propagate-logs=true --introspection-json-path /schema.json" did not complete successfully: exit code: 1
input: resolve: module: withSource: failed to get modified source directory for go module sdk codegen: process "/usr/local/bin/codegen --module . --propagate-logs=true --introspection-json-path /schema.json" did not complete successfully: exit code: 1
```
This was also in the output
```
Stderr:
internal error during module code generation: runtime error: invalid memory address or nil pointer dereference
``` | https://github.com/dagger/dagger/issues/6532 | https://github.com/dagger/dagger/pull/6551 | 5b273004464711d1efcf427da9cefa7dc389497d | dcee33ec84858610450ef30ddfcad60a9b9be053 | 2024-01-30T19:02:52Z | go | 2024-02-07T17:20:29Z | 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 modInit(ctx context.Context, t *testing.T, c *dagger.Client, sdk, contents string) *dagger.Container { |
closed | dagger/dagger | https://github.com/dagger/dagger | 6,532 | π Confusing error message when `Context` is not the first parameter of a function | ### What is the issue?
Mostly what the title says. The error message I get from putting the `Context` in the wrong place is cryptic.
### Dagger version
dagger v0.9.7
### Steps to reproduce
Create any Zenith module function and put the `context.Context` in any location but the first parameter.
### Log output
```
Error: failed to automate vcs: failed to get vcs ignored paths: input: resolve: module: withSource: failed to get modified source directory for go module sdk codegen: process "/usr/local/bin/codegen --module . --propagate-logs=true --introspection-json-path /schema.json" did not complete successfully: exit code: 1
input: resolve: module: withSource: failed to get modified source directory for go module sdk codegen: process "/usr/local/bin/codegen --module . --propagate-logs=true --introspection-json-path /schema.json" did not complete successfully: exit code: 1
```
This was also in the output
```
Stderr:
internal error during module code generation: runtime error: invalid memory address or nil pointer dereference
``` | https://github.com/dagger/dagger/issues/6532 | https://github.com/dagger/dagger/pull/6551 | 5b273004464711d1efcf427da9cefa7dc389497d | dcee33ec84858610450ef30ddfcad60a9b9be053 | 2024-01-30T19:02:52Z | go | 2024-02-07T17:20:29Z | core/integration/module_test.go | t.Helper()
modGen := c.Container().From(golangImage).
WithMountedFile(testCLIBinPath, daggerCliFile(t, c)).
WithWorkdir("/work").
With(daggerExec("init", "--name=test", "--sdk="+sdk)).
With(sdkSource(sdk, contents))
if sdk == "go" {
logGen(ctx, t, modGen.Directory("."))
}
return modGen
}
func currentSchema(ctx context.Context, t *testing.T, ctr *dagger.Container) *introspection.Schema {
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
}
var moduleIntrospection = daggerQuery(`
query { host { directory(path: ".") { asModule { initialize {
description |
closed | dagger/dagger | https://github.com/dagger/dagger | 6,532 | π Confusing error message when `Context` is not the first parameter of a function | ### What is the issue?
Mostly what the title says. The error message I get from putting the `Context` in the wrong place is cryptic.
### Dagger version
dagger v0.9.7
### Steps to reproduce
Create any Zenith module function and put the `context.Context` in any location but the first parameter.
### Log output
```
Error: failed to automate vcs: failed to get vcs ignored paths: input: resolve: module: withSource: failed to get modified source directory for go module sdk codegen: process "/usr/local/bin/codegen --module . --propagate-logs=true --introspection-json-path /schema.json" did not complete successfully: exit code: 1
input: resolve: module: withSource: failed to get modified source directory for go module sdk codegen: process "/usr/local/bin/codegen --module . --propagate-logs=true --introspection-json-path /schema.json" did not complete successfully: exit code: 1
```
This was also in the output
```
Stderr:
internal error during module code generation: runtime error: invalid memory address or nil pointer dereference
``` | https://github.com/dagger/dagger/issues/6532 | https://github.com/dagger/dagger/pull/6551 | 5b273004464711d1efcf427da9cefa7dc389497d | dcee33ec84858610450ef30ddfcad60a9b9be053 | 2024-01-30T19:02:52Z | go | 2024-02-07T17:20:29Z | core/integration/module_test.go | objects {
asObject {
name
description
constructor {
description
args {
name
description
defaultValue
}
}
functions {
name
description
args {
name
description
defaultValue
}
}
fields {
name
description
}
}
}
} } } } }
`)
func inspectModule(ctx context.Context, t *testing.T, ctr *dagger.Container) gjson.Result { |
closed | dagger/dagger | https://github.com/dagger/dagger | 6,532 | π Confusing error message when `Context` is not the first parameter of a function | ### What is the issue?
Mostly what the title says. The error message I get from putting the `Context` in the wrong place is cryptic.
### Dagger version
dagger v0.9.7
### Steps to reproduce
Create any Zenith module function and put the `context.Context` in any location but the first parameter.
### Log output
```
Error: failed to automate vcs: failed to get vcs ignored paths: input: resolve: module: withSource: failed to get modified source directory for go module sdk codegen: process "/usr/local/bin/codegen --module . --propagate-logs=true --introspection-json-path /schema.json" did not complete successfully: exit code: 1
input: resolve: module: withSource: failed to get modified source directory for go module sdk codegen: process "/usr/local/bin/codegen --module . --propagate-logs=true --introspection-json-path /schema.json" did not complete successfully: exit code: 1
```
This was also in the output
```
Stderr:
internal error during module code generation: runtime error: invalid memory address or nil pointer dereference
``` | https://github.com/dagger/dagger/issues/6532 | https://github.com/dagger/dagger/pull/6551 | 5b273004464711d1efcf427da9cefa7dc389497d | dcee33ec84858610450ef30ddfcad60a9b9be053 | 2024-01-30T19:02:52Z | go | 2024-02-07T17:20:29Z | core/integration/module_test.go | t.Helper()
out, err := ctr.With(moduleIntrospection).Stdout(ctx)
require.NoError(t, err)
result := gjson.Get(out, "host.directory.asModule.initialize")
t.Logf("module introspection:\n%v", result.Raw)
return result
}
func inspectModuleObjects(ctx context.Context, t *testing.T, ctr *dagger.Container) gjson.Result {
t.Helper()
return inspectModule(ctx, t, ctr).Get("objects.#.asObject")
}
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,532 | π Confusing error message when `Context` is not the first parameter of a function | ### What is the issue?
Mostly what the title says. The error message I get from putting the `Context` in the wrong place is cryptic.
### Dagger version
dagger v0.9.7
### Steps to reproduce
Create any Zenith module function and put the `context.Context` in any location but the first parameter.
### Log output
```
Error: failed to automate vcs: failed to get vcs ignored paths: input: resolve: module: withSource: failed to get modified source directory for go module sdk codegen: process "/usr/local/bin/codegen --module . --propagate-logs=true --introspection-json-path /schema.json" did not complete successfully: exit code: 1
input: resolve: module: withSource: failed to get modified source directory for go module sdk codegen: process "/usr/local/bin/codegen --module . --propagate-logs=true --introspection-json-path /schema.json" did not complete successfully: exit code: 1
```
This was also in the output
```
Stderr:
internal error during module code generation: runtime error: invalid memory address or nil pointer dereference
``` | https://github.com/dagger/dagger/issues/6532 | https://github.com/dagger/dagger/pull/6551 | 5b273004464711d1efcf427da9cefa7dc389497d | dcee33ec84858610450ef30ddfcad60a9b9be053 | 2024-01-30T19:02:52Z | go | 2024-02-07T17:20:29Z | 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,303 | Bug: `bind: address already in use` when using `dagger up --port` | Hit this while backfilling integ test coverage for `dagger up` as part of CLI changes. Repro below.
Module code:
```go
package main
import "context"
func New(ctx context.Context) *Test {
return &Test{
Ctr: dag.Container().
From("python").
WithMountedDirectory(
"/srv/www",
dag.Directory().WithNewFile("index.html", "hey there"),
).
WithWorkdir("/srv/www").
WithExposedPort(8000).
WithExec([]string{"python", "-m", "http.server"}),
}
}
type Test struct {
Ctr *Container
}
```
Everything works when using `--native`:
```console
sipsma@dagger_dev:~/repo/github.com/sipsma/daggerverse/test$ dagger up --native ctr
β
dagger up ctr CANCELED [10.17s]
β 8000/TCP: tunnel 0.0.0.0:8000 -> cpi9mli1o4u78.b7d44b699trss.dagger.local:8000
β Error: context canceled
β’ Cloud URL: https://dagger.cloud/runs/fc1afa30-d2e8-473c-ade3-3910adbfb046
β’ Engine: 3b84e1257d0d (version v0.9.4)
β§ 11.78s β 46 β
8
```
But if I run anything with `--port` I get bind errors, including with `--port 8000:8000` which I thought would have been the same as `--native`:
```console
sipsma@dagger_dev:~/repo/github.com/sipsma/daggerverse/test$ dagger up --port 23456:8000 ctr
β dagger up ctr ERROR [1.62s]
β Error: failed to start tunnel: input:1: host.tunnel.start host to container: failed to receive listen response: rpc error: code = Unknown desc = listen tcp 0.0.0.0:23456: bind: address already in use
β start ERROR [0.39s]
β’ Cloud URL: https://dagger.cloud/runs/849eceaf-86f3-4f1d-b8db-b23a31fb69b1
β’ Engine: 3b84e1257d0d (version v0.9.4)
β§ 2.77s β 44 β
8 β 2
sipsma@dagger_dev:~/repo/github.com/sipsma/daggerverse/test$ dagger up --port 8000:8000 ctr
β dagger up ctr ERROR [1.76s]
β Error: failed to start tunnel: input:1: host.tunnel.start host to container: failed to receive listen response: rpc error: code = Unknown desc = listen tcp 0.0.0.0:8000: bind: address already in use
β start ERROR [0.43s]
β’ Cloud URL: https://dagger.cloud/runs/bcd2c12b-66cb-4a0d-abcd-4236201617e5
β’ Engine: 3b84e1257d0d (version v0.9.4)
β§ 3.08s β 44 β
8 β 2
```
---
Not sure if specific to the CLI somehow or more general, but the fact that `--native` works and `--port 8000:8000` doesn't is quite mysterious. | https://github.com/dagger/dagger/issues/6303 | https://github.com/dagger/dagger/pull/6626 | 7f31f89b7e121368199403ff36cbbece3b31a6cb | 5ee49b9e9a955432d688157893b299f8a6180b1d | 2023-12-20T21:23:29Z | go | 2024-02-08T20:42:59Z | core/integration/module_up_test.go | package core
import (
"context"
"io"
"net/http"
"os"
"path/filepath"
"testing"
"time"
"github.com/creack/pty"
"github.com/stretchr/testify/require"
)
func TestModuleDaggerUp(t *testing.T) {
ctx := context.Background()
modDir := t.TempDir()
err := os.WriteFile(filepath.Join(modDir, "main.go"), []byte(`package main
import "context" |
closed | dagger/dagger | https://github.com/dagger/dagger | 6,303 | Bug: `bind: address already in use` when using `dagger up --port` | Hit this while backfilling integ test coverage for `dagger up` as part of CLI changes. Repro below.
Module code:
```go
package main
import "context"
func New(ctx context.Context) *Test {
return &Test{
Ctr: dag.Container().
From("python").
WithMountedDirectory(
"/srv/www",
dag.Directory().WithNewFile("index.html", "hey there"),
).
WithWorkdir("/srv/www").
WithExposedPort(8000).
WithExec([]string{"python", "-m", "http.server"}),
}
}
type Test struct {
Ctr *Container
}
```
Everything works when using `--native`:
```console
sipsma@dagger_dev:~/repo/github.com/sipsma/daggerverse/test$ dagger up --native ctr
β
dagger up ctr CANCELED [10.17s]
β 8000/TCP: tunnel 0.0.0.0:8000 -> cpi9mli1o4u78.b7d44b699trss.dagger.local:8000
β Error: context canceled
β’ Cloud URL: https://dagger.cloud/runs/fc1afa30-d2e8-473c-ade3-3910adbfb046
β’ Engine: 3b84e1257d0d (version v0.9.4)
β§ 11.78s β 46 β
8
```
But if I run anything with `--port` I get bind errors, including with `--port 8000:8000` which I thought would have been the same as `--native`:
```console
sipsma@dagger_dev:~/repo/github.com/sipsma/daggerverse/test$ dagger up --port 23456:8000 ctr
β dagger up ctr ERROR [1.62s]
β Error: failed to start tunnel: input:1: host.tunnel.start host to container: failed to receive listen response: rpc error: code = Unknown desc = listen tcp 0.0.0.0:23456: bind: address already in use
β start ERROR [0.39s]
β’ Cloud URL: https://dagger.cloud/runs/849eceaf-86f3-4f1d-b8db-b23a31fb69b1
β’ Engine: 3b84e1257d0d (version v0.9.4)
β§ 2.77s β 44 β
8 β 2
sipsma@dagger_dev:~/repo/github.com/sipsma/daggerverse/test$ dagger up --port 8000:8000 ctr
β dagger up ctr ERROR [1.76s]
β Error: failed to start tunnel: input:1: host.tunnel.start host to container: failed to receive listen response: rpc error: code = Unknown desc = listen tcp 0.0.0.0:8000: bind: address already in use
β start ERROR [0.43s]
β’ Cloud URL: https://dagger.cloud/runs/bcd2c12b-66cb-4a0d-abcd-4236201617e5
β’ Engine: 3b84e1257d0d (version v0.9.4)
β§ 3.08s β 44 β
8 β 2
```
---
Not sure if specific to the CLI somehow or more general, but the fact that `--native` works and `--port 8000:8000` doesn't is quite mysterious. | https://github.com/dagger/dagger/issues/6303 | https://github.com/dagger/dagger/pull/6626 | 7f31f89b7e121368199403ff36cbbece3b31a6cb | 5ee49b9e9a955432d688157893b299f8a6180b1d | 2023-12-20T21:23:29Z | go | 2024-02-08T20:42:59Z | core/integration/module_up_test.go | func New(ctx context.Context) *Test {
return &Test{
Ctr: dag.Container().
From("python").
WithMountedDirectory(
"/srv/www",
dag.Directory().WithNewFile("index.html", "hey there"),
).
WithWorkdir("/srv/www").
WithExposedPort(23457).
WithExec([]string{"python", "-m", "http.server", "23457"}),
}
}
type Test struct {
Ctr *Container
}
`), 0644)
require.NoError(t, err)
_, err = hostDaggerExec(ctx, t, modDir, "--debug", "init", "--source=.", "--name=test", "--sdk=go")
require.NoError(t, err)
_, err = hostDaggerExec(ctx, t, modDir, "--debug", "functions")
require.NoError(t, err)
ctx, cancel := context.WithTimeout(ctx, 3*time.Minute)
defer cancel()
t.Run("native", func(t *testing.T) {
cmd := hostDaggerCommand(ctx, t, modDir, "call", "ctr", "as-service", "up")
cmd.Stdin = os.Stdin
cmd.Stdout = os.Stdout
cmd.Stderr = os.Stderr |
closed | dagger/dagger | https://github.com/dagger/dagger | 6,303 | Bug: `bind: address already in use` when using `dagger up --port` | Hit this while backfilling integ test coverage for `dagger up` as part of CLI changes. Repro below.
Module code:
```go
package main
import "context"
func New(ctx context.Context) *Test {
return &Test{
Ctr: dag.Container().
From("python").
WithMountedDirectory(
"/srv/www",
dag.Directory().WithNewFile("index.html", "hey there"),
).
WithWorkdir("/srv/www").
WithExposedPort(8000).
WithExec([]string{"python", "-m", "http.server"}),
}
}
type Test struct {
Ctr *Container
}
```
Everything works when using `--native`:
```console
sipsma@dagger_dev:~/repo/github.com/sipsma/daggerverse/test$ dagger up --native ctr
β
dagger up ctr CANCELED [10.17s]
β 8000/TCP: tunnel 0.0.0.0:8000 -> cpi9mli1o4u78.b7d44b699trss.dagger.local:8000
β Error: context canceled
β’ Cloud URL: https://dagger.cloud/runs/fc1afa30-d2e8-473c-ade3-3910adbfb046
β’ Engine: 3b84e1257d0d (version v0.9.4)
β§ 11.78s β 46 β
8
```
But if I run anything with `--port` I get bind errors, including with `--port 8000:8000` which I thought would have been the same as `--native`:
```console
sipsma@dagger_dev:~/repo/github.com/sipsma/daggerverse/test$ dagger up --port 23456:8000 ctr
β dagger up ctr ERROR [1.62s]
β Error: failed to start tunnel: input:1: host.tunnel.start host to container: failed to receive listen response: rpc error: code = Unknown desc = listen tcp 0.0.0.0:23456: bind: address already in use
β start ERROR [0.39s]
β’ Cloud URL: https://dagger.cloud/runs/849eceaf-86f3-4f1d-b8db-b23a31fb69b1
β’ Engine: 3b84e1257d0d (version v0.9.4)
β§ 2.77s β 44 β
8 β 2
sipsma@dagger_dev:~/repo/github.com/sipsma/daggerverse/test$ dagger up --port 8000:8000 ctr
β dagger up ctr ERROR [1.76s]
β Error: failed to start tunnel: input:1: host.tunnel.start host to container: failed to receive listen response: rpc error: code = Unknown desc = listen tcp 0.0.0.0:8000: bind: address already in use
β start ERROR [0.43s]
β’ Cloud URL: https://dagger.cloud/runs/bcd2c12b-66cb-4a0d-abcd-4236201617e5
β’ Engine: 3b84e1257d0d (version v0.9.4)
β§ 3.08s β 44 β
8 β 2
```
---
Not sure if specific to the CLI somehow or more general, but the fact that `--native` works and `--port 8000:8000` doesn't is quite mysterious. | https://github.com/dagger/dagger/issues/6303 | https://github.com/dagger/dagger/pull/6626 | 7f31f89b7e121368199403ff36cbbece3b31a6cb | 5ee49b9e9a955432d688157893b299f8a6180b1d | 2023-12-20T21:23:29Z | go | 2024-02-08T20:42:59Z | core/integration/module_up_test.go | err = cmd.Start()
require.NoError(t, err)
defer cmd.Process.Kill()
for {
select {
case <-ctx.Done():
require.FailNow(t, "timed out waiting for container to start")
default:
}
resp, err := http.Get("http://127.0.0.1:23457")
if err != nil {
t.Logf("waiting for container to start: %s", err)
time.Sleep(time.Second)
continue
}
defer resp.Body.Close()
require.Equal(t, http.StatusOK, resp.StatusCode)
body, err := io.ReadAll(resp.Body)
require.NoError(t, err)
require.Equal(t, "hey there", string(body))
break
}
})
t.Run("random", func(t *testing.T) {
console, err := newTUIConsole(t, time.Minute)
require.NoError(t, err)
tty := console.Tty()
err = pty.Setsize(tty, &pty.Winsize{Rows: 10, Cols: 28})
require.NoError(t, err)
cmd := hostDaggerCommand(ctx, t, modDir, "call", "ctr", "as-service", "up", "--random") |
closed | dagger/dagger | https://github.com/dagger/dagger | 6,303 | Bug: `bind: address already in use` when using `dagger up --port` | Hit this while backfilling integ test coverage for `dagger up` as part of CLI changes. Repro below.
Module code:
```go
package main
import "context"
func New(ctx context.Context) *Test {
return &Test{
Ctr: dag.Container().
From("python").
WithMountedDirectory(
"/srv/www",
dag.Directory().WithNewFile("index.html", "hey there"),
).
WithWorkdir("/srv/www").
WithExposedPort(8000).
WithExec([]string{"python", "-m", "http.server"}),
}
}
type Test struct {
Ctr *Container
}
```
Everything works when using `--native`:
```console
sipsma@dagger_dev:~/repo/github.com/sipsma/daggerverse/test$ dagger up --native ctr
β
dagger up ctr CANCELED [10.17s]
β 8000/TCP: tunnel 0.0.0.0:8000 -> cpi9mli1o4u78.b7d44b699trss.dagger.local:8000
β Error: context canceled
β’ Cloud URL: https://dagger.cloud/runs/fc1afa30-d2e8-473c-ade3-3910adbfb046
β’ Engine: 3b84e1257d0d (version v0.9.4)
β§ 11.78s β 46 β
8
```
But if I run anything with `--port` I get bind errors, including with `--port 8000:8000` which I thought would have been the same as `--native`:
```console
sipsma@dagger_dev:~/repo/github.com/sipsma/daggerverse/test$ dagger up --port 23456:8000 ctr
β dagger up ctr ERROR [1.62s]
β Error: failed to start tunnel: input:1: host.tunnel.start host to container: failed to receive listen response: rpc error: code = Unknown desc = listen tcp 0.0.0.0:23456: bind: address already in use
β start ERROR [0.39s]
β’ Cloud URL: https://dagger.cloud/runs/849eceaf-86f3-4f1d-b8db-b23a31fb69b1
β’ Engine: 3b84e1257d0d (version v0.9.4)
β§ 2.77s β 44 β
8 β 2
sipsma@dagger_dev:~/repo/github.com/sipsma/daggerverse/test$ dagger up --port 8000:8000 ctr
β dagger up ctr ERROR [1.76s]
β Error: failed to start tunnel: input:1: host.tunnel.start host to container: failed to receive listen response: rpc error: code = Unknown desc = listen tcp 0.0.0.0:8000: bind: address already in use
β start ERROR [0.43s]
β’ Cloud URL: https://dagger.cloud/runs/bcd2c12b-66cb-4a0d-abcd-4236201617e5
β’ Engine: 3b84e1257d0d (version v0.9.4)
β§ 3.08s β 44 β
8 β 2
```
---
Not sure if specific to the CLI somehow or more general, but the fact that `--native` works and `--port 8000:8000` doesn't is quite mysterious. | https://github.com/dagger/dagger/issues/6303 | https://github.com/dagger/dagger/pull/6626 | 7f31f89b7e121368199403ff36cbbece3b31a6cb | 5ee49b9e9a955432d688157893b299f8a6180b1d | 2023-12-20T21:23:29Z | go | 2024-02-08T20:42:59Z | core/integration/module_up_test.go | cmd.Stdin = nil
cmd.Stdout = tty
cmd.Stderr = tty
err = cmd.Start()
require.NoError(t, err)
defer cmd.Process.Kill()
_, matches, err := console.MatchLine(ctx, `(\d+)/TCP:`)
require.NoError(t, err)
port := matches[1]
t.Logf("random port: %s", port)
for {
select {
case <-ctx.Done():
require.FailNow(t, "timed out waiting for container to start")
default:
}
resp, err := http.Get("http://127.0.0.1:" + port)
if err != nil {
t.Logf("waiting for container to start: %s", err)
time.Sleep(time.Second)
continue
}
defer resp.Body.Close()
require.Equal(t, http.StatusOK, resp.StatusCode)
body, err := io.ReadAll(resp.Body)
require.NoError(t, err)
require.Equal(t, "hey there", string(body))
break
}
}) |
closed | dagger/dagger | https://github.com/dagger/dagger | 6,303 | Bug: `bind: address already in use` when using `dagger up --port` | Hit this while backfilling integ test coverage for `dagger up` as part of CLI changes. Repro below.
Module code:
```go
package main
import "context"
func New(ctx context.Context) *Test {
return &Test{
Ctr: dag.Container().
From("python").
WithMountedDirectory(
"/srv/www",
dag.Directory().WithNewFile("index.html", "hey there"),
).
WithWorkdir("/srv/www").
WithExposedPort(8000).
WithExec([]string{"python", "-m", "http.server"}),
}
}
type Test struct {
Ctr *Container
}
```
Everything works when using `--native`:
```console
sipsma@dagger_dev:~/repo/github.com/sipsma/daggerverse/test$ dagger up --native ctr
β
dagger up ctr CANCELED [10.17s]
β 8000/TCP: tunnel 0.0.0.0:8000 -> cpi9mli1o4u78.b7d44b699trss.dagger.local:8000
β Error: context canceled
β’ Cloud URL: https://dagger.cloud/runs/fc1afa30-d2e8-473c-ade3-3910adbfb046
β’ Engine: 3b84e1257d0d (version v0.9.4)
β§ 11.78s β 46 β
8
```
But if I run anything with `--port` I get bind errors, including with `--port 8000:8000` which I thought would have been the same as `--native`:
```console
sipsma@dagger_dev:~/repo/github.com/sipsma/daggerverse/test$ dagger up --port 23456:8000 ctr
β dagger up ctr ERROR [1.62s]
β Error: failed to start tunnel: input:1: host.tunnel.start host to container: failed to receive listen response: rpc error: code = Unknown desc = listen tcp 0.0.0.0:23456: bind: address already in use
β start ERROR [0.39s]
β’ Cloud URL: https://dagger.cloud/runs/849eceaf-86f3-4f1d-b8db-b23a31fb69b1
β’ Engine: 3b84e1257d0d (version v0.9.4)
β§ 2.77s β 44 β
8 β 2
sipsma@dagger_dev:~/repo/github.com/sipsma/daggerverse/test$ dagger up --port 8000:8000 ctr
β dagger up ctr ERROR [1.76s]
β Error: failed to start tunnel: input:1: host.tunnel.start host to container: failed to receive listen response: rpc error: code = Unknown desc = listen tcp 0.0.0.0:8000: bind: address already in use
β start ERROR [0.43s]
β’ Cloud URL: https://dagger.cloud/runs/bcd2c12b-66cb-4a0d-abcd-4236201617e5
β’ Engine: 3b84e1257d0d (version v0.9.4)
β§ 3.08s β 44 β
8 β 2
```
---
Not sure if specific to the CLI somehow or more general, but the fact that `--native` works and `--port 8000:8000` doesn't is quite mysterious. | https://github.com/dagger/dagger/issues/6303 | https://github.com/dagger/dagger/pull/6626 | 7f31f89b7e121368199403ff36cbbece3b31a6cb | 5ee49b9e9a955432d688157893b299f8a6180b1d | 2023-12-20T21:23:29Z | go | 2024-02-08T20:42:59Z | core/integration/module_up_test.go | t.Run("port map", func(t *testing.T) {
cmd := hostDaggerCommand(ctx, t, modDir, "call", "ctr", "as-service", "up", "--ports", "23458:23457")
cmd.Stdin = os.Stdin
cmd.Stdout = os.Stdout
cmd.Stderr = os.Stderr
err = cmd.Start()
require.NoError(t, err)
defer cmd.Process.Kill()
for {
select {
case <-ctx.Done():
require.FailNow(t, "timed out waiting for container to start")
default:
}
resp, err := http.Get("http://127.0.0.1:23458")
if err != nil {
t.Logf("waiting for container to start: %s", err)
time.Sleep(time.Second)
continue
}
defer resp.Body.Close()
require.Equal(t, http.StatusOK, resp.StatusCode)
body, err := io.ReadAll(resp.Body)
require.NoError(t, err)
require.Equal(t, "hey there", string(body))
break
}
})
} |
closed | dagger/dagger | https://github.com/dagger/dagger | 6,303 | Bug: `bind: address already in use` when using `dagger up --port` | Hit this while backfilling integ test coverage for `dagger up` as part of CLI changes. Repro below.
Module code:
```go
package main
import "context"
func New(ctx context.Context) *Test {
return &Test{
Ctr: dag.Container().
From("python").
WithMountedDirectory(
"/srv/www",
dag.Directory().WithNewFile("index.html", "hey there"),
).
WithWorkdir("/srv/www").
WithExposedPort(8000).
WithExec([]string{"python", "-m", "http.server"}),
}
}
type Test struct {
Ctr *Container
}
```
Everything works when using `--native`:
```console
sipsma@dagger_dev:~/repo/github.com/sipsma/daggerverse/test$ dagger up --native ctr
β
dagger up ctr CANCELED [10.17s]
β 8000/TCP: tunnel 0.0.0.0:8000 -> cpi9mli1o4u78.b7d44b699trss.dagger.local:8000
β Error: context canceled
β’ Cloud URL: https://dagger.cloud/runs/fc1afa30-d2e8-473c-ade3-3910adbfb046
β’ Engine: 3b84e1257d0d (version v0.9.4)
β§ 11.78s β 46 β
8
```
But if I run anything with `--port` I get bind errors, including with `--port 8000:8000` which I thought would have been the same as `--native`:
```console
sipsma@dagger_dev:~/repo/github.com/sipsma/daggerverse/test$ dagger up --port 23456:8000 ctr
β dagger up ctr ERROR [1.62s]
β Error: failed to start tunnel: input:1: host.tunnel.start host to container: failed to receive listen response: rpc error: code = Unknown desc = listen tcp 0.0.0.0:23456: bind: address already in use
β start ERROR [0.39s]
β’ Cloud URL: https://dagger.cloud/runs/849eceaf-86f3-4f1d-b8db-b23a31fb69b1
β’ Engine: 3b84e1257d0d (version v0.9.4)
β§ 2.77s β 44 β
8 β 2
sipsma@dagger_dev:~/repo/github.com/sipsma/daggerverse/test$ dagger up --port 8000:8000 ctr
β dagger up ctr ERROR [1.76s]
β Error: failed to start tunnel: input:1: host.tunnel.start host to container: failed to receive listen response: rpc error: code = Unknown desc = listen tcp 0.0.0.0:8000: bind: address already in use
β start ERROR [0.43s]
β’ Cloud URL: https://dagger.cloud/runs/bcd2c12b-66cb-4a0d-abcd-4236201617e5
β’ Engine: 3b84e1257d0d (version v0.9.4)
β§ 3.08s β 44 β
8 β 2
```
---
Not sure if specific to the CLI somehow or more general, but the fact that `--native` works and `--port 8000:8000` doesn't is quite mysterious. | https://github.com/dagger/dagger/issues/6303 | https://github.com/dagger/dagger/pull/6626 | 7f31f89b7e121368199403ff36cbbece3b31a6cb | 5ee49b9e9a955432d688157893b299f8a6180b1d | 2023-12-20T21:23:29Z | go | 2024-02-08T20:42:59Z | core/schema/service.go | package schema
import (
"context"
"fmt"
"runtime/debug"
"github.com/dagger/dagger/core"
"github.com/dagger/dagger/dagql"
"github.com/dagger/dagger/dagql/ioctx"
)
type serviceSchema struct {
srv *dagql.Server
}
var _ SchemaResolvers = &serviceSchema{}
func (s *serviceSchema) Install() {
dagql.Fields[*core.Container]{
dagql.Func("asService", s.containerAsService).
Doc(`Turn the container into a Service.`,
`Be sure to set any exposed ports before this conversion.`),
}.Install(s.srv)
dagql.Fields[*core.Service]{
dagql.NodeFunc("hostname", s.hostname).
Doc(`Retrieves a hostname which can be used by clients to reach this container.`),
dagql.NodeFunc("ports", s.ports).
Impure("A tunnel service's ports can change each time it is restarted.").
Doc(`Retrieves the list of ports provided by the service.`),
dagql.NodeFunc("endpoint", s.endpoint).
Impure("A tunnel service's endpoint can change if tunnel service is restarted.").
Doc(`Retrieves an endpoint that clients can use to reach this container.`,
`If no port is specified, the first exposed port is used. If none exist an error is returned.`, |
closed | dagger/dagger | https://github.com/dagger/dagger | 6,303 | Bug: `bind: address already in use` when using `dagger up --port` | Hit this while backfilling integ test coverage for `dagger up` as part of CLI changes. Repro below.
Module code:
```go
package main
import "context"
func New(ctx context.Context) *Test {
return &Test{
Ctr: dag.Container().
From("python").
WithMountedDirectory(
"/srv/www",
dag.Directory().WithNewFile("index.html", "hey there"),
).
WithWorkdir("/srv/www").
WithExposedPort(8000).
WithExec([]string{"python", "-m", "http.server"}),
}
}
type Test struct {
Ctr *Container
}
```
Everything works when using `--native`:
```console
sipsma@dagger_dev:~/repo/github.com/sipsma/daggerverse/test$ dagger up --native ctr
β
dagger up ctr CANCELED [10.17s]
β 8000/TCP: tunnel 0.0.0.0:8000 -> cpi9mli1o4u78.b7d44b699trss.dagger.local:8000
β Error: context canceled
β’ Cloud URL: https://dagger.cloud/runs/fc1afa30-d2e8-473c-ade3-3910adbfb046
β’ Engine: 3b84e1257d0d (version v0.9.4)
β§ 11.78s β 46 β
8
```
But if I run anything with `--port` I get bind errors, including with `--port 8000:8000` which I thought would have been the same as `--native`:
```console
sipsma@dagger_dev:~/repo/github.com/sipsma/daggerverse/test$ dagger up --port 23456:8000 ctr
β dagger up ctr ERROR [1.62s]
β Error: failed to start tunnel: input:1: host.tunnel.start host to container: failed to receive listen response: rpc error: code = Unknown desc = listen tcp 0.0.0.0:23456: bind: address already in use
β start ERROR [0.39s]
β’ Cloud URL: https://dagger.cloud/runs/849eceaf-86f3-4f1d-b8db-b23a31fb69b1
β’ Engine: 3b84e1257d0d (version v0.9.4)
β§ 2.77s β 44 β
8 β 2
sipsma@dagger_dev:~/repo/github.com/sipsma/daggerverse/test$ dagger up --port 8000:8000 ctr
β dagger up ctr ERROR [1.76s]
β Error: failed to start tunnel: input:1: host.tunnel.start host to container: failed to receive listen response: rpc error: code = Unknown desc = listen tcp 0.0.0.0:8000: bind: address already in use
β start ERROR [0.43s]
β’ Cloud URL: https://dagger.cloud/runs/bcd2c12b-66cb-4a0d-abcd-4236201617e5
β’ Engine: 3b84e1257d0d (version v0.9.4)
β§ 3.08s β 44 β
8 β 2
```
---
Not sure if specific to the CLI somehow or more general, but the fact that `--native` works and `--port 8000:8000` doesn't is quite mysterious. | https://github.com/dagger/dagger/issues/6303 | https://github.com/dagger/dagger/pull/6626 | 7f31f89b7e121368199403ff36cbbece3b31a6cb | 5ee49b9e9a955432d688157893b299f8a6180b1d | 2023-12-20T21:23:29Z | go | 2024-02-08T20:42:59Z | core/schema/service.go | `If a scheme is specified, a URL is returned. Otherwise, a host:port pair is returned.`).
ArgDoc("port", `The exposed port number for the endpoint`).
ArgDoc("scheme", `Return a URL with the given scheme, eg. http for http://`),
dagql.NodeFunc("start", s.start).
Impure("Imperatively mutates runtime state.").
Doc(`Start the service and wait for its health checks to succeed.`,
`Services bound to a Container do not need to be manually started.`),
dagql.NodeFunc("up", s.up).
Impure("Starts a host tunnel, possibly with ports that change each time it's started.").
Doc(`Creates a tunnel that forwards traffic from the caller's network to this service.`).
ArgDoc("random", `Bind each tunnel port to a random port on the host.`).
ArgDoc("ports", `List of frontend/backend port mappings to forward.`,
`Frontend is the port accepting traffic on the host, backend is the service port.`),
dagql.NodeFunc("stop", s.stop).
Impure("Imperatively mutates runtime state.").
Doc(`Stop the service.`).
ArgDoc("kill", `Immediately kill the service without waiting for a graceful exit`),
}.Install(s.srv)
}
func (s *serviceSchema) containerAsService(ctx context.Context, parent *core.Container, args struct{}) (*core.Service, error) {
return parent.Service(ctx)
}
func (s *serviceSchema) hostname(ctx context.Context, parent dagql.Instance[*core.Service], args struct{}) (dagql.String, error) {
hn, err := parent.Self.Hostname(ctx, parent.ID())
if err != nil {
return "", err
}
return dagql.NewString(hn), nil
}
func (s *serviceSchema) ports(ctx context.Context, parent dagql.Instance[*core.Service], args struct{}) (dagql.Array[core.Port], error) { |
closed | dagger/dagger | https://github.com/dagger/dagger | 6,303 | Bug: `bind: address already in use` when using `dagger up --port` | Hit this while backfilling integ test coverage for `dagger up` as part of CLI changes. Repro below.
Module code:
```go
package main
import "context"
func New(ctx context.Context) *Test {
return &Test{
Ctr: dag.Container().
From("python").
WithMountedDirectory(
"/srv/www",
dag.Directory().WithNewFile("index.html", "hey there"),
).
WithWorkdir("/srv/www").
WithExposedPort(8000).
WithExec([]string{"python", "-m", "http.server"}),
}
}
type Test struct {
Ctr *Container
}
```
Everything works when using `--native`:
```console
sipsma@dagger_dev:~/repo/github.com/sipsma/daggerverse/test$ dagger up --native ctr
β
dagger up ctr CANCELED [10.17s]
β 8000/TCP: tunnel 0.0.0.0:8000 -> cpi9mli1o4u78.b7d44b699trss.dagger.local:8000
β Error: context canceled
β’ Cloud URL: https://dagger.cloud/runs/fc1afa30-d2e8-473c-ade3-3910adbfb046
β’ Engine: 3b84e1257d0d (version v0.9.4)
β§ 11.78s β 46 β
8
```
But if I run anything with `--port` I get bind errors, including with `--port 8000:8000` which I thought would have been the same as `--native`:
```console
sipsma@dagger_dev:~/repo/github.com/sipsma/daggerverse/test$ dagger up --port 23456:8000 ctr
β dagger up ctr ERROR [1.62s]
β Error: failed to start tunnel: input:1: host.tunnel.start host to container: failed to receive listen response: rpc error: code = Unknown desc = listen tcp 0.0.0.0:23456: bind: address already in use
β start ERROR [0.39s]
β’ Cloud URL: https://dagger.cloud/runs/849eceaf-86f3-4f1d-b8db-b23a31fb69b1
β’ Engine: 3b84e1257d0d (version v0.9.4)
β§ 2.77s β 44 β
8 β 2
sipsma@dagger_dev:~/repo/github.com/sipsma/daggerverse/test$ dagger up --port 8000:8000 ctr
β dagger up ctr ERROR [1.76s]
β Error: failed to start tunnel: input:1: host.tunnel.start host to container: failed to receive listen response: rpc error: code = Unknown desc = listen tcp 0.0.0.0:8000: bind: address already in use
β start ERROR [0.43s]
β’ Cloud URL: https://dagger.cloud/runs/bcd2c12b-66cb-4a0d-abcd-4236201617e5
β’ Engine: 3b84e1257d0d (version v0.9.4)
β§ 3.08s β 44 β
8 β 2
```
---
Not sure if specific to the CLI somehow or more general, but the fact that `--native` works and `--port 8000:8000` doesn't is quite mysterious. | https://github.com/dagger/dagger/issues/6303 | https://github.com/dagger/dagger/pull/6626 | 7f31f89b7e121368199403ff36cbbece3b31a6cb | 5ee49b9e9a955432d688157893b299f8a6180b1d | 2023-12-20T21:23:29Z | go | 2024-02-08T20:42:59Z | core/schema/service.go | return parent.Self.Ports(ctx, parent.ID())
}
type serviceEndpointArgs struct {
Port dagql.Optional[dagql.Int]
Scheme string `default:""`
}
func (s *serviceSchema) endpoint(ctx context.Context, parent dagql.Instance[*core.Service], args serviceEndpointArgs) (dagql.String, error) {
str, err := parent.Self.Endpoint(ctx, parent.ID(), args.Port.Value.Int(), args.Scheme)
if err != nil {
return "", err
}
return dagql.NewString(str), nil
}
func (s *serviceSchema) start(ctx context.Context, parent dagql.Instance[*core.Service], args struct{}) (core.ServiceID, error) {
defer func() {
if err := recover(); err != nil {
debug.PrintStack()
panic(err)
}
}()
if err := parent.Self.StartAndTrack(ctx, parent.ID()); err != nil {
return core.ServiceID{}, err
}
return dagql.NewID[*core.Service](parent.ID()), nil
}
type serviceStopArgs struct { |
closed | dagger/dagger | https://github.com/dagger/dagger | 6,303 | Bug: `bind: address already in use` when using `dagger up --port` | Hit this while backfilling integ test coverage for `dagger up` as part of CLI changes. Repro below.
Module code:
```go
package main
import "context"
func New(ctx context.Context) *Test {
return &Test{
Ctr: dag.Container().
From("python").
WithMountedDirectory(
"/srv/www",
dag.Directory().WithNewFile("index.html", "hey there"),
).
WithWorkdir("/srv/www").
WithExposedPort(8000).
WithExec([]string{"python", "-m", "http.server"}),
}
}
type Test struct {
Ctr *Container
}
```
Everything works when using `--native`:
```console
sipsma@dagger_dev:~/repo/github.com/sipsma/daggerverse/test$ dagger up --native ctr
β
dagger up ctr CANCELED [10.17s]
β 8000/TCP: tunnel 0.0.0.0:8000 -> cpi9mli1o4u78.b7d44b699trss.dagger.local:8000
β Error: context canceled
β’ Cloud URL: https://dagger.cloud/runs/fc1afa30-d2e8-473c-ade3-3910adbfb046
β’ Engine: 3b84e1257d0d (version v0.9.4)
β§ 11.78s β 46 β
8
```
But if I run anything with `--port` I get bind errors, including with `--port 8000:8000` which I thought would have been the same as `--native`:
```console
sipsma@dagger_dev:~/repo/github.com/sipsma/daggerverse/test$ dagger up --port 23456:8000 ctr
β dagger up ctr ERROR [1.62s]
β Error: failed to start tunnel: input:1: host.tunnel.start host to container: failed to receive listen response: rpc error: code = Unknown desc = listen tcp 0.0.0.0:23456: bind: address already in use
β start ERROR [0.39s]
β’ Cloud URL: https://dagger.cloud/runs/849eceaf-86f3-4f1d-b8db-b23a31fb69b1
β’ Engine: 3b84e1257d0d (version v0.9.4)
β§ 2.77s β 44 β
8 β 2
sipsma@dagger_dev:~/repo/github.com/sipsma/daggerverse/test$ dagger up --port 8000:8000 ctr
β dagger up ctr ERROR [1.76s]
β Error: failed to start tunnel: input:1: host.tunnel.start host to container: failed to receive listen response: rpc error: code = Unknown desc = listen tcp 0.0.0.0:8000: bind: address already in use
β start ERROR [0.43s]
β’ Cloud URL: https://dagger.cloud/runs/bcd2c12b-66cb-4a0d-abcd-4236201617e5
β’ Engine: 3b84e1257d0d (version v0.9.4)
β§ 3.08s β 44 β
8 β 2
```
---
Not sure if specific to the CLI somehow or more general, but the fact that `--native` works and `--port 8000:8000` doesn't is quite mysterious. | https://github.com/dagger/dagger/issues/6303 | https://github.com/dagger/dagger/pull/6626 | 7f31f89b7e121368199403ff36cbbece3b31a6cb | 5ee49b9e9a955432d688157893b299f8a6180b1d | 2023-12-20T21:23:29Z | go | 2024-02-08T20:42:59Z | core/schema/service.go | Kill bool `default:"false"`
}
func (s *serviceSchema) stop(ctx context.Context, parent dagql.Instance[*core.Service], args serviceStopArgs) (core.ServiceID, error) {
if err := parent.Self.Stop(ctx, parent.ID(), args.Kill); err != nil {
return core.ServiceID{}, err
}
return dagql.NewID[*core.Service](parent.ID()), nil
}
type upArgs struct {
Ports []dagql.InputObject[core.PortForward] `default:"[]"`
Random bool `default:"false"`
}
func (s *serviceSchema) up(ctx context.Context, svc dagql.Instance[*core.Service], args upArgs) (dagql.Nullable[core.Void], error) {
void := dagql.Null[core.Void]()
var hostSvc dagql.Instance[*core.Service]
err := s.srv.Select(ctx, s.srv.Root(), &hostSvc,
dagql.Selector{
Field: "host",
}, |
closed | dagger/dagger | https://github.com/dagger/dagger | 6,303 | Bug: `bind: address already in use` when using `dagger up --port` | Hit this while backfilling integ test coverage for `dagger up` as part of CLI changes. Repro below.
Module code:
```go
package main
import "context"
func New(ctx context.Context) *Test {
return &Test{
Ctr: dag.Container().
From("python").
WithMountedDirectory(
"/srv/www",
dag.Directory().WithNewFile("index.html", "hey there"),
).
WithWorkdir("/srv/www").
WithExposedPort(8000).
WithExec([]string{"python", "-m", "http.server"}),
}
}
type Test struct {
Ctr *Container
}
```
Everything works when using `--native`:
```console
sipsma@dagger_dev:~/repo/github.com/sipsma/daggerverse/test$ dagger up --native ctr
β
dagger up ctr CANCELED [10.17s]
β 8000/TCP: tunnel 0.0.0.0:8000 -> cpi9mli1o4u78.b7d44b699trss.dagger.local:8000
β Error: context canceled
β’ Cloud URL: https://dagger.cloud/runs/fc1afa30-d2e8-473c-ade3-3910adbfb046
β’ Engine: 3b84e1257d0d (version v0.9.4)
β§ 11.78s β 46 β
8
```
But if I run anything with `--port` I get bind errors, including with `--port 8000:8000` which I thought would have been the same as `--native`:
```console
sipsma@dagger_dev:~/repo/github.com/sipsma/daggerverse/test$ dagger up --port 23456:8000 ctr
β dagger up ctr ERROR [1.62s]
β Error: failed to start tunnel: input:1: host.tunnel.start host to container: failed to receive listen response: rpc error: code = Unknown desc = listen tcp 0.0.0.0:23456: bind: address already in use
β start ERROR [0.39s]
β’ Cloud URL: https://dagger.cloud/runs/849eceaf-86f3-4f1d-b8db-b23a31fb69b1
β’ Engine: 3b84e1257d0d (version v0.9.4)
β§ 2.77s β 44 β
8 β 2
sipsma@dagger_dev:~/repo/github.com/sipsma/daggerverse/test$ dagger up --port 8000:8000 ctr
β dagger up ctr ERROR [1.76s]
β Error: failed to start tunnel: input:1: host.tunnel.start host to container: failed to receive listen response: rpc error: code = Unknown desc = listen tcp 0.0.0.0:8000: bind: address already in use
β start ERROR [0.43s]
β’ Cloud URL: https://dagger.cloud/runs/bcd2c12b-66cb-4a0d-abcd-4236201617e5
β’ Engine: 3b84e1257d0d (version v0.9.4)
β§ 3.08s β 44 β
8 β 2
```
---
Not sure if specific to the CLI somehow or more general, but the fact that `--native` works and `--port 8000:8000` doesn't is quite mysterious. | https://github.com/dagger/dagger/issues/6303 | https://github.com/dagger/dagger/pull/6626 | 7f31f89b7e121368199403ff36cbbece3b31a6cb | 5ee49b9e9a955432d688157893b299f8a6180b1d | 2023-12-20T21:23:29Z | go | 2024-02-08T20:42:59Z | core/schema/service.go | dagql.Selector{
Field: "tunnel",
Args: []dagql.NamedInput{
{Name: "service", Value: dagql.NewID[*core.Service](svc.ID())},
{Name: "ports", Value: dagql.ArrayInput[dagql.InputObject[core.PortForward]](args.Ports)},
{Name: "native", Value: dagql.Boolean(!args.Random)},
},
},
)
if err != nil {
return void, fmt.Errorf("failed to select host service: %w", err)
}
runningSvc, err := hostSvc.Self.Query.Services.Start(ctx, hostSvc.ID(), hostSvc.Self)
if err != nil {
return void, fmt.Errorf("failed to start host service: %w", err)
}
ioctxOut := ioctx.Stdout(ctx)
for _, port := range runningSvc.Ports {
portStr := fmt.Sprintf("%d/%s", port.Port, port.Protocol)
if port.Description != nil {
portStr += ": " + *port.Description
}
portStr += "\n"
ioctxOut.Write([]byte(portStr))
}
<-ctx.Done()
return void, nil
} |
closed | dagger/dagger | https://github.com/dagger/dagger | 6,630 | `slice bounds out of range [1:0]` panic in shim secret scrubbing | Hit this while testing publish things in my fork: https://github.com/sipsma/dagger/actions/runs/7837271347/job/21386972933#step:4:2866
Stack:
```
62: [0.09s] panic: runtime error: slice bounds out of range [1:0] goroutine 1 [running, locked to thread]:
62: [0.09s] runtime/debug.Stack()
62: [0.09s] /usr/local/go/src/runtime/debug/stack.go:24 +0x5e
62: [0.09s] main.main.func1()
62: [0.09s] /app/cmd/shim/main.go:63 +0x38
62: [0.09s] panic({0x1105620?, 0xc000044c78?})
62: [0.09s] /usr/local/go/src/runtime/panic.go:914 +0x21f
62: [0.09s] main.(*Trie).Insert(0xc00008b020?, {0xc0001a2b90, 0x4e, 0x50}, {0x1b18a8e, 0x3, 0x3})
62: [0.09s] /app/cmd/shim/secret_scrub.go:230 +0x351
62: [0.09s] main.NewSecretScrubReader({0x13307a0?, 0xc000126938}, {0x1329160, 0x1}, {0x1330820, 0xc0005a2780}, {0xc0003a28c0?, 0x2?, 0x2?}, {{0xc0005b7500, ...}, ...})
62: [0.09s] /app/cmd/shim/secret_scrub.go:39 +0x345
62: [0.09s] main.shim()
62: [0.09s] /app/cmd/shim/main.go:259 +0xc52
62: [0.09s] main.main()
62: [0.09s] /app/cmd/shim/main.go:76 +0x74
62: [0.09s]
```
[Relevant line of code](https://github.com/sipsma/dagger/blob/d71867c127f6970113221c57fc03d2c8084b6c0a/cmd/shim/secret_scrub.go#L230-L230)
Not 100% sure but suspect I may have somehow set a secret value to `""`? That seems like a plausible explanation, but haven't looked at this in depth.
cc @jedevc | https://github.com/dagger/dagger/issues/6630 | https://github.com/dagger/dagger/pull/6641 | 794e3b3d298c7ca77dfedf5bf3d98d143ed05095 | 0c0de6b23b0151a9d1debfa8cbc879fd30391ab5 | 2024-02-08T23:51:48Z | go | 2024-02-12T14:41:35Z | cmd/shim/secret_scrub.go | package main
import (
"fmt"
"io"
"io/fs"
"path/filepath"
"strings"
"github.com/dagger/dagger/core"
"golang.org/x/text/transform"
)
var (
scrubString = []byte("***")
)
func NewSecretScrubReader(r io.Reader, currentDirPath string, fsys fs.FS, env []string, secretsToScrub core.SecretToScrubInfo) (io.Reader, error) { |
closed | dagger/dagger | https://github.com/dagger/dagger | 6,630 | `slice bounds out of range [1:0]` panic in shim secret scrubbing | Hit this while testing publish things in my fork: https://github.com/sipsma/dagger/actions/runs/7837271347/job/21386972933#step:4:2866
Stack:
```
62: [0.09s] panic: runtime error: slice bounds out of range [1:0] goroutine 1 [running, locked to thread]:
62: [0.09s] runtime/debug.Stack()
62: [0.09s] /usr/local/go/src/runtime/debug/stack.go:24 +0x5e
62: [0.09s] main.main.func1()
62: [0.09s] /app/cmd/shim/main.go:63 +0x38
62: [0.09s] panic({0x1105620?, 0xc000044c78?})
62: [0.09s] /usr/local/go/src/runtime/panic.go:914 +0x21f
62: [0.09s] main.(*Trie).Insert(0xc00008b020?, {0xc0001a2b90, 0x4e, 0x50}, {0x1b18a8e, 0x3, 0x3})
62: [0.09s] /app/cmd/shim/secret_scrub.go:230 +0x351
62: [0.09s] main.NewSecretScrubReader({0x13307a0?, 0xc000126938}, {0x1329160, 0x1}, {0x1330820, 0xc0005a2780}, {0xc0003a28c0?, 0x2?, 0x2?}, {{0xc0005b7500, ...}, ...})
62: [0.09s] /app/cmd/shim/secret_scrub.go:39 +0x345
62: [0.09s] main.shim()
62: [0.09s] /app/cmd/shim/main.go:259 +0xc52
62: [0.09s] main.main()
62: [0.09s] /app/cmd/shim/main.go:76 +0x74
62: [0.09s]
```
[Relevant line of code](https://github.com/sipsma/dagger/blob/d71867c127f6970113221c57fc03d2c8084b6c0a/cmd/shim/secret_scrub.go#L230-L230)
Not 100% sure but suspect I may have somehow set a secret value to `""`? That seems like a plausible explanation, but haven't looked at this in depth.
cc @jedevc | https://github.com/dagger/dagger/issues/6630 | https://github.com/dagger/dagger/pull/6641 | 794e3b3d298c7ca77dfedf5bf3d98d143ed05095 | 0c0de6b23b0151a9d1debfa8cbc879fd30391ab5 | 2024-02-08T23:51:48Z | go | 2024-02-12T14:41:35Z | cmd/shim/secret_scrub.go | secrets := loadSecretsToScrubFromEnv(env, secretsToScrub.Envs)
fileSecrets, err := loadSecretsToScrubFromFiles(currentDirPath, fsys, secretsToScrub.Files)
if err != nil {
return nil, fmt.Errorf("could not load secrets from file: %w", err)
}
secrets = append(secrets, fileSecrets...)
secretAsBytes := make([][]byte, 0)
for _, v := range secrets {
if len(v) == 0 {
continue
}
secretAsBytes = append(secretAsBytes, []byte(v))
}
trie := &Trie{}
for _, s := range secretAsBytes {
trie.Insert([]byte(s), scrubString)
}
transformer := &censor{
trie: trie,
trieRoot: trie,
srcBuf: make([]byte, 0, 4096),
dstBuf: make([]byte, 0, 4096),
}
return transform.NewReader(r, transformer), nil
}
func loadSecretsToScrubFromEnv(env []string, secretsToScrub []string) []string { |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.