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
unknown
language
stringclasses
5 values
commit_datetime
unknown
updated_file
stringlengths
7
188
chunk_content
stringlengths
1
1.03M
closed
dagger/dagger
https://github.com/dagger/dagger
6,725
Support passing modules as arguments in the CLI
Modules can accept other modules as arguments to functions. Use cases: 1. SDKs implemented as modules do this already by accepting `ModuleSource` as an arg 2. Support for running tests of modules could use this: https://github.com/dagger/dagger/issues/6724 3. Support for re-executing modules in specialized hosts (i.e. run my module on a "gpu-as-a-service" platform) 4. Combined with support for interfaces, you could pass a module as an implementation of an interface argument (if it matches) * @vito mentioned one use case specifically around using this to construct a dev env that is defined across multiple modules and could be dynamically composed into one (IIUC, correct if I misunderstood) However, it's not yet possible to do this from the CLI with `dagger call`, which greatly limits its utility. We could likely just re-use the syntax we use for `-m`, e.g.: * `dagger call go-test --module github.com/my-org/my-repo/my-mod`, where `--module` is an argument of type either `ModuleSource`, `Module` or an interface that the module must implement. That would in theory be extremely straightforward to implement while also unlocking all sorts of very interesting use cases
https://github.com/dagger/dagger/issues/6725
https://github.com/dagger/dagger/pull/6761
c5bf6978ba169abbc5cef54b3d7cd829f141d792
e02ff3d2b50665275deb52902abc46ac0f6f138a
"2024-02-23T18:56:08Z"
go
"2024-02-27T22:55:04Z"
cmd/dagger/flags.go
u, err := gitutil.ParseURL(urlStr) if err != nil { return nil, err } if u.Fragment == nil { u.Fragment = &gitutil.GitURLFragment{} } if u.Fragment.Ref == "" { u.Fragment.Ref = "main" } return u, nil } type fileValue struct { path string } func (v *fileValue) Type() string { return File } func (v *fileValue) Set(s string) error { if s == "" { return fmt.Errorf("file path cannot be empty") } v.path = s return nil } func (v *fileValue) String() string { return v.path
closed
dagger/dagger
https://github.com/dagger/dagger
6,725
Support passing modules as arguments in the CLI
Modules can accept other modules as arguments to functions. Use cases: 1. SDKs implemented as modules do this already by accepting `ModuleSource` as an arg 2. Support for running tests of modules could use this: https://github.com/dagger/dagger/issues/6724 3. Support for re-executing modules in specialized hosts (i.e. run my module on a "gpu-as-a-service" platform) 4. Combined with support for interfaces, you could pass a module as an implementation of an interface argument (if it matches) * @vito mentioned one use case specifically around using this to construct a dev env that is defined across multiple modules and could be dynamically composed into one (IIUC, correct if I misunderstood) However, it's not yet possible to do this from the CLI with `dagger call`, which greatly limits its utility. We could likely just re-use the syntax we use for `-m`, e.g.: * `dagger call go-test --module github.com/my-org/my-repo/my-mod`, where `--module` is an argument of type either `ModuleSource`, `Module` or an interface that the module must implement. That would in theory be extremely straightforward to implement while also unlocking all sorts of very interesting use cases
https://github.com/dagger/dagger/issues/6725
https://github.com/dagger/dagger/pull/6761
c5bf6978ba169abbc5cef54b3d7cd829f141d792
e02ff3d2b50665275deb52902abc46ac0f6f138a
"2024-02-23T18:56:08Z"
go
"2024-02-27T22:55:04Z"
cmd/dagger/flags.go
} func (v *fileValue) Get(_ context.Context, c *dagger.Client) (any, error) { vStr := v.String() if vStr == "" { return nil, fmt.Errorf("file path cannot be empty") } vStr = strings.TrimPrefix(vStr, "file:") if !filepath.IsAbs(vStr) { var err error vStr, err = filepath.Abs(vStr) if err != nil { return nil, fmt.Errorf("failed to resolve absolute path: %w", err) } } return c.Host().File(vStr), nil } type secretValue struct { secretSource string sourceVal string } const ( envSecretSource = "env" fileSecretSource = "file" commandSecretSource = "cmd" ) func (v *secretValue) Type() string { return Secret } func (v *secretValue) Set(s string) error { secretSource, val, ok := strings.Cut(s, ":")
closed
dagger/dagger
https://github.com/dagger/dagger
6,725
Support passing modules as arguments in the CLI
Modules can accept other modules as arguments to functions. Use cases: 1. SDKs implemented as modules do this already by accepting `ModuleSource` as an arg 2. Support for running tests of modules could use this: https://github.com/dagger/dagger/issues/6724 3. Support for re-executing modules in specialized hosts (i.e. run my module on a "gpu-as-a-service" platform) 4. Combined with support for interfaces, you could pass a module as an implementation of an interface argument (if it matches) * @vito mentioned one use case specifically around using this to construct a dev env that is defined across multiple modules and could be dynamically composed into one (IIUC, correct if I misunderstood) However, it's not yet possible to do this from the CLI with `dagger call`, which greatly limits its utility. We could likely just re-use the syntax we use for `-m`, e.g.: * `dagger call go-test --module github.com/my-org/my-repo/my-mod`, where `--module` is an argument of type either `ModuleSource`, `Module` or an interface that the module must implement. That would in theory be extremely straightforward to implement while also unlocking all sorts of very interesting use cases
https://github.com/dagger/dagger/issues/6725
https://github.com/dagger/dagger/pull/6761
c5bf6978ba169abbc5cef54b3d7cd829f141d792
e02ff3d2b50665275deb52902abc46ac0f6f138a
"2024-02-23T18:56:08Z"
go
"2024-02-27T22:55:04Z"
cmd/dagger/flags.go
if !ok { val = secretSource secretSource = envSecretSource } v.secretSource = secretSource v.sourceVal = val return nil } func (v *secretValue) String() string { return fmt.Sprintf("%s:%s", v.secretSource, v.sourceVal) } func (v *secretValue) Get(ctx context.Context, c *dagger.Client) (any, error) { var plaintext string switch v.secretSource { case envSecretSource: envPlaintext, ok := os.LookupEnv(v.sourceVal) if !ok { key := v.sourceVal if len(key) >= 4 { key = key[:3] + "..." } return nil, fmt.Errorf("secret env var not found: %q", key) } plaintext = envPlaintext case fileSecretSource: filePlaintext, err := os.ReadFile(v.sourceVal)
closed
dagger/dagger
https://github.com/dagger/dagger
6,725
Support passing modules as arguments in the CLI
Modules can accept other modules as arguments to functions. Use cases: 1. SDKs implemented as modules do this already by accepting `ModuleSource` as an arg 2. Support for running tests of modules could use this: https://github.com/dagger/dagger/issues/6724 3. Support for re-executing modules in specialized hosts (i.e. run my module on a "gpu-as-a-service" platform) 4. Combined with support for interfaces, you could pass a module as an implementation of an interface argument (if it matches) * @vito mentioned one use case specifically around using this to construct a dev env that is defined across multiple modules and could be dynamically composed into one (IIUC, correct if I misunderstood) However, it's not yet possible to do this from the CLI with `dagger call`, which greatly limits its utility. We could likely just re-use the syntax we use for `-m`, e.g.: * `dagger call go-test --module github.com/my-org/my-repo/my-mod`, where `--module` is an argument of type either `ModuleSource`, `Module` or an interface that the module must implement. That would in theory be extremely straightforward to implement while also unlocking all sorts of very interesting use cases
https://github.com/dagger/dagger/issues/6725
https://github.com/dagger/dagger/pull/6761
c5bf6978ba169abbc5cef54b3d7cd829f141d792
e02ff3d2b50665275deb52902abc46ac0f6f138a
"2024-02-23T18:56:08Z"
go
"2024-02-27T22:55:04Z"
cmd/dagger/flags.go
if err != nil { return nil, fmt.Errorf("failed to read secret file %q: %w", v.sourceVal, err) } plaintext = string(filePlaintext) case commandSecretSource: stdoutBytes, err := exec.CommandContext(ctx, "sh", "-c", v.sourceVal).Output() if err != nil { return nil, fmt.Errorf("failed to run secret command %q: %w", v.sourceVal, err) } plaintext = string(stdoutBytes) default: return nil, fmt.Errorf("unsupported secret arg source: %q", v.secretSource) } hash := sha256.Sum256([]byte(plaintext)) secretName := hex.EncodeToString(hash[:]) return c.SetSecret(secretName, plaintext), nil } type serviceValue struct { address string host string ports []dagger.PortForward } func (v *serviceValue) Type() string { return Service } func (v *serviceValue) String() string { return v.address
closed
dagger/dagger
https://github.com/dagger/dagger
6,725
Support passing modules as arguments in the CLI
Modules can accept other modules as arguments to functions. Use cases: 1. SDKs implemented as modules do this already by accepting `ModuleSource` as an arg 2. Support for running tests of modules could use this: https://github.com/dagger/dagger/issues/6724 3. Support for re-executing modules in specialized hosts (i.e. run my module on a "gpu-as-a-service" platform) 4. Combined with support for interfaces, you could pass a module as an implementation of an interface argument (if it matches) * @vito mentioned one use case specifically around using this to construct a dev env that is defined across multiple modules and could be dynamically composed into one (IIUC, correct if I misunderstood) However, it's not yet possible to do this from the CLI with `dagger call`, which greatly limits its utility. We could likely just re-use the syntax we use for `-m`, e.g.: * `dagger call go-test --module github.com/my-org/my-repo/my-mod`, where `--module` is an argument of type either `ModuleSource`, `Module` or an interface that the module must implement. That would in theory be extremely straightforward to implement while also unlocking all sorts of very interesting use cases
https://github.com/dagger/dagger/issues/6725
https://github.com/dagger/dagger/pull/6761
c5bf6978ba169abbc5cef54b3d7cd829f141d792
e02ff3d2b50665275deb52902abc46ac0f6f138a
"2024-02-23T18:56:08Z"
go
"2024-02-27T22:55:04Z"
cmd/dagger/flags.go
} func (v *serviceValue) Set(s string) error { if s == "" { return fmt.Errorf("service address cannot be empty") } u, err := url.Parse(s) if err != nil { return err } switch u.Scheme { case "tcp": host, port, err := net.SplitHostPort(u.Host) if err != nil { return err } nPort, err := strconv.Atoi(port) if err != nil { return err } v.host = host v.ports = append(v.ports, dagger.PortForward{ Backend: nPort, Frontend: nPort, Protocol: dagger.Tcp, }) case "udp": host, port, err := net.SplitHostPort(u.Host) if err != nil { return err }
closed
dagger/dagger
https://github.com/dagger/dagger
6,725
Support passing modules as arguments in the CLI
Modules can accept other modules as arguments to functions. Use cases: 1. SDKs implemented as modules do this already by accepting `ModuleSource` as an arg 2. Support for running tests of modules could use this: https://github.com/dagger/dagger/issues/6724 3. Support for re-executing modules in specialized hosts (i.e. run my module on a "gpu-as-a-service" platform) 4. Combined with support for interfaces, you could pass a module as an implementation of an interface argument (if it matches) * @vito mentioned one use case specifically around using this to construct a dev env that is defined across multiple modules and could be dynamically composed into one (IIUC, correct if I misunderstood) However, it's not yet possible to do this from the CLI with `dagger call`, which greatly limits its utility. We could likely just re-use the syntax we use for `-m`, e.g.: * `dagger call go-test --module github.com/my-org/my-repo/my-mod`, where `--module` is an argument of type either `ModuleSource`, `Module` or an interface that the module must implement. That would in theory be extremely straightforward to implement while also unlocking all sorts of very interesting use cases
https://github.com/dagger/dagger/issues/6725
https://github.com/dagger/dagger/pull/6761
c5bf6978ba169abbc5cef54b3d7cd829f141d792
e02ff3d2b50665275deb52902abc46ac0f6f138a
"2024-02-23T18:56:08Z"
go
"2024-02-27T22:55:04Z"
cmd/dagger/flags.go
nPort, err := strconv.Atoi(port) if err != nil { return err } v.host = host v.ports = append(v.ports, dagger.PortForward{ Backend: nPort, Frontend: nPort, Protocol: dagger.Udp, }) default: return fmt.Errorf("unsupported service address. Must be a valid tcp: or udp: URL") } v.address = s return nil } func (v *serviceValue) Get(ctx context.Context, c *dagger.Client) (any, error) { svc, err := c.Host().Service(v.ports, dagger.HostServiceOpts{Host: v.host}).Start(ctx) if err != nil { return nil, fmt.Errorf("failed to start service: %w", err) } return svc, nil } type portForwardValue struct { frontend int backend int } func (v *portForwardValue) Type() string { return PortForward }
closed
dagger/dagger
https://github.com/dagger/dagger
6,725
Support passing modules as arguments in the CLI
Modules can accept other modules as arguments to functions. Use cases: 1. SDKs implemented as modules do this already by accepting `ModuleSource` as an arg 2. Support for running tests of modules could use this: https://github.com/dagger/dagger/issues/6724 3. Support for re-executing modules in specialized hosts (i.e. run my module on a "gpu-as-a-service" platform) 4. Combined with support for interfaces, you could pass a module as an implementation of an interface argument (if it matches) * @vito mentioned one use case specifically around using this to construct a dev env that is defined across multiple modules and could be dynamically composed into one (IIUC, correct if I misunderstood) However, it's not yet possible to do this from the CLI with `dagger call`, which greatly limits its utility. We could likely just re-use the syntax we use for `-m`, e.g.: * `dagger call go-test --module github.com/my-org/my-repo/my-mod`, where `--module` is an argument of type either `ModuleSource`, `Module` or an interface that the module must implement. That would in theory be extremely straightforward to implement while also unlocking all sorts of very interesting use cases
https://github.com/dagger/dagger/issues/6725
https://github.com/dagger/dagger/pull/6761
c5bf6978ba169abbc5cef54b3d7cd829f141d792
e02ff3d2b50665275deb52902abc46ac0f6f138a
"2024-02-23T18:56:08Z"
go
"2024-02-27T22:55:04Z"
cmd/dagger/flags.go
func (v *portForwardValue) Set(s string) error { if s == "" { return fmt.Errorf("portForward setting cannot be empty") } frontendStr, backendStr, ok := strings.Cut(s, ":") if !ok { return fmt.Errorf("portForward setting not in the form of frontend:backend: %q", s) } frontend, err := strconv.Atoi(frontendStr) if err != nil { return fmt.Errorf("portForward frontend not a valid integer: %q", frontendStr) } v.frontend = frontend backend, err := strconv.Atoi(backendStr) if err != nil { return fmt.Errorf("portForward backend not a valid integer: %q", backendStr) } v.backend = backend return nil } func (v *portForwardValue) String() string { return fmt.Sprintf("%d:%d", v.frontend, v.backend) } func (v *portForwardValue) Get(_ context.Context, c *dagger.Client) (any, error) { return &dagger.PortForward{ Frontend: v.frontend, Backend: v.backend, }, nil } type cacheVolumeValue struct {
closed
dagger/dagger
https://github.com/dagger/dagger
6,725
Support passing modules as arguments in the CLI
Modules can accept other modules as arguments to functions. Use cases: 1. SDKs implemented as modules do this already by accepting `ModuleSource` as an arg 2. Support for running tests of modules could use this: https://github.com/dagger/dagger/issues/6724 3. Support for re-executing modules in specialized hosts (i.e. run my module on a "gpu-as-a-service" platform) 4. Combined with support for interfaces, you could pass a module as an implementation of an interface argument (if it matches) * @vito mentioned one use case specifically around using this to construct a dev env that is defined across multiple modules and could be dynamically composed into one (IIUC, correct if I misunderstood) However, it's not yet possible to do this from the CLI with `dagger call`, which greatly limits its utility. We could likely just re-use the syntax we use for `-m`, e.g.: * `dagger call go-test --module github.com/my-org/my-repo/my-mod`, where `--module` is an argument of type either `ModuleSource`, `Module` or an interface that the module must implement. That would in theory be extremely straightforward to implement while also unlocking all sorts of very interesting use cases
https://github.com/dagger/dagger/issues/6725
https://github.com/dagger/dagger/pull/6761
c5bf6978ba169abbc5cef54b3d7cd829f141d792
e02ff3d2b50665275deb52902abc46ac0f6f138a
"2024-02-23T18:56:08Z"
go
"2024-02-27T22:55:04Z"
cmd/dagger/flags.go
name string } func (v *cacheVolumeValue) Type() string { return CacheVolume } func (v *cacheVolumeValue) Set(s string) error { if s == "" { return fmt.Errorf("cacheVolume name cannot be empty") } v.name = s return nil } func (v *cacheVolumeValue) String() string { return v.name } func (v *cacheVolumeValue) Get(_ context.Context, dag *dagger.Client) (any, error) { if v.String() == "" { return nil, fmt.Errorf("cacheVolume name cannot be empty") } return dag.CacheVolume(v.name), nil } func (r *modFunctionArg) AddFlag(flags *pflag.FlagSet, dag *dagger.Client) (any, error) { name := r.FlagName() usage := r.Description if flags.Lookup(name) != nil { return nil, fmt.Errorf("flag already exists: %s", name) } switch r.TypeDef.Kind {
closed
dagger/dagger
https://github.com/dagger/dagger
6,725
Support passing modules as arguments in the CLI
Modules can accept other modules as arguments to functions. Use cases: 1. SDKs implemented as modules do this already by accepting `ModuleSource` as an arg 2. Support for running tests of modules could use this: https://github.com/dagger/dagger/issues/6724 3. Support for re-executing modules in specialized hosts (i.e. run my module on a "gpu-as-a-service" platform) 4. Combined with support for interfaces, you could pass a module as an implementation of an interface argument (if it matches) * @vito mentioned one use case specifically around using this to construct a dev env that is defined across multiple modules and could be dynamically composed into one (IIUC, correct if I misunderstood) However, it's not yet possible to do this from the CLI with `dagger call`, which greatly limits its utility. We could likely just re-use the syntax we use for `-m`, e.g.: * `dagger call go-test --module github.com/my-org/my-repo/my-mod`, where `--module` is an argument of type either `ModuleSource`, `Module` or an interface that the module must implement. That would in theory be extremely straightforward to implement while also unlocking all sorts of very interesting use cases
https://github.com/dagger/dagger/issues/6725
https://github.com/dagger/dagger/pull/6761
c5bf6978ba169abbc5cef54b3d7cd829f141d792
e02ff3d2b50665275deb52902abc46ac0f6f138a
"2024-02-23T18:56:08Z"
go
"2024-02-27T22:55:04Z"
cmd/dagger/flags.go
case dagger.StringKind: val, _ := getDefaultValue[string](r) return flags.String(name, val, usage), nil case dagger.IntegerKind: val, _ := getDefaultValue[int](r) return flags.Int(name, val, usage), nil case dagger.BooleanKind: val, _ := getDefaultValue[bool](r) return flags.Bool(name, val, usage), nil case dagger.ObjectKind: objName := r.TypeDef.AsObject.Name if val := GetCustomFlagValue(objName); val != nil { flags.Var(val, name, usage) return val, nil } return nil, fmt.Errorf("unsupported object type %q for flag: %s", objName, name) case dagger.InputKind: inputName := r.TypeDef.AsInput.Name if val := GetCustomFlagValue(inputName); val != nil { flags.Var(val, name, usage) return val, nil } return nil, fmt.Errorf("unsupported input type %q for flag: %s", inputName, name) case dagger.ListKind: elementType := r.TypeDef.AsList.ElementTypeDef switch elementType.Kind { case dagger.StringKind: val, _ := getDefaultValue[[]string](r)
closed
dagger/dagger
https://github.com/dagger/dagger
6,725
Support passing modules as arguments in the CLI
Modules can accept other modules as arguments to functions. Use cases: 1. SDKs implemented as modules do this already by accepting `ModuleSource` as an arg 2. Support for running tests of modules could use this: https://github.com/dagger/dagger/issues/6724 3. Support for re-executing modules in specialized hosts (i.e. run my module on a "gpu-as-a-service" platform) 4. Combined with support for interfaces, you could pass a module as an implementation of an interface argument (if it matches) * @vito mentioned one use case specifically around using this to construct a dev env that is defined across multiple modules and could be dynamically composed into one (IIUC, correct if I misunderstood) However, it's not yet possible to do this from the CLI with `dagger call`, which greatly limits its utility. We could likely just re-use the syntax we use for `-m`, e.g.: * `dagger call go-test --module github.com/my-org/my-repo/my-mod`, where `--module` is an argument of type either `ModuleSource`, `Module` or an interface that the module must implement. That would in theory be extremely straightforward to implement while also unlocking all sorts of very interesting use cases
https://github.com/dagger/dagger/issues/6725
https://github.com/dagger/dagger/pull/6761
c5bf6978ba169abbc5cef54b3d7cd829f141d792
e02ff3d2b50665275deb52902abc46ac0f6f138a
"2024-02-23T18:56:08Z"
go
"2024-02-27T22:55:04Z"
cmd/dagger/flags.go
return flags.StringSlice(name, val, usage), nil case dagger.IntegerKind: val, _ := getDefaultValue[[]int](r) return flags.IntSlice(name, val, usage), nil case dagger.BooleanKind: val, _ := getDefaultValue[[]bool](r) return flags.BoolSlice(name, val, usage), nil case dagger.ObjectKind: objName := elementType.AsObject.Name if val := GetCustomFlagValueSlice(objName); val != nil { flags.Var(val, name, usage) return val, nil } return nil, fmt.Errorf("unsupported list of objects %q for flag: %s", objName, name) case dagger.InputKind: inputName := elementType.AsInput.Name if val := GetCustomFlagValueSlice(inputName); val != nil { flags.Var(val, name, usage) return val, nil } return nil, fmt.Errorf("unsupported list of input type %q for flag: %s", inputName, name) case dagger.ListKind: return nil, fmt.Errorf("unsupported list of lists for flag: %s", name) } } return nil, fmt.Errorf("unsupported type for argument: %s", r.Name) } func readAsCSV(val string) ([]string, error) {
closed
dagger/dagger
https://github.com/dagger/dagger
6,725
Support passing modules as arguments in the CLI
Modules can accept other modules as arguments to functions. Use cases: 1. SDKs implemented as modules do this already by accepting `ModuleSource` as an arg 2. Support for running tests of modules could use this: https://github.com/dagger/dagger/issues/6724 3. Support for re-executing modules in specialized hosts (i.e. run my module on a "gpu-as-a-service" platform) 4. Combined with support for interfaces, you could pass a module as an implementation of an interface argument (if it matches) * @vito mentioned one use case specifically around using this to construct a dev env that is defined across multiple modules and could be dynamically composed into one (IIUC, correct if I misunderstood) However, it's not yet possible to do this from the CLI with `dagger call`, which greatly limits its utility. We could likely just re-use the syntax we use for `-m`, e.g.: * `dagger call go-test --module github.com/my-org/my-repo/my-mod`, where `--module` is an argument of type either `ModuleSource`, `Module` or an interface that the module must implement. That would in theory be extremely straightforward to implement while also unlocking all sorts of very interesting use cases
https://github.com/dagger/dagger/issues/6725
https://github.com/dagger/dagger/pull/6761
c5bf6978ba169abbc5cef54b3d7cd829f141d792
e02ff3d2b50665275deb52902abc46ac0f6f138a
"2024-02-23T18:56:08Z"
go
"2024-02-27T22:55:04Z"
cmd/dagger/flags.go
if val == "" { return []string{}, nil } stringReader := strings.NewReader(val) csvReader := csv.NewReader(stringReader) return csvReader.Read() } func writeAsCSV(vals []string) (string, error) { b := &bytes.Buffer{} w := csv.NewWriter(b) err := w.Write(vals) if err != nil { return "", err } w.Flush() return strings.TrimSuffix(b.String(), "\n"), nil }
closed
dagger/dagger
https://github.com/dagger/dagger
6,725
Support passing modules as arguments in the CLI
Modules can accept other modules as arguments to functions. Use cases: 1. SDKs implemented as modules do this already by accepting `ModuleSource` as an arg 2. Support for running tests of modules could use this: https://github.com/dagger/dagger/issues/6724 3. Support for re-executing modules in specialized hosts (i.e. run my module on a "gpu-as-a-service" platform) 4. Combined with support for interfaces, you could pass a module as an implementation of an interface argument (if it matches) * @vito mentioned one use case specifically around using this to construct a dev env that is defined across multiple modules and could be dynamically composed into one (IIUC, correct if I misunderstood) However, it's not yet possible to do this from the CLI with `dagger call`, which greatly limits its utility. We could likely just re-use the syntax we use for `-m`, e.g.: * `dagger call go-test --module github.com/my-org/my-repo/my-mod`, where `--module` is an argument of type either `ModuleSource`, `Module` or an interface that the module must implement. That would in theory be extremely straightforward to implement while also unlocking all sorts of very interesting use cases
https://github.com/dagger/dagger/issues/6725
https://github.com/dagger/dagger/pull/6761
c5bf6978ba169abbc5cef54b3d7cd829f141d792
e02ff3d2b50665275deb52902abc46ac0f6f138a
"2024-02-23T18:56:08Z"
go
"2024-02-27T22:55:04Z"
cmd/dagger/functions.go
package main import ( "context" "errors" "fmt" "sort" "strings" "dagger.iodagger" "dagger.iodaggerquerybuilder" "github.comdaggerdaggerdagqlidtui" "github.comdaggerdaggerengineclient" "github.comjujuansitermtabwriter" "github.commueslitermenv" "github.comspf13cobra" "github.comspf13pflag" "github.comvitoprogrock" ) const ( Directory string = "Directory" Container string = "Container" File string = "File" Secret string = "Secret" Service string = "Service" Terminal string = "Terminal" PortForward string = "PortForward" CacheVolume string = "CacheVolume" ) var funcGroup = &cobra.Group{
closed
dagger/dagger
https://github.com/dagger/dagger
6,725
Support passing modules as arguments in the CLI
Modules can accept other modules as arguments to functions. Use cases: 1. SDKs implemented as modules do this already by accepting `ModuleSource` as an arg 2. Support for running tests of modules could use this: https://github.com/dagger/dagger/issues/6724 3. Support for re-executing modules in specialized hosts (i.e. run my module on a "gpu-as-a-service" platform) 4. Combined with support for interfaces, you could pass a module as an implementation of an interface argument (if it matches) * @vito mentioned one use case specifically around using this to construct a dev env that is defined across multiple modules and could be dynamically composed into one (IIUC, correct if I misunderstood) However, it's not yet possible to do this from the CLI with `dagger call`, which greatly limits its utility. We could likely just re-use the syntax we use for `-m`, e.g.: * `dagger call go-test --module github.com/my-org/my-repo/my-mod`, where `--module` is an argument of type either `ModuleSource`, `Module` or an interface that the module must implement. That would in theory be extremely straightforward to implement while also unlocking all sorts of very interesting use cases
https://github.com/dagger/dagger/issues/6725
https://github.com/dagger/dagger/pull/6761
c5bf6978ba169abbc5cef54b3d7cd829f141d792
e02ff3d2b50665275deb52902abc46ac0f6f138a
"2024-02-23T18:56:08Z"
go
"2024-02-27T22:55:04Z"
cmd/dagger/functions.go
ID: "functions", Title: "Function Commands", } var funcCmds = FuncCommands{ funcListCmd, callCmd, } var funcListCmd = &FuncCommand{ Name: "functions [flags] [FUNCTION]...", Short: `List available functions`, Long: strings.ReplaceAll(`List available functions in a module. This is similar to ´dagger call --help´, but only focused on showing the available functions. `, "´", "`", ), Execute: func(fc *FuncCommand, cmd *cobra.Command) error { tw := tabwriter.NewWriter(cmd.OutOrStdout(), 0, 0, 3, ' ', tabwriter.DiscardEmptyColumns) var o functionProvider = fc.mod.GetMainObject() fmt.Fprintf(tw, "%s\t%s\n", termenv.String("Name").Bold(), termenv.String("Description").Bold(), ) for _, field := range cmd.Flags().Args() { nextFunc, err := o.GetFunction(field) if err != nil { return err
closed
dagger/dagger
https://github.com/dagger/dagger
6,725
Support passing modules as arguments in the CLI
Modules can accept other modules as arguments to functions. Use cases: 1. SDKs implemented as modules do this already by accepting `ModuleSource` as an arg 2. Support for running tests of modules could use this: https://github.com/dagger/dagger/issues/6724 3. Support for re-executing modules in specialized hosts (i.e. run my module on a "gpu-as-a-service" platform) 4. Combined with support for interfaces, you could pass a module as an implementation of an interface argument (if it matches) * @vito mentioned one use case specifically around using this to construct a dev env that is defined across multiple modules and could be dynamically composed into one (IIUC, correct if I misunderstood) However, it's not yet possible to do this from the CLI with `dagger call`, which greatly limits its utility. We could likely just re-use the syntax we use for `-m`, e.g.: * `dagger call go-test --module github.com/my-org/my-repo/my-mod`, where `--module` is an argument of type either `ModuleSource`, `Module` or an interface that the module must implement. That would in theory be extremely straightforward to implement while also unlocking all sorts of very interesting use cases
https://github.com/dagger/dagger/issues/6725
https://github.com/dagger/dagger/pull/6761
c5bf6978ba169abbc5cef54b3d7cd829f141d792
e02ff3d2b50665275deb52902abc46ac0f6f138a
"2024-02-23T18:56:08Z"
go
"2024-02-27T22:55:04Z"
cmd/dagger/functions.go
} nextType := nextFunc.ReturnType if nextType.AsFunctionProvider() != nil { o = fc.mod.GetFunctionProvider(nextType.Name()) continue } return fmt.Errorf("function %q returns type %q with no further functions available", field, nextType.Kind) } fns := o.GetFunctions() sort.Slice(fns, func(i, j int) bool { return fns[i].Name < fns[j].Name }) for _, fn := range fns { desc := strings.SplitN(fn.Description, "\n", 2)[0] if desc == "" { desc = "-" } fmt.Fprintf(tw, "%s\t%s\n",
closed
dagger/dagger
https://github.com/dagger/dagger
6,725
Support passing modules as arguments in the CLI
Modules can accept other modules as arguments to functions. Use cases: 1. SDKs implemented as modules do this already by accepting `ModuleSource` as an arg 2. Support for running tests of modules could use this: https://github.com/dagger/dagger/issues/6724 3. Support for re-executing modules in specialized hosts (i.e. run my module on a "gpu-as-a-service" platform) 4. Combined with support for interfaces, you could pass a module as an implementation of an interface argument (if it matches) * @vito mentioned one use case specifically around using this to construct a dev env that is defined across multiple modules and could be dynamically composed into one (IIUC, correct if I misunderstood) However, it's not yet possible to do this from the CLI with `dagger call`, which greatly limits its utility. We could likely just re-use the syntax we use for `-m`, e.g.: * `dagger call go-test --module github.com/my-org/my-repo/my-mod`, where `--module` is an argument of type either `ModuleSource`, `Module` or an interface that the module must implement. That would in theory be extremely straightforward to implement while also unlocking all sorts of very interesting use cases
https://github.com/dagger/dagger/issues/6725
https://github.com/dagger/dagger/pull/6761
c5bf6978ba169abbc5cef54b3d7cd829f141d792
e02ff3d2b50665275deb52902abc46ac0f6f138a
"2024-02-23T18:56:08Z"
go
"2024-02-27T22:55:04Z"
cmd/dagger/functions.go
cliName(fn.Name), desc, ) } return tw.Flush() }, } type FuncCommands []*FuncCommand func (fcs FuncCommands) AddFlagSet(flags *pflag.FlagSet) { for _, cmd := range fcs.All() { cmd.PersistentFlags().AddFlagSet(flags) } } func (fcs FuncCommands) AddParent(rootCmd *cobra.Command) { rootCmd.AddCommand(fcs.All()...) } func (fcs FuncCommands) All() []*cobra.Command { cmds := make([]*cobra.Command, len(fcs)) for i, fc := range fcs { cmds[i] = fc.Command() } return cmds } func setCmdOutput(cmd *cobra.Command, vtx *progrock.VertexRecorder) { cmd.SetOut(vtx.Stdout()) cmd.SetErr(vtx.Stderr()) } FuncCommand is a config object used to create a dynamic set of commands for querying a module's functions. type FuncCommand struct {
closed
dagger/dagger
https://github.com/dagger/dagger
6,725
Support passing modules as arguments in the CLI
Modules can accept other modules as arguments to functions. Use cases: 1. SDKs implemented as modules do this already by accepting `ModuleSource` as an arg 2. Support for running tests of modules could use this: https://github.com/dagger/dagger/issues/6724 3. Support for re-executing modules in specialized hosts (i.e. run my module on a "gpu-as-a-service" platform) 4. Combined with support for interfaces, you could pass a module as an implementation of an interface argument (if it matches) * @vito mentioned one use case specifically around using this to construct a dev env that is defined across multiple modules and could be dynamically composed into one (IIUC, correct if I misunderstood) However, it's not yet possible to do this from the CLI with `dagger call`, which greatly limits its utility. We could likely just re-use the syntax we use for `-m`, e.g.: * `dagger call go-test --module github.com/my-org/my-repo/my-mod`, where `--module` is an argument of type either `ModuleSource`, `Module` or an interface that the module must implement. That would in theory be extremely straightforward to implement while also unlocking all sorts of very interesting use cases
https://github.com/dagger/dagger/issues/6725
https://github.com/dagger/dagger/pull/6761
c5bf6978ba169abbc5cef54b3d7cd829f141d792
e02ff3d2b50665275deb52902abc46ac0f6f138a
"2024-02-23T18:56:08Z"
go
"2024-02-27T22:55:04Z"
cmd/dagger/functions.go
The name of the command (or verb), as shown in usage. Name string Aliases is an array of aliases that can be used instead of the first word in Use.
closed
dagger/dagger
https://github.com/dagger/dagger
6,725
Support passing modules as arguments in the CLI
Modules can accept other modules as arguments to functions. Use cases: 1. SDKs implemented as modules do this already by accepting `ModuleSource` as an arg 2. Support for running tests of modules could use this: https://github.com/dagger/dagger/issues/6724 3. Support for re-executing modules in specialized hosts (i.e. run my module on a "gpu-as-a-service" platform) 4. Combined with support for interfaces, you could pass a module as an implementation of an interface argument (if it matches) * @vito mentioned one use case specifically around using this to construct a dev env that is defined across multiple modules and could be dynamically composed into one (IIUC, correct if I misunderstood) However, it's not yet possible to do this from the CLI with `dagger call`, which greatly limits its utility. We could likely just re-use the syntax we use for `-m`, e.g.: * `dagger call go-test --module github.com/my-org/my-repo/my-mod`, where `--module` is an argument of type either `ModuleSource`, `Module` or an interface that the module must implement. That would in theory be extremely straightforward to implement while also unlocking all sorts of very interesting use cases
https://github.com/dagger/dagger/issues/6725
https://github.com/dagger/dagger/pull/6761
c5bf6978ba169abbc5cef54b3d7cd829f141d792
e02ff3d2b50665275deb52902abc46ac0f6f138a
"2024-02-23T18:56:08Z"
go
"2024-02-27T22:55:04Z"
cmd/dagger/functions.go
Aliases []string Short is the short description shown in the 'help' output. Short string Long is the long message shown in the 'help <this-command>' output. Long string Example is examples of how to use the command. Example string Init is called when the command is created and initialized, before execution. It can be useful to add persistent flags for all subcommands here. Init func(*cobra.Command) Execute circumvents the default behavior of traversing subcommands from the arguments, but still has access to the loaded objects from the module. Execute func(*FuncCommand, *cobra.Command) error BeforeParse is called before parsing the flags for a subcommand. It can be useful to add any additional flags for a subcommand here. BeforeParse func(*FuncCommand, *cobra.Command, *modFunction) error OnSelectObjectLeaf is called when a user provided command ends in a object and no more sub-commands are provided. If set, it should make another selection on the object that results return no error. Otherwise if it doesn't handle the object, it should return an error. OnSelectObjectLeaf func(*FuncCommand, string) error BeforeRequest is called before making the request with the query that contains the whole chain of functions.
closed
dagger/dagger
https://github.com/dagger/dagger
6,725
Support passing modules as arguments in the CLI
Modules can accept other modules as arguments to functions. Use cases: 1. SDKs implemented as modules do this already by accepting `ModuleSource` as an arg 2. Support for running tests of modules could use this: https://github.com/dagger/dagger/issues/6724 3. Support for re-executing modules in specialized hosts (i.e. run my module on a "gpu-as-a-service" platform) 4. Combined with support for interfaces, you could pass a module as an implementation of an interface argument (if it matches) * @vito mentioned one use case specifically around using this to construct a dev env that is defined across multiple modules and could be dynamically composed into one (IIUC, correct if I misunderstood) However, it's not yet possible to do this from the CLI with `dagger call`, which greatly limits its utility. We could likely just re-use the syntax we use for `-m`, e.g.: * `dagger call go-test --module github.com/my-org/my-repo/my-mod`, where `--module` is an argument of type either `ModuleSource`, `Module` or an interface that the module must implement. That would in theory be extremely straightforward to implement while also unlocking all sorts of very interesting use cases
https://github.com/dagger/dagger/issues/6725
https://github.com/dagger/dagger/pull/6761
c5bf6978ba169abbc5cef54b3d7cd829f141d792
e02ff3d2b50665275deb52902abc46ac0f6f138a
"2024-02-23T18:56:08Z"
go
"2024-02-27T22:55:04Z"
cmd/dagger/functions.go
It can be useful to validate the return type of the function or as a last effort to select a GraphQL sub-field. BeforeRequest func(*FuncCommand, *cobra.Command, *modTypeDef) error AfterResponse is called when the query has completed and returned a result. AfterResponse func(*FuncCommand, *cobra.Command, *modTypeDef, any) error cmd is the parent cobra command. cmd *cobra.Command mod is the loaded module definition. mod *moduleDef showHelp is set in the loader vertex to flag whether to show the help in the execution vertex. showHelp bool showUsage flags whether to show a one-line usage message after error. showUsage bool q *querybuilder.Selection c *client.Client } func (fc *FuncCommand) Command() *cobra.Command { if fc.cmd == nil { fc.cmd = &cobra.Command{ Use: fc.Name, Aliases: fc.Aliases, Short: fc.Short, Long: fc.Long, Example: fc.Example, GroupID: moduleGroup.ID, DisableFlagParsing: true,
closed
dagger/dagger
https://github.com/dagger/dagger
6,725
Support passing modules as arguments in the CLI
Modules can accept other modules as arguments to functions. Use cases: 1. SDKs implemented as modules do this already by accepting `ModuleSource` as an arg 2. Support for running tests of modules could use this: https://github.com/dagger/dagger/issues/6724 3. Support for re-executing modules in specialized hosts (i.e. run my module on a "gpu-as-a-service" platform) 4. Combined with support for interfaces, you could pass a module as an implementation of an interface argument (if it matches) * @vito mentioned one use case specifically around using this to construct a dev env that is defined across multiple modules and could be dynamically composed into one (IIUC, correct if I misunderstood) However, it's not yet possible to do this from the CLI with `dagger call`, which greatly limits its utility. We could likely just re-use the syntax we use for `-m`, e.g.: * `dagger call go-test --module github.com/my-org/my-repo/my-mod`, where `--module` is an argument of type either `ModuleSource`, `Module` or an interface that the module must implement. That would in theory be extremely straightforward to implement while also unlocking all sorts of very interesting use cases
https://github.com/dagger/dagger/issues/6725
https://github.com/dagger/dagger/pull/6761
c5bf6978ba169abbc5cef54b3d7cd829f141d792
e02ff3d2b50665275deb52902abc46ac0f6f138a
"2024-02-23T18:56:08Z"
go
"2024-02-27T22:55:04Z"
cmd/dagger/functions.go
DisableFlagsInUseLine: true, PreRunE: func(c *cobra.Command, a []string) error { c.DisableFlagParsing = false c.Flags().SetInterspersed(false) c.SetGlobalNormalizationFunc(func(f *pflag.FlagSet, name string) pflag.NormalizedName { return pflag.NormalizedName(cliName(name)) }) c.FParseErrWhitelist.UnknownFlags = true if err := c.ParseFlags(a); err != nil { return c.FlagErrorFunc()(c, err) } c.FParseErrWhitelist.UnknownFlags = false fc.showHelp, _ = c.Flags().GetBool("help") return nil },
closed
dagger/dagger
https://github.com/dagger/dagger
6,725
Support passing modules as arguments in the CLI
Modules can accept other modules as arguments to functions. Use cases: 1. SDKs implemented as modules do this already by accepting `ModuleSource` as an arg 2. Support for running tests of modules could use this: https://github.com/dagger/dagger/issues/6724 3. Support for re-executing modules in specialized hosts (i.e. run my module on a "gpu-as-a-service" platform) 4. Combined with support for interfaces, you could pass a module as an implementation of an interface argument (if it matches) * @vito mentioned one use case specifically around using this to construct a dev env that is defined across multiple modules and could be dynamically composed into one (IIUC, correct if I misunderstood) However, it's not yet possible to do this from the CLI with `dagger call`, which greatly limits its utility. We could likely just re-use the syntax we use for `-m`, e.g.: * `dagger call go-test --module github.com/my-org/my-repo/my-mod`, where `--module` is an argument of type either `ModuleSource`, `Module` or an interface that the module must implement. That would in theory be extremely straightforward to implement while also unlocking all sorts of very interesting use cases
https://github.com/dagger/dagger/issues/6725
https://github.com/dagger/dagger/pull/6761
c5bf6978ba169abbc5cef54b3d7cd829f141d792
e02ff3d2b50665275deb52902abc46ac0f6f138a
"2024-02-23T18:56:08Z"
go
"2024-02-27T22:55:04Z"
cmd/dagger/functions.go
RunE: func(c *cobra.Command, a []string) error { return withEngineAndTUI(c.Context(), client.Params{}, func(ctx context.Context, engineClient *client.Client) (rerr error) { fc.c = engineClient c.SetContext(ctx) c.SilenceErrors = true return fc.execute(c, a) }) }, } if fc.Init != nil { fc.Init(fc.cmd) } } return fc.cmd } func (fc *FuncCommand) execute(c *cobra.Command, a []string) (rerr error) { ctx := c.Context() var primaryVtx *progrock.VertexRecorder var cmd *cobra.Command The following is a little complicated because it needs to handle the case where we fail to load the modules or parse the CLI. In the happy path we want to initialize the PrimaryVertex with the parsed command string, but we can't have that until we load the command.
closed
dagger/dagger
https://github.com/dagger/dagger
6,725
Support passing modules as arguments in the CLI
Modules can accept other modules as arguments to functions. Use cases: 1. SDKs implemented as modules do this already by accepting `ModuleSource` as an arg 2. Support for running tests of modules could use this: https://github.com/dagger/dagger/issues/6724 3. Support for re-executing modules in specialized hosts (i.e. run my module on a "gpu-as-a-service" platform) 4. Combined with support for interfaces, you could pass a module as an implementation of an interface argument (if it matches) * @vito mentioned one use case specifically around using this to construct a dev env that is defined across multiple modules and could be dynamically composed into one (IIUC, correct if I misunderstood) However, it's not yet possible to do this from the CLI with `dagger call`, which greatly limits its utility. We could likely just re-use the syntax we use for `-m`, e.g.: * `dagger call go-test --module github.com/my-org/my-repo/my-mod`, where `--module` is an argument of type either `ModuleSource`, `Module` or an interface that the module must implement. That would in theory be extremely straightforward to implement while also unlocking all sorts of very interesting use cases
https://github.com/dagger/dagger/issues/6725
https://github.com/dagger/dagger/pull/6761
c5bf6978ba169abbc5cef54b3d7cd829f141d792
e02ff3d2b50665275deb52902abc46ac0f6f138a
"2024-02-23T18:56:08Z"
go
"2024-02-27T22:55:04Z"
cmd/dagger/functions.go
So we just detect if we failed before getting to that point and fall back to the outer command. defer func() { if cmd == nil { cmd = c } if primaryVtx == nil { ctx, primaryVtx = progrock.Span(ctx, idtui.PrimaryVertex, cmd.CommandPath()) defer func() { primaryVtx.Done(rerr) }() cmd.SetContext(ctx) setCmdOutput(cmd, primaryVtx) } if ctx.Err() != nil { cmd.PrintErrln("Canceled.") } else if rerr != nil { cmd.PrintErrln("Error:", rerr.Error()) if fc.showHelp { cmd.Help() } if fc.showUsage { cmd.PrintErrf("Run '%v --help' for usage.\n", cmd.CommandPath()) } } }() Load the command, which may fail if modules are broken. cmd, flags, err := fc.load(c, a)
closed
dagger/dagger
https://github.com/dagger/dagger
6,725
Support passing modules as arguments in the CLI
Modules can accept other modules as arguments to functions. Use cases: 1. SDKs implemented as modules do this already by accepting `ModuleSource` as an arg 2. Support for running tests of modules could use this: https://github.com/dagger/dagger/issues/6724 3. Support for re-executing modules in specialized hosts (i.e. run my module on a "gpu-as-a-service" platform) 4. Combined with support for interfaces, you could pass a module as an implementation of an interface argument (if it matches) * @vito mentioned one use case specifically around using this to construct a dev env that is defined across multiple modules and could be dynamically composed into one (IIUC, correct if I misunderstood) However, it's not yet possible to do this from the CLI with `dagger call`, which greatly limits its utility. We could likely just re-use the syntax we use for `-m`, e.g.: * `dagger call go-test --module github.com/my-org/my-repo/my-mod`, where `--module` is an argument of type either `ModuleSource`, `Module` or an interface that the module must implement. That would in theory be extremely straightforward to implement while also unlocking all sorts of very interesting use cases
https://github.com/dagger/dagger/issues/6725
https://github.com/dagger/dagger/pull/6761
c5bf6978ba169abbc5cef54b3d7cd829f141d792
e02ff3d2b50665275deb52902abc46ac0f6f138a
"2024-02-23T18:56:08Z"
go
"2024-02-27T22:55:04Z"
cmd/dagger/functions.go
if err != nil { return err } Ok, we've loaded the command, now we can initialize the PrimaryVertex. ctx, primaryVtx = progrock.Span(ctx, idtui.PrimaryVertex, cmd.CommandPath()) defer func() { primaryVtx.Done(rerr) }() cmd.SetContext(ctx) setCmdOutput(cmd, primaryVtx) if fc.showHelp { if cmd != c { cmd.Aliases = nil } return cmd.Help() } There should be no args left, if there are it's an unknown command. if err := cobra.NoArgs(cmd, flags); err != nil { return err } if fc.Execute != nil { return fc.Execute(fc, cmd) } No args to the parent command, default to showing help. if cmd == c { return cmd.Help() } err = cmd.RunE(cmd, flags) if err != nil { return err
closed
dagger/dagger
https://github.com/dagger/dagger
6,725
Support passing modules as arguments in the CLI
Modules can accept other modules as arguments to functions. Use cases: 1. SDKs implemented as modules do this already by accepting `ModuleSource` as an arg 2. Support for running tests of modules could use this: https://github.com/dagger/dagger/issues/6724 3. Support for re-executing modules in specialized hosts (i.e. run my module on a "gpu-as-a-service" platform) 4. Combined with support for interfaces, you could pass a module as an implementation of an interface argument (if it matches) * @vito mentioned one use case specifically around using this to construct a dev env that is defined across multiple modules and could be dynamically composed into one (IIUC, correct if I misunderstood) However, it's not yet possible to do this from the CLI with `dagger call`, which greatly limits its utility. We could likely just re-use the syntax we use for `-m`, e.g.: * `dagger call go-test --module github.com/my-org/my-repo/my-mod`, where `--module` is an argument of type either `ModuleSource`, `Module` or an interface that the module must implement. That would in theory be extremely straightforward to implement while also unlocking all sorts of very interesting use cases
https://github.com/dagger/dagger/issues/6725
https://github.com/dagger/dagger/pull/6761
c5bf6978ba169abbc5cef54b3d7cd829f141d792
e02ff3d2b50665275deb52902abc46ac0f6f138a
"2024-02-23T18:56:08Z"
go
"2024-02-27T22:55:04Z"
cmd/dagger/functions.go
} return nil } func (fc *FuncCommand) load(c *cobra.Command, a []string) (cmd *cobra.Command, _ []string, rerr error) { ctx := c.Context() dag := fc.c.Dagger() ctx, vtx := progrock.Span(ctx, idtui.InitVertex, "initialize") defer func() { vtx.Done(rerr) }() modConf, err := getDefaultModuleConfiguration(ctx, dag, true) if err != nil { return nil, nil, fmt.Errorf("failed to get configured module: %w", err) } if !modConf.FullyInitialized() { return nil, nil, fmt.Errorf("module at source dir %q doesn't exist or is invalid", modConf.LocalRootSourcePath) } mod := modConf.Source.AsModule().Initialize() _, err = mod.Serve(ctx) if err != nil { return nil, nil, err } modDef, err := loadModTypeDefs(ctx, dag, mod) if err != nil { return nil, nil, err } obj := modDef.GetMainObject() if obj == nil { return nil, nil, fmt.Errorf("main object not found") } fc.mod = modDef if fc.Execute != nil {
closed
dagger/dagger
https://github.com/dagger/dagger
6,725
Support passing modules as arguments in the CLI
Modules can accept other modules as arguments to functions. Use cases: 1. SDKs implemented as modules do this already by accepting `ModuleSource` as an arg 2. Support for running tests of modules could use this: https://github.com/dagger/dagger/issues/6724 3. Support for re-executing modules in specialized hosts (i.e. run my module on a "gpu-as-a-service" platform) 4. Combined with support for interfaces, you could pass a module as an implementation of an interface argument (if it matches) * @vito mentioned one use case specifically around using this to construct a dev env that is defined across multiple modules and could be dynamically composed into one (IIUC, correct if I misunderstood) However, it's not yet possible to do this from the CLI with `dagger call`, which greatly limits its utility. We could likely just re-use the syntax we use for `-m`, e.g.: * `dagger call go-test --module github.com/my-org/my-repo/my-mod`, where `--module` is an argument of type either `ModuleSource`, `Module` or an interface that the module must implement. That would in theory be extremely straightforward to implement while also unlocking all sorts of very interesting use cases
https://github.com/dagger/dagger/issues/6725
https://github.com/dagger/dagger/pull/6761
c5bf6978ba169abbc5cef54b3d7cd829f141d792
e02ff3d2b50665275deb52902abc46ac0f6f138a
"2024-02-23T18:56:08Z"
go
"2024-02-27T22:55:04Z"
cmd/dagger/functions.go
return c, nil, nil } if obj.Constructor != nil { if err := fc.addArgsForFunction(c, a, obj.Constructor, dag); err != nil { return nil, nil, err } fc.selectFunc(obj.Name, obj.Constructor, c, dag) } else { fc.Select(obj.Name) } Add main object's functions as subcommands fc.addSubCommands(c, dag, obj) if fc.showHelp { return c, nil, nil } cmd, flags, err := fc.traverse(c) if err != nil { if errors.Is(err, pflag.ErrHelp) { fc.showHelp = true return cmd, flags, nil } fc.showUsage = true return cmd, flags, err } return cmd, flags, nil } traverse the arguments to build the command tree and return the leaf command. func (fc *FuncCommand) traverse(c *cobra.Command) (*cobra.Command, []string, error) {
closed
dagger/dagger
https://github.com/dagger/dagger
6,725
Support passing modules as arguments in the CLI
Modules can accept other modules as arguments to functions. Use cases: 1. SDKs implemented as modules do this already by accepting `ModuleSource` as an arg 2. Support for running tests of modules could use this: https://github.com/dagger/dagger/issues/6724 3. Support for re-executing modules in specialized hosts (i.e. run my module on a "gpu-as-a-service" platform) 4. Combined with support for interfaces, you could pass a module as an implementation of an interface argument (if it matches) * @vito mentioned one use case specifically around using this to construct a dev env that is defined across multiple modules and could be dynamically composed into one (IIUC, correct if I misunderstood) However, it's not yet possible to do this from the CLI with `dagger call`, which greatly limits its utility. We could likely just re-use the syntax we use for `-m`, e.g.: * `dagger call go-test --module github.com/my-org/my-repo/my-mod`, where `--module` is an argument of type either `ModuleSource`, `Module` or an interface that the module must implement. That would in theory be extremely straightforward to implement while also unlocking all sorts of very interesting use cases
https://github.com/dagger/dagger/issues/6725
https://github.com/dagger/dagger/pull/6761
c5bf6978ba169abbc5cef54b3d7cd829f141d792
e02ff3d2b50665275deb52902abc46ac0f6f138a
"2024-02-23T18:56:08Z"
go
"2024-02-27T22:55:04Z"
cmd/dagger/functions.go
cmd, args, err := c.Find(c.Flags().Args()) if err != nil { return cmd, args, err } Leaf command if cmd == c { return cmd, args, nil } cmd.SetContext(c.Context()) cmd.InitDefaultHelpFlag() Load and ParseFlags err = cmd.PreRunE(cmd, args) if err != nil { return cmd, args, err } return fc.traverse(cmd) } func (fc *FuncCommand) addSubCommands(cmd *cobra.Command, dag *dagger.Client, fnProvider functionProvider) { if fnProvider != nil { cmd.AddGroup(funcGroup) for _, fn := range fnProvider.GetFunctions() { subCmd := fc.makeSubCmd(dag, fn) cmd.AddCommand(subCmd) } } } func (fc *FuncCommand) makeSubCmd(dag *dagger.Client, fn *modFunction) *cobra.Command { newCmd := &cobra.Command{ Use: cliName(fn.Name), Short: strings.SplitN(fn.Description, "\n", 2)[0],
closed
dagger/dagger
https://github.com/dagger/dagger
6,725
Support passing modules as arguments in the CLI
Modules can accept other modules as arguments to functions. Use cases: 1. SDKs implemented as modules do this already by accepting `ModuleSource` as an arg 2. Support for running tests of modules could use this: https://github.com/dagger/dagger/issues/6724 3. Support for re-executing modules in specialized hosts (i.e. run my module on a "gpu-as-a-service" platform) 4. Combined with support for interfaces, you could pass a module as an implementation of an interface argument (if it matches) * @vito mentioned one use case specifically around using this to construct a dev env that is defined across multiple modules and could be dynamically composed into one (IIUC, correct if I misunderstood) However, it's not yet possible to do this from the CLI with `dagger call`, which greatly limits its utility. We could likely just re-use the syntax we use for `-m`, e.g.: * `dagger call go-test --module github.com/my-org/my-repo/my-mod`, where `--module` is an argument of type either `ModuleSource`, `Module` or an interface that the module must implement. That would in theory be extremely straightforward to implement while also unlocking all sorts of very interesting use cases
https://github.com/dagger/dagger/issues/6725
https://github.com/dagger/dagger/pull/6761
c5bf6978ba169abbc5cef54b3d7cd829f141d792
e02ff3d2b50665275deb52902abc46ac0f6f138a
"2024-02-23T18:56:08Z"
go
"2024-02-27T22:55:04Z"
cmd/dagger/functions.go
Long: fn.Description, GroupID: funcGroup.ID, PreRunE: func(cmd *cobra.Command, args []string) (err error) { if err := fc.addArgsForFunction(cmd, args, fn, dag); err != nil { return err } fnProvider := fn.ReturnType.AsFunctionProvider() if fnProvider == nil && fn.ReturnType.AsList != nil { fnProvider = fn.ReturnType.AsList.ElementTypeDef.AsFunctionProvider() } fc.addSubCommands(cmd, dag, fnProvider) help, _ := cmd.Flags().GetBool("help") if help { return pflag.ErrHelp } return fc.selectFunc(fn.Name, fn, cmd, dag) }, RunE: func(cmd *cobra.Command, args []string) (err error) { switch fn.ReturnType.Kind { case dagger.ObjectKind, dagger.InterfaceKind: if fc.OnSelectObjectLeaf == nil { fc.showUsage = true return fmt.Errorf("%q requires a sub-command", cmd.Name()) }
closed
dagger/dagger
https://github.com/dagger/dagger
6,725
Support passing modules as arguments in the CLI
Modules can accept other modules as arguments to functions. Use cases: 1. SDKs implemented as modules do this already by accepting `ModuleSource` as an arg 2. Support for running tests of modules could use this: https://github.com/dagger/dagger/issues/6724 3. Support for re-executing modules in specialized hosts (i.e. run my module on a "gpu-as-a-service" platform) 4. Combined with support for interfaces, you could pass a module as an implementation of an interface argument (if it matches) * @vito mentioned one use case specifically around using this to construct a dev env that is defined across multiple modules and could be dynamically composed into one (IIUC, correct if I misunderstood) However, it's not yet possible to do this from the CLI with `dagger call`, which greatly limits its utility. We could likely just re-use the syntax we use for `-m`, e.g.: * `dagger call go-test --module github.com/my-org/my-repo/my-mod`, where `--module` is an argument of type either `ModuleSource`, `Module` or an interface that the module must implement. That would in theory be extremely straightforward to implement while also unlocking all sorts of very interesting use cases
https://github.com/dagger/dagger/issues/6725
https://github.com/dagger/dagger/pull/6761
c5bf6978ba169abbc5cef54b3d7cd829f141d792
e02ff3d2b50665275deb52902abc46ac0f6f138a
"2024-02-23T18:56:08Z"
go
"2024-02-27T22:55:04Z"
cmd/dagger/functions.go
err := fc.OnSelectObjectLeaf(fc, fn.ReturnType.Name()) if err != nil { fc.showUsage = true return fmt.Errorf("invalid selection for command %q: %w", cmd.Name(), err) } case dagger.ListKind: fnProvider := fn.ReturnType.AsList.ElementTypeDef.AsFunctionProvider() if fnProvider != nil && len(fnProvider.GetFunctions()) > 0 { fc.showUsage = true return fmt.Errorf("%q requires a sub-command", cmd.Name()) } } if fc.BeforeRequest != nil { if err = fc.BeforeRequest(fc, cmd, fn.ReturnType); err != nil { return err } } ctx := cmd.Context() query, _ := fc.q.Build(ctx) rec := progrock.FromContext(ctx) rec.Debug("executing", progrock.Labelf("query", "%+v", query)) var response any q := fc.q.Bind(&response) if err := q.Execute(ctx, dag.Client); err != nil { return fmt.Errorf("response from query: %w", err) } if fc.AfterResponse != nil { return fc.AfterResponse(fc, cmd, fn.ReturnType, response) }
closed
dagger/dagger
https://github.com/dagger/dagger
6,725
Support passing modules as arguments in the CLI
Modules can accept other modules as arguments to functions. Use cases: 1. SDKs implemented as modules do this already by accepting `ModuleSource` as an arg 2. Support for running tests of modules could use this: https://github.com/dagger/dagger/issues/6724 3. Support for re-executing modules in specialized hosts (i.e. run my module on a "gpu-as-a-service" platform) 4. Combined with support for interfaces, you could pass a module as an implementation of an interface argument (if it matches) * @vito mentioned one use case specifically around using this to construct a dev env that is defined across multiple modules and could be dynamically composed into one (IIUC, correct if I misunderstood) However, it's not yet possible to do this from the CLI with `dagger call`, which greatly limits its utility. We could likely just re-use the syntax we use for `-m`, e.g.: * `dagger call go-test --module github.com/my-org/my-repo/my-mod`, where `--module` is an argument of type either `ModuleSource`, `Module` or an interface that the module must implement. That would in theory be extremely straightforward to implement while also unlocking all sorts of very interesting use cases
https://github.com/dagger/dagger/issues/6725
https://github.com/dagger/dagger/pull/6761
c5bf6978ba169abbc5cef54b3d7cd829f141d792
e02ff3d2b50665275deb52902abc46ac0f6f138a
"2024-02-23T18:56:08Z"
go
"2024-02-27T22:55:04Z"
cmd/dagger/functions.go
if fn.ReturnType.Kind != dagger.VoidKind { cmd.Println(response) } return nil }, } Allow using the function name from the SDK as an alias for the command. if fn.Name != newCmd.Name() { newCmd.Aliases = append(newCmd.Aliases, fn.Name) } newCmd.Flags().SetInterspersed(false) return newCmd } func (fc *FuncCommand) addArgsForFunction(cmd *cobra.Command, cmdArgs []string, fn *modFunction, dag *dagger.Client) error { fc.mod.LoadTypeDef(fn.ReturnType) for _, arg := range fn.Args { fc.mod.LoadTypeDef(arg.TypeDef) } for _, arg := range fn.Args { _, err := arg.AddFlag(cmd.Flags(), dag) if err != nil { return err } if !arg.TypeDef.Optional && arg.DefaultValue == "" { cmd.MarkFlagRequired(arg.FlagName()) } } if fc.BeforeParse != nil { if err := fc.BeforeParse(fc, cmd, fn); err != nil { return err
closed
dagger/dagger
https://github.com/dagger/dagger
6,725
Support passing modules as arguments in the CLI
Modules can accept other modules as arguments to functions. Use cases: 1. SDKs implemented as modules do this already by accepting `ModuleSource` as an arg 2. Support for running tests of modules could use this: https://github.com/dagger/dagger/issues/6724 3. Support for re-executing modules in specialized hosts (i.e. run my module on a "gpu-as-a-service" platform) 4. Combined with support for interfaces, you could pass a module as an implementation of an interface argument (if it matches) * @vito mentioned one use case specifically around using this to construct a dev env that is defined across multiple modules and could be dynamically composed into one (IIUC, correct if I misunderstood) However, it's not yet possible to do this from the CLI with `dagger call`, which greatly limits its utility. We could likely just re-use the syntax we use for `-m`, e.g.: * `dagger call go-test --module github.com/my-org/my-repo/my-mod`, where `--module` is an argument of type either `ModuleSource`, `Module` or an interface that the module must implement. That would in theory be extremely straightforward to implement while also unlocking all sorts of very interesting use cases
https://github.com/dagger/dagger/issues/6725
https://github.com/dagger/dagger/pull/6761
c5bf6978ba169abbc5cef54b3d7cd829f141d792
e02ff3d2b50665275deb52902abc46ac0f6f138a
"2024-02-23T18:56:08Z"
go
"2024-02-27T22:55:04Z"
cmd/dagger/functions.go
} } if err := cmd.ParseFlags(cmdArgs); err != nil { return cmd.FlagErrorFunc()(cmd, err) } help, _ := cmd.Flags().GetBool("help") if !help { if err := cmd.ValidateRequiredFlags(); err != nil { return err } if err := cmd.ValidateFlagGroups(); err != nil { return err } } return nil } selectFunc adds the function selection to the query. Note that the type can change if there's an extra selection for supported types. func (fc *FuncCommand) selectFunc(selectName string, fn *modFunction, cmd *cobra.Command, dag *dagger.Client) error { fc.Select(selectName) for _, arg := range fn.Args { var val any flag := cmd.Flags().Lookup(arg.FlagName()) if flag == nil { return fmt.Errorf("no flag for %q", arg.FlagName()) } if arg.TypeDef.Optional && !flag.Changed {
closed
dagger/dagger
https://github.com/dagger/dagger
6,725
Support passing modules as arguments in the CLI
Modules can accept other modules as arguments to functions. Use cases: 1. SDKs implemented as modules do this already by accepting `ModuleSource` as an arg 2. Support for running tests of modules could use this: https://github.com/dagger/dagger/issues/6724 3. Support for re-executing modules in specialized hosts (i.e. run my module on a "gpu-as-a-service" platform) 4. Combined with support for interfaces, you could pass a module as an implementation of an interface argument (if it matches) * @vito mentioned one use case specifically around using this to construct a dev env that is defined across multiple modules and could be dynamically composed into one (IIUC, correct if I misunderstood) However, it's not yet possible to do this from the CLI with `dagger call`, which greatly limits its utility. We could likely just re-use the syntax we use for `-m`, e.g.: * `dagger call go-test --module github.com/my-org/my-repo/my-mod`, where `--module` is an argument of type either `ModuleSource`, `Module` or an interface that the module must implement. That would in theory be extremely straightforward to implement while also unlocking all sorts of very interesting use cases
https://github.com/dagger/dagger/issues/6725
https://github.com/dagger/dagger/pull/6761
c5bf6978ba169abbc5cef54b3d7cd829f141d792
e02ff3d2b50665275deb52902abc46ac0f6f138a
"2024-02-23T18:56:08Z"
go
"2024-02-27T22:55:04Z"
cmd/dagger/functions.go
continue } val = flag.Value switch v := val.(type) { case DaggerValue: obj, err := v.Get(cmd.Context(), dag) if err != nil { return fmt.Errorf("failed to get value for argument %q: %w", arg.Name, err) } if obj == nil { return fmt.Errorf("no value for argument: %s", arg.Name) } val = obj case pflag.SliceValue: val = v.GetSlice() } fc.Arg(arg.Name, val) } return nil } func (fc *FuncCommand) Select(name string) { if fc.q == nil { fc.q = querybuilder.Query() } fc.q = fc.q.Select(gqlFieldName(name)) } func (fc *FuncCommand) Arg(name string, value any) { fc.q = fc.q.Arg(gqlArgName(name), value) }
closed
dagger/dagger
https://github.com/dagger/dagger
6,725
Support passing modules as arguments in the CLI
Modules can accept other modules as arguments to functions. Use cases: 1. SDKs implemented as modules do this already by accepting `ModuleSource` as an arg 2. Support for running tests of modules could use this: https://github.com/dagger/dagger/issues/6724 3. Support for re-executing modules in specialized hosts (i.e. run my module on a "gpu-as-a-service" platform) 4. Combined with support for interfaces, you could pass a module as an implementation of an interface argument (if it matches) * @vito mentioned one use case specifically around using this to construct a dev env that is defined across multiple modules and could be dynamically composed into one (IIUC, correct if I misunderstood) However, it's not yet possible to do this from the CLI with `dagger call`, which greatly limits its utility. We could likely just re-use the syntax we use for `-m`, e.g.: * `dagger call go-test --module github.com/my-org/my-repo/my-mod`, where `--module` is an argument of type either `ModuleSource`, `Module` or an interface that the module must implement. That would in theory be extremely straightforward to implement while also unlocking all sorts of very interesting use cases
https://github.com/dagger/dagger/issues/6725
https://github.com/dagger/dagger/pull/6761
c5bf6978ba169abbc5cef54b3d7cd829f141d792
e02ff3d2b50665275deb52902abc46ac0f6f138a
"2024-02-23T18:56:08Z"
go
"2024-02-27T22:55:04Z"
core/integration/module_call_test.go
package core import ( "fmt" "strings" "testing" "dagger.io/dagger" "github.com/moby/buildkit/identity" "github.com/stretchr/testify/require" ) func TestModuleDaggerCallArgTypes(t *testing.T) {
closed
dagger/dagger
https://github.com/dagger/dagger
6,725
Support passing modules as arguments in the CLI
Modules can accept other modules as arguments to functions. Use cases: 1. SDKs implemented as modules do this already by accepting `ModuleSource` as an arg 2. Support for running tests of modules could use this: https://github.com/dagger/dagger/issues/6724 3. Support for re-executing modules in specialized hosts (i.e. run my module on a "gpu-as-a-service" platform) 4. Combined with support for interfaces, you could pass a module as an implementation of an interface argument (if it matches) * @vito mentioned one use case specifically around using this to construct a dev env that is defined across multiple modules and could be dynamically composed into one (IIUC, correct if I misunderstood) However, it's not yet possible to do this from the CLI with `dagger call`, which greatly limits its utility. We could likely just re-use the syntax we use for `-m`, e.g.: * `dagger call go-test --module github.com/my-org/my-repo/my-mod`, where `--module` is an argument of type either `ModuleSource`, `Module` or an interface that the module must implement. That would in theory be extremely straightforward to implement while also unlocking all sorts of very interesting use cases
https://github.com/dagger/dagger/issues/6725
https://github.com/dagger/dagger/pull/6761
c5bf6978ba169abbc5cef54b3d7cd829f141d792
e02ff3d2b50665275deb52902abc46ac0f6f138a
"2024-02-23T18:56:08Z"
go
"2024-02-27T22:55:04Z"
core/integration/module_call_test.go
t.Parallel() t.Run("service args", func(t *testing.T) { t.Parallel() t.Run("used as service binding", 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", "--source=.", "--name=test", "--sdk=go")). WithNewFile("main.go", dagger.ContainerWithNewFileOpts{ Contents: `package main import ( "context" ) type Test struct {} func (m *Test) Fn(ctx context.Context, svc *Service) (string, error) { return dag.Container().From("alpine:3.18").WithExec([]string{"apk", "add", "curl"}). WithServiceBinding("daserver", svc). WithExec([]string{"curl", "http://daserver:8000"}). Stdout(ctx) } `, }) logGen(ctx, t, modGen.Directory(".")) httpServer, _ := httpService(ctx, t, c, "im up") endpoint, err := httpServer.Endpoint(ctx) require.NoError(t, err) out, err := modGen. WithServiceBinding("testserver", httpServer).
closed
dagger/dagger
https://github.com/dagger/dagger
6,725
Support passing modules as arguments in the CLI
Modules can accept other modules as arguments to functions. Use cases: 1. SDKs implemented as modules do this already by accepting `ModuleSource` as an arg 2. Support for running tests of modules could use this: https://github.com/dagger/dagger/issues/6724 3. Support for re-executing modules in specialized hosts (i.e. run my module on a "gpu-as-a-service" platform) 4. Combined with support for interfaces, you could pass a module as an implementation of an interface argument (if it matches) * @vito mentioned one use case specifically around using this to construct a dev env that is defined across multiple modules and could be dynamically composed into one (IIUC, correct if I misunderstood) However, it's not yet possible to do this from the CLI with `dagger call`, which greatly limits its utility. We could likely just re-use the syntax we use for `-m`, e.g.: * `dagger call go-test --module github.com/my-org/my-repo/my-mod`, where `--module` is an argument of type either `ModuleSource`, `Module` or an interface that the module must implement. That would in theory be extremely straightforward to implement while also unlocking all sorts of very interesting use cases
https://github.com/dagger/dagger/issues/6725
https://github.com/dagger/dagger/pull/6761
c5bf6978ba169abbc5cef54b3d7cd829f141d792
e02ff3d2b50665275deb52902abc46ac0f6f138a
"2024-02-23T18:56:08Z"
go
"2024-02-27T22:55:04Z"
core/integration/module_call_test.go
With(daggerCall("fn", "--svc", "tcp://"+endpoint)).Stdout(ctx) require.NoError(t, err) require.Equal(t, "im up", out) }) t.Run("used directly", 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", "--source=.", "--name=test", "--sdk=go")). WithNewFile("main.go", dagger.ContainerWithNewFileOpts{ Contents: `package main import ( "context" "fmt" "strings" ) type Test struct {} func (m *Test) Fn(ctx context.Context, svc *Service) (string, error) { ports, err := svc.Ports(ctx) if err != nil { return "", err } var out []string out = append(out, fmt.Sprintf("%d exposed ports:", len(ports))) for _, port := range ports { number, err := port.Port(ctx) if err != nil { return "", err
closed
dagger/dagger
https://github.com/dagger/dagger
6,725
Support passing modules as arguments in the CLI
Modules can accept other modules as arguments to functions. Use cases: 1. SDKs implemented as modules do this already by accepting `ModuleSource` as an arg 2. Support for running tests of modules could use this: https://github.com/dagger/dagger/issues/6724 3. Support for re-executing modules in specialized hosts (i.e. run my module on a "gpu-as-a-service" platform) 4. Combined with support for interfaces, you could pass a module as an implementation of an interface argument (if it matches) * @vito mentioned one use case specifically around using this to construct a dev env that is defined across multiple modules and could be dynamically composed into one (IIUC, correct if I misunderstood) However, it's not yet possible to do this from the CLI with `dagger call`, which greatly limits its utility. We could likely just re-use the syntax we use for `-m`, e.g.: * `dagger call go-test --module github.com/my-org/my-repo/my-mod`, where `--module` is an argument of type either `ModuleSource`, `Module` or an interface that the module must implement. That would in theory be extremely straightforward to implement while also unlocking all sorts of very interesting use cases
https://github.com/dagger/dagger/issues/6725
https://github.com/dagger/dagger/pull/6761
c5bf6978ba169abbc5cef54b3d7cd829f141d792
e02ff3d2b50665275deb52902abc46ac0f6f138a
"2024-02-23T18:56:08Z"
go
"2024-02-27T22:55:04Z"
core/integration/module_call_test.go
} out = append(out, fmt.Sprintf("- TCP/%d", number)) } return strings.Join(out, "\n"), nil } `, }) logGen(ctx, t, modGen.Directory(".")) httpServer, _ := httpService(ctx, t, c, "im up") endpoint, err := httpServer.Endpoint(ctx) require.NoError(t, err) out, err := modGen. WithServiceBinding("testserver", httpServer). With(daggerCall("fn", "--svc", "tcp://"+endpoint)).Stdout(ctx) require.NoError(t, err) require.Equal(t, "1 exposed ports:\n- TCP/8000", out) }) }) t.Run("list args", 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", "--source=.", "--name=minimal", "--sdk=go")). WithNewFile("foo.txt", dagger.ContainerWithNewFileOpts{ Contents: "bar", }). WithNewFile("main.go", dagger.ContainerWithNewFileOpts{ Contents: `package main
closed
dagger/dagger
https://github.com/dagger/dagger
6,725
Support passing modules as arguments in the CLI
Modules can accept other modules as arguments to functions. Use cases: 1. SDKs implemented as modules do this already by accepting `ModuleSource` as an arg 2. Support for running tests of modules could use this: https://github.com/dagger/dagger/issues/6724 3. Support for re-executing modules in specialized hosts (i.e. run my module on a "gpu-as-a-service" platform) 4. Combined with support for interfaces, you could pass a module as an implementation of an interface argument (if it matches) * @vito mentioned one use case specifically around using this to construct a dev env that is defined across multiple modules and could be dynamically composed into one (IIUC, correct if I misunderstood) However, it's not yet possible to do this from the CLI with `dagger call`, which greatly limits its utility. We could likely just re-use the syntax we use for `-m`, e.g.: * `dagger call go-test --module github.com/my-org/my-repo/my-mod`, where `--module` is an argument of type either `ModuleSource`, `Module` or an interface that the module must implement. That would in theory be extremely straightforward to implement while also unlocking all sorts of very interesting use cases
https://github.com/dagger/dagger/issues/6725
https://github.com/dagger/dagger/pull/6761
c5bf6978ba169abbc5cef54b3d7cd829f141d792
e02ff3d2b50665275deb52902abc46ac0f6f138a
"2024-02-23T18:56:08Z"
go
"2024-02-27T22:55:04Z"
core/integration/module_call_test.go
import ( "context" "strings" ) type Minimal struct {} func (m *Minimal) Hello(msgs []string) string { return strings.Join(msgs, "+") } func (m *Minimal) Reads(ctx context.Context, files []File) (string, error) { var contents []string for _, f := range files { content, err := f.Contents(ctx) if err != nil { return "", err } contents = append(contents, content) } return strings.Join(contents, "+"), nil } `, }) logGen(ctx, t, modGen.Directory(".")) out, err := modGen.With(daggerCall("hello", "--msgs", "yo", "--msgs", "my", "--msgs", "friend")).Stdout(ctx) require.NoError(t, err) require.Equal(t, "yo+my+friend", out) out, err = modGen.With(daggerCall("reads", "--files=foo.txt", "--files=foo.txt")).Stdout(ctx) require.NoError(t, err) require.Equal(t, "bar+bar", out) }) t.Run("directory arg inputs", func(t *testing.T) {
closed
dagger/dagger
https://github.com/dagger/dagger
6,725
Support passing modules as arguments in the CLI
Modules can accept other modules as arguments to functions. Use cases: 1. SDKs implemented as modules do this already by accepting `ModuleSource` as an arg 2. Support for running tests of modules could use this: https://github.com/dagger/dagger/issues/6724 3. Support for re-executing modules in specialized hosts (i.e. run my module on a "gpu-as-a-service" platform) 4. Combined with support for interfaces, you could pass a module as an implementation of an interface argument (if it matches) * @vito mentioned one use case specifically around using this to construct a dev env that is defined across multiple modules and could be dynamically composed into one (IIUC, correct if I misunderstood) However, it's not yet possible to do this from the CLI with `dagger call`, which greatly limits its utility. We could likely just re-use the syntax we use for `-m`, e.g.: * `dagger call go-test --module github.com/my-org/my-repo/my-mod`, where `--module` is an argument of type either `ModuleSource`, `Module` or an interface that the module must implement. That would in theory be extremely straightforward to implement while also unlocking all sorts of very interesting use cases
https://github.com/dagger/dagger/issues/6725
https://github.com/dagger/dagger/pull/6761
c5bf6978ba169abbc5cef54b3d7cd829f141d792
e02ff3d2b50665275deb52902abc46ac0f6f138a
"2024-02-23T18:56:08Z"
go
"2024-02-27T22:55:04Z"
core/integration/module_call_test.go
t.Parallel() t.Run("local dir", func(t *testing.T) { t.Parallel() t.Run("abs path", func(t *testing.T) { c, ctx := connect(t) modGen := c.Container().From(golangImage). WithMountedFile(testCLIBinPath, daggerCliFile(t, c)). WithWorkdir("/work"). With(daggerExec("init", "--source=.", "--name=test", "--sdk=go")). WithNewFile("/dir/subdir/foo.txt", dagger.ContainerWithNewFileOpts{ Contents: "foo", }). WithNewFile("/dir/subdir/bar.txt", dagger.ContainerWithNewFileOpts{ Contents: "bar", }). WithNewFile("main.go", dagger.ContainerWithNewFileOpts{ Contents: `package main type Test struct {} func (m *Test) Fn(dir *Directory) *Directory { return dir } `, }) out, err := modGen.With(daggerCall("fn", "--dir", "/dir/subdir", "entries")).Stdout(ctx) require.NoError(t, err) require.Equal(t, "bar.txt\nfoo.txt\n", out) out, err = modGen.With(daggerCall("fn", "--dir", "file:///dir/subdir", "entries")).Stdout(ctx) require.NoError(t, err) require.Equal(t, "bar.txt\nfoo.txt\n", out) })
closed
dagger/dagger
https://github.com/dagger/dagger
6,725
Support passing modules as arguments in the CLI
Modules can accept other modules as arguments to functions. Use cases: 1. SDKs implemented as modules do this already by accepting `ModuleSource` as an arg 2. Support for running tests of modules could use this: https://github.com/dagger/dagger/issues/6724 3. Support for re-executing modules in specialized hosts (i.e. run my module on a "gpu-as-a-service" platform) 4. Combined with support for interfaces, you could pass a module as an implementation of an interface argument (if it matches) * @vito mentioned one use case specifically around using this to construct a dev env that is defined across multiple modules and could be dynamically composed into one (IIUC, correct if I misunderstood) However, it's not yet possible to do this from the CLI with `dagger call`, which greatly limits its utility. We could likely just re-use the syntax we use for `-m`, e.g.: * `dagger call go-test --module github.com/my-org/my-repo/my-mod`, where `--module` is an argument of type either `ModuleSource`, `Module` or an interface that the module must implement. That would in theory be extremely straightforward to implement while also unlocking all sorts of very interesting use cases
https://github.com/dagger/dagger/issues/6725
https://github.com/dagger/dagger/pull/6761
c5bf6978ba169abbc5cef54b3d7cd829f141d792
e02ff3d2b50665275deb52902abc46ac0f6f138a
"2024-02-23T18:56:08Z"
go
"2024-02-27T22:55:04Z"
core/integration/module_call_test.go
t.Run("rel path", func(t *testing.T) { t.Parallel() c, ctx := connect(t) modGen := goGitBase(t, c). WithMountedFile(testCLIBinPath, daggerCliFile(t, c)). WithWorkdir("/work/dir"). With(daggerExec("init", "--source=.", "--name=test", "--sdk=go")). WithNewFile("/work/otherdir/foo.txt", dagger.ContainerWithNewFileOpts{ Contents: "foo", }). WithNewFile("/work/otherdir/bar.txt", dagger.ContainerWithNewFileOpts{ Contents: "bar", }). WithNewFile("/work/dir/subdir/blah.txt", dagger.ContainerWithNewFileOpts{ Contents: "blah", }). WithNewFile("main.go", dagger.ContainerWithNewFileOpts{ Contents: `package main type Test struct {} func (m *Test) Fn(dir *Directory) *Directory { return dir } `, }) out, err := modGen.With(daggerCall("fn", "--dir", "../otherdir", "entries")).Stdout(ctx) require.NoError(t, err) require.Equal(t, "bar.txt\nfoo.txt\n", out) out, err = modGen.With(daggerCall("fn", "--dir", "file://../otherdir", "entries")).Stdout(ctx) require.NoError(t, err) require.Equal(t, "bar.txt\nfoo.txt\n", out)
closed
dagger/dagger
https://github.com/dagger/dagger
6,725
Support passing modules as arguments in the CLI
Modules can accept other modules as arguments to functions. Use cases: 1. SDKs implemented as modules do this already by accepting `ModuleSource` as an arg 2. Support for running tests of modules could use this: https://github.com/dagger/dagger/issues/6724 3. Support for re-executing modules in specialized hosts (i.e. run my module on a "gpu-as-a-service" platform) 4. Combined with support for interfaces, you could pass a module as an implementation of an interface argument (if it matches) * @vito mentioned one use case specifically around using this to construct a dev env that is defined across multiple modules and could be dynamically composed into one (IIUC, correct if I misunderstood) However, it's not yet possible to do this from the CLI with `dagger call`, which greatly limits its utility. We could likely just re-use the syntax we use for `-m`, e.g.: * `dagger call go-test --module github.com/my-org/my-repo/my-mod`, where `--module` is an argument of type either `ModuleSource`, `Module` or an interface that the module must implement. That would in theory be extremely straightforward to implement while also unlocking all sorts of very interesting use cases
https://github.com/dagger/dagger/issues/6725
https://github.com/dagger/dagger/pull/6761
c5bf6978ba169abbc5cef54b3d7cd829f141d792
e02ff3d2b50665275deb52902abc46ac0f6f138a
"2024-02-23T18:56:08Z"
go
"2024-02-27T22:55:04Z"
core/integration/module_call_test.go
out, err = modGen.With(daggerCall("fn", "--dir", "subdir", "entries")).Stdout(ctx) require.NoError(t, err) require.Equal(t, "blah.txt\n", out) out, err = modGen.With(daggerCall("fn", "--dir", "file://subdir", "entries")).Stdout(ctx) require.NoError(t, err) require.Equal(t, "blah.txt\n", out) }) }) t.Run("git dir", 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", "--source=.", "--name=test", "--sdk=go")). WithNewFile("main.go", dagger.ContainerWithNewFileOpts{ Contents: `package main type Test struct {} func (m *Test) Fn( dir *Directory, subpath string, // +optional ) *Directory { if subpath == "" { subpath = "." } return dir.Directory(subpath) } `, }) for _, tc := range []struct {
closed
dagger/dagger
https://github.com/dagger/dagger
6,725
Support passing modules as arguments in the CLI
Modules can accept other modules as arguments to functions. Use cases: 1. SDKs implemented as modules do this already by accepting `ModuleSource` as an arg 2. Support for running tests of modules could use this: https://github.com/dagger/dagger/issues/6724 3. Support for re-executing modules in specialized hosts (i.e. run my module on a "gpu-as-a-service" platform) 4. Combined with support for interfaces, you could pass a module as an implementation of an interface argument (if it matches) * @vito mentioned one use case specifically around using this to construct a dev env that is defined across multiple modules and could be dynamically composed into one (IIUC, correct if I misunderstood) However, it's not yet possible to do this from the CLI with `dagger call`, which greatly limits its utility. We could likely just re-use the syntax we use for `-m`, e.g.: * `dagger call go-test --module github.com/my-org/my-repo/my-mod`, where `--module` is an argument of type either `ModuleSource`, `Module` or an interface that the module must implement. That would in theory be extremely straightforward to implement while also unlocking all sorts of very interesting use cases
https://github.com/dagger/dagger/issues/6725
https://github.com/dagger/dagger/pull/6761
c5bf6978ba169abbc5cef54b3d7cd829f141d792
e02ff3d2b50665275deb52902abc46ac0f6f138a
"2024-02-23T18:56:08Z"
go
"2024-02-27T22:55:04Z"
core/integration/module_call_test.go
baseURL string subpath string }{ { baseURL: "https://github.com/dagger/dagger", }, { baseURL: "https://github.com/dagger/dagger", subpath: ".changes", }, { baseURL: "https://github.com/dagger/dagger.git", }, { baseURL: "https://github.com/dagger/dagger.git", subpath: ".changes", }, } { tc := tc
closed
dagger/dagger
https://github.com/dagger/dagger
6,725
Support passing modules as arguments in the CLI
Modules can accept other modules as arguments to functions. Use cases: 1. SDKs implemented as modules do this already by accepting `ModuleSource` as an arg 2. Support for running tests of modules could use this: https://github.com/dagger/dagger/issues/6724 3. Support for re-executing modules in specialized hosts (i.e. run my module on a "gpu-as-a-service" platform) 4. Combined with support for interfaces, you could pass a module as an implementation of an interface argument (if it matches) * @vito mentioned one use case specifically around using this to construct a dev env that is defined across multiple modules and could be dynamically composed into one (IIUC, correct if I misunderstood) However, it's not yet possible to do this from the CLI with `dagger call`, which greatly limits its utility. We could likely just re-use the syntax we use for `-m`, e.g.: * `dagger call go-test --module github.com/my-org/my-repo/my-mod`, where `--module` is an argument of type either `ModuleSource`, `Module` or an interface that the module must implement. That would in theory be extremely straightforward to implement while also unlocking all sorts of very interesting use cases
https://github.com/dagger/dagger/issues/6725
https://github.com/dagger/dagger/pull/6761
c5bf6978ba169abbc5cef54b3d7cd829f141d792
e02ff3d2b50665275deb52902abc46ac0f6f138a
"2024-02-23T18:56:08Z"
go
"2024-02-27T22:55:04Z"
core/integration/module_call_test.go
t.Run(fmt.Sprintf("%s:%s", tc.baseURL, tc.subpath), func(t *testing.T) { url := tc.baseURL + "#v0.9.1" if tc.subpath != "" { url += ":" + tc.subpath } args := []string{"fn", "--dir", url} if tc.subpath == "" { args = append(args, "--subpath", ".changes") } args = append(args, "entries") out, err := modGen.With(daggerCall(args...)).Stdout(ctx) require.NoError(t, err) require.Contains(t, out, "v0.9.1.md") require.NotContains(t, out, "v0.9.2.md") }) } }) }) t.Run("file arg inputs", func(t *testing.T) { t.Parallel() t.Run("abs path", func(t *testing.T) { c, ctx := connect(t) modGen := c.Container().From(golangImage). WithMountedFile(testCLIBinPath, daggerCliFile(t, c)). WithWorkdir("/work"). With(daggerExec("init", "--source=.", "--name=test", "--sdk=go")). WithNewFile("/dir/subdir/foo.txt", dagger.ContainerWithNewFileOpts{ Contents: "foo", }). WithNewFile("main.go", dagger.ContainerWithNewFileOpts{
closed
dagger/dagger
https://github.com/dagger/dagger
6,725
Support passing modules as arguments in the CLI
Modules can accept other modules as arguments to functions. Use cases: 1. SDKs implemented as modules do this already by accepting `ModuleSource` as an arg 2. Support for running tests of modules could use this: https://github.com/dagger/dagger/issues/6724 3. Support for re-executing modules in specialized hosts (i.e. run my module on a "gpu-as-a-service" platform) 4. Combined with support for interfaces, you could pass a module as an implementation of an interface argument (if it matches) * @vito mentioned one use case specifically around using this to construct a dev env that is defined across multiple modules and could be dynamically composed into one (IIUC, correct if I misunderstood) However, it's not yet possible to do this from the CLI with `dagger call`, which greatly limits its utility. We could likely just re-use the syntax we use for `-m`, e.g.: * `dagger call go-test --module github.com/my-org/my-repo/my-mod`, where `--module` is an argument of type either `ModuleSource`, `Module` or an interface that the module must implement. That would in theory be extremely straightforward to implement while also unlocking all sorts of very interesting use cases
https://github.com/dagger/dagger/issues/6725
https://github.com/dagger/dagger/pull/6761
c5bf6978ba169abbc5cef54b3d7cd829f141d792
e02ff3d2b50665275deb52902abc46ac0f6f138a
"2024-02-23T18:56:08Z"
go
"2024-02-27T22:55:04Z"
core/integration/module_call_test.go
Contents: `package main type Test struct {} func (m *Test) Fn(file *File) *File { return file } `, }) out, err := modGen.With(daggerCall("fn", "--file", "/dir/subdir/foo.txt", "contents")).Stdout(ctx) require.NoError(t, err) require.Equal(t, "foo", out) out, err = modGen.With(daggerCall("fn", "--file", "file:///dir/subdir/foo.txt", "contents")).Stdout(ctx) require.NoError(t, err) require.Equal(t, "foo", out) }) t.Run("rel path", func(t *testing.T) { t.Parallel() c, ctx := connect(t) modGen := goGitBase(t, c). WithMountedFile(testCLIBinPath, daggerCliFile(t, c)). WithWorkdir("/work/dir"). With(daggerExec("init", "--source=.", "--name=test", "--sdk=go")). WithNewFile("/work/otherdir/foo.txt", dagger.ContainerWithNewFileOpts{ Contents: "foo", }). WithNewFile("/work/dir/subdir/blah.txt", dagger.ContainerWithNewFileOpts{ Contents: "blah", }). WithNewFile("main.go", dagger.ContainerWithNewFileOpts{ Contents: `package main type Test struct {}
closed
dagger/dagger
https://github.com/dagger/dagger
6,725
Support passing modules as arguments in the CLI
Modules can accept other modules as arguments to functions. Use cases: 1. SDKs implemented as modules do this already by accepting `ModuleSource` as an arg 2. Support for running tests of modules could use this: https://github.com/dagger/dagger/issues/6724 3. Support for re-executing modules in specialized hosts (i.e. run my module on a "gpu-as-a-service" platform) 4. Combined with support for interfaces, you could pass a module as an implementation of an interface argument (if it matches) * @vito mentioned one use case specifically around using this to construct a dev env that is defined across multiple modules and could be dynamically composed into one (IIUC, correct if I misunderstood) However, it's not yet possible to do this from the CLI with `dagger call`, which greatly limits its utility. We could likely just re-use the syntax we use for `-m`, e.g.: * `dagger call go-test --module github.com/my-org/my-repo/my-mod`, where `--module` is an argument of type either `ModuleSource`, `Module` or an interface that the module must implement. That would in theory be extremely straightforward to implement while also unlocking all sorts of very interesting use cases
https://github.com/dagger/dagger/issues/6725
https://github.com/dagger/dagger/pull/6761
c5bf6978ba169abbc5cef54b3d7cd829f141d792
e02ff3d2b50665275deb52902abc46ac0f6f138a
"2024-02-23T18:56:08Z"
go
"2024-02-27T22:55:04Z"
core/integration/module_call_test.go
func (m *Test) Fn(file *File) *File { return file } `, }) out, err := modGen.With(daggerCall("fn", "--file", "../otherdir/foo.txt", "contents")).Stdout(ctx) require.NoError(t, err) require.Equal(t, "foo", out) out, err = modGen.With(daggerCall("fn", "--file", "file://../otherdir/foo.txt", "contents")).Stdout(ctx) require.NoError(t, err) require.Equal(t, "foo", out) out, err = modGen.With(daggerCall("fn", "--file", "subdir/blah.txt", "contents")).Stdout(ctx) require.NoError(t, err) require.Equal(t, "blah", out) out, err = modGen.With(daggerCall("fn", "--file", "file://subdir/blah.txt", "contents")).Stdout(ctx) require.NoError(t, err) require.Equal(t, "blah", out) }) }) t.Run("secret args", 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", "--source=.", "--name=test", "--sdk=go")). WithNewFile("main.go", dagger.ContainerWithNewFileOpts{ Contents: `package main import "context" type Test struct {}
closed
dagger/dagger
https://github.com/dagger/dagger
6,725
Support passing modules as arguments in the CLI
Modules can accept other modules as arguments to functions. Use cases: 1. SDKs implemented as modules do this already by accepting `ModuleSource` as an arg 2. Support for running tests of modules could use this: https://github.com/dagger/dagger/issues/6724 3. Support for re-executing modules in specialized hosts (i.e. run my module on a "gpu-as-a-service" platform) 4. Combined with support for interfaces, you could pass a module as an implementation of an interface argument (if it matches) * @vito mentioned one use case specifically around using this to construct a dev env that is defined across multiple modules and could be dynamically composed into one (IIUC, correct if I misunderstood) However, it's not yet possible to do this from the CLI with `dagger call`, which greatly limits its utility. We could likely just re-use the syntax we use for `-m`, e.g.: * `dagger call go-test --module github.com/my-org/my-repo/my-mod`, where `--module` is an argument of type either `ModuleSource`, `Module` or an interface that the module must implement. That would in theory be extremely straightforward to implement while also unlocking all sorts of very interesting use cases
https://github.com/dagger/dagger/issues/6725
https://github.com/dagger/dagger/pull/6761
c5bf6978ba169abbc5cef54b3d7cd829f141d792
e02ff3d2b50665275deb52902abc46ac0f6f138a
"2024-02-23T18:56:08Z"
go
"2024-02-27T22:55:04Z"
core/integration/module_call_test.go
func (m *Test) Insecure(ctx context.Context, token *Secret) (string, error) { return token.Plaintext(ctx) } `, }). WithEnvVariable("TOPSECRET", "shhh"). WithNewFile("/mysupersecret", dagger.ContainerWithNewFileOpts{Contents: "file shhh"}) t.Run("explicit env", func(t *testing.T) { t.Run("happy", func(t *testing.T) { out, err := modGen.With(daggerCall("insecure", "--token", "env:TOPSECRET")).Stdout(ctx) require.NoError(t, err) require.Equal(t, "shhh", out) }) t.Run("sad", func(t *testing.T) { _, err := modGen.With(daggerCall("insecure", "--token", "env:NOWHERETOBEFOUND")).Stdout(ctx) require.ErrorContains(t, err, `secret env var not found: "NOW..."`) }) }) t.Run("implicit env", func(t *testing.T) { t.Parallel() t.Run("happy", func(t *testing.T) { out, err := modGen.With(daggerCall("insecure", "--token", "TOPSECRET")).Stdout(ctx) require.NoError(t, err) require.Equal(t, "shhh", out) }) t.Run("sad", func(t *testing.T) { _, err := modGen.With(daggerCall("insecure", "--token", "NOWHERETOBEFOUND")).Stdout(ctx) require.ErrorContains(t, err, `secret env var not found: "NOW..."`) }) })
closed
dagger/dagger
https://github.com/dagger/dagger
6,725
Support passing modules as arguments in the CLI
Modules can accept other modules as arguments to functions. Use cases: 1. SDKs implemented as modules do this already by accepting `ModuleSource` as an arg 2. Support for running tests of modules could use this: https://github.com/dagger/dagger/issues/6724 3. Support for re-executing modules in specialized hosts (i.e. run my module on a "gpu-as-a-service" platform) 4. Combined with support for interfaces, you could pass a module as an implementation of an interface argument (if it matches) * @vito mentioned one use case specifically around using this to construct a dev env that is defined across multiple modules and could be dynamically composed into one (IIUC, correct if I misunderstood) However, it's not yet possible to do this from the CLI with `dagger call`, which greatly limits its utility. We could likely just re-use the syntax we use for `-m`, e.g.: * `dagger call go-test --module github.com/my-org/my-repo/my-mod`, where `--module` is an argument of type either `ModuleSource`, `Module` or an interface that the module must implement. That would in theory be extremely straightforward to implement while also unlocking all sorts of very interesting use cases
https://github.com/dagger/dagger/issues/6725
https://github.com/dagger/dagger/pull/6761
c5bf6978ba169abbc5cef54b3d7cd829f141d792
e02ff3d2b50665275deb52902abc46ac0f6f138a
"2024-02-23T18:56:08Z"
go
"2024-02-27T22:55:04Z"
core/integration/module_call_test.go
t.Run("file", func(t *testing.T) { t.Run("happy", func(t *testing.T) { out, err := modGen.With(daggerCall("insecure", "--token", "file:/mysupersecret")).Stdout(ctx) require.NoError(t, err) require.Equal(t, "file shhh", out) }) t.Run("sad", func(t *testing.T) { _, err := modGen.With(daggerCall("insecure", "--token", "file:/nowheretobefound")).Stdout(ctx) require.ErrorContains(t, err, `failed to read secret file "/nowheretobefound": open /nowheretobefound: no such file or directory`) }) }) t.Run("cmd", func(t *testing.T) { t.Run("happy", func(t *testing.T) { out, err := modGen.With(daggerCall("insecure", "--token", "cmd:echo -n cmd shhh")).Stdout(ctx) require.NoError(t, err) require.Equal(t, "cmd shhh", out) }) t.Run("sad", func(t *testing.T) { _, err := modGen.With(daggerCall("insecure", "--token", "cmd:exit 1")).Stdout(ctx) require.ErrorContains(t, err, `failed to run secret command "exit 1": exit status 1`) }) }) t.Run("invalid source", func(t *testing.T) { _, err := modGen.With(daggerCall("insecure", "--token", "wtf:HUH")).Stdout(ctx) require.ErrorContains(t, err, `unsupported secret arg source: "wtf"`) }) }) t.Run("cache volume args", func(t *testing.T) { t.Parallel() c, ctx := connect(t)
closed
dagger/dagger
https://github.com/dagger/dagger
6,725
Support passing modules as arguments in the CLI
Modules can accept other modules as arguments to functions. Use cases: 1. SDKs implemented as modules do this already by accepting `ModuleSource` as an arg 2. Support for running tests of modules could use this: https://github.com/dagger/dagger/issues/6724 3. Support for re-executing modules in specialized hosts (i.e. run my module on a "gpu-as-a-service" platform) 4. Combined with support for interfaces, you could pass a module as an implementation of an interface argument (if it matches) * @vito mentioned one use case specifically around using this to construct a dev env that is defined across multiple modules and could be dynamically composed into one (IIUC, correct if I misunderstood) However, it's not yet possible to do this from the CLI with `dagger call`, which greatly limits its utility. We could likely just re-use the syntax we use for `-m`, e.g.: * `dagger call go-test --module github.com/my-org/my-repo/my-mod`, where `--module` is an argument of type either `ModuleSource`, `Module` or an interface that the module must implement. That would in theory be extremely straightforward to implement while also unlocking all sorts of very interesting use cases
https://github.com/dagger/dagger/issues/6725
https://github.com/dagger/dagger/pull/6761
c5bf6978ba169abbc5cef54b3d7cd829f141d792
e02ff3d2b50665275deb52902abc46ac0f6f138a
"2024-02-23T18:56:08Z"
go
"2024-02-27T22:55:04Z"
core/integration/module_call_test.go
volName := identity.NewID() modGen := c.Container().From(golangImage). WithMountedFile(testCLIBinPath, daggerCliFile(t, c)). WithWorkdir("/work"). With(daggerExec("init", "--source=.", "--name=test", "--sdk=go")). WithNewFile("main.go", dagger.ContainerWithNewFileOpts{ Contents: `package main import ( "context" ) type Test struct {} func (m *Test) Cacher(ctx context.Context, cache *CacheVolume, val string) (string, error) { return dag.Container(). From("` + alpineImage + `"). WithMountedCache("/cache", cache). WithExec([]string{"sh", "-c", "echo $0 >> /cache/vals", val}). WithExec([]string{"cat", "/cache/vals"}). Stdout(ctx) } `, }) out, err := modGen.With(daggerCall("cacher", "--cache", volName, "--val", "foo")).Stdout(ctx) require.NoError(t, err) require.Equal(t, "foo\n", out) out, err = modGen.With(daggerCall("cacher", "--cache", volName, "--val", "bar")).Stdout(ctx) require.NoError(t, err) require.Equal(t, "foo\nbar\n", out) }) } func TestModuleDaggerCallReturnTypes(t *testing.T) {
closed
dagger/dagger
https://github.com/dagger/dagger
6,725
Support passing modules as arguments in the CLI
Modules can accept other modules as arguments to functions. Use cases: 1. SDKs implemented as modules do this already by accepting `ModuleSource` as an arg 2. Support for running tests of modules could use this: https://github.com/dagger/dagger/issues/6724 3. Support for re-executing modules in specialized hosts (i.e. run my module on a "gpu-as-a-service" platform) 4. Combined with support for interfaces, you could pass a module as an implementation of an interface argument (if it matches) * @vito mentioned one use case specifically around using this to construct a dev env that is defined across multiple modules and could be dynamically composed into one (IIUC, correct if I misunderstood) However, it's not yet possible to do this from the CLI with `dagger call`, which greatly limits its utility. We could likely just re-use the syntax we use for `-m`, e.g.: * `dagger call go-test --module github.com/my-org/my-repo/my-mod`, where `--module` is an argument of type either `ModuleSource`, `Module` or an interface that the module must implement. That would in theory be extremely straightforward to implement while also unlocking all sorts of very interesting use cases
https://github.com/dagger/dagger/issues/6725
https://github.com/dagger/dagger/pull/6761
c5bf6978ba169abbc5cef54b3d7cd829f141d792
e02ff3d2b50665275deb52902abc46ac0f6f138a
"2024-02-23T18:56:08Z"
go
"2024-02-27T22:55:04Z"
core/integration/module_call_test.go
t.Parallel() t.Run("return list objects", 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", "--source=.", "--name=minimal", "--sdk=go")). WithNewFile("main.go", dagger.ContainerWithNewFileOpts{ Contents: `package main type Minimal struct {} type Foo struct { Bar int ` + "`" + `json:"bar"` + "`" + ` } func (m *Minimal) Fn() []*Foo {
closed
dagger/dagger
https://github.com/dagger/dagger
6,725
Support passing modules as arguments in the CLI
Modules can accept other modules as arguments to functions. Use cases: 1. SDKs implemented as modules do this already by accepting `ModuleSource` as an arg 2. Support for running tests of modules could use this: https://github.com/dagger/dagger/issues/6724 3. Support for re-executing modules in specialized hosts (i.e. run my module on a "gpu-as-a-service" platform) 4. Combined with support for interfaces, you could pass a module as an implementation of an interface argument (if it matches) * @vito mentioned one use case specifically around using this to construct a dev env that is defined across multiple modules and could be dynamically composed into one (IIUC, correct if I misunderstood) However, it's not yet possible to do this from the CLI with `dagger call`, which greatly limits its utility. We could likely just re-use the syntax we use for `-m`, e.g.: * `dagger call go-test --module github.com/my-org/my-repo/my-mod`, where `--module` is an argument of type either `ModuleSource`, `Module` or an interface that the module must implement. That would in theory be extremely straightforward to implement while also unlocking all sorts of very interesting use cases
https://github.com/dagger/dagger/issues/6725
https://github.com/dagger/dagger/pull/6761
c5bf6978ba169abbc5cef54b3d7cd829f141d792
e02ff3d2b50665275deb52902abc46ac0f6f138a
"2024-02-23T18:56:08Z"
go
"2024-02-27T22:55:04Z"
core/integration/module_call_test.go
var foos []*Foo for i := 0; i < 3; i++ { foos = append(foos, &Foo{Bar: i}) } return foos } `, }) logGen(ctx, t, modGen.Directory(".")) expected := "0\n1\n2\n" t.Run("print", func(t *testing.T) { out, err := modGen.With(daggerCall("fn", "bar")).Stdout(ctx) require.NoError(t, err) require.Equal(t, expected, out) }) t.Run("output", func(t *testing.T) { out, err := modGen. With(daggerCall("fn", "bar", "-o", "./outfile")). File("./outfile"). Contents(ctx) require.NoError(t, err) require.Equal(t, expected, out) }) t.Run("json", func(t *testing.T) { out, err := modGen. With(daggerCall("fn", "bar", "--json")). Stdout(ctx) require.NoError(t, err) require.JSONEq(t, `[{"bar": 0}, {"bar": 1}, {"bar": 2}]`, out) })
closed
dagger/dagger
https://github.com/dagger/dagger
6,725
Support passing modules as arguments in the CLI
Modules can accept other modules as arguments to functions. Use cases: 1. SDKs implemented as modules do this already by accepting `ModuleSource` as an arg 2. Support for running tests of modules could use this: https://github.com/dagger/dagger/issues/6724 3. Support for re-executing modules in specialized hosts (i.e. run my module on a "gpu-as-a-service" platform) 4. Combined with support for interfaces, you could pass a module as an implementation of an interface argument (if it matches) * @vito mentioned one use case specifically around using this to construct a dev env that is defined across multiple modules and could be dynamically composed into one (IIUC, correct if I misunderstood) However, it's not yet possible to do this from the CLI with `dagger call`, which greatly limits its utility. We could likely just re-use the syntax we use for `-m`, e.g.: * `dagger call go-test --module github.com/my-org/my-repo/my-mod`, where `--module` is an argument of type either `ModuleSource`, `Module` or an interface that the module must implement. That would in theory be extremely straightforward to implement while also unlocking all sorts of very interesting use cases
https://github.com/dagger/dagger/issues/6725
https://github.com/dagger/dagger/pull/6761
c5bf6978ba169abbc5cef54b3d7cd829f141d792
e02ff3d2b50665275deb52902abc46ac0f6f138a
"2024-02-23T18:56:08Z"
go
"2024-02-27T22:55:04Z"
core/integration/module_call_test.go
}) t.Run("return container", 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", "--source=.", "--name=test", "--sdk=go")). WithNewFile("main.go", dagger.ContainerWithNewFileOpts{ Contents: `package main func New() *Test { return &Test{Ctr: dag.Container().From("alpine:3.18").WithExec([]string{"echo", "hello", "world"})} } type Test struct { Ctr *Container } `, }) logGen(ctx, t, modGen.Directory(".")) t.Run("default", func(t *testing.T) { ctr := modGen.With(daggerCall("ctr")) out, err := ctr.Stdout(ctx) require.NoError(t, err) require.Empty(t, out) out, err = ctr.Stderr(ctx) require.NoError(t, err) require.Contains(t, out, "Container evaluated") }) t.Run("output", func(t *testing.T) { modGen, err := modGen.With(daggerCall("ctr", "-o", "./container.tar")).Sync(ctx)
closed
dagger/dagger
https://github.com/dagger/dagger
6,725
Support passing modules as arguments in the CLI
Modules can accept other modules as arguments to functions. Use cases: 1. SDKs implemented as modules do this already by accepting `ModuleSource` as an arg 2. Support for running tests of modules could use this: https://github.com/dagger/dagger/issues/6724 3. Support for re-executing modules in specialized hosts (i.e. run my module on a "gpu-as-a-service" platform) 4. Combined with support for interfaces, you could pass a module as an implementation of an interface argument (if it matches) * @vito mentioned one use case specifically around using this to construct a dev env that is defined across multiple modules and could be dynamically composed into one (IIUC, correct if I misunderstood) However, it's not yet possible to do this from the CLI with `dagger call`, which greatly limits its utility. We could likely just re-use the syntax we use for `-m`, e.g.: * `dagger call go-test --module github.com/my-org/my-repo/my-mod`, where `--module` is an argument of type either `ModuleSource`, `Module` or an interface that the module must implement. That would in theory be extremely straightforward to implement while also unlocking all sorts of very interesting use cases
https://github.com/dagger/dagger/issues/6725
https://github.com/dagger/dagger/pull/6761
c5bf6978ba169abbc5cef54b3d7cd829f141d792
e02ff3d2b50665275deb52902abc46ac0f6f138a
"2024-02-23T18:56:08Z"
go
"2024-02-27T22:55:04Z"
core/integration/module_call_test.go
require.NoError(t, err) size, err := modGen.File("./container.tar").Size(ctx) require.NoError(t, err) require.Greater(t, size, 0) _, err = modGen.WithExec([]string{"tar", "tf", "./container.tar", "oci-layout"}).Sync(ctx) require.NoError(t, err) }) }) t.Run("return directory", 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", "--source=.", "--name=test", "--sdk=go")). WithNewFile("main.go", dagger.ContainerWithNewFileOpts{ Contents: `package main func New() *Test { return &Test{ Dir: dag.Directory().WithNewFile("foo.txt", "foo").WithNewFile("bar.txt", "bar"), } } type Test struct { Dir *Directory } `, }) logGen(ctx, t, modGen.Directory(".")) t.Run("default", func(t *testing.T) { ctr := modGen.With(daggerCall("dir"))
closed
dagger/dagger
https://github.com/dagger/dagger
6,725
Support passing modules as arguments in the CLI
Modules can accept other modules as arguments to functions. Use cases: 1. SDKs implemented as modules do this already by accepting `ModuleSource` as an arg 2. Support for running tests of modules could use this: https://github.com/dagger/dagger/issues/6724 3. Support for re-executing modules in specialized hosts (i.e. run my module on a "gpu-as-a-service" platform) 4. Combined with support for interfaces, you could pass a module as an implementation of an interface argument (if it matches) * @vito mentioned one use case specifically around using this to construct a dev env that is defined across multiple modules and could be dynamically composed into one (IIUC, correct if I misunderstood) However, it's not yet possible to do this from the CLI with `dagger call`, which greatly limits its utility. We could likely just re-use the syntax we use for `-m`, e.g.: * `dagger call go-test --module github.com/my-org/my-repo/my-mod`, where `--module` is an argument of type either `ModuleSource`, `Module` or an interface that the module must implement. That would in theory be extremely straightforward to implement while also unlocking all sorts of very interesting use cases
https://github.com/dagger/dagger/issues/6725
https://github.com/dagger/dagger/pull/6761
c5bf6978ba169abbc5cef54b3d7cd829f141d792
e02ff3d2b50665275deb52902abc46ac0f6f138a
"2024-02-23T18:56:08Z"
go
"2024-02-27T22:55:04Z"
core/integration/module_call_test.go
out, err := ctr.Stdout(ctx) require.NoError(t, err) require.Empty(t, out) out, err = ctr.Stderr(ctx) require.NoError(t, err) require.Contains(t, out, "Directory evaluated") }) t.Run("output", func(t *testing.T) { modGen, err := modGen.With(daggerCall("dir", "-o", "./outdir")).Sync(ctx) require.NoError(t, err) entries, err := modGen.Directory("./outdir").Entries(ctx) require.NoError(t, err) require.Equal(t, "bar.txt\nfoo.txt", strings.Join(entries, "\n")) foo, err := modGen.Directory("./outdir").File("foo.txt").Contents(ctx) require.NoError(t, err) require.Equal(t, "foo", foo) bar, err := modGen.Directory("./outdir").File("bar.txt").Contents(ctx) require.NoError(t, err) require.Equal(t, "bar", bar) }) }) t.Run("return file", 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", "--source=.", "--name=test", "--sdk=go")). WithNewFile("main.go", dagger.ContainerWithNewFileOpts{ Contents: `package main
closed
dagger/dagger
https://github.com/dagger/dagger
6,725
Support passing modules as arguments in the CLI
Modules can accept other modules as arguments to functions. Use cases: 1. SDKs implemented as modules do this already by accepting `ModuleSource` as an arg 2. Support for running tests of modules could use this: https://github.com/dagger/dagger/issues/6724 3. Support for re-executing modules in specialized hosts (i.e. run my module on a "gpu-as-a-service" platform) 4. Combined with support for interfaces, you could pass a module as an implementation of an interface argument (if it matches) * @vito mentioned one use case specifically around using this to construct a dev env that is defined across multiple modules and could be dynamically composed into one (IIUC, correct if I misunderstood) However, it's not yet possible to do this from the CLI with `dagger call`, which greatly limits its utility. We could likely just re-use the syntax we use for `-m`, e.g.: * `dagger call go-test --module github.com/my-org/my-repo/my-mod`, where `--module` is an argument of type either `ModuleSource`, `Module` or an interface that the module must implement. That would in theory be extremely straightforward to implement while also unlocking all sorts of very interesting use cases
https://github.com/dagger/dagger/issues/6725
https://github.com/dagger/dagger/pull/6761
c5bf6978ba169abbc5cef54b3d7cd829f141d792
e02ff3d2b50665275deb52902abc46ac0f6f138a
"2024-02-23T18:56:08Z"
go
"2024-02-27T22:55:04Z"
core/integration/module_call_test.go
func New() *Test { return &Test{ File: dag.Directory().WithNewFile("foo.txt", "foo").File("foo.txt"), } } type Test struct { File *File } `, }) logGen(ctx, t, modGen.Directory(".")) t.Run("default", func(t *testing.T) { ctr := modGen.With(daggerCall("file")) out, err := ctr.Stdout(ctx) require.NoError(t, err) require.Empty(t, out) out, err = ctr.Stderr(ctx) require.NoError(t, err) require.Contains(t, out, "File evaluated") }) t.Run("output", func(t *testing.T) { out, err := modGen. With(daggerCall("file", "-o", "./outfile")). File("./outfile"). Contents(ctx) require.NoError(t, err) require.Equal(t, "foo", out) }) }) t.Run("sync", func(t *testing.T) {
closed
dagger/dagger
https://github.com/dagger/dagger
6,725
Support passing modules as arguments in the CLI
Modules can accept other modules as arguments to functions. Use cases: 1. SDKs implemented as modules do this already by accepting `ModuleSource` as an arg 2. Support for running tests of modules could use this: https://github.com/dagger/dagger/issues/6724 3. Support for re-executing modules in specialized hosts (i.e. run my module on a "gpu-as-a-service" platform) 4. Combined with support for interfaces, you could pass a module as an implementation of an interface argument (if it matches) * @vito mentioned one use case specifically around using this to construct a dev env that is defined across multiple modules and could be dynamically composed into one (IIUC, correct if I misunderstood) However, it's not yet possible to do this from the CLI with `dagger call`, which greatly limits its utility. We could likely just re-use the syntax we use for `-m`, e.g.: * `dagger call go-test --module github.com/my-org/my-repo/my-mod`, where `--module` is an argument of type either `ModuleSource`, `Module` or an interface that the module must implement. That would in theory be extremely straightforward to implement while also unlocking all sorts of very interesting use cases
https://github.com/dagger/dagger/issues/6725
https://github.com/dagger/dagger/pull/6761
c5bf6978ba169abbc5cef54b3d7cd829f141d792
e02ff3d2b50665275deb52902abc46ac0f6f138a
"2024-02-23T18:56:08Z"
go
"2024-02-27T22:55:04Z"
core/integration/module_call_test.go
t.Parallel() c, ctx := connect(t) modGen := c.Container().From(golangImage). WithMountedFile(testCLIBinPath, daggerCliFile(t, c)). WithWorkdir("/work"). With(daggerExec("init", "--source=.", "--name=test", "--sdk=go")). WithNewFile("main.go", dagger.ContainerWithNewFileOpts{ Contents: `package main func New() *Test { return &Test{Ctr: dag.Container().From("alpine:3.18").WithExec([]string{"echo", "hello", "world"})} } type Test struct { Ctr *Container } `, }) _, err := modGen.With(daggerCall("ctr", "sync")).Stdout(ctx) require.NoError(t, err) }) } func TestModuleDaggerCallCoreChaining(t *testing.T) { t.Parallel() t.Run("container", func(t *testing.T) { t.Parallel() c, ctx := connect(t) modGen := c.Container().From(golangImage). WithMountedFile(testCLIBinPath, daggerCliFile(t, c)). WithWorkdir("/work").
closed
dagger/dagger
https://github.com/dagger/dagger
6,725
Support passing modules as arguments in the CLI
Modules can accept other modules as arguments to functions. Use cases: 1. SDKs implemented as modules do this already by accepting `ModuleSource` as an arg 2. Support for running tests of modules could use this: https://github.com/dagger/dagger/issues/6724 3. Support for re-executing modules in specialized hosts (i.e. run my module on a "gpu-as-a-service" platform) 4. Combined with support for interfaces, you could pass a module as an implementation of an interface argument (if it matches) * @vito mentioned one use case specifically around using this to construct a dev env that is defined across multiple modules and could be dynamically composed into one (IIUC, correct if I misunderstood) However, it's not yet possible to do this from the CLI with `dagger call`, which greatly limits its utility. We could likely just re-use the syntax we use for `-m`, e.g.: * `dagger call go-test --module github.com/my-org/my-repo/my-mod`, where `--module` is an argument of type either `ModuleSource`, `Module` or an interface that the module must implement. That would in theory be extremely straightforward to implement while also unlocking all sorts of very interesting use cases
https://github.com/dagger/dagger/issues/6725
https://github.com/dagger/dagger/pull/6761
c5bf6978ba169abbc5cef54b3d7cd829f141d792
e02ff3d2b50665275deb52902abc46ac0f6f138a
"2024-02-23T18:56:08Z"
go
"2024-02-27T22:55:04Z"
core/integration/module_call_test.go
With(daggerExec("init", "--source=.", "--name=test", "--sdk=go")). WithNewFile("main.go", dagger.ContainerWithNewFileOpts{ Contents: `package main func New() *Test { return &Test{Ctr: dag.Container().From("alpine:3.18.5")} } type Test struct { Ctr *Container } `, }) t.Run("file", func(t *testing.T) { out, err := modGen.With(daggerCall("ctr", "file", "--path=/etc/alpine-release", "contents")).Stdout(ctx) require.NoError(t, err) require.Equal(t, "3.18.5\n", out) }) t.Run("export", func(t *testing.T) { modGen, err := modGen.With(daggerCall("ctr", "export", "--path=./container.tar.gz")).Sync(ctx) require.NoError(t, err) size, err := modGen.File("./container.tar.gz").Size(ctx) require.NoError(t, err) require.Greater(t, size, 0) }) }) t.Run("directory", func(t *testing.T) { t.Parallel() c, ctx := connect(t) modGen := c.Container().From(golangImage). WithMountedFile(testCLIBinPath, daggerCliFile(t, c)). WithWorkdir("/work").
closed
dagger/dagger
https://github.com/dagger/dagger
6,725
Support passing modules as arguments in the CLI
Modules can accept other modules as arguments to functions. Use cases: 1. SDKs implemented as modules do this already by accepting `ModuleSource` as an arg 2. Support for running tests of modules could use this: https://github.com/dagger/dagger/issues/6724 3. Support for re-executing modules in specialized hosts (i.e. run my module on a "gpu-as-a-service" platform) 4. Combined with support for interfaces, you could pass a module as an implementation of an interface argument (if it matches) * @vito mentioned one use case specifically around using this to construct a dev env that is defined across multiple modules and could be dynamically composed into one (IIUC, correct if I misunderstood) However, it's not yet possible to do this from the CLI with `dagger call`, which greatly limits its utility. We could likely just re-use the syntax we use for `-m`, e.g.: * `dagger call go-test --module github.com/my-org/my-repo/my-mod`, where `--module` is an argument of type either `ModuleSource`, `Module` or an interface that the module must implement. That would in theory be extremely straightforward to implement while also unlocking all sorts of very interesting use cases
https://github.com/dagger/dagger/issues/6725
https://github.com/dagger/dagger/pull/6761
c5bf6978ba169abbc5cef54b3d7cd829f141d792
e02ff3d2b50665275deb52902abc46ac0f6f138a
"2024-02-23T18:56:08Z"
go
"2024-02-27T22:55:04Z"
core/integration/module_call_test.go
With(daggerExec("init", "--source=.", "--name=test", "--sdk=go")). WithNewFile("main.go", dagger.ContainerWithNewFileOpts{ Contents: `package main func New() *Test { return &Test{ Dir: dag.Directory().WithNewFile("foo.txt", "foo").WithNewFile("bar.txt", "bar"), } } type Test struct { Dir *Directory } `, }) t.Run("file", func(t *testing.T) { out, err := modGen.With(daggerCall("dir", "file", "--path=foo.txt", "contents")).Stdout(ctx) require.NoError(t, err) require.Equal(t, "foo", out) }) t.Run("export", func(t *testing.T) { modGen, err := modGen.With(daggerCall("dir", "export", "--path=./outdir")).Sync(ctx) require.NoError(t, err) ents, err := modGen.Directory("./outdir").Entries(ctx) require.NoError(t, err) require.Equal(t, []string{"bar.txt", "foo.txt"}, ents) }) }) t.Run("return file", func(t *testing.T) { t.Parallel() c, ctx := connect(t) modGen := c.Container().From(golangImage).
closed
dagger/dagger
https://github.com/dagger/dagger
6,725
Support passing modules as arguments in the CLI
Modules can accept other modules as arguments to functions. Use cases: 1. SDKs implemented as modules do this already by accepting `ModuleSource` as an arg 2. Support for running tests of modules could use this: https://github.com/dagger/dagger/issues/6724 3. Support for re-executing modules in specialized hosts (i.e. run my module on a "gpu-as-a-service" platform) 4. Combined with support for interfaces, you could pass a module as an implementation of an interface argument (if it matches) * @vito mentioned one use case specifically around using this to construct a dev env that is defined across multiple modules and could be dynamically composed into one (IIUC, correct if I misunderstood) However, it's not yet possible to do this from the CLI with `dagger call`, which greatly limits its utility. We could likely just re-use the syntax we use for `-m`, e.g.: * `dagger call go-test --module github.com/my-org/my-repo/my-mod`, where `--module` is an argument of type either `ModuleSource`, `Module` or an interface that the module must implement. That would in theory be extremely straightforward to implement while also unlocking all sorts of very interesting use cases
https://github.com/dagger/dagger/issues/6725
https://github.com/dagger/dagger/pull/6761
c5bf6978ba169abbc5cef54b3d7cd829f141d792
e02ff3d2b50665275deb52902abc46ac0f6f138a
"2024-02-23T18:56:08Z"
go
"2024-02-27T22:55:04Z"
core/integration/module_call_test.go
WithMountedFile(testCLIBinPath, daggerCliFile(t, c)). WithWorkdir("/work"). With(daggerExec("init", "--source=.", "--name=test", "--sdk=go")). WithNewFile("main.go", dagger.ContainerWithNewFileOpts{ Contents: `package main func New() *Test { return &Test{ File: dag.Directory().WithNewFile("foo.txt", "foo").File("foo.txt"), } } type Test struct { File *File } `, }) t.Run("size", func(t *testing.T) { out, err := modGen.With(daggerCall("file", "size")).Stdout(ctx) require.NoError(t, err) require.Equal(t, "3", out) }) t.Run("export", func(t *testing.T) { modGen, err := modGen.With(daggerCall("file", "export", "--path=./outfile")).Sync(ctx) require.NoError(t, err) contents, err := modGen.File("./outfile").Contents(ctx) require.NoError(t, err) require.Equal(t, "foo", contents) }) }) } func TestModuleDaggerCallSaveOutput(t *testing.T) {
closed
dagger/dagger
https://github.com/dagger/dagger
6,725
Support passing modules as arguments in the CLI
Modules can accept other modules as arguments to functions. Use cases: 1. SDKs implemented as modules do this already by accepting `ModuleSource` as an arg 2. Support for running tests of modules could use this: https://github.com/dagger/dagger/issues/6724 3. Support for re-executing modules in specialized hosts (i.e. run my module on a "gpu-as-a-service" platform) 4. Combined with support for interfaces, you could pass a module as an implementation of an interface argument (if it matches) * @vito mentioned one use case specifically around using this to construct a dev env that is defined across multiple modules and could be dynamically composed into one (IIUC, correct if I misunderstood) However, it's not yet possible to do this from the CLI with `dagger call`, which greatly limits its utility. We could likely just re-use the syntax we use for `-m`, e.g.: * `dagger call go-test --module github.com/my-org/my-repo/my-mod`, where `--module` is an argument of type either `ModuleSource`, `Module` or an interface that the module must implement. That would in theory be extremely straightforward to implement while also unlocking all sorts of very interesting use cases
https://github.com/dagger/dagger/issues/6725
https://github.com/dagger/dagger/pull/6761
c5bf6978ba169abbc5cef54b3d7cd829f141d792
e02ff3d2b50665275deb52902abc46ac0f6f138a
"2024-02-23T18:56:08Z"
go
"2024-02-27T22:55:04Z"
core/integration/module_call_test.go
t.Parallel() c, ctx := connect(t) modGen := c.Container().From(golangImage). WithMountedFile(testCLIBinPath, daggerCliFile(t, c)). WithWorkdir("/work"). With(daggerExec("init", "--source=.", "--name=test", "--sdk=go")). WithNewFile("main.go", dagger.ContainerWithNewFileOpts{ Contents: `package main type Test struct { } func (t *Test) Hello() string { return "hello" } func (t *Test) File() *File { return dag.Directory().WithNewFile("foo.txt", "foo").File("foo.txt") } `, }) logGen(ctx, t, modGen.Directory(".")) t.Run("truncate file", func(t *testing.T) { out, err := modGen. WithNewFile("foo.txt", dagger.ContainerWithNewFileOpts{ Contents: "foobar", }). With(daggerCall("hello", "-o", "foo.txt")). File("foo.txt"). Contents(ctx) require.NoError(t, err)
closed
dagger/dagger
https://github.com/dagger/dagger
6,725
Support passing modules as arguments in the CLI
Modules can accept other modules as arguments to functions. Use cases: 1. SDKs implemented as modules do this already by accepting `ModuleSource` as an arg 2. Support for running tests of modules could use this: https://github.com/dagger/dagger/issues/6724 3. Support for re-executing modules in specialized hosts (i.e. run my module on a "gpu-as-a-service" platform) 4. Combined with support for interfaces, you could pass a module as an implementation of an interface argument (if it matches) * @vito mentioned one use case specifically around using this to construct a dev env that is defined across multiple modules and could be dynamically composed into one (IIUC, correct if I misunderstood) However, it's not yet possible to do this from the CLI with `dagger call`, which greatly limits its utility. We could likely just re-use the syntax we use for `-m`, e.g.: * `dagger call go-test --module github.com/my-org/my-repo/my-mod`, where `--module` is an argument of type either `ModuleSource`, `Module` or an interface that the module must implement. That would in theory be extremely straightforward to implement while also unlocking all sorts of very interesting use cases
https://github.com/dagger/dagger/issues/6725
https://github.com/dagger/dagger/pull/6761
c5bf6978ba169abbc5cef54b3d7cd829f141d792
e02ff3d2b50665275deb52902abc46ac0f6f138a
"2024-02-23T18:56:08Z"
go
"2024-02-27T22:55:04Z"
core/integration/module_call_test.go
require.Equal(t, "hello", out) }) t.Run("not a file", func(t *testing.T) { _, err := modGen.With(daggerCall("hello", "-o", ".")).Sync(ctx) require.ErrorContains(t, err, "is a directory") }) t.Run("allow dir for file", func(t *testing.T) { out, err := modGen. With(daggerCall("file", "-o", ".")). File("foo.txt"). Contents(ctx) require.NoError(t, err) require.Equal(t, "foo", out) }) t.Run("create parent dirs", func(t *testing.T) { ctr, err := modGen.With(daggerCall("hello", "-o", "foo/bar.txt")).Sync(ctx) require.NoError(t, err) t.Run("print success", func(t *testing.T) { out, err := ctr.Stderr(ctx) require.NoError(t, err) require.Contains(t, out, `Saved output to "/work/foo/bar.txt"`) }) t.Run("check directory permissions", func(t *testing.T) { out, err := ctr.WithExec([]string{"stat", "-c", "%a", "foo"}).Stdout(ctx) require.NoError(t, err) require.Equal(t, "755\n", out) }) t.Run("check file permissions", func(t *testing.T) { out, err := ctr.WithExec([]string{"stat", "-c", "%a", "foo/bar.txt"}).Stdout(ctx)
closed
dagger/dagger
https://github.com/dagger/dagger
6,725
Support passing modules as arguments in the CLI
Modules can accept other modules as arguments to functions. Use cases: 1. SDKs implemented as modules do this already by accepting `ModuleSource` as an arg 2. Support for running tests of modules could use this: https://github.com/dagger/dagger/issues/6724 3. Support for re-executing modules in specialized hosts (i.e. run my module on a "gpu-as-a-service" platform) 4. Combined with support for interfaces, you could pass a module as an implementation of an interface argument (if it matches) * @vito mentioned one use case specifically around using this to construct a dev env that is defined across multiple modules and could be dynamically composed into one (IIUC, correct if I misunderstood) However, it's not yet possible to do this from the CLI with `dagger call`, which greatly limits its utility. We could likely just re-use the syntax we use for `-m`, e.g.: * `dagger call go-test --module github.com/my-org/my-repo/my-mod`, where `--module` is an argument of type either `ModuleSource`, `Module` or an interface that the module must implement. That would in theory be extremely straightforward to implement while also unlocking all sorts of very interesting use cases
https://github.com/dagger/dagger/issues/6725
https://github.com/dagger/dagger/pull/6761
c5bf6978ba169abbc5cef54b3d7cd829f141d792
e02ff3d2b50665275deb52902abc46ac0f6f138a
"2024-02-23T18:56:08Z"
go
"2024-02-27T22:55:04Z"
core/integration/module_call_test.go
require.NoError(t, err) require.Equal(t, "644\n", out) }) }) t.Run("check umask", func(t *testing.T) { ctr, err := modGen. WithNewFile("/entrypoint.sh", dagger.ContainerWithNewFileOpts{ Contents: `#!/bin/sh umask 027 exec "$@" `, Permissions: 0o750, }). WithEntrypoint([]string{"/entrypoint.sh"}). With(daggerCall("hello", "-o", "/tmp/foo/bar.txt")). Sync(ctx) require.NoError(t, err) t.Run("directory", func(t *testing.T) { out, err := ctr.WithExec([]string{"stat", "-c", "%a", "/tmp/foo"}).Stdout(ctx) require.NoError(t, err) require.Equal(t, "750\n", out) }) t.Run("file", func(t *testing.T) { out, err := ctr.WithExec([]string{"stat", "-c", "%a", "/tmp/foo/bar.txt"}).Stdout(ctx) require.NoError(t, err) require.Equal(t, "640\n", out) }) }) } func TestModuleCallByName(t *testing.T) {
closed
dagger/dagger
https://github.com/dagger/dagger
6,725
Support passing modules as arguments in the CLI
Modules can accept other modules as arguments to functions. Use cases: 1. SDKs implemented as modules do this already by accepting `ModuleSource` as an arg 2. Support for running tests of modules could use this: https://github.com/dagger/dagger/issues/6724 3. Support for re-executing modules in specialized hosts (i.e. run my module on a "gpu-as-a-service" platform) 4. Combined with support for interfaces, you could pass a module as an implementation of an interface argument (if it matches) * @vito mentioned one use case specifically around using this to construct a dev env that is defined across multiple modules and could be dynamically composed into one (IIUC, correct if I misunderstood) However, it's not yet possible to do this from the CLI with `dagger call`, which greatly limits its utility. We could likely just re-use the syntax we use for `-m`, e.g.: * `dagger call go-test --module github.com/my-org/my-repo/my-mod`, where `--module` is an argument of type either `ModuleSource`, `Module` or an interface that the module must implement. That would in theory be extremely straightforward to implement while also unlocking all sorts of very interesting use cases
https://github.com/dagger/dagger/issues/6725
https://github.com/dagger/dagger/pull/6761
c5bf6978ba169abbc5cef54b3d7cd829f141d792
e02ff3d2b50665275deb52902abc46ac0f6f138a
"2024-02-23T18:56:08Z"
go
"2024-02-27T22:55:04Z"
core/integration/module_call_test.go
t.Parallel() t.Run("local", func(t *testing.T) { t.Parallel() c, ctx := connect(t) ctr := c.Container().From(golangImage). WithMountedFile(testCLIBinPath, daggerCliFile(t, c)). WithWorkdir("/work/mod-a"). With(daggerExec("init", "--source=.", "--name=mod-a", "--sdk=go")). WithNewFile("/work/mod-a/main.go", dagger.ContainerWithNewFileOpts{ Contents: `package main import "context" type ModA struct {} func (m *ModA) Fn(ctx context.Context) string { return "hi from mod-a" } `, }). WithWorkdir("/work/mod-b"). With(daggerExec("init", "--source=.", "--name=mod-b", "--sdk=go")). WithNewFile("/work/mod-b/main.go", dagger.ContainerWithNewFileOpts{ Contents: `package main import "context" type ModB struct {} func (m *ModB) Fn(ctx context.Context) string { return "hi from mod-b" } `,
closed
dagger/dagger
https://github.com/dagger/dagger
6,725
Support passing modules as arguments in the CLI
Modules can accept other modules as arguments to functions. Use cases: 1. SDKs implemented as modules do this already by accepting `ModuleSource` as an arg 2. Support for running tests of modules could use this: https://github.com/dagger/dagger/issues/6724 3. Support for re-executing modules in specialized hosts (i.e. run my module on a "gpu-as-a-service" platform) 4. Combined with support for interfaces, you could pass a module as an implementation of an interface argument (if it matches) * @vito mentioned one use case specifically around using this to construct a dev env that is defined across multiple modules and could be dynamically composed into one (IIUC, correct if I misunderstood) However, it's not yet possible to do this from the CLI with `dagger call`, which greatly limits its utility. We could likely just re-use the syntax we use for `-m`, e.g.: * `dagger call go-test --module github.com/my-org/my-repo/my-mod`, where `--module` is an argument of type either `ModuleSource`, `Module` or an interface that the module must implement. That would in theory be extremely straightforward to implement while also unlocking all sorts of very interesting use cases
https://github.com/dagger/dagger/issues/6725
https://github.com/dagger/dagger/pull/6761
c5bf6978ba169abbc5cef54b3d7cd829f141d792
e02ff3d2b50665275deb52902abc46ac0f6f138a
"2024-02-23T18:56:08Z"
go
"2024-02-27T22:55:04Z"
core/integration/module_call_test.go
}). WithWorkdir("/work"). With(daggerExec("init")). With(daggerExec("install", "--name", "foo", "./mod-a")). With(daggerExec("install", "--name", "bar", "./mod-b")) out, err := ctr.With(daggerCallAt("foo", "fn")).Stdout(ctx) require.NoError(t, err) require.Equal(t, "hi from mod-a", strings.TrimSpace(out)) out, err = ctr.With(daggerCallAt("bar", "fn")).Stdout(ctx) require.NoError(t, err) require.Equal(t, "hi from mod-b", strings.TrimSpace(out)) }) t.Run("git", 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")). With(daggerExec("install", "--name", "foo", testGitModuleRef(""))). With(daggerExec("install", "--name", "bar", testGitModuleRef("subdir/dep2"))) out, err := ctr.With(daggerCallAt("foo", "fn")).Stdout(ctx) require.NoError(t, err) require.Equal(t, "hi from root hi from dep hi from dep2", strings.TrimSpace(out)) out, err = ctr.With(daggerCallAt("bar", "fn")).Stdout(ctx) require.NoError(t, err) require.Equal(t, "hi from dep2", strings.TrimSpace(out)) }) } func TestModuleCallGitMod(t *testing.T) {
closed
dagger/dagger
https://github.com/dagger/dagger
6,725
Support passing modules as arguments in the CLI
Modules can accept other modules as arguments to functions. Use cases: 1. SDKs implemented as modules do this already by accepting `ModuleSource` as an arg 2. Support for running tests of modules could use this: https://github.com/dagger/dagger/issues/6724 3. Support for re-executing modules in specialized hosts (i.e. run my module on a "gpu-as-a-service" platform) 4. Combined with support for interfaces, you could pass a module as an implementation of an interface argument (if it matches) * @vito mentioned one use case specifically around using this to construct a dev env that is defined across multiple modules and could be dynamically composed into one (IIUC, correct if I misunderstood) However, it's not yet possible to do this from the CLI with `dagger call`, which greatly limits its utility. We could likely just re-use the syntax we use for `-m`, e.g.: * `dagger call go-test --module github.com/my-org/my-repo/my-mod`, where `--module` is an argument of type either `ModuleSource`, `Module` or an interface that the module must implement. That would in theory be extremely straightforward to implement while also unlocking all sorts of very interesting use cases
https://github.com/dagger/dagger/issues/6725
https://github.com/dagger/dagger/pull/6761
c5bf6978ba169abbc5cef54b3d7cd829f141d792
e02ff3d2b50665275deb52902abc46ac0f6f138a
"2024-02-23T18:56:08Z"
go
"2024-02-27T22:55:04Z"
core/integration/module_call_test.go
t.Parallel() c, ctx := connect(t) out, err := c.Container().From(golangImage). WithMountedFile(testCLIBinPath, daggerCliFile(t, c)). With(daggerCallAt(testGitModuleRef("top-level"), "fn")). Stdout(ctx) require.NoError(t, err) require.Equal(t, "hi from top level hi from dep hi from dep2", strings.TrimSpace(out)) }
closed
dagger/dagger
https://github.com/dagger/dagger
6,743
🐞 grpc: received message larger than max
### What is the issue? seeing these panics, running 0.9.11 dagger-engine, 0.9.11 dagger CLI, and 0.9.11 client: ```2024/02/26 21:24:05 http: panic serving 127.0.0.1:52322: rpc error: code = ResourceExhausted desc = grpc: received message larger than max (65067251 vs. 16777216) goroutine 760 [running]: net/http.(*conn).serve.func1() /usr/local/go/src/net/http/server.go:1868 +0xb0 panic({0xd0af20?, 0x4000092b70?}) /usr/local/go/src/runtime/panic.go:920 +0x26c github.com/dagger/dagger/engine/client.(*Client).ServeHTTP(0x40004169c0, {0x1068960, 0x4000606000}, 0x40004e0000) /app/engine/client/client.go:558 +0xa7c net/http.serverHandler.ServeHTTP({0x1064768?}, {0x1068960?, 0x4000606000?}, 0x6?) /usr/local/go/src/net/http/server.go:2938 +0xbc net/http.(*conn).serve(0x40001298c0, {0x106e768, 0x40003e4fc0}) /usr/local/go/src/net/http/server.go:2009 +0x518 created by net/http.(*Server).Serve in goroutine 67 /usr/local/go/src/net/http/server.go:3086 +0x4cc ``` ### Dagger version dagger v0.9.11 (registry.dagger.io/engine) linux/amd64 ### Steps to reproduce load contents of a dagger.Container's File, where the file is large, largest file in my manifest is 70546316 bytes: ``` fmt.Printf("starting transfer for %s: %s\n", deb_pkg, time.Now()) deb_data, err := testImage.File(deb_pkg).Contents(ctx) if err != nil { panic(err) } ``` ### Log output _No response_
https://github.com/dagger/dagger/issues/6743
https://github.com/dagger/dagger/pull/6772
7d606df4623db4f7ca9a5c28607e2d811263cf39
18c8c420d7c309c8f3735e985170a184a8b62d56
"2024-02-26T21:54:40Z"
go
"2024-03-05T10:02:01Z"
core/integration/file_test.go
package core import ( "bytes" "fmt" "os" "path/filepath" "strconv" "strings" "testing" "time" "dagger.io/dagger" "github.com/dagger/dagger/core" "github.com/dagger/dagger/engine/buildkit" "github.com/dagger/dagger/internal/testutil" "github.com/moby/buildkit/identity" "github.com/stretchr/testify/require" ) func TestFile(t *testing.T) { t.Parallel() var res struct {
closed
dagger/dagger
https://github.com/dagger/dagger
6,743
🐞 grpc: received message larger than max
### What is the issue? seeing these panics, running 0.9.11 dagger-engine, 0.9.11 dagger CLI, and 0.9.11 client: ```2024/02/26 21:24:05 http: panic serving 127.0.0.1:52322: rpc error: code = ResourceExhausted desc = grpc: received message larger than max (65067251 vs. 16777216) goroutine 760 [running]: net/http.(*conn).serve.func1() /usr/local/go/src/net/http/server.go:1868 +0xb0 panic({0xd0af20?, 0x4000092b70?}) /usr/local/go/src/runtime/panic.go:920 +0x26c github.com/dagger/dagger/engine/client.(*Client).ServeHTTP(0x40004169c0, {0x1068960, 0x4000606000}, 0x40004e0000) /app/engine/client/client.go:558 +0xa7c net/http.serverHandler.ServeHTTP({0x1064768?}, {0x1068960?, 0x4000606000?}, 0x6?) /usr/local/go/src/net/http/server.go:2938 +0xbc net/http.(*conn).serve(0x40001298c0, {0x106e768, 0x40003e4fc0}) /usr/local/go/src/net/http/server.go:2009 +0x518 created by net/http.(*Server).Serve in goroutine 67 /usr/local/go/src/net/http/server.go:3086 +0x4cc ``` ### Dagger version dagger v0.9.11 (registry.dagger.io/engine) linux/amd64 ### Steps to reproduce load contents of a dagger.Container's File, where the file is large, largest file in my manifest is 70546316 bytes: ``` fmt.Printf("starting transfer for %s: %s\n", deb_pkg, time.Now()) deb_data, err := testImage.File(deb_pkg).Contents(ctx) if err != nil { panic(err) } ``` ### Log output _No response_
https://github.com/dagger/dagger/issues/6743
https://github.com/dagger/dagger/pull/6772
7d606df4623db4f7ca9a5c28607e2d811263cf39
18c8c420d7c309c8f3735e985170a184a8b62d56
"2024-02-26T21:54:40Z"
go
"2024-03-05T10:02:01Z"
core/integration/file_test.go
Directory struct { WithNewFile struct { File struct { ID core.FileID Contents string } } } } err := testutil.Query( `{ directory { withNewFile(path: "some-file", contents: "some-content") { file(path: "some-file") { id contents } } } }`, &res, nil) require.NoError(t, err) require.NotEmpty(t, res.Directory.WithNewFile.File.ID) require.Equal(t, "some-content", res.Directory.WithNewFile.File.Contents) } func TestDirectoryFile(t *testing.T) { t.Parallel() var res struct { Directory struct {
closed
dagger/dagger
https://github.com/dagger/dagger
6,743
🐞 grpc: received message larger than max
### What is the issue? seeing these panics, running 0.9.11 dagger-engine, 0.9.11 dagger CLI, and 0.9.11 client: ```2024/02/26 21:24:05 http: panic serving 127.0.0.1:52322: rpc error: code = ResourceExhausted desc = grpc: received message larger than max (65067251 vs. 16777216) goroutine 760 [running]: net/http.(*conn).serve.func1() /usr/local/go/src/net/http/server.go:1868 +0xb0 panic({0xd0af20?, 0x4000092b70?}) /usr/local/go/src/runtime/panic.go:920 +0x26c github.com/dagger/dagger/engine/client.(*Client).ServeHTTP(0x40004169c0, {0x1068960, 0x4000606000}, 0x40004e0000) /app/engine/client/client.go:558 +0xa7c net/http.serverHandler.ServeHTTP({0x1064768?}, {0x1068960?, 0x4000606000?}, 0x6?) /usr/local/go/src/net/http/server.go:2938 +0xbc net/http.(*conn).serve(0x40001298c0, {0x106e768, 0x40003e4fc0}) /usr/local/go/src/net/http/server.go:2009 +0x518 created by net/http.(*Server).Serve in goroutine 67 /usr/local/go/src/net/http/server.go:3086 +0x4cc ``` ### Dagger version dagger v0.9.11 (registry.dagger.io/engine) linux/amd64 ### Steps to reproduce load contents of a dagger.Container's File, where the file is large, largest file in my manifest is 70546316 bytes: ``` fmt.Printf("starting transfer for %s: %s\n", deb_pkg, time.Now()) deb_data, err := testImage.File(deb_pkg).Contents(ctx) if err != nil { panic(err) } ``` ### Log output _No response_
https://github.com/dagger/dagger/issues/6743
https://github.com/dagger/dagger/pull/6772
7d606df4623db4f7ca9a5c28607e2d811263cf39
18c8c420d7c309c8f3735e985170a184a8b62d56
"2024-02-26T21:54:40Z"
go
"2024-03-05T10:02:01Z"
core/integration/file_test.go
WithNewFile struct { Directory struct { File struct { ID core.FileID Contents string } } } } } err := testutil.Query( `{ directory { withNewFile(path: "some-dir/some-file", contents: "some-content") { directory(path: "some-dir") { file(path: "some-file") { id contents } } } } }`, &res, nil) require.NoError(t, err) require.NotEmpty(t, res.Directory.WithNewFile.Directory.File.ID) require.Equal(t, "some-content", res.Directory.WithNewFile.Directory.File.Contents) } func TestFileSize(t *testing.T) { t.Parallel() var res struct {
closed
dagger/dagger
https://github.com/dagger/dagger
6,743
🐞 grpc: received message larger than max
### What is the issue? seeing these panics, running 0.9.11 dagger-engine, 0.9.11 dagger CLI, and 0.9.11 client: ```2024/02/26 21:24:05 http: panic serving 127.0.0.1:52322: rpc error: code = ResourceExhausted desc = grpc: received message larger than max (65067251 vs. 16777216) goroutine 760 [running]: net/http.(*conn).serve.func1() /usr/local/go/src/net/http/server.go:1868 +0xb0 panic({0xd0af20?, 0x4000092b70?}) /usr/local/go/src/runtime/panic.go:920 +0x26c github.com/dagger/dagger/engine/client.(*Client).ServeHTTP(0x40004169c0, {0x1068960, 0x4000606000}, 0x40004e0000) /app/engine/client/client.go:558 +0xa7c net/http.serverHandler.ServeHTTP({0x1064768?}, {0x1068960?, 0x4000606000?}, 0x6?) /usr/local/go/src/net/http/server.go:2938 +0xbc net/http.(*conn).serve(0x40001298c0, {0x106e768, 0x40003e4fc0}) /usr/local/go/src/net/http/server.go:2009 +0x518 created by net/http.(*Server).Serve in goroutine 67 /usr/local/go/src/net/http/server.go:3086 +0x4cc ``` ### Dagger version dagger v0.9.11 (registry.dagger.io/engine) linux/amd64 ### Steps to reproduce load contents of a dagger.Container's File, where the file is large, largest file in my manifest is 70546316 bytes: ``` fmt.Printf("starting transfer for %s: %s\n", deb_pkg, time.Now()) deb_data, err := testImage.File(deb_pkg).Contents(ctx) if err != nil { panic(err) } ``` ### Log output _No response_
https://github.com/dagger/dagger/issues/6743
https://github.com/dagger/dagger/pull/6772
7d606df4623db4f7ca9a5c28607e2d811263cf39
18c8c420d7c309c8f3735e985170a184a8b62d56
"2024-02-26T21:54:40Z"
go
"2024-03-05T10:02:01Z"
core/integration/file_test.go
Directory struct { WithNewFile struct { File struct { ID core.FileID Size int } } } } err := testutil.Query( `{ directory { withNewFile(path: "some-file", contents: "some-content") { file(path: "some-file") { id size } } } }`, &res, nil) require.NoError(t, err) require.NotEmpty(t, res.Directory.WithNewFile.File.ID) require.Equal(t, len("some-content"), res.Directory.WithNewFile.File.Size) } func TestFileName(t *testing.T) {
closed
dagger/dagger
https://github.com/dagger/dagger
6,743
🐞 grpc: received message larger than max
### What is the issue? seeing these panics, running 0.9.11 dagger-engine, 0.9.11 dagger CLI, and 0.9.11 client: ```2024/02/26 21:24:05 http: panic serving 127.0.0.1:52322: rpc error: code = ResourceExhausted desc = grpc: received message larger than max (65067251 vs. 16777216) goroutine 760 [running]: net/http.(*conn).serve.func1() /usr/local/go/src/net/http/server.go:1868 +0xb0 panic({0xd0af20?, 0x4000092b70?}) /usr/local/go/src/runtime/panic.go:920 +0x26c github.com/dagger/dagger/engine/client.(*Client).ServeHTTP(0x40004169c0, {0x1068960, 0x4000606000}, 0x40004e0000) /app/engine/client/client.go:558 +0xa7c net/http.serverHandler.ServeHTTP({0x1064768?}, {0x1068960?, 0x4000606000?}, 0x6?) /usr/local/go/src/net/http/server.go:2938 +0xbc net/http.(*conn).serve(0x40001298c0, {0x106e768, 0x40003e4fc0}) /usr/local/go/src/net/http/server.go:2009 +0x518 created by net/http.(*Server).Serve in goroutine 67 /usr/local/go/src/net/http/server.go:3086 +0x4cc ``` ### Dagger version dagger v0.9.11 (registry.dagger.io/engine) linux/amd64 ### Steps to reproduce load contents of a dagger.Container's File, where the file is large, largest file in my manifest is 70546316 bytes: ``` fmt.Printf("starting transfer for %s: %s\n", deb_pkg, time.Now()) deb_data, err := testImage.File(deb_pkg).Contents(ctx) if err != nil { panic(err) } ``` ### Log output _No response_
https://github.com/dagger/dagger/issues/6743
https://github.com/dagger/dagger/pull/6772
7d606df4623db4f7ca9a5c28607e2d811263cf39
18c8c420d7c309c8f3735e985170a184a8b62d56
"2024-02-26T21:54:40Z"
go
"2024-03-05T10:02:01Z"
core/integration/file_test.go
t.Parallel() wd := t.TempDir() c, ctx := connect(t, dagger.WithWorkdir(wd)) t.Run("new file", func(t *testing.T) { t.Parallel() file := c.Directory().WithNewFile("/foo/bar", "content1").File("foo/bar") name, err := file.Name(ctx) require.NoError(t, err) require.Equal(t, "bar", name) }) t.Run("container file", func(t *testing.T) { t.Parallel() file := c.Container().From(alpineImage).File("/etc/alpine-release") name, err := file.Name(ctx)
closed
dagger/dagger
https://github.com/dagger/dagger
6,743
🐞 grpc: received message larger than max
### What is the issue? seeing these panics, running 0.9.11 dagger-engine, 0.9.11 dagger CLI, and 0.9.11 client: ```2024/02/26 21:24:05 http: panic serving 127.0.0.1:52322: rpc error: code = ResourceExhausted desc = grpc: received message larger than max (65067251 vs. 16777216) goroutine 760 [running]: net/http.(*conn).serve.func1() /usr/local/go/src/net/http/server.go:1868 +0xb0 panic({0xd0af20?, 0x4000092b70?}) /usr/local/go/src/runtime/panic.go:920 +0x26c github.com/dagger/dagger/engine/client.(*Client).ServeHTTP(0x40004169c0, {0x1068960, 0x4000606000}, 0x40004e0000) /app/engine/client/client.go:558 +0xa7c net/http.serverHandler.ServeHTTP({0x1064768?}, {0x1068960?, 0x4000606000?}, 0x6?) /usr/local/go/src/net/http/server.go:2938 +0xbc net/http.(*conn).serve(0x40001298c0, {0x106e768, 0x40003e4fc0}) /usr/local/go/src/net/http/server.go:2009 +0x518 created by net/http.(*Server).Serve in goroutine 67 /usr/local/go/src/net/http/server.go:3086 +0x4cc ``` ### Dagger version dagger v0.9.11 (registry.dagger.io/engine) linux/amd64 ### Steps to reproduce load contents of a dagger.Container's File, where the file is large, largest file in my manifest is 70546316 bytes: ``` fmt.Printf("starting transfer for %s: %s\n", deb_pkg, time.Now()) deb_data, err := testImage.File(deb_pkg).Contents(ctx) if err != nil { panic(err) } ``` ### Log output _No response_
https://github.com/dagger/dagger/issues/6743
https://github.com/dagger/dagger/pull/6772
7d606df4623db4f7ca9a5c28607e2d811263cf39
18c8c420d7c309c8f3735e985170a184a8b62d56
"2024-02-26T21:54:40Z"
go
"2024-03-05T10:02:01Z"
core/integration/file_test.go
require.NoError(t, err) require.Equal(t, "alpine-release", name) }) t.Run("container file in dir", func(t *testing.T) { t.Parallel() file := c.Container().From(alpineImage).Directory("/etc").File("/alpine-release") name, err := file.Name(ctx) require.NoError(t, err) require.Equal(t, "alpine-release", name) }) t.Run("host file", func(t *testing.T) { t.Parallel() err := os.WriteFile(filepath.Join(wd, "file.txt"), []byte{}, 0o600) require.NoError(t, err) name, err := c.Host().File("file.txt").Name(ctx) require.NoError(t, err) require.Equal(t, "file.txt", name) }) t.Run("host file in dir", func(t *testing.T) { t.Parallel() err := os.MkdirAll(filepath.Join(wd, "path/to/"), 0o700) require.NoError(t, err) err = os.WriteFile(filepath.Join(wd, "path/to/file.txt"), []byte{}, 0o600) require.NoError(t, err) name, err := c.Host().Directory("path").File("to/file.txt").Name(ctx) require.NoError(t, err) require.Equal(t, "file.txt", name) }) } func TestFileExport(t *testing.T) {
closed
dagger/dagger
https://github.com/dagger/dagger
6,743
🐞 grpc: received message larger than max
### What is the issue? seeing these panics, running 0.9.11 dagger-engine, 0.9.11 dagger CLI, and 0.9.11 client: ```2024/02/26 21:24:05 http: panic serving 127.0.0.1:52322: rpc error: code = ResourceExhausted desc = grpc: received message larger than max (65067251 vs. 16777216) goroutine 760 [running]: net/http.(*conn).serve.func1() /usr/local/go/src/net/http/server.go:1868 +0xb0 panic({0xd0af20?, 0x4000092b70?}) /usr/local/go/src/runtime/panic.go:920 +0x26c github.com/dagger/dagger/engine/client.(*Client).ServeHTTP(0x40004169c0, {0x1068960, 0x4000606000}, 0x40004e0000) /app/engine/client/client.go:558 +0xa7c net/http.serverHandler.ServeHTTP({0x1064768?}, {0x1068960?, 0x4000606000?}, 0x6?) /usr/local/go/src/net/http/server.go:2938 +0xbc net/http.(*conn).serve(0x40001298c0, {0x106e768, 0x40003e4fc0}) /usr/local/go/src/net/http/server.go:2009 +0x518 created by net/http.(*Server).Serve in goroutine 67 /usr/local/go/src/net/http/server.go:3086 +0x4cc ``` ### Dagger version dagger v0.9.11 (registry.dagger.io/engine) linux/amd64 ### Steps to reproduce load contents of a dagger.Container's File, where the file is large, largest file in my manifest is 70546316 bytes: ``` fmt.Printf("starting transfer for %s: %s\n", deb_pkg, time.Now()) deb_data, err := testImage.File(deb_pkg).Contents(ctx) if err != nil { panic(err) } ``` ### Log output _No response_
https://github.com/dagger/dagger/issues/6743
https://github.com/dagger/dagger/pull/6772
7d606df4623db4f7ca9a5c28607e2d811263cf39
18c8c420d7c309c8f3735e985170a184a8b62d56
"2024-02-26T21:54:40Z"
go
"2024-03-05T10:02:01Z"
core/integration/file_test.go
t.Parallel() wd := t.TempDir() targetDir := t.TempDir() c, ctx := connect(t, dagger.WithWorkdir(wd)) file := c.Container().From(alpineImage).File("/etc/alpine-release") t.Run("to absolute path", func(t *testing.T) { dest := filepath.Join(targetDir, "some-file") ok, err := file.Export(ctx, dest) require.NoError(t, err) require.True(t, ok) contents, err := os.ReadFile(dest) require.NoError(t, err) require.Equal(t, "3.18.2\n", string(contents)) entries, err := ls(targetDir) require.NoError(t, err) require.Len(t, entries, 1) }) t.Run("to relative path", func(t *testing.T) { ok, err := file.Export(ctx, "some-file") require.NoError(t, err) require.True(t, ok) contents, err := os.ReadFile(filepath.Join(wd, "some-file")) require.NoError(t, err) require.Equal(t, "3.18.2\n", string(contents)) entries, err := ls(wd)
closed
dagger/dagger
https://github.com/dagger/dagger
6,743
🐞 grpc: received message larger than max
### What is the issue? seeing these panics, running 0.9.11 dagger-engine, 0.9.11 dagger CLI, and 0.9.11 client: ```2024/02/26 21:24:05 http: panic serving 127.0.0.1:52322: rpc error: code = ResourceExhausted desc = grpc: received message larger than max (65067251 vs. 16777216) goroutine 760 [running]: net/http.(*conn).serve.func1() /usr/local/go/src/net/http/server.go:1868 +0xb0 panic({0xd0af20?, 0x4000092b70?}) /usr/local/go/src/runtime/panic.go:920 +0x26c github.com/dagger/dagger/engine/client.(*Client).ServeHTTP(0x40004169c0, {0x1068960, 0x4000606000}, 0x40004e0000) /app/engine/client/client.go:558 +0xa7c net/http.serverHandler.ServeHTTP({0x1064768?}, {0x1068960?, 0x4000606000?}, 0x6?) /usr/local/go/src/net/http/server.go:2938 +0xbc net/http.(*conn).serve(0x40001298c0, {0x106e768, 0x40003e4fc0}) /usr/local/go/src/net/http/server.go:2009 +0x518 created by net/http.(*Server).Serve in goroutine 67 /usr/local/go/src/net/http/server.go:3086 +0x4cc ``` ### Dagger version dagger v0.9.11 (registry.dagger.io/engine) linux/amd64 ### Steps to reproduce load contents of a dagger.Container's File, where the file is large, largest file in my manifest is 70546316 bytes: ``` fmt.Printf("starting transfer for %s: %s\n", deb_pkg, time.Now()) deb_data, err := testImage.File(deb_pkg).Contents(ctx) if err != nil { panic(err) } ``` ### Log output _No response_
https://github.com/dagger/dagger/issues/6743
https://github.com/dagger/dagger/pull/6772
7d606df4623db4f7ca9a5c28607e2d811263cf39
18c8c420d7c309c8f3735e985170a184a8b62d56
"2024-02-26T21:54:40Z"
go
"2024-03-05T10:02:01Z"
core/integration/file_test.go
require.NoError(t, err) require.Len(t, entries, 1) }) t.Run("to path in outer dir", func(t *testing.T) { ok, err := file.Export(ctx, "../some-file") require.Error(t, err) require.False(t, ok) }) t.Run("to absolute dir", func(t *testing.T) { ok, err := file.Export(ctx, targetDir) require.Error(t, err) require.False(t, ok) }) t.Run("to workdir", func(t *testing.T) { ok, err := file.Export(ctx, ".") require.Error(t, err) require.False(t, ok) }) t.Run("file under subdir", func(t *testing.T) { dir := c.Directory(). WithNewFile("/file", "content1"). WithNewFile("/subdir/file", "content2") file := dir.File("/subdir/file") dest := filepath.Join(targetDir, "da-file") _, err := file.Export(ctx, dest) require.NoError(t, err) contents, err := os.ReadFile(dest) require.NoError(t, err) require.Equal(t, "content2", string(contents)) dir = dir.Directory("/subdir")
closed
dagger/dagger
https://github.com/dagger/dagger
6,743
🐞 grpc: received message larger than max
### What is the issue? seeing these panics, running 0.9.11 dagger-engine, 0.9.11 dagger CLI, and 0.9.11 client: ```2024/02/26 21:24:05 http: panic serving 127.0.0.1:52322: rpc error: code = ResourceExhausted desc = grpc: received message larger than max (65067251 vs. 16777216) goroutine 760 [running]: net/http.(*conn).serve.func1() /usr/local/go/src/net/http/server.go:1868 +0xb0 panic({0xd0af20?, 0x4000092b70?}) /usr/local/go/src/runtime/panic.go:920 +0x26c github.com/dagger/dagger/engine/client.(*Client).ServeHTTP(0x40004169c0, {0x1068960, 0x4000606000}, 0x40004e0000) /app/engine/client/client.go:558 +0xa7c net/http.serverHandler.ServeHTTP({0x1064768?}, {0x1068960?, 0x4000606000?}, 0x6?) /usr/local/go/src/net/http/server.go:2938 +0xbc net/http.(*conn).serve(0x40001298c0, {0x106e768, 0x40003e4fc0}) /usr/local/go/src/net/http/server.go:2009 +0x518 created by net/http.(*Server).Serve in goroutine 67 /usr/local/go/src/net/http/server.go:3086 +0x4cc ``` ### Dagger version dagger v0.9.11 (registry.dagger.io/engine) linux/amd64 ### Steps to reproduce load contents of a dagger.Container's File, where the file is large, largest file in my manifest is 70546316 bytes: ``` fmt.Printf("starting transfer for %s: %s\n", deb_pkg, time.Now()) deb_data, err := testImage.File(deb_pkg).Contents(ctx) if err != nil { panic(err) } ``` ### Log output _No response_
https://github.com/dagger/dagger/issues/6743
https://github.com/dagger/dagger/pull/6772
7d606df4623db4f7ca9a5c28607e2d811263cf39
18c8c420d7c309c8f3735e985170a184a8b62d56
"2024-02-26T21:54:40Z"
go
"2024-03-05T10:02:01Z"
core/integration/file_test.go
file = dir.File("file") dest = filepath.Join(targetDir, "da-file-2") _, err = file.Export(ctx, dest) require.NoError(t, err) contents, err = os.ReadFile(dest) require.NoError(t, err) require.Equal(t, "content2", string(contents)) }) t.Run("file larger than max chunk size", func(t *testing.T) { maxChunkSize := buildkit.MaxFileContentsChunkSize fileSizeBytes := maxChunkSize*4 + 1 _, err := c.Container().From(alpineImage).WithExec([]string{"sh", "-c", fmt.Sprintf("dd if=/dev/zero of=/file bs=%d count=1", fileSizeBytes)}). File("/file").Export(ctx, "some-pretty-big-file") require.NoError(t, err) stat, err := os.Stat(filepath.Join(wd, "some-pretty-big-file")) require.NoError(t, err) require.EqualValues(t, fileSizeBytes, stat.Size()) }) t.Run("file permissions are retained", func(t *testing.T) { _, err := c.Directory().WithNewFile("/file", "#!/bin/sh\necho hello", dagger.DirectoryWithNewFileOpts{ Permissions: 0744, }).File("/file").Export(ctx, "some-executable-file") require.NoError(t, err) stat, err := os.Stat(filepath.Join(wd, "some-executable-file")) require.NoError(t, err) require.EqualValues(t, 0744, stat.Mode().Perm()) }) } func TestFileWithTimestamps(t *testing.T) {
closed
dagger/dagger
https://github.com/dagger/dagger
6,743
🐞 grpc: received message larger than max
### What is the issue? seeing these panics, running 0.9.11 dagger-engine, 0.9.11 dagger CLI, and 0.9.11 client: ```2024/02/26 21:24:05 http: panic serving 127.0.0.1:52322: rpc error: code = ResourceExhausted desc = grpc: received message larger than max (65067251 vs. 16777216) goroutine 760 [running]: net/http.(*conn).serve.func1() /usr/local/go/src/net/http/server.go:1868 +0xb0 panic({0xd0af20?, 0x4000092b70?}) /usr/local/go/src/runtime/panic.go:920 +0x26c github.com/dagger/dagger/engine/client.(*Client).ServeHTTP(0x40004169c0, {0x1068960, 0x4000606000}, 0x40004e0000) /app/engine/client/client.go:558 +0xa7c net/http.serverHandler.ServeHTTP({0x1064768?}, {0x1068960?, 0x4000606000?}, 0x6?) /usr/local/go/src/net/http/server.go:2938 +0xbc net/http.(*conn).serve(0x40001298c0, {0x106e768, 0x40003e4fc0}) /usr/local/go/src/net/http/server.go:2009 +0x518 created by net/http.(*Server).Serve in goroutine 67 /usr/local/go/src/net/http/server.go:3086 +0x4cc ``` ### Dagger version dagger v0.9.11 (registry.dagger.io/engine) linux/amd64 ### Steps to reproduce load contents of a dagger.Container's File, where the file is large, largest file in my manifest is 70546316 bytes: ``` fmt.Printf("starting transfer for %s: %s\n", deb_pkg, time.Now()) deb_data, err := testImage.File(deb_pkg).Contents(ctx) if err != nil { panic(err) } ``` ### Log output _No response_
https://github.com/dagger/dagger/issues/6743
https://github.com/dagger/dagger/pull/6772
7d606df4623db4f7ca9a5c28607e2d811263cf39
18c8c420d7c309c8f3735e985170a184a8b62d56
"2024-02-26T21:54:40Z"
go
"2024-03-05T10:02:01Z"
core/integration/file_test.go
t.Parallel() c, ctx := connect(t) reallyImportantTime := time.Date(1985, 10, 26, 8, 15, 0, 0, time.UTC) file := c.Directory(). WithNewFile("sub-dir/sub-file", "sub-content"). File("sub-dir/sub-file"). WithTimestamps(int(reallyImportantTime.Unix())) ls, err := c.Container(). From(alpineImage). WithMountedFile("/file", file). WithEnvVariable("RANDOM", identity.NewID()). WithExec([]string{"stat", "/file"}). Stdout(ctx) require.NoError(t, err) require.Contains(t, ls, "Access: 1985-10-26 08:15:00.000000000 +0000") require.Contains(t, ls, "Modify: 1985-10-26 08:15:00.000000000 +0000") } func TestFileContents(t *testing.T) { t.Parallel() c, ctx := connect(t) testFiles := []struct {
closed
dagger/dagger
https://github.com/dagger/dagger
6,743
🐞 grpc: received message larger than max
### What is the issue? seeing these panics, running 0.9.11 dagger-engine, 0.9.11 dagger CLI, and 0.9.11 client: ```2024/02/26 21:24:05 http: panic serving 127.0.0.1:52322: rpc error: code = ResourceExhausted desc = grpc: received message larger than max (65067251 vs. 16777216) goroutine 760 [running]: net/http.(*conn).serve.func1() /usr/local/go/src/net/http/server.go:1868 +0xb0 panic({0xd0af20?, 0x4000092b70?}) /usr/local/go/src/runtime/panic.go:920 +0x26c github.com/dagger/dagger/engine/client.(*Client).ServeHTTP(0x40004169c0, {0x1068960, 0x4000606000}, 0x40004e0000) /app/engine/client/client.go:558 +0xa7c net/http.serverHandler.ServeHTTP({0x1064768?}, {0x1068960?, 0x4000606000?}, 0x6?) /usr/local/go/src/net/http/server.go:2938 +0xbc net/http.(*conn).serve(0x40001298c0, {0x106e768, 0x40003e4fc0}) /usr/local/go/src/net/http/server.go:2009 +0x518 created by net/http.(*Server).Serve in goroutine 67 /usr/local/go/src/net/http/server.go:3086 +0x4cc ``` ### Dagger version dagger v0.9.11 (registry.dagger.io/engine) linux/amd64 ### Steps to reproduce load contents of a dagger.Container's File, where the file is large, largest file in my manifest is 70546316 bytes: ``` fmt.Printf("starting transfer for %s: %s\n", deb_pkg, time.Now()) deb_data, err := testImage.File(deb_pkg).Contents(ctx) if err != nil { panic(err) } ``` ### Log output _No response_
https://github.com/dagger/dagger/issues/6743
https://github.com/dagger/dagger/pull/6772
7d606df4623db4f7ca9a5c28607e2d811263cf39
18c8c420d7c309c8f3735e985170a184a8b62d56
"2024-02-26T21:54:40Z"
go
"2024-03-05T10:02:01Z"
core/integration/file_test.go
size int hash string }{ {size: buildkit.MaxFileContentsChunkSize / 2}, {size: buildkit.MaxFileContentsChunkSize}, {size: buildkit.MaxFileContentsChunkSize * 2}, {size: buildkit.MaxFileContentsSize + 1}, } tempDir := t.TempDir() for i, testFile := range testFiles { filename := strconv.Itoa(i) dest := filepath.Join(tempDir, filename) var buf bytes.Buffer for i := 0; i < testFile.size; i++ { buf.WriteByte('a') } err := os.WriteFile(dest, buf.Bytes(), 0o600) require.NoError(t, err) testFiles[i].hash = computeMD5FromReader(&buf) } hostDir := c.Host().Directory(tempDir) alpine := c.Container(). From(alpineImage).WithDirectory(".", hostDir) for i, testFile := range testFiles { filename := strconv.Itoa(i) contents, err := alpine.File(filename).Contents(ctx)
closed
dagger/dagger
https://github.com/dagger/dagger
6,743
🐞 grpc: received message larger than max
### What is the issue? seeing these panics, running 0.9.11 dagger-engine, 0.9.11 dagger CLI, and 0.9.11 client: ```2024/02/26 21:24:05 http: panic serving 127.0.0.1:52322: rpc error: code = ResourceExhausted desc = grpc: received message larger than max (65067251 vs. 16777216) goroutine 760 [running]: net/http.(*conn).serve.func1() /usr/local/go/src/net/http/server.go:1868 +0xb0 panic({0xd0af20?, 0x4000092b70?}) /usr/local/go/src/runtime/panic.go:920 +0x26c github.com/dagger/dagger/engine/client.(*Client).ServeHTTP(0x40004169c0, {0x1068960, 0x4000606000}, 0x40004e0000) /app/engine/client/client.go:558 +0xa7c net/http.serverHandler.ServeHTTP({0x1064768?}, {0x1068960?, 0x4000606000?}, 0x6?) /usr/local/go/src/net/http/server.go:2938 +0xbc net/http.(*conn).serve(0x40001298c0, {0x106e768, 0x40003e4fc0}) /usr/local/go/src/net/http/server.go:2009 +0x518 created by net/http.(*Server).Serve in goroutine 67 /usr/local/go/src/net/http/server.go:3086 +0x4cc ``` ### Dagger version dagger v0.9.11 (registry.dagger.io/engine) linux/amd64 ### Steps to reproduce load contents of a dagger.Container's File, where the file is large, largest file in my manifest is 70546316 bytes: ``` fmt.Printf("starting transfer for %s: %s\n", deb_pkg, time.Now()) deb_data, err := testImage.File(deb_pkg).Contents(ctx) if err != nil { panic(err) } ``` ### Log output _No response_
https://github.com/dagger/dagger/issues/6743
https://github.com/dagger/dagger/pull/6772
7d606df4623db4f7ca9a5c28607e2d811263cf39
18c8c420d7c309c8f3735e985170a184a8b62d56
"2024-02-26T21:54:40Z"
go
"2024-03-05T10:02:01Z"
core/integration/file_test.go
if testFile.size > buildkit.MaxFileContentsSize { require.Error(t, err) continue } require.NoError(t, err) contentsHash := computeMD5FromReader(strings.NewReader(contents)) require.Equal(t, testFile.hash, contentsHash) } } func TestFileSync(t *testing.T) { t.Parallel() c, ctx := connect(t) t.Run("triggers error", func(t *testing.T) { _, err := c.Directory().File("baz").Sync(ctx) require.Error(t, err) require.Contains(t, err.Error(), "no such file") _, err = c.Container().From(alpineImage).File("/bar").Sync(ctx) require.Error(t, err) require.Contains(t, err.Error(), "no such file") }) t.Run("allows chaining", func(t *testing.T) { file, err := c.Directory().WithNewFile("foo", "bar").File("foo").Sync(ctx) require.NoError(t, err) contents, err := file.Contents(ctx) require.NoError(t, err) require.Equal(t, "bar", contents) }) }
closed
dagger/dagger
https://github.com/dagger/dagger
6,743
🐞 grpc: received message larger than max
### What is the issue? seeing these panics, running 0.9.11 dagger-engine, 0.9.11 dagger CLI, and 0.9.11 client: ```2024/02/26 21:24:05 http: panic serving 127.0.0.1:52322: rpc error: code = ResourceExhausted desc = grpc: received message larger than max (65067251 vs. 16777216) goroutine 760 [running]: net/http.(*conn).serve.func1() /usr/local/go/src/net/http/server.go:1868 +0xb0 panic({0xd0af20?, 0x4000092b70?}) /usr/local/go/src/runtime/panic.go:920 +0x26c github.com/dagger/dagger/engine/client.(*Client).ServeHTTP(0x40004169c0, {0x1068960, 0x4000606000}, 0x40004e0000) /app/engine/client/client.go:558 +0xa7c net/http.serverHandler.ServeHTTP({0x1064768?}, {0x1068960?, 0x4000606000?}, 0x6?) /usr/local/go/src/net/http/server.go:2938 +0xbc net/http.(*conn).serve(0x40001298c0, {0x106e768, 0x40003e4fc0}) /usr/local/go/src/net/http/server.go:2009 +0x518 created by net/http.(*Server).Serve in goroutine 67 /usr/local/go/src/net/http/server.go:3086 +0x4cc ``` ### Dagger version dagger v0.9.11 (registry.dagger.io/engine) linux/amd64 ### Steps to reproduce load contents of a dagger.Container's File, where the file is large, largest file in my manifest is 70546316 bytes: ``` fmt.Printf("starting transfer for %s: %s\n", deb_pkg, time.Now()) deb_data, err := testImage.File(deb_pkg).Contents(ctx) if err != nil { panic(err) } ``` ### Log output _No response_
https://github.com/dagger/dagger/issues/6743
https://github.com/dagger/dagger/pull/6772
7d606df4623db4f7ca9a5c28607e2d811263cf39
18c8c420d7c309c8f3735e985170a184a8b62d56
"2024-02-26T21:54:40Z"
go
"2024-03-05T10:02:01Z"
engine/server/server.go
package server import ( "bytes" "context" "errors" "fmt" "io" "net" "net/http" "os" "sync" "time" "github.com/dagger/dagger/analytics" "github.com/dagger/dagger/auth" "github.com/dagger/dagger/core" "github.com/dagger/dagger/core/pipeline" "github.com/dagger/dagger/core/schema" "github.com/dagger/dagger/engine" "github.com/dagger/dagger/engine/buildkit" bksession "github.com/moby/buildkit/session" "github.com/moby/buildkit/util/bklog" bkworker "github.com/moby/buildkit/worker" "github.com/sirupsen/logrus" "github.com/vito/progrock" ) type DaggerServer struct {
closed
dagger/dagger
https://github.com/dagger/dagger
6,743
🐞 grpc: received message larger than max
### What is the issue? seeing these panics, running 0.9.11 dagger-engine, 0.9.11 dagger CLI, and 0.9.11 client: ```2024/02/26 21:24:05 http: panic serving 127.0.0.1:52322: rpc error: code = ResourceExhausted desc = grpc: received message larger than max (65067251 vs. 16777216) goroutine 760 [running]: net/http.(*conn).serve.func1() /usr/local/go/src/net/http/server.go:1868 +0xb0 panic({0xd0af20?, 0x4000092b70?}) /usr/local/go/src/runtime/panic.go:920 +0x26c github.com/dagger/dagger/engine/client.(*Client).ServeHTTP(0x40004169c0, {0x1068960, 0x4000606000}, 0x40004e0000) /app/engine/client/client.go:558 +0xa7c net/http.serverHandler.ServeHTTP({0x1064768?}, {0x1068960?, 0x4000606000?}, 0x6?) /usr/local/go/src/net/http/server.go:2938 +0xbc net/http.(*conn).serve(0x40001298c0, {0x106e768, 0x40003e4fc0}) /usr/local/go/src/net/http/server.go:2009 +0x518 created by net/http.(*Server).Serve in goroutine 67 /usr/local/go/src/net/http/server.go:3086 +0x4cc ``` ### Dagger version dagger v0.9.11 (registry.dagger.io/engine) linux/amd64 ### Steps to reproduce load contents of a dagger.Container's File, where the file is large, largest file in my manifest is 70546316 bytes: ``` fmt.Printf("starting transfer for %s: %s\n", deb_pkg, time.Now()) deb_data, err := testImage.File(deb_pkg).Contents(ctx) if err != nil { panic(err) } ``` ### Log output _No response_
https://github.com/dagger/dagger/issues/6743
https://github.com/dagger/dagger/pull/6772
7d606df4623db4f7ca9a5c28607e2d811263cf39
18c8c420d7c309c8f3735e985170a184a8b62d56
"2024-02-26T21:54:40Z"
go
"2024-03-05T10:02:01Z"
engine/server/server.go
serverID string bkClient *buildkit.Client worker bkworker.Worker schema *schema.APIServer recorder *progrock.Recorder analytics analytics.Tracker progCleanup func() error doneCh chan struct{}
closed
dagger/dagger
https://github.com/dagger/dagger
6,743
🐞 grpc: received message larger than max
### What is the issue? seeing these panics, running 0.9.11 dagger-engine, 0.9.11 dagger CLI, and 0.9.11 client: ```2024/02/26 21:24:05 http: panic serving 127.0.0.1:52322: rpc error: code = ResourceExhausted desc = grpc: received message larger than max (65067251 vs. 16777216) goroutine 760 [running]: net/http.(*conn).serve.func1() /usr/local/go/src/net/http/server.go:1868 +0xb0 panic({0xd0af20?, 0x4000092b70?}) /usr/local/go/src/runtime/panic.go:920 +0x26c github.com/dagger/dagger/engine/client.(*Client).ServeHTTP(0x40004169c0, {0x1068960, 0x4000606000}, 0x40004e0000) /app/engine/client/client.go:558 +0xa7c net/http.serverHandler.ServeHTTP({0x1064768?}, {0x1068960?, 0x4000606000?}, 0x6?) /usr/local/go/src/net/http/server.go:2938 +0xbc net/http.(*conn).serve(0x40001298c0, {0x106e768, 0x40003e4fc0}) /usr/local/go/src/net/http/server.go:2009 +0x518 created by net/http.(*Server).Serve in goroutine 67 /usr/local/go/src/net/http/server.go:3086 +0x4cc ``` ### Dagger version dagger v0.9.11 (registry.dagger.io/engine) linux/amd64 ### Steps to reproduce load contents of a dagger.Container's File, where the file is large, largest file in my manifest is 70546316 bytes: ``` fmt.Printf("starting transfer for %s: %s\n", deb_pkg, time.Now()) deb_data, err := testImage.File(deb_pkg).Contents(ctx) if err != nil { panic(err) } ``` ### Log output _No response_
https://github.com/dagger/dagger/issues/6743
https://github.com/dagger/dagger/pull/6772
7d606df4623db4f7ca9a5c28607e2d811263cf39
18c8c420d7c309c8f3735e985170a184a8b62d56
"2024-02-26T21:54:40Z"
go
"2024-03-05T10:02:01Z"
engine/server/server.go
closeOnce sync.Once connectedClients int clientMu sync.RWMutex } func NewDaggerServer( ctx context.Context, bkClient *buildkit.Client, worker bkworker.Worker, caller bksession.Caller, serverID string, secretStore *core.SecretStore, authProvider *auth.RegistryAuthProvider, rootLabels []pipeline.Label, cloudToken string, doNotTrack bool, ) (*DaggerServer, error) { srv := &DaggerServer{ serverID: serverID, bkClient: bkClient, worker: worker, analytics: analytics.New(analytics.Config{ DoNotTrack: doNotTrack || analytics.DoNotTrack(), Labels: rootLabels, CloudToken: cloudToken, }), doneCh: make(chan struct{}, 1),
closed
dagger/dagger
https://github.com/dagger/dagger
6,743
🐞 grpc: received message larger than max
### What is the issue? seeing these panics, running 0.9.11 dagger-engine, 0.9.11 dagger CLI, and 0.9.11 client: ```2024/02/26 21:24:05 http: panic serving 127.0.0.1:52322: rpc error: code = ResourceExhausted desc = grpc: received message larger than max (65067251 vs. 16777216) goroutine 760 [running]: net/http.(*conn).serve.func1() /usr/local/go/src/net/http/server.go:1868 +0xb0 panic({0xd0af20?, 0x4000092b70?}) /usr/local/go/src/runtime/panic.go:920 +0x26c github.com/dagger/dagger/engine/client.(*Client).ServeHTTP(0x40004169c0, {0x1068960, 0x4000606000}, 0x40004e0000) /app/engine/client/client.go:558 +0xa7c net/http.serverHandler.ServeHTTP({0x1064768?}, {0x1068960?, 0x4000606000?}, 0x6?) /usr/local/go/src/net/http/server.go:2938 +0xbc net/http.(*conn).serve(0x40001298c0, {0x106e768, 0x40003e4fc0}) /usr/local/go/src/net/http/server.go:2009 +0x518 created by net/http.(*Server).Serve in goroutine 67 /usr/local/go/src/net/http/server.go:3086 +0x4cc ``` ### Dagger version dagger v0.9.11 (registry.dagger.io/engine) linux/amd64 ### Steps to reproduce load contents of a dagger.Container's File, where the file is large, largest file in my manifest is 70546316 bytes: ``` fmt.Printf("starting transfer for %s: %s\n", deb_pkg, time.Now()) deb_data, err := testImage.File(deb_pkg).Contents(ctx) if err != nil { panic(err) } ``` ### Log output _No response_
https://github.com/dagger/dagger/issues/6743
https://github.com/dagger/dagger/pull/6772
7d606df4623db4f7ca9a5c28607e2d811263cf39
18c8c420d7c309c8f3735e985170a184a8b62d56
"2024-02-26T21:54:40Z"
go
"2024-03-05T10:02:01Z"
engine/server/server.go
} clientConn := caller.Conn() progClient := progrock.NewProgressServiceClient(clientConn) progUpdates, err := progClient.WriteUpdates(ctx) if err != nil { return nil, err } progWriter, progCleanup, err := buildkit.ProgrockForwarder(bkClient.ProgSockPath, progrock.MultiWriter{ progrock.NewRPCWriter(clientConn, progUpdates), buildkit.ProgrockLogrusWriter{}, }) if err != nil { return nil, err } srv.progCleanup = progCleanup progrockLabels := []*progrock.Label{} for _, label := range rootLabels { progrockLabels = append(progrockLabels, &progrock.Label{ Name: label.Name, Value: label.Value, }) } srv.recorder = progrock.NewRecorder(progWriter, progrock.WithLabels(progrockLabels...))
closed
dagger/dagger
https://github.com/dagger/dagger
6,743
🐞 grpc: received message larger than max
### What is the issue? seeing these panics, running 0.9.11 dagger-engine, 0.9.11 dagger CLI, and 0.9.11 client: ```2024/02/26 21:24:05 http: panic serving 127.0.0.1:52322: rpc error: code = ResourceExhausted desc = grpc: received message larger than max (65067251 vs. 16777216) goroutine 760 [running]: net/http.(*conn).serve.func1() /usr/local/go/src/net/http/server.go:1868 +0xb0 panic({0xd0af20?, 0x4000092b70?}) /usr/local/go/src/runtime/panic.go:920 +0x26c github.com/dagger/dagger/engine/client.(*Client).ServeHTTP(0x40004169c0, {0x1068960, 0x4000606000}, 0x40004e0000) /app/engine/client/client.go:558 +0xa7c net/http.serverHandler.ServeHTTP({0x1064768?}, {0x1068960?, 0x4000606000?}, 0x6?) /usr/local/go/src/net/http/server.go:2938 +0xbc net/http.(*conn).serve(0x40001298c0, {0x106e768, 0x40003e4fc0}) /usr/local/go/src/net/http/server.go:2009 +0x518 created by net/http.(*Server).Serve in goroutine 67 /usr/local/go/src/net/http/server.go:3086 +0x4cc ``` ### Dagger version dagger v0.9.11 (registry.dagger.io/engine) linux/amd64 ### Steps to reproduce load contents of a dagger.Container's File, where the file is large, largest file in my manifest is 70546316 bytes: ``` fmt.Printf("starting transfer for %s: %s\n", deb_pkg, time.Now()) deb_data, err := testImage.File(deb_pkg).Contents(ctx) if err != nil { panic(err) } ``` ### Log output _No response_
https://github.com/dagger/dagger/issues/6743
https://github.com/dagger/dagger/pull/6772
7d606df4623db4f7ca9a5c28607e2d811263cf39
18c8c420d7c309c8f3735e985170a184a8b62d56
"2024-02-26T21:54:40Z"
go
"2024-03-05T10:02:01Z"
engine/server/server.go
bkClient.WriteStatusesTo(context.Background(), srv.recorder) apiSchema, err := schema.New(ctx, schema.InitializeArgs{ BuildkitClient: srv.bkClient, Platform: srv.worker.Platforms(true)[0], ProgSockPath: bkClient.ProgSockPath, OCIStore: srv.worker.ContentStore(), LeaseManager: srv.worker.LeaseManager(), Secrets: secretStore, Auth: authProvider, }) if err != nil { return nil, err } srv.schema = apiSchema return srv, nil } func (srv *DaggerServer) LogMetrics(l *logrus.Entry) *logrus.Entry { srv.clientMu.RLock() defer srv.clientMu.RUnlock() return l.WithField(fmt.Sprintf("server-%s-client-count", srv.serverID), srv.connectedClients) } func (srv *DaggerServer) Close() { defer srv.closeOnce.Do(func() { close(srv.doneCh) }) srv.recorder.Complete()
closed
dagger/dagger
https://github.com/dagger/dagger
6,743
🐞 grpc: received message larger than max
### What is the issue? seeing these panics, running 0.9.11 dagger-engine, 0.9.11 dagger CLI, and 0.9.11 client: ```2024/02/26 21:24:05 http: panic serving 127.0.0.1:52322: rpc error: code = ResourceExhausted desc = grpc: received message larger than max (65067251 vs. 16777216) goroutine 760 [running]: net/http.(*conn).serve.func1() /usr/local/go/src/net/http/server.go:1868 +0xb0 panic({0xd0af20?, 0x4000092b70?}) /usr/local/go/src/runtime/panic.go:920 +0x26c github.com/dagger/dagger/engine/client.(*Client).ServeHTTP(0x40004169c0, {0x1068960, 0x4000606000}, 0x40004e0000) /app/engine/client/client.go:558 +0xa7c net/http.serverHandler.ServeHTTP({0x1064768?}, {0x1068960?, 0x4000606000?}, 0x6?) /usr/local/go/src/net/http/server.go:2938 +0xbc net/http.(*conn).serve(0x40001298c0, {0x106e768, 0x40003e4fc0}) /usr/local/go/src/net/http/server.go:2009 +0x518 created by net/http.(*Server).Serve in goroutine 67 /usr/local/go/src/net/http/server.go:3086 +0x4cc ``` ### Dagger version dagger v0.9.11 (registry.dagger.io/engine) linux/amd64 ### Steps to reproduce load contents of a dagger.Container's File, where the file is large, largest file in my manifest is 70546316 bytes: ``` fmt.Printf("starting transfer for %s: %s\n", deb_pkg, time.Now()) deb_data, err := testImage.File(deb_pkg).Contents(ctx) if err != nil { panic(err) } ``` ### Log output _No response_
https://github.com/dagger/dagger/issues/6743
https://github.com/dagger/dagger/pull/6772
7d606df4623db4f7ca9a5c28607e2d811263cf39
18c8c420d7c309c8f3735e985170a184a8b62d56
"2024-02-26T21:54:40Z"
go
"2024-03-05T10:02:01Z"
engine/server/server.go
srv.recorder.Close() srv.progCleanup() srv.analytics.Close() } func (srv *DaggerServer) Wait(ctx context.Context) error { select { case <-ctx.Done(): return ctx.Err() case <-srv.doneCh: return nil } } func (srv *DaggerServer) ServeClientConn( ctx context.Context, clientMetadata *engine.ClientMetadata, conn net.Conn, ) error { bklog.G(ctx).Trace("serve client conn") defer bklog.G(ctx).Trace("done serving client conn") srv.clientMu.Lock() srv.connectedClients++ defer func() { srv.clientMu.Lock() srv.connectedClients-- srv.clientMu.Unlock() }() srv.clientMu.Unlock() conn = newLogicalDeadlineConn(nopCloserConn{conn}) l := &singleConnListener{conn: conn, closeCh: make(chan struct{})}
closed
dagger/dagger
https://github.com/dagger/dagger
6,743
🐞 grpc: received message larger than max
### What is the issue? seeing these panics, running 0.9.11 dagger-engine, 0.9.11 dagger CLI, and 0.9.11 client: ```2024/02/26 21:24:05 http: panic serving 127.0.0.1:52322: rpc error: code = ResourceExhausted desc = grpc: received message larger than max (65067251 vs. 16777216) goroutine 760 [running]: net/http.(*conn).serve.func1() /usr/local/go/src/net/http/server.go:1868 +0xb0 panic({0xd0af20?, 0x4000092b70?}) /usr/local/go/src/runtime/panic.go:920 +0x26c github.com/dagger/dagger/engine/client.(*Client).ServeHTTP(0x40004169c0, {0x1068960, 0x4000606000}, 0x40004e0000) /app/engine/client/client.go:558 +0xa7c net/http.serverHandler.ServeHTTP({0x1064768?}, {0x1068960?, 0x4000606000?}, 0x6?) /usr/local/go/src/net/http/server.go:2938 +0xbc net/http.(*conn).serve(0x40001298c0, {0x106e768, 0x40003e4fc0}) /usr/local/go/src/net/http/server.go:2009 +0x518 created by net/http.(*Server).Serve in goroutine 67 /usr/local/go/src/net/http/server.go:3086 +0x4cc ``` ### Dagger version dagger v0.9.11 (registry.dagger.io/engine) linux/amd64 ### Steps to reproduce load contents of a dagger.Container's File, where the file is large, largest file in my manifest is 70546316 bytes: ``` fmt.Printf("starting transfer for %s: %s\n", deb_pkg, time.Now()) deb_data, err := testImage.File(deb_pkg).Contents(ctx) if err != nil { panic(err) } ``` ### Log output _No response_
https://github.com/dagger/dagger/issues/6743
https://github.com/dagger/dagger/pull/6772
7d606df4623db4f7ca9a5c28607e2d811263cf39
18c8c420d7c309c8f3735e985170a184a8b62d56
"2024-02-26T21:54:40Z"
go
"2024-03-05T10:02:01Z"
engine/server/server.go
go func() { <-ctx.Done() l.Close() }() handler, err := srv.HTTPHandlerForClient(clientMetadata, conn, bklog.G(ctx)) if err != nil { return fmt.Errorf("failed to create http handler: %w", err) } httpSrv := http.Server{ Handler: handler, ReadHeaderTimeout: 30 * time.Second, } defer httpSrv.Close() return httpSrv.Serve(l) } func (srv *DaggerServer) HTTPHandlerForClient(clientMetadata *engine.ClientMetadata, conn net.Conn, lg *logrus.Entry) (http.Handler, error) { return http.HandlerFunc(func(w http.ResponseWriter, req *http.Request) { defer func() { lg.Trace("handler done") }() req = req.WithContext(bklog.WithLogger(req.Context(), lg)) bklog.G(req.Context()).Debugf("http handler for client conn to path %s", req.URL.Path) defer bklog.G(req.Context()).Debugf("http handler for client conn done: %s", clientMetadata.ClientID) req = req.WithContext(progrock.ToContext(req.Context(), srv.recorder)) req = req.WithContext(engine.ContextWithClientMetadata(req.Context(), clientMetadata)) req = req.WithContext(analytics.WithContext(req.Context(), srv.analytics)) srv.schema.ServeHTTP(w, req)
closed
dagger/dagger
https://github.com/dagger/dagger
6,743
🐞 grpc: received message larger than max
### What is the issue? seeing these panics, running 0.9.11 dagger-engine, 0.9.11 dagger CLI, and 0.9.11 client: ```2024/02/26 21:24:05 http: panic serving 127.0.0.1:52322: rpc error: code = ResourceExhausted desc = grpc: received message larger than max (65067251 vs. 16777216) goroutine 760 [running]: net/http.(*conn).serve.func1() /usr/local/go/src/net/http/server.go:1868 +0xb0 panic({0xd0af20?, 0x4000092b70?}) /usr/local/go/src/runtime/panic.go:920 +0x26c github.com/dagger/dagger/engine/client.(*Client).ServeHTTP(0x40004169c0, {0x1068960, 0x4000606000}, 0x40004e0000) /app/engine/client/client.go:558 +0xa7c net/http.serverHandler.ServeHTTP({0x1064768?}, {0x1068960?, 0x4000606000?}, 0x6?) /usr/local/go/src/net/http/server.go:2938 +0xbc net/http.(*conn).serve(0x40001298c0, {0x106e768, 0x40003e4fc0}) /usr/local/go/src/net/http/server.go:2009 +0x518 created by net/http.(*Server).Serve in goroutine 67 /usr/local/go/src/net/http/server.go:3086 +0x4cc ``` ### Dagger version dagger v0.9.11 (registry.dagger.io/engine) linux/amd64 ### Steps to reproduce load contents of a dagger.Container's File, where the file is large, largest file in my manifest is 70546316 bytes: ``` fmt.Printf("starting transfer for %s: %s\n", deb_pkg, time.Now()) deb_data, err := testImage.File(deb_pkg).Contents(ctx) if err != nil { panic(err) } ``` ### Log output _No response_
https://github.com/dagger/dagger/issues/6743
https://github.com/dagger/dagger/pull/6772
7d606df4623db4f7ca9a5c28607e2d811263cf39
18c8c420d7c309c8f3735e985170a184a8b62d56
"2024-02-26T21:54:40Z"
go
"2024-03-05T10:02:01Z"
engine/server/server.go
}), nil } type singleConnListener struct { conn net.Conn l sync.Mutex closeCh chan struct{} closeOnce sync.Once } func (l *singleConnListener) Accept() (net.Conn, error) { l.l.Lock() if l.conn == nil { l.l.Unlock() <-l.closeCh return nil, io.ErrClosedPipe } defer l.l.Unlock() c := l.conn l.conn = nil return c, nil } func (l *singleConnListener) Addr() net.Addr { return nil } func (l *singleConnListener) Close() error { l.closeOnce.Do(func() { close(l.closeCh) }) return nil } type nopCloserConn struct {
closed
dagger/dagger
https://github.com/dagger/dagger
6,743
🐞 grpc: received message larger than max
### What is the issue? seeing these panics, running 0.9.11 dagger-engine, 0.9.11 dagger CLI, and 0.9.11 client: ```2024/02/26 21:24:05 http: panic serving 127.0.0.1:52322: rpc error: code = ResourceExhausted desc = grpc: received message larger than max (65067251 vs. 16777216) goroutine 760 [running]: net/http.(*conn).serve.func1() /usr/local/go/src/net/http/server.go:1868 +0xb0 panic({0xd0af20?, 0x4000092b70?}) /usr/local/go/src/runtime/panic.go:920 +0x26c github.com/dagger/dagger/engine/client.(*Client).ServeHTTP(0x40004169c0, {0x1068960, 0x4000606000}, 0x40004e0000) /app/engine/client/client.go:558 +0xa7c net/http.serverHandler.ServeHTTP({0x1064768?}, {0x1068960?, 0x4000606000?}, 0x6?) /usr/local/go/src/net/http/server.go:2938 +0xbc net/http.(*conn).serve(0x40001298c0, {0x106e768, 0x40003e4fc0}) /usr/local/go/src/net/http/server.go:2009 +0x518 created by net/http.(*Server).Serve in goroutine 67 /usr/local/go/src/net/http/server.go:3086 +0x4cc ``` ### Dagger version dagger v0.9.11 (registry.dagger.io/engine) linux/amd64 ### Steps to reproduce load contents of a dagger.Container's File, where the file is large, largest file in my manifest is 70546316 bytes: ``` fmt.Printf("starting transfer for %s: %s\n", deb_pkg, time.Now()) deb_data, err := testImage.File(deb_pkg).Contents(ctx) if err != nil { panic(err) } ``` ### Log output _No response_
https://github.com/dagger/dagger/issues/6743
https://github.com/dagger/dagger/pull/6772
7d606df4623db4f7ca9a5c28607e2d811263cf39
18c8c420d7c309c8f3735e985170a184a8b62d56
"2024-02-26T21:54:40Z"
go
"2024-03-05T10:02:01Z"
engine/server/server.go
net.Conn } func (nopCloserConn) Close() error { return nil } type withDeadlineConn struct { conn net.Conn readDeadline time.Time readers []func() readBuf *bytes.Buffer readEOF bool readCond *sync.Cond writeDeadline time.Time writers []func() writersL sync.Mutex } func newLogicalDeadlineConn(inner net.Conn) net.Conn {
closed
dagger/dagger
https://github.com/dagger/dagger
6,743
🐞 grpc: received message larger than max
### What is the issue? seeing these panics, running 0.9.11 dagger-engine, 0.9.11 dagger CLI, and 0.9.11 client: ```2024/02/26 21:24:05 http: panic serving 127.0.0.1:52322: rpc error: code = ResourceExhausted desc = grpc: received message larger than max (65067251 vs. 16777216) goroutine 760 [running]: net/http.(*conn).serve.func1() /usr/local/go/src/net/http/server.go:1868 +0xb0 panic({0xd0af20?, 0x4000092b70?}) /usr/local/go/src/runtime/panic.go:920 +0x26c github.com/dagger/dagger/engine/client.(*Client).ServeHTTP(0x40004169c0, {0x1068960, 0x4000606000}, 0x40004e0000) /app/engine/client/client.go:558 +0xa7c net/http.serverHandler.ServeHTTP({0x1064768?}, {0x1068960?, 0x4000606000?}, 0x6?) /usr/local/go/src/net/http/server.go:2938 +0xbc net/http.(*conn).serve(0x40001298c0, {0x106e768, 0x40003e4fc0}) /usr/local/go/src/net/http/server.go:2009 +0x518 created by net/http.(*Server).Serve in goroutine 67 /usr/local/go/src/net/http/server.go:3086 +0x4cc ``` ### Dagger version dagger v0.9.11 (registry.dagger.io/engine) linux/amd64 ### Steps to reproduce load contents of a dagger.Container's File, where the file is large, largest file in my manifest is 70546316 bytes: ``` fmt.Printf("starting transfer for %s: %s\n", deb_pkg, time.Now()) deb_data, err := testImage.File(deb_pkg).Contents(ctx) if err != nil { panic(err) } ``` ### Log output _No response_
https://github.com/dagger/dagger/issues/6743
https://github.com/dagger/dagger/pull/6772
7d606df4623db4f7ca9a5c28607e2d811263cf39
18c8c420d7c309c8f3735e985170a184a8b62d56
"2024-02-26T21:54:40Z"
go
"2024-03-05T10:02:01Z"
engine/server/server.go
c := &withDeadlineConn{ conn: inner, readBuf: new(bytes.Buffer), readCond: sync.NewCond(new(sync.Mutex)), } go func() { for { buf := make([]byte, 32*1024) n, err := inner.Read(buf) if err != nil { c.readCond.L.Lock() c.readEOF = true c.readCond.L.Unlock() c.readCond.Broadcast() return } c.readCond.L.Lock() c.readBuf.Write(buf[0:n]) c.readCond.Broadcast() c.readCond.L.Unlock() }
closed
dagger/dagger
https://github.com/dagger/dagger
6,743
🐞 grpc: received message larger than max
### What is the issue? seeing these panics, running 0.9.11 dagger-engine, 0.9.11 dagger CLI, and 0.9.11 client: ```2024/02/26 21:24:05 http: panic serving 127.0.0.1:52322: rpc error: code = ResourceExhausted desc = grpc: received message larger than max (65067251 vs. 16777216) goroutine 760 [running]: net/http.(*conn).serve.func1() /usr/local/go/src/net/http/server.go:1868 +0xb0 panic({0xd0af20?, 0x4000092b70?}) /usr/local/go/src/runtime/panic.go:920 +0x26c github.com/dagger/dagger/engine/client.(*Client).ServeHTTP(0x40004169c0, {0x1068960, 0x4000606000}, 0x40004e0000) /app/engine/client/client.go:558 +0xa7c net/http.serverHandler.ServeHTTP({0x1064768?}, {0x1068960?, 0x4000606000?}, 0x6?) /usr/local/go/src/net/http/server.go:2938 +0xbc net/http.(*conn).serve(0x40001298c0, {0x106e768, 0x40003e4fc0}) /usr/local/go/src/net/http/server.go:2009 +0x518 created by net/http.(*Server).Serve in goroutine 67 /usr/local/go/src/net/http/server.go:3086 +0x4cc ``` ### Dagger version dagger v0.9.11 (registry.dagger.io/engine) linux/amd64 ### Steps to reproduce load contents of a dagger.Container's File, where the file is large, largest file in my manifest is 70546316 bytes: ``` fmt.Printf("starting transfer for %s: %s\n", deb_pkg, time.Now()) deb_data, err := testImage.File(deb_pkg).Contents(ctx) if err != nil { panic(err) } ``` ### Log output _No response_
https://github.com/dagger/dagger/issues/6743
https://github.com/dagger/dagger/pull/6772
7d606df4623db4f7ca9a5c28607e2d811263cf39
18c8c420d7c309c8f3735e985170a184a8b62d56
"2024-02-26T21:54:40Z"
go
"2024-03-05T10:02:01Z"
engine/server/server.go
}() return c } func (c *withDeadlineConn) Read(b []byte) (n int, err error) { c.readCond.L.Lock() if c.readEOF { c.readCond.L.Unlock() return 0, io.EOF } ctx, cancel := context.WithCancel(context.Background()) defer cancel() if !c.readDeadline.IsZero() { if time.Now().After(c.readDeadline) { c.readCond.L.Unlock() return 0, os.ErrDeadlineExceeded } go func() { dt := time.Until(c.readDeadline) if dt > 0 { time.Sleep(dt) } cancel() }() } c.readers = append(c.readers, cancel) c.readCond.L.Unlock() read := make(chan struct{})
closed
dagger/dagger
https://github.com/dagger/dagger
6,743
🐞 grpc: received message larger than max
### What is the issue? seeing these panics, running 0.9.11 dagger-engine, 0.9.11 dagger CLI, and 0.9.11 client: ```2024/02/26 21:24:05 http: panic serving 127.0.0.1:52322: rpc error: code = ResourceExhausted desc = grpc: received message larger than max (65067251 vs. 16777216) goroutine 760 [running]: net/http.(*conn).serve.func1() /usr/local/go/src/net/http/server.go:1868 +0xb0 panic({0xd0af20?, 0x4000092b70?}) /usr/local/go/src/runtime/panic.go:920 +0x26c github.com/dagger/dagger/engine/client.(*Client).ServeHTTP(0x40004169c0, {0x1068960, 0x4000606000}, 0x40004e0000) /app/engine/client/client.go:558 +0xa7c net/http.serverHandler.ServeHTTP({0x1064768?}, {0x1068960?, 0x4000606000?}, 0x6?) /usr/local/go/src/net/http/server.go:2938 +0xbc net/http.(*conn).serve(0x40001298c0, {0x106e768, 0x40003e4fc0}) /usr/local/go/src/net/http/server.go:2009 +0x518 created by net/http.(*Server).Serve in goroutine 67 /usr/local/go/src/net/http/server.go:3086 +0x4cc ``` ### Dagger version dagger v0.9.11 (registry.dagger.io/engine) linux/amd64 ### Steps to reproduce load contents of a dagger.Container's File, where the file is large, largest file in my manifest is 70546316 bytes: ``` fmt.Printf("starting transfer for %s: %s\n", deb_pkg, time.Now()) deb_data, err := testImage.File(deb_pkg).Contents(ctx) if err != nil { panic(err) } ``` ### Log output _No response_
https://github.com/dagger/dagger/issues/6743
https://github.com/dagger/dagger/pull/6772
7d606df4623db4f7ca9a5c28607e2d811263cf39
18c8c420d7c309c8f3735e985170a184a8b62d56
"2024-02-26T21:54:40Z"
go
"2024-03-05T10:02:01Z"
engine/server/server.go
var rN int var rerr error go func() { defer close(read) c.readCond.L.Lock() defer c.readCond.L.Unlock() for ctx.Err() == nil { if c.readEOF { rerr = io.EOF break } n, _ := c.readBuf.Read(b) if n > 0 { rN = n break } c.readCond.Wait() } }() select { case <-read: return rN, rerr case <-ctx.Done():
closed
dagger/dagger
https://github.com/dagger/dagger
6,743
🐞 grpc: received message larger than max
### What is the issue? seeing these panics, running 0.9.11 dagger-engine, 0.9.11 dagger CLI, and 0.9.11 client: ```2024/02/26 21:24:05 http: panic serving 127.0.0.1:52322: rpc error: code = ResourceExhausted desc = grpc: received message larger than max (65067251 vs. 16777216) goroutine 760 [running]: net/http.(*conn).serve.func1() /usr/local/go/src/net/http/server.go:1868 +0xb0 panic({0xd0af20?, 0x4000092b70?}) /usr/local/go/src/runtime/panic.go:920 +0x26c github.com/dagger/dagger/engine/client.(*Client).ServeHTTP(0x40004169c0, {0x1068960, 0x4000606000}, 0x40004e0000) /app/engine/client/client.go:558 +0xa7c net/http.serverHandler.ServeHTTP({0x1064768?}, {0x1068960?, 0x4000606000?}, 0x6?) /usr/local/go/src/net/http/server.go:2938 +0xbc net/http.(*conn).serve(0x40001298c0, {0x106e768, 0x40003e4fc0}) /usr/local/go/src/net/http/server.go:2009 +0x518 created by net/http.(*Server).Serve in goroutine 67 /usr/local/go/src/net/http/server.go:3086 +0x4cc ``` ### Dagger version dagger v0.9.11 (registry.dagger.io/engine) linux/amd64 ### Steps to reproduce load contents of a dagger.Container's File, where the file is large, largest file in my manifest is 70546316 bytes: ``` fmt.Printf("starting transfer for %s: %s\n", deb_pkg, time.Now()) deb_data, err := testImage.File(deb_pkg).Contents(ctx) if err != nil { panic(err) } ``` ### Log output _No response_
https://github.com/dagger/dagger/issues/6743
https://github.com/dagger/dagger/pull/6772
7d606df4623db4f7ca9a5c28607e2d811263cf39
18c8c420d7c309c8f3735e985170a184a8b62d56
"2024-02-26T21:54:40Z"
go
"2024-03-05T10:02:01Z"
engine/server/server.go
return 0, os.ErrDeadlineExceeded } } func (c *withDeadlineConn) Write(b []byte) (n int, err error) { c.writersL.Lock() ctx, cancel := context.WithCancel(context.Background()) defer cancel() if !c.writeDeadline.IsZero() { if time.Now().After(c.writeDeadline) { c.writersL.Unlock() return 0, os.ErrDeadlineExceeded } go func() { dt := time.Until(c.writeDeadline) if dt > 0 { time.Sleep(dt) } cancel() }() } c.writers = append(c.writers, cancel) c.writersL.Unlock() write := make(chan int, 1) go func() { n, err = c.conn.Write(b) write <- 0 }()
closed
dagger/dagger
https://github.com/dagger/dagger
6,743
🐞 grpc: received message larger than max
### What is the issue? seeing these panics, running 0.9.11 dagger-engine, 0.9.11 dagger CLI, and 0.9.11 client: ```2024/02/26 21:24:05 http: panic serving 127.0.0.1:52322: rpc error: code = ResourceExhausted desc = grpc: received message larger than max (65067251 vs. 16777216) goroutine 760 [running]: net/http.(*conn).serve.func1() /usr/local/go/src/net/http/server.go:1868 +0xb0 panic({0xd0af20?, 0x4000092b70?}) /usr/local/go/src/runtime/panic.go:920 +0x26c github.com/dagger/dagger/engine/client.(*Client).ServeHTTP(0x40004169c0, {0x1068960, 0x4000606000}, 0x40004e0000) /app/engine/client/client.go:558 +0xa7c net/http.serverHandler.ServeHTTP({0x1064768?}, {0x1068960?, 0x4000606000?}, 0x6?) /usr/local/go/src/net/http/server.go:2938 +0xbc net/http.(*conn).serve(0x40001298c0, {0x106e768, 0x40003e4fc0}) /usr/local/go/src/net/http/server.go:2009 +0x518 created by net/http.(*Server).Serve in goroutine 67 /usr/local/go/src/net/http/server.go:3086 +0x4cc ``` ### Dagger version dagger v0.9.11 (registry.dagger.io/engine) linux/amd64 ### Steps to reproduce load contents of a dagger.Container's File, where the file is large, largest file in my manifest is 70546316 bytes: ``` fmt.Printf("starting transfer for %s: %s\n", deb_pkg, time.Now()) deb_data, err := testImage.File(deb_pkg).Contents(ctx) if err != nil { panic(err) } ``` ### Log output _No response_
https://github.com/dagger/dagger/issues/6743
https://github.com/dagger/dagger/pull/6772
7d606df4623db4f7ca9a5c28607e2d811263cf39
18c8c420d7c309c8f3735e985170a184a8b62d56
"2024-02-26T21:54:40Z"
go
"2024-03-05T10:02:01Z"
engine/server/server.go
select { case <-write: return n, err case <-ctx.Done(): return 0, os.ErrDeadlineExceeded } } func (c *withDeadlineConn) Close() error { return c.conn.Close() } func (c *withDeadlineConn) LocalAddr() net.Addr { return c.conn.LocalAddr() } func (c *withDeadlineConn) RemoteAddr() net.Addr { return c.conn.RemoteAddr() } func (c *withDeadlineConn) SetDeadline(t time.Time) error { return errors.Join( c.SetReadDeadline(t), c.SetWriteDeadline(t), ) } func (c *withDeadlineConn) SetReadDeadline(t time.Time) error { c.readCond.L.Lock() c.readDeadline = t readers := c.readers c.readCond.L.Unlock() if len(readers) > 0 && !t.IsZero() { go func() {
closed
dagger/dagger
https://github.com/dagger/dagger
6,743
🐞 grpc: received message larger than max
### What is the issue? seeing these panics, running 0.9.11 dagger-engine, 0.9.11 dagger CLI, and 0.9.11 client: ```2024/02/26 21:24:05 http: panic serving 127.0.0.1:52322: rpc error: code = ResourceExhausted desc = grpc: received message larger than max (65067251 vs. 16777216) goroutine 760 [running]: net/http.(*conn).serve.func1() /usr/local/go/src/net/http/server.go:1868 +0xb0 panic({0xd0af20?, 0x4000092b70?}) /usr/local/go/src/runtime/panic.go:920 +0x26c github.com/dagger/dagger/engine/client.(*Client).ServeHTTP(0x40004169c0, {0x1068960, 0x4000606000}, 0x40004e0000) /app/engine/client/client.go:558 +0xa7c net/http.serverHandler.ServeHTTP({0x1064768?}, {0x1068960?, 0x4000606000?}, 0x6?) /usr/local/go/src/net/http/server.go:2938 +0xbc net/http.(*conn).serve(0x40001298c0, {0x106e768, 0x40003e4fc0}) /usr/local/go/src/net/http/server.go:2009 +0x518 created by net/http.(*Server).Serve in goroutine 67 /usr/local/go/src/net/http/server.go:3086 +0x4cc ``` ### Dagger version dagger v0.9.11 (registry.dagger.io/engine) linux/amd64 ### Steps to reproduce load contents of a dagger.Container's File, where the file is large, largest file in my manifest is 70546316 bytes: ``` fmt.Printf("starting transfer for %s: %s\n", deb_pkg, time.Now()) deb_data, err := testImage.File(deb_pkg).Contents(ctx) if err != nil { panic(err) } ``` ### Log output _No response_
https://github.com/dagger/dagger/issues/6743
https://github.com/dagger/dagger/pull/6772
7d606df4623db4f7ca9a5c28607e2d811263cf39
18c8c420d7c309c8f3735e985170a184a8b62d56
"2024-02-26T21:54:40Z"
go
"2024-03-05T10:02:01Z"
engine/server/server.go
dt := time.Until(c.readDeadline) if dt > 0 { time.Sleep(dt) } for _, cancel := range readers { cancel() } }() } return nil } func (c *withDeadlineConn) SetWriteDeadline(t time.Time) error { c.writersL.Lock() c.writeDeadline = t writers := c.writers c.writersL.Unlock() if len(writers) > 0 && !t.IsZero() { go func() { dt := time.Until(c.writeDeadline) if dt > 0 { time.Sleep(dt) } for _, cancel := range writers { cancel() } }() } return nil }
closed
dagger/dagger
https://github.com/dagger/dagger
6,828
Panic in `terminal` if no args set
Think this is a regression in v0.10.1 cc @TomChv See https://github.com/dagger/dagger/pull/6805/files#r1513137070 ``` goroutine 457496 [running]: runtime/debug.Stack() /usr/local/go/src/runtime/debug/stack.go:24 +0x5e github.com/dagger/dagger/dagql.(*Server).resolvePath.func1() /app/dagql/server.go:642 +0x74 panic({0x1bd65a0?, 0x3139130?}) /usr/local/go/src/runtime/panic.go:914 +0x21f github.com/dagger/dagger/core/schema.(*containerSchema).terminal(0x1d3a040?, {0x2299038, 0xc00330eea0}, {0xc005579280, 0xc00305f340, {0x0, 0x1, 0xc0033daf60, 0xc00394bed8}, 0x0}, ...) /app/core/schema/container.go:1366 +0xc9 github.com/dagger/dagger/dagql.NodeFunc[...].func1({0xc005579280, 0xc00305f340, {0x0, 0x1, 0xc0033daf60, 0xc00394bed8}, 0x0}, 0xc00330ef00) /app/dagql/objects.go:355 +0x184 github.com/dagger/dagger/dagql.Class[...].Call(0x22c3500?, {0x2299038?, 0xc00330eea0?}, {0xc005579280, 0xc00305f340, {0x0, 0x1, 0xc0033daf60, 0xc00394bed8}, 0x0}, ...) /app/dagql/objects.go:202 +0x15d github.com/dagger/dagger/dagql.Instance[...].Select(0x22b3a20, {0x2299038, 0xc00330eea0}, {{0xc000cd2508, 0x8}, {0x319c680, 0x0, 0x0}, 0x0}) /app/dagql/objects.go:271 +0x2fe github.com/dagger/dagger/dagql.(*Server).cachedSelect.func1({0x2299038?, 0xc00330eea0?}) /app/dagql/server.go:583 +0x49 github.com/dagger/dagger/tracing.AroundFunc.ProgrockAroundFunc.func1({0x2299038, 0xc00330ed80}) /app/tracing/graphql.go:102 +0x5c4 github.com/dagger/dagger/tracing.AroundFunc.SpanAroundFunc.func2({0x2299038, 0xc003e691a0}) /app/tracing/graphql.go:33 +0xa6 github.com/dagger/dagger/dagql.(*cacheMap[...]).GetOrInitializeOnHit(0x22bf680, {0x2299038, 0xc003e68ea0}, {0xc003775130, 0x47}, 0xc004ccb788, 0xc0031f9b08) /app/dagql/cachemap.go:85 +0x272 github.com/dagger/dagger/dagql.(*cacheMap[...]).GetOrInitialize(0xc0031f9b48?, {0x2299038?, 0xc003e68ea0?}, {0xc003775130?, 0x10c0f25?}, 0x229c200?) /app/dagql/cachemap.go:60 +0x45 github.com/dagger/dagger/dagql.(*Server).cachedSelect(0xc003e1a4b0, {0x2299038, 0xc004a82630}, {0x229c200, 0xc002c9ac40}, {{0xc000cd2508, 0x8}, {0x319c680, 0x0, 0x0}, ...}) /app/dagql/server.go:592 +0x203 github.com/dagger/dagger/dagql.(*Server).resolvePath(0x1052c6b?, {0x2299038, 0xc004a82630}, {0x229c200?, 0xc002c9ac40?}, {{0xc000cd2508, 0x8}, {{0xc000cd2508, 0x8}, {0x319c680, ...}, ...}, ...}) /app/dagql/server.go:651 +0x13e github.com/dagger/dagger/dagql.(*Server).Resolve.func1() /app/dagql/server.go:405 +0x7f github.com/dagger/dagger/dagql.(*Server).Resolve.(*ErrorPool).Go.func3() /go/pkg/mod/github.com/sourcegraph/[email protected]/pool/error_pool.go:30 +0x22 github.com/sourcegraph/conc/pool.(*Pool).worker(0xc001825858?) /go/pkg/mod/github.com/sourcegraph/[email protected]/pool/pool.go:154 +0x6f github.com/sourcegraph/conc/panics.(*Catcher).Try(0x445edc?, 0x6?) /go/pkg/mod/github.com/sourcegraph/[email protected]/panics/panics.go:23 +0x48 github.com/sourcegraph/conc.(*WaitGroup).Go.func1() /go/pkg/mod/github.com/sourcegraph/[email protected]/waitgroup.go:32 +0x56 created by github.com/sourcegraph/conc.(*WaitGroup).Go in goroutine 372437 /go/pkg/mod/github.com/sourcegraph/[email protected]/waitgroup.go:30 +0x73 ``` I can hit this if I `terminal` a container that doesn't have default args, and hasn't called `withDefaultTerminalCmd`.
https://github.com/dagger/dagger/issues/6828
https://github.com/dagger/dagger/pull/6838
e5f0bc7389dc0ba454fa8247de023e4a92efb1c2
7b69661a44e419b03d94264b74c3e99d6e98cf0d
"2024-03-05T16:34:06Z"
go
"2024-03-06T14:03:34Z"
core/container.go
package core import ( "context" "encoding/json" "fmt" "io/fs" "os" "path" "path/filepath" "sort" "strconv" "strings" "sync" "github.com/containerd/containerd/content" "github.com/containerd/containerd/images" "github.com/containerd/containerd/pkg/transfer/archive" "github.com/containerd/containerd/platforms" "github.com/vektah/gqlparser/v2/ast" "github.com/dagger/dagger/dagql" "github.com/dagger/dagger/dagql/idproto"
closed
dagger/dagger
https://github.com/dagger/dagger
6,828
Panic in `terminal` if no args set
Think this is a regression in v0.10.1 cc @TomChv See https://github.com/dagger/dagger/pull/6805/files#r1513137070 ``` goroutine 457496 [running]: runtime/debug.Stack() /usr/local/go/src/runtime/debug/stack.go:24 +0x5e github.com/dagger/dagger/dagql.(*Server).resolvePath.func1() /app/dagql/server.go:642 +0x74 panic({0x1bd65a0?, 0x3139130?}) /usr/local/go/src/runtime/panic.go:914 +0x21f github.com/dagger/dagger/core/schema.(*containerSchema).terminal(0x1d3a040?, {0x2299038, 0xc00330eea0}, {0xc005579280, 0xc00305f340, {0x0, 0x1, 0xc0033daf60, 0xc00394bed8}, 0x0}, ...) /app/core/schema/container.go:1366 +0xc9 github.com/dagger/dagger/dagql.NodeFunc[...].func1({0xc005579280, 0xc00305f340, {0x0, 0x1, 0xc0033daf60, 0xc00394bed8}, 0x0}, 0xc00330ef00) /app/dagql/objects.go:355 +0x184 github.com/dagger/dagger/dagql.Class[...].Call(0x22c3500?, {0x2299038?, 0xc00330eea0?}, {0xc005579280, 0xc00305f340, {0x0, 0x1, 0xc0033daf60, 0xc00394bed8}, 0x0}, ...) /app/dagql/objects.go:202 +0x15d github.com/dagger/dagger/dagql.Instance[...].Select(0x22b3a20, {0x2299038, 0xc00330eea0}, {{0xc000cd2508, 0x8}, {0x319c680, 0x0, 0x0}, 0x0}) /app/dagql/objects.go:271 +0x2fe github.com/dagger/dagger/dagql.(*Server).cachedSelect.func1({0x2299038?, 0xc00330eea0?}) /app/dagql/server.go:583 +0x49 github.com/dagger/dagger/tracing.AroundFunc.ProgrockAroundFunc.func1({0x2299038, 0xc00330ed80}) /app/tracing/graphql.go:102 +0x5c4 github.com/dagger/dagger/tracing.AroundFunc.SpanAroundFunc.func2({0x2299038, 0xc003e691a0}) /app/tracing/graphql.go:33 +0xa6 github.com/dagger/dagger/dagql.(*cacheMap[...]).GetOrInitializeOnHit(0x22bf680, {0x2299038, 0xc003e68ea0}, {0xc003775130, 0x47}, 0xc004ccb788, 0xc0031f9b08) /app/dagql/cachemap.go:85 +0x272 github.com/dagger/dagger/dagql.(*cacheMap[...]).GetOrInitialize(0xc0031f9b48?, {0x2299038?, 0xc003e68ea0?}, {0xc003775130?, 0x10c0f25?}, 0x229c200?) /app/dagql/cachemap.go:60 +0x45 github.com/dagger/dagger/dagql.(*Server).cachedSelect(0xc003e1a4b0, {0x2299038, 0xc004a82630}, {0x229c200, 0xc002c9ac40}, {{0xc000cd2508, 0x8}, {0x319c680, 0x0, 0x0}, ...}) /app/dagql/server.go:592 +0x203 github.com/dagger/dagger/dagql.(*Server).resolvePath(0x1052c6b?, {0x2299038, 0xc004a82630}, {0x229c200?, 0xc002c9ac40?}, {{0xc000cd2508, 0x8}, {{0xc000cd2508, 0x8}, {0x319c680, ...}, ...}, ...}) /app/dagql/server.go:651 +0x13e github.com/dagger/dagger/dagql.(*Server).Resolve.func1() /app/dagql/server.go:405 +0x7f github.com/dagger/dagger/dagql.(*Server).Resolve.(*ErrorPool).Go.func3() /go/pkg/mod/github.com/sourcegraph/[email protected]/pool/error_pool.go:30 +0x22 github.com/sourcegraph/conc/pool.(*Pool).worker(0xc001825858?) /go/pkg/mod/github.com/sourcegraph/[email protected]/pool/pool.go:154 +0x6f github.com/sourcegraph/conc/panics.(*Catcher).Try(0x445edc?, 0x6?) /go/pkg/mod/github.com/sourcegraph/[email protected]/panics/panics.go:23 +0x48 github.com/sourcegraph/conc.(*WaitGroup).Go.func1() /go/pkg/mod/github.com/sourcegraph/[email protected]/waitgroup.go:32 +0x56 created by github.com/sourcegraph/conc.(*WaitGroup).Go in goroutine 372437 /go/pkg/mod/github.com/sourcegraph/[email protected]/waitgroup.go:30 +0x73 ``` I can hit this if I `terminal` a container that doesn't have default args, and hasn't called `withDefaultTerminalCmd`.
https://github.com/dagger/dagger/issues/6828
https://github.com/dagger/dagger/pull/6838
e5f0bc7389dc0ba454fa8247de023e4a92efb1c2
7b69661a44e419b03d94264b74c3e99d6e98cf0d
"2024-03-05T16:34:06Z"
go
"2024-03-06T14:03:34Z"
core/container.go
"github.com/dagger/dagger/engine" "github.com/docker/distribution/reference" "github.com/moby/buildkit/client/llb" "github.com/moby/buildkit/exporter/containerimage/exptypes" "github.com/moby/buildkit/frontend/dockerui" bkgw "github.com/moby/buildkit/frontend/gateway/client" "github.com/moby/buildkit/identity" "github.com/moby/buildkit/solver/pb" "github.com/moby/buildkit/util/leaseutil" "github.com/opencontainers/go-digest" specs "github.com/opencontainers/image-spec/specs-go/v1" "github.com/pkg/errors" "github.com/vito/progrock" "github.com/dagger/dagger/core/pipeline" "github.com/dagger/dagger/engine/buildkit" ) var ErrContainerNoExec = errors.New("no command has been executed") type DefaultTerminalCmdOpts struct { Args []string ExperimentalPrivilegedNesting bool `default:"false"` InsecureRootCapabilities bool `default:"false"` } type Container struct { Query *Query FS *pb.Definition `json:"fs"`
closed
dagger/dagger
https://github.com/dagger/dagger
6,828
Panic in `terminal` if no args set
Think this is a regression in v0.10.1 cc @TomChv See https://github.com/dagger/dagger/pull/6805/files#r1513137070 ``` goroutine 457496 [running]: runtime/debug.Stack() /usr/local/go/src/runtime/debug/stack.go:24 +0x5e github.com/dagger/dagger/dagql.(*Server).resolvePath.func1() /app/dagql/server.go:642 +0x74 panic({0x1bd65a0?, 0x3139130?}) /usr/local/go/src/runtime/panic.go:914 +0x21f github.com/dagger/dagger/core/schema.(*containerSchema).terminal(0x1d3a040?, {0x2299038, 0xc00330eea0}, {0xc005579280, 0xc00305f340, {0x0, 0x1, 0xc0033daf60, 0xc00394bed8}, 0x0}, ...) /app/core/schema/container.go:1366 +0xc9 github.com/dagger/dagger/dagql.NodeFunc[...].func1({0xc005579280, 0xc00305f340, {0x0, 0x1, 0xc0033daf60, 0xc00394bed8}, 0x0}, 0xc00330ef00) /app/dagql/objects.go:355 +0x184 github.com/dagger/dagger/dagql.Class[...].Call(0x22c3500?, {0x2299038?, 0xc00330eea0?}, {0xc005579280, 0xc00305f340, {0x0, 0x1, 0xc0033daf60, 0xc00394bed8}, 0x0}, ...) /app/dagql/objects.go:202 +0x15d github.com/dagger/dagger/dagql.Instance[...].Select(0x22b3a20, {0x2299038, 0xc00330eea0}, {{0xc000cd2508, 0x8}, {0x319c680, 0x0, 0x0}, 0x0}) /app/dagql/objects.go:271 +0x2fe github.com/dagger/dagger/dagql.(*Server).cachedSelect.func1({0x2299038?, 0xc00330eea0?}) /app/dagql/server.go:583 +0x49 github.com/dagger/dagger/tracing.AroundFunc.ProgrockAroundFunc.func1({0x2299038, 0xc00330ed80}) /app/tracing/graphql.go:102 +0x5c4 github.com/dagger/dagger/tracing.AroundFunc.SpanAroundFunc.func2({0x2299038, 0xc003e691a0}) /app/tracing/graphql.go:33 +0xa6 github.com/dagger/dagger/dagql.(*cacheMap[...]).GetOrInitializeOnHit(0x22bf680, {0x2299038, 0xc003e68ea0}, {0xc003775130, 0x47}, 0xc004ccb788, 0xc0031f9b08) /app/dagql/cachemap.go:85 +0x272 github.com/dagger/dagger/dagql.(*cacheMap[...]).GetOrInitialize(0xc0031f9b48?, {0x2299038?, 0xc003e68ea0?}, {0xc003775130?, 0x10c0f25?}, 0x229c200?) /app/dagql/cachemap.go:60 +0x45 github.com/dagger/dagger/dagql.(*Server).cachedSelect(0xc003e1a4b0, {0x2299038, 0xc004a82630}, {0x229c200, 0xc002c9ac40}, {{0xc000cd2508, 0x8}, {0x319c680, 0x0, 0x0}, ...}) /app/dagql/server.go:592 +0x203 github.com/dagger/dagger/dagql.(*Server).resolvePath(0x1052c6b?, {0x2299038, 0xc004a82630}, {0x229c200?, 0xc002c9ac40?}, {{0xc000cd2508, 0x8}, {{0xc000cd2508, 0x8}, {0x319c680, ...}, ...}, ...}) /app/dagql/server.go:651 +0x13e github.com/dagger/dagger/dagql.(*Server).Resolve.func1() /app/dagql/server.go:405 +0x7f github.com/dagger/dagger/dagql.(*Server).Resolve.(*ErrorPool).Go.func3() /go/pkg/mod/github.com/sourcegraph/[email protected]/pool/error_pool.go:30 +0x22 github.com/sourcegraph/conc/pool.(*Pool).worker(0xc001825858?) /go/pkg/mod/github.com/sourcegraph/[email protected]/pool/pool.go:154 +0x6f github.com/sourcegraph/conc/panics.(*Catcher).Try(0x445edc?, 0x6?) /go/pkg/mod/github.com/sourcegraph/[email protected]/panics/panics.go:23 +0x48 github.com/sourcegraph/conc.(*WaitGroup).Go.func1() /go/pkg/mod/github.com/sourcegraph/[email protected]/waitgroup.go:32 +0x56 created by github.com/sourcegraph/conc.(*WaitGroup).Go in goroutine 372437 /go/pkg/mod/github.com/sourcegraph/[email protected]/waitgroup.go:30 +0x73 ``` I can hit this if I `terminal` a container that doesn't have default args, and hasn't called `withDefaultTerminalCmd`.
https://github.com/dagger/dagger/issues/6828
https://github.com/dagger/dagger/pull/6838
e5f0bc7389dc0ba454fa8247de023e4a92efb1c2
7b69661a44e419b03d94264b74c3e99d6e98cf0d
"2024-03-05T16:34:06Z"
go
"2024-03-06T14:03:34Z"
core/container.go
Config specs.ImageConfig `json:"cfg"` EnabledGPUs []string `json:"enabledGPUs,omitempty"` Mounts ContainerMounts `json:"mounts,omitempty"` Meta *pb.Definition `json:"meta,omitempty"` Platform Platform `json:"platform,omitempty"` Secrets []ContainerSecret `json:"secret_env,omitempty"` Sockets []ContainerSocket `json:"sockets,omitempty"` ImageRef string `json:"image_ref,omitempty"` Ports []Port `json:"ports,omitempty"` Services ServiceBindings `json:"services,omitempty"` Focused bool `json:"focused"` DefaultTerminalCmd *DefaultTerminalCmdOpts `json:"defaultTerminalCmd,omitempty"` } func (*Container) Type() *ast.Type { return &ast.Type{ NamedType: "Container", NonNull: true,
closed
dagger/dagger
https://github.com/dagger/dagger
6,828
Panic in `terminal` if no args set
Think this is a regression in v0.10.1 cc @TomChv See https://github.com/dagger/dagger/pull/6805/files#r1513137070 ``` goroutine 457496 [running]: runtime/debug.Stack() /usr/local/go/src/runtime/debug/stack.go:24 +0x5e github.com/dagger/dagger/dagql.(*Server).resolvePath.func1() /app/dagql/server.go:642 +0x74 panic({0x1bd65a0?, 0x3139130?}) /usr/local/go/src/runtime/panic.go:914 +0x21f github.com/dagger/dagger/core/schema.(*containerSchema).terminal(0x1d3a040?, {0x2299038, 0xc00330eea0}, {0xc005579280, 0xc00305f340, {0x0, 0x1, 0xc0033daf60, 0xc00394bed8}, 0x0}, ...) /app/core/schema/container.go:1366 +0xc9 github.com/dagger/dagger/dagql.NodeFunc[...].func1({0xc005579280, 0xc00305f340, {0x0, 0x1, 0xc0033daf60, 0xc00394bed8}, 0x0}, 0xc00330ef00) /app/dagql/objects.go:355 +0x184 github.com/dagger/dagger/dagql.Class[...].Call(0x22c3500?, {0x2299038?, 0xc00330eea0?}, {0xc005579280, 0xc00305f340, {0x0, 0x1, 0xc0033daf60, 0xc00394bed8}, 0x0}, ...) /app/dagql/objects.go:202 +0x15d github.com/dagger/dagger/dagql.Instance[...].Select(0x22b3a20, {0x2299038, 0xc00330eea0}, {{0xc000cd2508, 0x8}, {0x319c680, 0x0, 0x0}, 0x0}) /app/dagql/objects.go:271 +0x2fe github.com/dagger/dagger/dagql.(*Server).cachedSelect.func1({0x2299038?, 0xc00330eea0?}) /app/dagql/server.go:583 +0x49 github.com/dagger/dagger/tracing.AroundFunc.ProgrockAroundFunc.func1({0x2299038, 0xc00330ed80}) /app/tracing/graphql.go:102 +0x5c4 github.com/dagger/dagger/tracing.AroundFunc.SpanAroundFunc.func2({0x2299038, 0xc003e691a0}) /app/tracing/graphql.go:33 +0xa6 github.com/dagger/dagger/dagql.(*cacheMap[...]).GetOrInitializeOnHit(0x22bf680, {0x2299038, 0xc003e68ea0}, {0xc003775130, 0x47}, 0xc004ccb788, 0xc0031f9b08) /app/dagql/cachemap.go:85 +0x272 github.com/dagger/dagger/dagql.(*cacheMap[...]).GetOrInitialize(0xc0031f9b48?, {0x2299038?, 0xc003e68ea0?}, {0xc003775130?, 0x10c0f25?}, 0x229c200?) /app/dagql/cachemap.go:60 +0x45 github.com/dagger/dagger/dagql.(*Server).cachedSelect(0xc003e1a4b0, {0x2299038, 0xc004a82630}, {0x229c200, 0xc002c9ac40}, {{0xc000cd2508, 0x8}, {0x319c680, 0x0, 0x0}, ...}) /app/dagql/server.go:592 +0x203 github.com/dagger/dagger/dagql.(*Server).resolvePath(0x1052c6b?, {0x2299038, 0xc004a82630}, {0x229c200?, 0xc002c9ac40?}, {{0xc000cd2508, 0x8}, {{0xc000cd2508, 0x8}, {0x319c680, ...}, ...}, ...}) /app/dagql/server.go:651 +0x13e github.com/dagger/dagger/dagql.(*Server).Resolve.func1() /app/dagql/server.go:405 +0x7f github.com/dagger/dagger/dagql.(*Server).Resolve.(*ErrorPool).Go.func3() /go/pkg/mod/github.com/sourcegraph/[email protected]/pool/error_pool.go:30 +0x22 github.com/sourcegraph/conc/pool.(*Pool).worker(0xc001825858?) /go/pkg/mod/github.com/sourcegraph/[email protected]/pool/pool.go:154 +0x6f github.com/sourcegraph/conc/panics.(*Catcher).Try(0x445edc?, 0x6?) /go/pkg/mod/github.com/sourcegraph/[email protected]/panics/panics.go:23 +0x48 github.com/sourcegraph/conc.(*WaitGroup).Go.func1() /go/pkg/mod/github.com/sourcegraph/[email protected]/waitgroup.go:32 +0x56 created by github.com/sourcegraph/conc.(*WaitGroup).Go in goroutine 372437 /go/pkg/mod/github.com/sourcegraph/[email protected]/waitgroup.go:30 +0x73 ``` I can hit this if I `terminal` a container that doesn't have default args, and hasn't called `withDefaultTerminalCmd`.
https://github.com/dagger/dagger/issues/6828
https://github.com/dagger/dagger/pull/6838
e5f0bc7389dc0ba454fa8247de023e4a92efb1c2
7b69661a44e419b03d94264b74c3e99d6e98cf0d
"2024-03-05T16:34:06Z"
go
"2024-03-06T14:03:34Z"
core/container.go
} } func (*Container) TypeDescription() string { return "An OCI-compatible container, also known as a Docker container." } var _ HasPBDefinitions = (*Container)(nil) func (container *Container) PBDefinitions(ctx context.Context) ([]*pb.Definition, error) { var defs []*pb.Definition if container.FS != nil { defs = append(defs, container.FS) } for _, mnt := range container.Mounts { if mnt.Source != nil { defs = append(defs, mnt.Source) } } for _, bnd := range container.Services { ctr := bnd.Service.Container if ctr == nil { continue } ctrDefs, err := ctr.PBDefinitions(ctx) if err != nil { return nil, err } defs = append(defs, ctrDefs...) } return defs, nil } func NewContainer(root *Query, platform Platform) (*Container, error) {
closed
dagger/dagger
https://github.com/dagger/dagger
6,828
Panic in `terminal` if no args set
Think this is a regression in v0.10.1 cc @TomChv See https://github.com/dagger/dagger/pull/6805/files#r1513137070 ``` goroutine 457496 [running]: runtime/debug.Stack() /usr/local/go/src/runtime/debug/stack.go:24 +0x5e github.com/dagger/dagger/dagql.(*Server).resolvePath.func1() /app/dagql/server.go:642 +0x74 panic({0x1bd65a0?, 0x3139130?}) /usr/local/go/src/runtime/panic.go:914 +0x21f github.com/dagger/dagger/core/schema.(*containerSchema).terminal(0x1d3a040?, {0x2299038, 0xc00330eea0}, {0xc005579280, 0xc00305f340, {0x0, 0x1, 0xc0033daf60, 0xc00394bed8}, 0x0}, ...) /app/core/schema/container.go:1366 +0xc9 github.com/dagger/dagger/dagql.NodeFunc[...].func1({0xc005579280, 0xc00305f340, {0x0, 0x1, 0xc0033daf60, 0xc00394bed8}, 0x0}, 0xc00330ef00) /app/dagql/objects.go:355 +0x184 github.com/dagger/dagger/dagql.Class[...].Call(0x22c3500?, {0x2299038?, 0xc00330eea0?}, {0xc005579280, 0xc00305f340, {0x0, 0x1, 0xc0033daf60, 0xc00394bed8}, 0x0}, ...) /app/dagql/objects.go:202 +0x15d github.com/dagger/dagger/dagql.Instance[...].Select(0x22b3a20, {0x2299038, 0xc00330eea0}, {{0xc000cd2508, 0x8}, {0x319c680, 0x0, 0x0}, 0x0}) /app/dagql/objects.go:271 +0x2fe github.com/dagger/dagger/dagql.(*Server).cachedSelect.func1({0x2299038?, 0xc00330eea0?}) /app/dagql/server.go:583 +0x49 github.com/dagger/dagger/tracing.AroundFunc.ProgrockAroundFunc.func1({0x2299038, 0xc00330ed80}) /app/tracing/graphql.go:102 +0x5c4 github.com/dagger/dagger/tracing.AroundFunc.SpanAroundFunc.func2({0x2299038, 0xc003e691a0}) /app/tracing/graphql.go:33 +0xa6 github.com/dagger/dagger/dagql.(*cacheMap[...]).GetOrInitializeOnHit(0x22bf680, {0x2299038, 0xc003e68ea0}, {0xc003775130, 0x47}, 0xc004ccb788, 0xc0031f9b08) /app/dagql/cachemap.go:85 +0x272 github.com/dagger/dagger/dagql.(*cacheMap[...]).GetOrInitialize(0xc0031f9b48?, {0x2299038?, 0xc003e68ea0?}, {0xc003775130?, 0x10c0f25?}, 0x229c200?) /app/dagql/cachemap.go:60 +0x45 github.com/dagger/dagger/dagql.(*Server).cachedSelect(0xc003e1a4b0, {0x2299038, 0xc004a82630}, {0x229c200, 0xc002c9ac40}, {{0xc000cd2508, 0x8}, {0x319c680, 0x0, 0x0}, ...}) /app/dagql/server.go:592 +0x203 github.com/dagger/dagger/dagql.(*Server).resolvePath(0x1052c6b?, {0x2299038, 0xc004a82630}, {0x229c200?, 0xc002c9ac40?}, {{0xc000cd2508, 0x8}, {{0xc000cd2508, 0x8}, {0x319c680, ...}, ...}, ...}) /app/dagql/server.go:651 +0x13e github.com/dagger/dagger/dagql.(*Server).Resolve.func1() /app/dagql/server.go:405 +0x7f github.com/dagger/dagger/dagql.(*Server).Resolve.(*ErrorPool).Go.func3() /go/pkg/mod/github.com/sourcegraph/[email protected]/pool/error_pool.go:30 +0x22 github.com/sourcegraph/conc/pool.(*Pool).worker(0xc001825858?) /go/pkg/mod/github.com/sourcegraph/[email protected]/pool/pool.go:154 +0x6f github.com/sourcegraph/conc/panics.(*Catcher).Try(0x445edc?, 0x6?) /go/pkg/mod/github.com/sourcegraph/[email protected]/panics/panics.go:23 +0x48 github.com/sourcegraph/conc.(*WaitGroup).Go.func1() /go/pkg/mod/github.com/sourcegraph/[email protected]/waitgroup.go:32 +0x56 created by github.com/sourcegraph/conc.(*WaitGroup).Go in goroutine 372437 /go/pkg/mod/github.com/sourcegraph/[email protected]/waitgroup.go:30 +0x73 ``` I can hit this if I `terminal` a container that doesn't have default args, and hasn't called `withDefaultTerminalCmd`.
https://github.com/dagger/dagger/issues/6828
https://github.com/dagger/dagger/pull/6838
e5f0bc7389dc0ba454fa8247de023e4a92efb1c2
7b69661a44e419b03d94264b74c3e99d6e98cf0d
"2024-03-05T16:34:06Z"
go
"2024-03-06T14:03:34Z"
core/container.go
if root == nil { panic("query must be non-nil") } return &Container{ Query: root, Platform: platform, }, nil } func (container *Container) Clone() *Container { cp := *container cp.Config.ExposedPorts = cloneMap(cp.Config.ExposedPorts) cp.Config.Env = cloneSlice(cp.Config.Env) cp.Config.Entrypoint = cloneSlice(cp.Config.Entrypoint) cp.Config.Cmd = cloneSlice(cp.Config.Cmd) cp.Config.Volumes = cloneMap(cp.Config.Volumes) cp.Config.Labels = cloneMap(cp.Config.Labels) cp.Mounts = cloneSlice(cp.Mounts) cp.Secrets = cloneSlice(cp.Secrets) cp.Sockets = cloneSlice(cp.Sockets) cp.Ports = cloneSlice(cp.Ports) cp.Services = cloneSlice(cp.Services) return &cp } var _ pipeline.Pipelineable = (*Container)(nil) func (container *Container) PipelinePath() pipeline.Path { return container.Query.Pipeline } type Ownership struct {
closed
dagger/dagger
https://github.com/dagger/dagger
6,828
Panic in `terminal` if no args set
Think this is a regression in v0.10.1 cc @TomChv See https://github.com/dagger/dagger/pull/6805/files#r1513137070 ``` goroutine 457496 [running]: runtime/debug.Stack() /usr/local/go/src/runtime/debug/stack.go:24 +0x5e github.com/dagger/dagger/dagql.(*Server).resolvePath.func1() /app/dagql/server.go:642 +0x74 panic({0x1bd65a0?, 0x3139130?}) /usr/local/go/src/runtime/panic.go:914 +0x21f github.com/dagger/dagger/core/schema.(*containerSchema).terminal(0x1d3a040?, {0x2299038, 0xc00330eea0}, {0xc005579280, 0xc00305f340, {0x0, 0x1, 0xc0033daf60, 0xc00394bed8}, 0x0}, ...) /app/core/schema/container.go:1366 +0xc9 github.com/dagger/dagger/dagql.NodeFunc[...].func1({0xc005579280, 0xc00305f340, {0x0, 0x1, 0xc0033daf60, 0xc00394bed8}, 0x0}, 0xc00330ef00) /app/dagql/objects.go:355 +0x184 github.com/dagger/dagger/dagql.Class[...].Call(0x22c3500?, {0x2299038?, 0xc00330eea0?}, {0xc005579280, 0xc00305f340, {0x0, 0x1, 0xc0033daf60, 0xc00394bed8}, 0x0}, ...) /app/dagql/objects.go:202 +0x15d github.com/dagger/dagger/dagql.Instance[...].Select(0x22b3a20, {0x2299038, 0xc00330eea0}, {{0xc000cd2508, 0x8}, {0x319c680, 0x0, 0x0}, 0x0}) /app/dagql/objects.go:271 +0x2fe github.com/dagger/dagger/dagql.(*Server).cachedSelect.func1({0x2299038?, 0xc00330eea0?}) /app/dagql/server.go:583 +0x49 github.com/dagger/dagger/tracing.AroundFunc.ProgrockAroundFunc.func1({0x2299038, 0xc00330ed80}) /app/tracing/graphql.go:102 +0x5c4 github.com/dagger/dagger/tracing.AroundFunc.SpanAroundFunc.func2({0x2299038, 0xc003e691a0}) /app/tracing/graphql.go:33 +0xa6 github.com/dagger/dagger/dagql.(*cacheMap[...]).GetOrInitializeOnHit(0x22bf680, {0x2299038, 0xc003e68ea0}, {0xc003775130, 0x47}, 0xc004ccb788, 0xc0031f9b08) /app/dagql/cachemap.go:85 +0x272 github.com/dagger/dagger/dagql.(*cacheMap[...]).GetOrInitialize(0xc0031f9b48?, {0x2299038?, 0xc003e68ea0?}, {0xc003775130?, 0x10c0f25?}, 0x229c200?) /app/dagql/cachemap.go:60 +0x45 github.com/dagger/dagger/dagql.(*Server).cachedSelect(0xc003e1a4b0, {0x2299038, 0xc004a82630}, {0x229c200, 0xc002c9ac40}, {{0xc000cd2508, 0x8}, {0x319c680, 0x0, 0x0}, ...}) /app/dagql/server.go:592 +0x203 github.com/dagger/dagger/dagql.(*Server).resolvePath(0x1052c6b?, {0x2299038, 0xc004a82630}, {0x229c200?, 0xc002c9ac40?}, {{0xc000cd2508, 0x8}, {{0xc000cd2508, 0x8}, {0x319c680, ...}, ...}, ...}) /app/dagql/server.go:651 +0x13e github.com/dagger/dagger/dagql.(*Server).Resolve.func1() /app/dagql/server.go:405 +0x7f github.com/dagger/dagger/dagql.(*Server).Resolve.(*ErrorPool).Go.func3() /go/pkg/mod/github.com/sourcegraph/[email protected]/pool/error_pool.go:30 +0x22 github.com/sourcegraph/conc/pool.(*Pool).worker(0xc001825858?) /go/pkg/mod/github.com/sourcegraph/[email protected]/pool/pool.go:154 +0x6f github.com/sourcegraph/conc/panics.(*Catcher).Try(0x445edc?, 0x6?) /go/pkg/mod/github.com/sourcegraph/[email protected]/panics/panics.go:23 +0x48 github.com/sourcegraph/conc.(*WaitGroup).Go.func1() /go/pkg/mod/github.com/sourcegraph/[email protected]/waitgroup.go:32 +0x56 created by github.com/sourcegraph/conc.(*WaitGroup).Go in goroutine 372437 /go/pkg/mod/github.com/sourcegraph/[email protected]/waitgroup.go:30 +0x73 ``` I can hit this if I `terminal` a container that doesn't have default args, and hasn't called `withDefaultTerminalCmd`.
https://github.com/dagger/dagger/issues/6828
https://github.com/dagger/dagger/pull/6838
e5f0bc7389dc0ba454fa8247de023e4a92efb1c2
7b69661a44e419b03d94264b74c3e99d6e98cf0d
"2024-03-05T16:34:06Z"
go
"2024-03-06T14:03:34Z"
core/container.go
UID int `json:"uid"` GID int `json:"gid"` } func (owner Ownership) Opt() llb.ChownOption { return llb.WithUIDGID(owner.UID, owner.GID) } type ContainerSecret struct {
closed
dagger/dagger
https://github.com/dagger/dagger
6,828
Panic in `terminal` if no args set
Think this is a regression in v0.10.1 cc @TomChv See https://github.com/dagger/dagger/pull/6805/files#r1513137070 ``` goroutine 457496 [running]: runtime/debug.Stack() /usr/local/go/src/runtime/debug/stack.go:24 +0x5e github.com/dagger/dagger/dagql.(*Server).resolvePath.func1() /app/dagql/server.go:642 +0x74 panic({0x1bd65a0?, 0x3139130?}) /usr/local/go/src/runtime/panic.go:914 +0x21f github.com/dagger/dagger/core/schema.(*containerSchema).terminal(0x1d3a040?, {0x2299038, 0xc00330eea0}, {0xc005579280, 0xc00305f340, {0x0, 0x1, 0xc0033daf60, 0xc00394bed8}, 0x0}, ...) /app/core/schema/container.go:1366 +0xc9 github.com/dagger/dagger/dagql.NodeFunc[...].func1({0xc005579280, 0xc00305f340, {0x0, 0x1, 0xc0033daf60, 0xc00394bed8}, 0x0}, 0xc00330ef00) /app/dagql/objects.go:355 +0x184 github.com/dagger/dagger/dagql.Class[...].Call(0x22c3500?, {0x2299038?, 0xc00330eea0?}, {0xc005579280, 0xc00305f340, {0x0, 0x1, 0xc0033daf60, 0xc00394bed8}, 0x0}, ...) /app/dagql/objects.go:202 +0x15d github.com/dagger/dagger/dagql.Instance[...].Select(0x22b3a20, {0x2299038, 0xc00330eea0}, {{0xc000cd2508, 0x8}, {0x319c680, 0x0, 0x0}, 0x0}) /app/dagql/objects.go:271 +0x2fe github.com/dagger/dagger/dagql.(*Server).cachedSelect.func1({0x2299038?, 0xc00330eea0?}) /app/dagql/server.go:583 +0x49 github.com/dagger/dagger/tracing.AroundFunc.ProgrockAroundFunc.func1({0x2299038, 0xc00330ed80}) /app/tracing/graphql.go:102 +0x5c4 github.com/dagger/dagger/tracing.AroundFunc.SpanAroundFunc.func2({0x2299038, 0xc003e691a0}) /app/tracing/graphql.go:33 +0xa6 github.com/dagger/dagger/dagql.(*cacheMap[...]).GetOrInitializeOnHit(0x22bf680, {0x2299038, 0xc003e68ea0}, {0xc003775130, 0x47}, 0xc004ccb788, 0xc0031f9b08) /app/dagql/cachemap.go:85 +0x272 github.com/dagger/dagger/dagql.(*cacheMap[...]).GetOrInitialize(0xc0031f9b48?, {0x2299038?, 0xc003e68ea0?}, {0xc003775130?, 0x10c0f25?}, 0x229c200?) /app/dagql/cachemap.go:60 +0x45 github.com/dagger/dagger/dagql.(*Server).cachedSelect(0xc003e1a4b0, {0x2299038, 0xc004a82630}, {0x229c200, 0xc002c9ac40}, {{0xc000cd2508, 0x8}, {0x319c680, 0x0, 0x0}, ...}) /app/dagql/server.go:592 +0x203 github.com/dagger/dagger/dagql.(*Server).resolvePath(0x1052c6b?, {0x2299038, 0xc004a82630}, {0x229c200?, 0xc002c9ac40?}, {{0xc000cd2508, 0x8}, {{0xc000cd2508, 0x8}, {0x319c680, ...}, ...}, ...}) /app/dagql/server.go:651 +0x13e github.com/dagger/dagger/dagql.(*Server).Resolve.func1() /app/dagql/server.go:405 +0x7f github.com/dagger/dagger/dagql.(*Server).Resolve.(*ErrorPool).Go.func3() /go/pkg/mod/github.com/sourcegraph/[email protected]/pool/error_pool.go:30 +0x22 github.com/sourcegraph/conc/pool.(*Pool).worker(0xc001825858?) /go/pkg/mod/github.com/sourcegraph/[email protected]/pool/pool.go:154 +0x6f github.com/sourcegraph/conc/panics.(*Catcher).Try(0x445edc?, 0x6?) /go/pkg/mod/github.com/sourcegraph/[email protected]/panics/panics.go:23 +0x48 github.com/sourcegraph/conc.(*WaitGroup).Go.func1() /go/pkg/mod/github.com/sourcegraph/[email protected]/waitgroup.go:32 +0x56 created by github.com/sourcegraph/conc.(*WaitGroup).Go in goroutine 372437 /go/pkg/mod/github.com/sourcegraph/[email protected]/waitgroup.go:30 +0x73 ``` I can hit this if I `terminal` a container that doesn't have default args, and hasn't called `withDefaultTerminalCmd`.
https://github.com/dagger/dagger/issues/6828
https://github.com/dagger/dagger/pull/6838
e5f0bc7389dc0ba454fa8247de023e4a92efb1c2
7b69661a44e419b03d94264b74c3e99d6e98cf0d
"2024-03-05T16:34:06Z"
go
"2024-03-06T14:03:34Z"
core/container.go
Secret *Secret `json:"secret"` EnvName string `json:"env,omitempty"` MountPath string `json:"path,omitempty"` Owner *Ownership `json:"owner,omitempty"` Mode fs.FileMode `json:"mode,omitempty"` } type ContainerSocket struct { Source *Socket `json:"socket"` ContainerPath string `json:"container_path,omitempty"` Owner *Ownership `json:"owner,omitempty"` } func (container *Container) FSState() (llb.State, error) { if container.FS == nil { return llb.Scratch(), nil } return defToState(container.FS) } func (container *Container) MetaState() (*llb.State, error) { if container.Meta == nil { return nil, nil } metaSt, err := defToState(container.Meta) if err != nil { return nil, err } return &metaSt, nil } type ContainerMount struct {
closed
dagger/dagger
https://github.com/dagger/dagger
6,828
Panic in `terminal` if no args set
Think this is a regression in v0.10.1 cc @TomChv See https://github.com/dagger/dagger/pull/6805/files#r1513137070 ``` goroutine 457496 [running]: runtime/debug.Stack() /usr/local/go/src/runtime/debug/stack.go:24 +0x5e github.com/dagger/dagger/dagql.(*Server).resolvePath.func1() /app/dagql/server.go:642 +0x74 panic({0x1bd65a0?, 0x3139130?}) /usr/local/go/src/runtime/panic.go:914 +0x21f github.com/dagger/dagger/core/schema.(*containerSchema).terminal(0x1d3a040?, {0x2299038, 0xc00330eea0}, {0xc005579280, 0xc00305f340, {0x0, 0x1, 0xc0033daf60, 0xc00394bed8}, 0x0}, ...) /app/core/schema/container.go:1366 +0xc9 github.com/dagger/dagger/dagql.NodeFunc[...].func1({0xc005579280, 0xc00305f340, {0x0, 0x1, 0xc0033daf60, 0xc00394bed8}, 0x0}, 0xc00330ef00) /app/dagql/objects.go:355 +0x184 github.com/dagger/dagger/dagql.Class[...].Call(0x22c3500?, {0x2299038?, 0xc00330eea0?}, {0xc005579280, 0xc00305f340, {0x0, 0x1, 0xc0033daf60, 0xc00394bed8}, 0x0}, ...) /app/dagql/objects.go:202 +0x15d github.com/dagger/dagger/dagql.Instance[...].Select(0x22b3a20, {0x2299038, 0xc00330eea0}, {{0xc000cd2508, 0x8}, {0x319c680, 0x0, 0x0}, 0x0}) /app/dagql/objects.go:271 +0x2fe github.com/dagger/dagger/dagql.(*Server).cachedSelect.func1({0x2299038?, 0xc00330eea0?}) /app/dagql/server.go:583 +0x49 github.com/dagger/dagger/tracing.AroundFunc.ProgrockAroundFunc.func1({0x2299038, 0xc00330ed80}) /app/tracing/graphql.go:102 +0x5c4 github.com/dagger/dagger/tracing.AroundFunc.SpanAroundFunc.func2({0x2299038, 0xc003e691a0}) /app/tracing/graphql.go:33 +0xa6 github.com/dagger/dagger/dagql.(*cacheMap[...]).GetOrInitializeOnHit(0x22bf680, {0x2299038, 0xc003e68ea0}, {0xc003775130, 0x47}, 0xc004ccb788, 0xc0031f9b08) /app/dagql/cachemap.go:85 +0x272 github.com/dagger/dagger/dagql.(*cacheMap[...]).GetOrInitialize(0xc0031f9b48?, {0x2299038?, 0xc003e68ea0?}, {0xc003775130?, 0x10c0f25?}, 0x229c200?) /app/dagql/cachemap.go:60 +0x45 github.com/dagger/dagger/dagql.(*Server).cachedSelect(0xc003e1a4b0, {0x2299038, 0xc004a82630}, {0x229c200, 0xc002c9ac40}, {{0xc000cd2508, 0x8}, {0x319c680, 0x0, 0x0}, ...}) /app/dagql/server.go:592 +0x203 github.com/dagger/dagger/dagql.(*Server).resolvePath(0x1052c6b?, {0x2299038, 0xc004a82630}, {0x229c200?, 0xc002c9ac40?}, {{0xc000cd2508, 0x8}, {{0xc000cd2508, 0x8}, {0x319c680, ...}, ...}, ...}) /app/dagql/server.go:651 +0x13e github.com/dagger/dagger/dagql.(*Server).Resolve.func1() /app/dagql/server.go:405 +0x7f github.com/dagger/dagger/dagql.(*Server).Resolve.(*ErrorPool).Go.func3() /go/pkg/mod/github.com/sourcegraph/[email protected]/pool/error_pool.go:30 +0x22 github.com/sourcegraph/conc/pool.(*Pool).worker(0xc001825858?) /go/pkg/mod/github.com/sourcegraph/[email protected]/pool/pool.go:154 +0x6f github.com/sourcegraph/conc/panics.(*Catcher).Try(0x445edc?, 0x6?) /go/pkg/mod/github.com/sourcegraph/[email protected]/panics/panics.go:23 +0x48 github.com/sourcegraph/conc.(*WaitGroup).Go.func1() /go/pkg/mod/github.com/sourcegraph/[email protected]/waitgroup.go:32 +0x56 created by github.com/sourcegraph/conc.(*WaitGroup).Go in goroutine 372437 /go/pkg/mod/github.com/sourcegraph/[email protected]/waitgroup.go:30 +0x73 ``` I can hit this if I `terminal` a container that doesn't have default args, and hasn't called `withDefaultTerminalCmd`.
https://github.com/dagger/dagger/issues/6828
https://github.com/dagger/dagger/pull/6838
e5f0bc7389dc0ba454fa8247de023e4a92efb1c2
7b69661a44e419b03d94264b74c3e99d6e98cf0d
"2024-03-05T16:34:06Z"
go
"2024-03-06T14:03:34Z"
core/container.go
Source *pb.Definition `json:"source,omitempty"` SourcePath string `json:"source_path,omitempty"` Target string `json:"target"` CacheVolumeID string `json:"cache_volume_id,omitempty"` CacheSharingMode CacheSharingMode `json:"cache_sharing,omitempty"` Tmpfs bool `json:"tmpfs,omitempty"` Readonly bool `json:"readonly,omitempty"` } func (mnt ContainerMount) SourceState() (llb.State, error) { if mnt.Source == nil { return llb.Scratch(), nil } return defToState(mnt.Source) } type ContainerMounts []ContainerMount func (mnts ContainerMounts) With(newMnt ContainerMount) ContainerMounts { mntsCp := make(ContainerMounts, 0, len(mnts)) parent := newMnt.Target + "/" for _, mnt := range mnts {
closed
dagger/dagger
https://github.com/dagger/dagger
6,828
Panic in `terminal` if no args set
Think this is a regression in v0.10.1 cc @TomChv See https://github.com/dagger/dagger/pull/6805/files#r1513137070 ``` goroutine 457496 [running]: runtime/debug.Stack() /usr/local/go/src/runtime/debug/stack.go:24 +0x5e github.com/dagger/dagger/dagql.(*Server).resolvePath.func1() /app/dagql/server.go:642 +0x74 panic({0x1bd65a0?, 0x3139130?}) /usr/local/go/src/runtime/panic.go:914 +0x21f github.com/dagger/dagger/core/schema.(*containerSchema).terminal(0x1d3a040?, {0x2299038, 0xc00330eea0}, {0xc005579280, 0xc00305f340, {0x0, 0x1, 0xc0033daf60, 0xc00394bed8}, 0x0}, ...) /app/core/schema/container.go:1366 +0xc9 github.com/dagger/dagger/dagql.NodeFunc[...].func1({0xc005579280, 0xc00305f340, {0x0, 0x1, 0xc0033daf60, 0xc00394bed8}, 0x0}, 0xc00330ef00) /app/dagql/objects.go:355 +0x184 github.com/dagger/dagger/dagql.Class[...].Call(0x22c3500?, {0x2299038?, 0xc00330eea0?}, {0xc005579280, 0xc00305f340, {0x0, 0x1, 0xc0033daf60, 0xc00394bed8}, 0x0}, ...) /app/dagql/objects.go:202 +0x15d github.com/dagger/dagger/dagql.Instance[...].Select(0x22b3a20, {0x2299038, 0xc00330eea0}, {{0xc000cd2508, 0x8}, {0x319c680, 0x0, 0x0}, 0x0}) /app/dagql/objects.go:271 +0x2fe github.com/dagger/dagger/dagql.(*Server).cachedSelect.func1({0x2299038?, 0xc00330eea0?}) /app/dagql/server.go:583 +0x49 github.com/dagger/dagger/tracing.AroundFunc.ProgrockAroundFunc.func1({0x2299038, 0xc00330ed80}) /app/tracing/graphql.go:102 +0x5c4 github.com/dagger/dagger/tracing.AroundFunc.SpanAroundFunc.func2({0x2299038, 0xc003e691a0}) /app/tracing/graphql.go:33 +0xa6 github.com/dagger/dagger/dagql.(*cacheMap[...]).GetOrInitializeOnHit(0x22bf680, {0x2299038, 0xc003e68ea0}, {0xc003775130, 0x47}, 0xc004ccb788, 0xc0031f9b08) /app/dagql/cachemap.go:85 +0x272 github.com/dagger/dagger/dagql.(*cacheMap[...]).GetOrInitialize(0xc0031f9b48?, {0x2299038?, 0xc003e68ea0?}, {0xc003775130?, 0x10c0f25?}, 0x229c200?) /app/dagql/cachemap.go:60 +0x45 github.com/dagger/dagger/dagql.(*Server).cachedSelect(0xc003e1a4b0, {0x2299038, 0xc004a82630}, {0x229c200, 0xc002c9ac40}, {{0xc000cd2508, 0x8}, {0x319c680, 0x0, 0x0}, ...}) /app/dagql/server.go:592 +0x203 github.com/dagger/dagger/dagql.(*Server).resolvePath(0x1052c6b?, {0x2299038, 0xc004a82630}, {0x229c200?, 0xc002c9ac40?}, {{0xc000cd2508, 0x8}, {{0xc000cd2508, 0x8}, {0x319c680, ...}, ...}, ...}) /app/dagql/server.go:651 +0x13e github.com/dagger/dagger/dagql.(*Server).Resolve.func1() /app/dagql/server.go:405 +0x7f github.com/dagger/dagger/dagql.(*Server).Resolve.(*ErrorPool).Go.func3() /go/pkg/mod/github.com/sourcegraph/[email protected]/pool/error_pool.go:30 +0x22 github.com/sourcegraph/conc/pool.(*Pool).worker(0xc001825858?) /go/pkg/mod/github.com/sourcegraph/[email protected]/pool/pool.go:154 +0x6f github.com/sourcegraph/conc/panics.(*Catcher).Try(0x445edc?, 0x6?) /go/pkg/mod/github.com/sourcegraph/[email protected]/panics/panics.go:23 +0x48 github.com/sourcegraph/conc.(*WaitGroup).Go.func1() /go/pkg/mod/github.com/sourcegraph/[email protected]/waitgroup.go:32 +0x56 created by github.com/sourcegraph/conc.(*WaitGroup).Go in goroutine 372437 /go/pkg/mod/github.com/sourcegraph/[email protected]/waitgroup.go:30 +0x73 ``` I can hit this if I `terminal` a container that doesn't have default args, and hasn't called `withDefaultTerminalCmd`.
https://github.com/dagger/dagger/issues/6828
https://github.com/dagger/dagger/pull/6838
e5f0bc7389dc0ba454fa8247de023e4a92efb1c2
7b69661a44e419b03d94264b74c3e99d6e98cf0d
"2024-03-05T16:34:06Z"
go
"2024-03-06T14:03:34Z"
core/container.go
if mnt.Target == newMnt.Target || strings.HasPrefix(mnt.Target, parent) { continue } mntsCp = append(mntsCp, mnt) } mntsCp = append(mntsCp, newMnt) return mntsCp } func (container *Container) From(ctx context.Context, addr string) (*Container, error) { bk := container.Query.Buildkit container = container.Clone() platform := container.Platform ctx, subRecorder := progrock.WithGroup(ctx, fmt.Sprintf("from %s", addr), progrock.Weak()) refName, err := reference.ParseNormalizedNamed(addr) if err != nil { return nil, err } ref := reference.TagNameOnly(refName).String() _, digest, cfgBytes, err := bk.ResolveImageConfig(ctx, ref, llb.ResolveImageConfigOpt{ Platform: ptr(platform.Spec()), ResolveMode: llb.ResolveModeDefault.String(), }) if err != nil { return nil, err } digested, err := reference.WithDigest(refName, digest) if err != nil { return nil, err
closed
dagger/dagger
https://github.com/dagger/dagger
6,828
Panic in `terminal` if no args set
Think this is a regression in v0.10.1 cc @TomChv See https://github.com/dagger/dagger/pull/6805/files#r1513137070 ``` goroutine 457496 [running]: runtime/debug.Stack() /usr/local/go/src/runtime/debug/stack.go:24 +0x5e github.com/dagger/dagger/dagql.(*Server).resolvePath.func1() /app/dagql/server.go:642 +0x74 panic({0x1bd65a0?, 0x3139130?}) /usr/local/go/src/runtime/panic.go:914 +0x21f github.com/dagger/dagger/core/schema.(*containerSchema).terminal(0x1d3a040?, {0x2299038, 0xc00330eea0}, {0xc005579280, 0xc00305f340, {0x0, 0x1, 0xc0033daf60, 0xc00394bed8}, 0x0}, ...) /app/core/schema/container.go:1366 +0xc9 github.com/dagger/dagger/dagql.NodeFunc[...].func1({0xc005579280, 0xc00305f340, {0x0, 0x1, 0xc0033daf60, 0xc00394bed8}, 0x0}, 0xc00330ef00) /app/dagql/objects.go:355 +0x184 github.com/dagger/dagger/dagql.Class[...].Call(0x22c3500?, {0x2299038?, 0xc00330eea0?}, {0xc005579280, 0xc00305f340, {0x0, 0x1, 0xc0033daf60, 0xc00394bed8}, 0x0}, ...) /app/dagql/objects.go:202 +0x15d github.com/dagger/dagger/dagql.Instance[...].Select(0x22b3a20, {0x2299038, 0xc00330eea0}, {{0xc000cd2508, 0x8}, {0x319c680, 0x0, 0x0}, 0x0}) /app/dagql/objects.go:271 +0x2fe github.com/dagger/dagger/dagql.(*Server).cachedSelect.func1({0x2299038?, 0xc00330eea0?}) /app/dagql/server.go:583 +0x49 github.com/dagger/dagger/tracing.AroundFunc.ProgrockAroundFunc.func1({0x2299038, 0xc00330ed80}) /app/tracing/graphql.go:102 +0x5c4 github.com/dagger/dagger/tracing.AroundFunc.SpanAroundFunc.func2({0x2299038, 0xc003e691a0}) /app/tracing/graphql.go:33 +0xa6 github.com/dagger/dagger/dagql.(*cacheMap[...]).GetOrInitializeOnHit(0x22bf680, {0x2299038, 0xc003e68ea0}, {0xc003775130, 0x47}, 0xc004ccb788, 0xc0031f9b08) /app/dagql/cachemap.go:85 +0x272 github.com/dagger/dagger/dagql.(*cacheMap[...]).GetOrInitialize(0xc0031f9b48?, {0x2299038?, 0xc003e68ea0?}, {0xc003775130?, 0x10c0f25?}, 0x229c200?) /app/dagql/cachemap.go:60 +0x45 github.com/dagger/dagger/dagql.(*Server).cachedSelect(0xc003e1a4b0, {0x2299038, 0xc004a82630}, {0x229c200, 0xc002c9ac40}, {{0xc000cd2508, 0x8}, {0x319c680, 0x0, 0x0}, ...}) /app/dagql/server.go:592 +0x203 github.com/dagger/dagger/dagql.(*Server).resolvePath(0x1052c6b?, {0x2299038, 0xc004a82630}, {0x229c200?, 0xc002c9ac40?}, {{0xc000cd2508, 0x8}, {{0xc000cd2508, 0x8}, {0x319c680, ...}, ...}, ...}) /app/dagql/server.go:651 +0x13e github.com/dagger/dagger/dagql.(*Server).Resolve.func1() /app/dagql/server.go:405 +0x7f github.com/dagger/dagger/dagql.(*Server).Resolve.(*ErrorPool).Go.func3() /go/pkg/mod/github.com/sourcegraph/[email protected]/pool/error_pool.go:30 +0x22 github.com/sourcegraph/conc/pool.(*Pool).worker(0xc001825858?) /go/pkg/mod/github.com/sourcegraph/[email protected]/pool/pool.go:154 +0x6f github.com/sourcegraph/conc/panics.(*Catcher).Try(0x445edc?, 0x6?) /go/pkg/mod/github.com/sourcegraph/[email protected]/panics/panics.go:23 +0x48 github.com/sourcegraph/conc.(*WaitGroup).Go.func1() /go/pkg/mod/github.com/sourcegraph/[email protected]/waitgroup.go:32 +0x56 created by github.com/sourcegraph/conc.(*WaitGroup).Go in goroutine 372437 /go/pkg/mod/github.com/sourcegraph/[email protected]/waitgroup.go:30 +0x73 ``` I can hit this if I `terminal` a container that doesn't have default args, and hasn't called `withDefaultTerminalCmd`.
https://github.com/dagger/dagger/issues/6828
https://github.com/dagger/dagger/pull/6838
e5f0bc7389dc0ba454fa8247de023e4a92efb1c2
7b69661a44e419b03d94264b74c3e99d6e98cf0d
"2024-03-05T16:34:06Z"
go
"2024-03-06T14:03:34Z"
core/container.go
} var imgSpec specs.Image if err := json.Unmarshal(cfgBytes, &imgSpec); err != nil { return nil, err } fsSt := llb.Image( digested.String(), llb.WithCustomNamef("pull %s", ref), ) def, err := fsSt.Marshal(ctx, llb.Platform(platform.Spec())) if err != nil { return nil, err } container.FS = def.ToPB() buildkit.RecordVertexes(subRecorder, container.FS) container.Config = mergeImageConfig(container.Config, imgSpec.Config) container.ImageRef = digested.String() return container, nil } const defaultDockerfileName = "Dockerfile" func (container *Container) Build( ctx context.Context, contextDir *Directory, dockerfile string, buildArgs []BuildArg, target string, secrets []*Secret, ) (*Container, error) { container = container.Clone()
closed
dagger/dagger
https://github.com/dagger/dagger
6,828
Panic in `terminal` if no args set
Think this is a regression in v0.10.1 cc @TomChv See https://github.com/dagger/dagger/pull/6805/files#r1513137070 ``` goroutine 457496 [running]: runtime/debug.Stack() /usr/local/go/src/runtime/debug/stack.go:24 +0x5e github.com/dagger/dagger/dagql.(*Server).resolvePath.func1() /app/dagql/server.go:642 +0x74 panic({0x1bd65a0?, 0x3139130?}) /usr/local/go/src/runtime/panic.go:914 +0x21f github.com/dagger/dagger/core/schema.(*containerSchema).terminal(0x1d3a040?, {0x2299038, 0xc00330eea0}, {0xc005579280, 0xc00305f340, {0x0, 0x1, 0xc0033daf60, 0xc00394bed8}, 0x0}, ...) /app/core/schema/container.go:1366 +0xc9 github.com/dagger/dagger/dagql.NodeFunc[...].func1({0xc005579280, 0xc00305f340, {0x0, 0x1, 0xc0033daf60, 0xc00394bed8}, 0x0}, 0xc00330ef00) /app/dagql/objects.go:355 +0x184 github.com/dagger/dagger/dagql.Class[...].Call(0x22c3500?, {0x2299038?, 0xc00330eea0?}, {0xc005579280, 0xc00305f340, {0x0, 0x1, 0xc0033daf60, 0xc00394bed8}, 0x0}, ...) /app/dagql/objects.go:202 +0x15d github.com/dagger/dagger/dagql.Instance[...].Select(0x22b3a20, {0x2299038, 0xc00330eea0}, {{0xc000cd2508, 0x8}, {0x319c680, 0x0, 0x0}, 0x0}) /app/dagql/objects.go:271 +0x2fe github.com/dagger/dagger/dagql.(*Server).cachedSelect.func1({0x2299038?, 0xc00330eea0?}) /app/dagql/server.go:583 +0x49 github.com/dagger/dagger/tracing.AroundFunc.ProgrockAroundFunc.func1({0x2299038, 0xc00330ed80}) /app/tracing/graphql.go:102 +0x5c4 github.com/dagger/dagger/tracing.AroundFunc.SpanAroundFunc.func2({0x2299038, 0xc003e691a0}) /app/tracing/graphql.go:33 +0xa6 github.com/dagger/dagger/dagql.(*cacheMap[...]).GetOrInitializeOnHit(0x22bf680, {0x2299038, 0xc003e68ea0}, {0xc003775130, 0x47}, 0xc004ccb788, 0xc0031f9b08) /app/dagql/cachemap.go:85 +0x272 github.com/dagger/dagger/dagql.(*cacheMap[...]).GetOrInitialize(0xc0031f9b48?, {0x2299038?, 0xc003e68ea0?}, {0xc003775130?, 0x10c0f25?}, 0x229c200?) /app/dagql/cachemap.go:60 +0x45 github.com/dagger/dagger/dagql.(*Server).cachedSelect(0xc003e1a4b0, {0x2299038, 0xc004a82630}, {0x229c200, 0xc002c9ac40}, {{0xc000cd2508, 0x8}, {0x319c680, 0x0, 0x0}, ...}) /app/dagql/server.go:592 +0x203 github.com/dagger/dagger/dagql.(*Server).resolvePath(0x1052c6b?, {0x2299038, 0xc004a82630}, {0x229c200?, 0xc002c9ac40?}, {{0xc000cd2508, 0x8}, {{0xc000cd2508, 0x8}, {0x319c680, ...}, ...}, ...}) /app/dagql/server.go:651 +0x13e github.com/dagger/dagger/dagql.(*Server).Resolve.func1() /app/dagql/server.go:405 +0x7f github.com/dagger/dagger/dagql.(*Server).Resolve.(*ErrorPool).Go.func3() /go/pkg/mod/github.com/sourcegraph/[email protected]/pool/error_pool.go:30 +0x22 github.com/sourcegraph/conc/pool.(*Pool).worker(0xc001825858?) /go/pkg/mod/github.com/sourcegraph/[email protected]/pool/pool.go:154 +0x6f github.com/sourcegraph/conc/panics.(*Catcher).Try(0x445edc?, 0x6?) /go/pkg/mod/github.com/sourcegraph/[email protected]/panics/panics.go:23 +0x48 github.com/sourcegraph/conc.(*WaitGroup).Go.func1() /go/pkg/mod/github.com/sourcegraph/[email protected]/waitgroup.go:32 +0x56 created by github.com/sourcegraph/conc.(*WaitGroup).Go in goroutine 372437 /go/pkg/mod/github.com/sourcegraph/[email protected]/waitgroup.go:30 +0x73 ``` I can hit this if I `terminal` a container that doesn't have default args, and hasn't called `withDefaultTerminalCmd`.
https://github.com/dagger/dagger/issues/6828
https://github.com/dagger/dagger/pull/6838
e5f0bc7389dc0ba454fa8247de023e4a92efb1c2
7b69661a44e419b03d94264b74c3e99d6e98cf0d
"2024-03-05T16:34:06Z"
go
"2024-03-06T14:03:34Z"
core/container.go
container.Services.Merge(contextDir.Services) for _, secret := range secrets { container.Secrets = append(container.Secrets, ContainerSecret{ Secret: secret, MountPath: fmt.Sprintf("/run/secrets/%s", secret.Name), }) } container.ImageRef = "" svcs := container.Query.Services bk := container.Query.Buildkit ctx, subRecorder := progrock.WithGroup(ctx, "docker build", progrock.Weak()) detach, _, err := svcs.StartBindings(ctx, container.Services) if err != nil { return nil, err } defer detach() platform := container.Platform opts := map[string]string{ "platform": platform.Format(), "contextsubdir": contextDir.Dir, } if dockerfile != "" { opts["filename"] = path.Join(contextDir.Dir, dockerfile) } else { opts["filename"] = path.Join(contextDir.Dir, defaultDockerfileName) } if target != "" { opts["target"] = target
closed
dagger/dagger
https://github.com/dagger/dagger
6,828
Panic in `terminal` if no args set
Think this is a regression in v0.10.1 cc @TomChv See https://github.com/dagger/dagger/pull/6805/files#r1513137070 ``` goroutine 457496 [running]: runtime/debug.Stack() /usr/local/go/src/runtime/debug/stack.go:24 +0x5e github.com/dagger/dagger/dagql.(*Server).resolvePath.func1() /app/dagql/server.go:642 +0x74 panic({0x1bd65a0?, 0x3139130?}) /usr/local/go/src/runtime/panic.go:914 +0x21f github.com/dagger/dagger/core/schema.(*containerSchema).terminal(0x1d3a040?, {0x2299038, 0xc00330eea0}, {0xc005579280, 0xc00305f340, {0x0, 0x1, 0xc0033daf60, 0xc00394bed8}, 0x0}, ...) /app/core/schema/container.go:1366 +0xc9 github.com/dagger/dagger/dagql.NodeFunc[...].func1({0xc005579280, 0xc00305f340, {0x0, 0x1, 0xc0033daf60, 0xc00394bed8}, 0x0}, 0xc00330ef00) /app/dagql/objects.go:355 +0x184 github.com/dagger/dagger/dagql.Class[...].Call(0x22c3500?, {0x2299038?, 0xc00330eea0?}, {0xc005579280, 0xc00305f340, {0x0, 0x1, 0xc0033daf60, 0xc00394bed8}, 0x0}, ...) /app/dagql/objects.go:202 +0x15d github.com/dagger/dagger/dagql.Instance[...].Select(0x22b3a20, {0x2299038, 0xc00330eea0}, {{0xc000cd2508, 0x8}, {0x319c680, 0x0, 0x0}, 0x0}) /app/dagql/objects.go:271 +0x2fe github.com/dagger/dagger/dagql.(*Server).cachedSelect.func1({0x2299038?, 0xc00330eea0?}) /app/dagql/server.go:583 +0x49 github.com/dagger/dagger/tracing.AroundFunc.ProgrockAroundFunc.func1({0x2299038, 0xc00330ed80}) /app/tracing/graphql.go:102 +0x5c4 github.com/dagger/dagger/tracing.AroundFunc.SpanAroundFunc.func2({0x2299038, 0xc003e691a0}) /app/tracing/graphql.go:33 +0xa6 github.com/dagger/dagger/dagql.(*cacheMap[...]).GetOrInitializeOnHit(0x22bf680, {0x2299038, 0xc003e68ea0}, {0xc003775130, 0x47}, 0xc004ccb788, 0xc0031f9b08) /app/dagql/cachemap.go:85 +0x272 github.com/dagger/dagger/dagql.(*cacheMap[...]).GetOrInitialize(0xc0031f9b48?, {0x2299038?, 0xc003e68ea0?}, {0xc003775130?, 0x10c0f25?}, 0x229c200?) /app/dagql/cachemap.go:60 +0x45 github.com/dagger/dagger/dagql.(*Server).cachedSelect(0xc003e1a4b0, {0x2299038, 0xc004a82630}, {0x229c200, 0xc002c9ac40}, {{0xc000cd2508, 0x8}, {0x319c680, 0x0, 0x0}, ...}) /app/dagql/server.go:592 +0x203 github.com/dagger/dagger/dagql.(*Server).resolvePath(0x1052c6b?, {0x2299038, 0xc004a82630}, {0x229c200?, 0xc002c9ac40?}, {{0xc000cd2508, 0x8}, {{0xc000cd2508, 0x8}, {0x319c680, ...}, ...}, ...}) /app/dagql/server.go:651 +0x13e github.com/dagger/dagger/dagql.(*Server).Resolve.func1() /app/dagql/server.go:405 +0x7f github.com/dagger/dagger/dagql.(*Server).Resolve.(*ErrorPool).Go.func3() /go/pkg/mod/github.com/sourcegraph/[email protected]/pool/error_pool.go:30 +0x22 github.com/sourcegraph/conc/pool.(*Pool).worker(0xc001825858?) /go/pkg/mod/github.com/sourcegraph/[email protected]/pool/pool.go:154 +0x6f github.com/sourcegraph/conc/panics.(*Catcher).Try(0x445edc?, 0x6?) /go/pkg/mod/github.com/sourcegraph/[email protected]/panics/panics.go:23 +0x48 github.com/sourcegraph/conc.(*WaitGroup).Go.func1() /go/pkg/mod/github.com/sourcegraph/[email protected]/waitgroup.go:32 +0x56 created by github.com/sourcegraph/conc.(*WaitGroup).Go in goroutine 372437 /go/pkg/mod/github.com/sourcegraph/[email protected]/waitgroup.go:30 +0x73 ``` I can hit this if I `terminal` a container that doesn't have default args, and hasn't called `withDefaultTerminalCmd`.
https://github.com/dagger/dagger/issues/6828
https://github.com/dagger/dagger/pull/6838
e5f0bc7389dc0ba454fa8247de023e4a92efb1c2
7b69661a44e419b03d94264b74c3e99d6e98cf0d
"2024-03-05T16:34:06Z"
go
"2024-03-06T14:03:34Z"
core/container.go
} for _, buildArg := range buildArgs { opts["build-arg:"+buildArg.Name] = buildArg.Value } inputs := map[string]*pb.Definition{ dockerui.DefaultLocalNameContext: contextDir.LLB, dockerui.DefaultLocalNameDockerfile: contextDir.LLB, } solveCtx := context.WithValue(ctx, "secret-translator", func(name string) (string, error) { return GetLocalSecretAccessor(ctx, container.Query, name) }) res, err := bk.Solve(solveCtx, bkgw.SolveRequest{ Frontend: "dockerfile.v0", FrontendOpt: opts, FrontendInputs: inputs, }) if err != nil { return nil, err } bkref, err := res.SingleRef() if err != nil { return nil, err } var st llb.State if bkref == nil { st = llb.Scratch() } else { st, err = bkref.ToState()