status
stringclasses
1 value
repo_name
stringclasses
31 values
repo_url
stringclasses
31 values
issue_id
int64
1
104k
title
stringlengths
4
233
body
stringlengths
0
186k
issue_url
stringlengths
38
56
pull_url
stringlengths
37
54
before_fix_sha
stringlengths
40
40
after_fix_sha
stringlengths
40
40
report_datetime
timestamp[us, tz=UTC]
language
stringclasses
5 values
commit_datetime
timestamp[us, tz=UTC]
updated_file
stringlengths
7
188
chunk_content
stringlengths
1
1.03M
closed
dagger/dagger
https://github.com/dagger/dagger
3,723
Fix spurious `WARN[0000] commandConn.CloseWrite: commandconn: failed to wait: signal: terminated`
Caused by our use of the buildkit connhelper more often now (we always wait to check if it's running first)
https://github.com/dagger/dagger/issues/3723
https://github.com/dagger/dagger/pull/3731
9bd33ed56ab5e64de7ec5759b9416cd05baec5ee
d0e08e48a909fc14647b8be5047597f8243d48a4
2022-11-08T01:47:22Z
go
2022-11-08T18:33:42Z
internal/buildkitd/buildkitd.go
cmd := exec.CommandContext(ctx, "docker", "rm", "-fv", containerName, ) _, err := cmd.CombinedOutput() if err != nil { return err } return nil } func getBuildkitInformation(ctx context.Context) (*buildkitInformation, error) {
closed
dagger/dagger
https://github.com/dagger/dagger
3,723
Fix spurious `WARN[0000] commandConn.CloseWrite: commandconn: failed to wait: signal: terminated`
Caused by our use of the buildkit connhelper more often now (we always wait to check if it's running first)
https://github.com/dagger/dagger/issues/3723
https://github.com/dagger/dagger/pull/3731
9bd33ed56ab5e64de7ec5759b9416cd05baec5ee
d0e08e48a909fc14647b8be5047597f8243d48a4
2022-11-08T01:47:22Z
go
2022-11-08T18:33:42Z
internal/buildkitd/buildkitd.go
formatString := "{{.Config.Image}};{{.State.Running}};{{if index .NetworkSettings.Networks \"host\"}}{{\"true\"}}{{else}}{{\"false\"}}{{end}}" cmd := exec.CommandContext(ctx, "docker", "inspect", "--format", formatString, containerName, ) output, err := cmd.CombinedOutput() if err != nil { return nil, err } s := strings.Split(string(output), ";") imageRef := strings.TrimSpace(s[0]) isActive, err := strconv.ParseBool(strings.TrimSpace(s[1])) if err != nil { return nil, err } return &buildkitInformation{ Image: imageRef, IsActive: isActive, }, nil } type buildkitInformation struct { Image string IsActive bool }
closed
dagger/dagger
https://github.com/dagger/dagger
3,702
Switch to Poetry
## Context We're using [hatch](https://hatch.pypa.io/latest/). ## Pros - Better support (e.g., ~dependabot~[^1], vs code, ...) - Better known by users - Reproducible dev environment (via lock file) ## Cons - Need tox[^2] to replace our use of scripts in dedicated environments - Hatch is more standards compliant [^1]: It [supports hatch](https://github.blog/changelog/2022-10-24-dependabot-updates-support-for-the-python-pep-621-standard/) now. [^2]: Or something else, e.g., [poethepoet](https://pypi.org/project/poethepoet/).
https://github.com/dagger/dagger/issues/3702
https://github.com/dagger/dagger/pull/3730
cd5fbd323926d1eef68a00f5f00e5e89dc0084b7
94f086f6f0e7ffedc4883d0be8e3f32b7b10a4fd
2022-11-05T00:40:24Z
go
2022-11-09T12:10:25Z
internal/mage/sdk/python.go
package sdk import ( "context" "errors" "os" "strings" "dagger.io/dagger" "github.com/dagger/dagger/internal/mage/util" "github.com/magefile/mage/mg" ) var ( pythonGeneratedAPIPaths = []string{ "sdk/python/src/dagger/api/gen.py", "sdk/python/src/dagger/api/gen_sync.py", } ) var _ SDK = Python{} type Python mg.Namespace func (t Python) Lint(ctx context.Context) error { c, err := dagger.Connect(ctx, dagger.WithLogOutput(os.Stderr)) if err != nil { return err } defer c.Close()
closed
dagger/dagger
https://github.com/dagger/dagger
3,702
Switch to Poetry
## Context We're using [hatch](https://hatch.pypa.io/latest/). ## Pros - Better support (e.g., ~dependabot~[^1], vs code, ...) - Better known by users - Reproducible dev environment (via lock file) ## Cons - Need tox[^2] to replace our use of scripts in dedicated environments - Hatch is more standards compliant [^1]: It [supports hatch](https://github.blog/changelog/2022-10-24-dependabot-updates-support-for-the-python-pep-621-standard/) now. [^2]: Or something else, e.g., [poethepoet](https://pypi.org/project/poethepoet/).
https://github.com/dagger/dagger/issues/3702
https://github.com/dagger/dagger/pull/3730
cd5fbd323926d1eef68a00f5f00e5e89dc0084b7
94f086f6f0e7ffedc4883d0be8e3f32b7b10a4fd
2022-11-05T00:40:24Z
go
2022-11-09T12:10:25Z
internal/mage/sdk/python.go
_, err = pythonBase(c). Exec(dagger.ContainerExecOpts{ Args: []string{"hatch", "run", "lint:style"}, }). ExitCode(ctx) if err != nil { return err } return lintGeneratedCode(func() error { return t.Generate(ctx) }, pythonGeneratedAPIPaths...) } func (t Python) Test(ctx context.Context) error { c, err := dagger.Connect(ctx, dagger.WithLogOutput(os.Stderr)) if err != nil { return err } defer c.Close() return util.WithDevEngine(ctx, c, func(ctx context.Context, c *dagger.Client) error { _, err = pythonBase(c). WithEnvVariable("DAGGER_HOST", "unix:///dagger.sock"). Exec(dagger.ContainerExecOpts{ Args: []string{"hatch", "run", "test"}, ExperimentalPrivilegedNesting: true, }). ExitCode(ctx) return err }) } func (t Python) Generate(ctx context.Context) error {
closed
dagger/dagger
https://github.com/dagger/dagger
3,702
Switch to Poetry
## Context We're using [hatch](https://hatch.pypa.io/latest/). ## Pros - Better support (e.g., ~dependabot~[^1], vs code, ...) - Better known by users - Reproducible dev environment (via lock file) ## Cons - Need tox[^2] to replace our use of scripts in dedicated environments - Hatch is more standards compliant [^1]: It [supports hatch](https://github.blog/changelog/2022-10-24-dependabot-updates-support-for-the-python-pep-621-standard/) now. [^2]: Or something else, e.g., [poethepoet](https://pypi.org/project/poethepoet/).
https://github.com/dagger/dagger/issues/3702
https://github.com/dagger/dagger/pull/3730
cd5fbd323926d1eef68a00f5f00e5e89dc0084b7
94f086f6f0e7ffedc4883d0be8e3f32b7b10a4fd
2022-11-05T00:40:24Z
go
2022-11-09T12:10:25Z
internal/mage/sdk/python.go
c, err := dagger.Connect(ctx, dagger.WithLogOutput(os.Stderr)) if err != nil { return err } defer c.Close() return util.WithDevEngine(ctx, c, func(ctx context.Context, c *dagger.Client) error { generated := pythonBase(c). Exec(dagger.ContainerExecOpts{ Args: []string{"hatch", "run", "generate"}, ExperimentalPrivilegedNesting: true, }). Exec(dagger.ContainerExecOpts{ Args: []string{"hatch", "run", "lint:fmt"}, }) for _, f := range pythonGeneratedAPIPaths { contents, err := generated.File(strings.TrimPrefix(f, "sdk/python/")).Contents(ctx) if err != nil { return err } if err := os.WriteFile(f, []byte(contents), 0600); err != nil { return err } } return nil }) } func (t Python) Publish(ctx context.Context, tag string) error { return errors.New("not implemented") } func pythonBase(c *dagger.Client) *dagger.Container {
closed
dagger/dagger
https://github.com/dagger/dagger
3,702
Switch to Poetry
## Context We're using [hatch](https://hatch.pypa.io/latest/). ## Pros - Better support (e.g., ~dependabot~[^1], vs code, ...) - Better known by users - Reproducible dev environment (via lock file) ## Cons - Need tox[^2] to replace our use of scripts in dedicated environments - Hatch is more standards compliant [^1]: It [supports hatch](https://github.blog/changelog/2022-10-24-dependabot-updates-support-for-the-python-pep-621-standard/) now. [^2]: Or something else, e.g., [poethepoet](https://pypi.org/project/poethepoet/).
https://github.com/dagger/dagger/issues/3702
https://github.com/dagger/dagger/pull/3730
cd5fbd323926d1eef68a00f5f00e5e89dc0084b7
94f086f6f0e7ffedc4883d0be8e3f32b7b10a4fd
2022-11-05T00:40:24Z
go
2022-11-09T12:10:25Z
internal/mage/sdk/python.go
src := c.Directory().WithDirectory("/", util.Repository(c).Directory("sdk/python")) base := c.Container().From("python:3.10-alpine"). Exec(dagger.ContainerExecOpts{ Args: []string{"apk", "add", "-U", "--no-cache", "gcc", "musl-dev", "libffi-dev"}, }) base = base. WithEnvVariable("PIP_NO_CACHE_DIR", "off"). WithEnvVariable("PIP_DISABLE_PIP_VERSION_CHECK", "on"). WithEnvVariable("PIP_DEFAULT_TIMEOUT", "100"). Exec(dagger.ContainerExecOpts{ Args: []string{"pip", "install", "hatch"}, }) return base. WithWorkdir("/app"). WithMountedDirectory("/app", src). Exec(dagger.ContainerExecOpts{ Args: []string{"hatch", "env", "create"}, }). Exec(dagger.ContainerExecOpts{ Args: []string{"hatch", "env", "create", "lint"}, }) }
closed
dagger/dagger
https://github.com/dagger/dagger
3,682
Add Python's CI pipeline to GitHub Actions
## Tasks - [x] Add steps from #3678 - [x] Deploy (trigger on release) - [x] Add test step (trigger on PRs) \cc @gerhard
https://github.com/dagger/dagger/issues/3682
https://github.com/dagger/dagger/pull/3730
cd5fbd323926d1eef68a00f5f00e5e89dc0084b7
94f086f6f0e7ffedc4883d0be8e3f32b7b10a4fd
2022-11-04T16:00:10Z
go
2022-11-09T12:10:25Z
internal/mage/sdk/python.go
package sdk import ( "context" "errors" "os" "strings" "dagger.io/dagger" "github.com/dagger/dagger/internal/mage/util" "github.com/magefile/mage/mg" ) var ( pythonGeneratedAPIPaths = []string{ "sdk/python/src/dagger/api/gen.py", "sdk/python/src/dagger/api/gen_sync.py", } ) var _ SDK = Python{} type Python mg.Namespace func (t Python) Lint(ctx context.Context) error { c, err := dagger.Connect(ctx, dagger.WithLogOutput(os.Stderr)) if err != nil { return err } defer c.Close()
closed
dagger/dagger
https://github.com/dagger/dagger
3,682
Add Python's CI pipeline to GitHub Actions
## Tasks - [x] Add steps from #3678 - [x] Deploy (trigger on release) - [x] Add test step (trigger on PRs) \cc @gerhard
https://github.com/dagger/dagger/issues/3682
https://github.com/dagger/dagger/pull/3730
cd5fbd323926d1eef68a00f5f00e5e89dc0084b7
94f086f6f0e7ffedc4883d0be8e3f32b7b10a4fd
2022-11-04T16:00:10Z
go
2022-11-09T12:10:25Z
internal/mage/sdk/python.go
_, err = pythonBase(c). Exec(dagger.ContainerExecOpts{ Args: []string{"hatch", "run", "lint:style"}, }). ExitCode(ctx) if err != nil { return err } return lintGeneratedCode(func() error { return t.Generate(ctx) }, pythonGeneratedAPIPaths...) } func (t Python) Test(ctx context.Context) error { c, err := dagger.Connect(ctx, dagger.WithLogOutput(os.Stderr)) if err != nil { return err } defer c.Close() return util.WithDevEngine(ctx, c, func(ctx context.Context, c *dagger.Client) error { _, err = pythonBase(c). WithEnvVariable("DAGGER_HOST", "unix:///dagger.sock"). Exec(dagger.ContainerExecOpts{ Args: []string{"hatch", "run", "test"}, ExperimentalPrivilegedNesting: true, }). ExitCode(ctx) return err }) } func (t Python) Generate(ctx context.Context) error {
closed
dagger/dagger
https://github.com/dagger/dagger
3,682
Add Python's CI pipeline to GitHub Actions
## Tasks - [x] Add steps from #3678 - [x] Deploy (trigger on release) - [x] Add test step (trigger on PRs) \cc @gerhard
https://github.com/dagger/dagger/issues/3682
https://github.com/dagger/dagger/pull/3730
cd5fbd323926d1eef68a00f5f00e5e89dc0084b7
94f086f6f0e7ffedc4883d0be8e3f32b7b10a4fd
2022-11-04T16:00:10Z
go
2022-11-09T12:10:25Z
internal/mage/sdk/python.go
c, err := dagger.Connect(ctx, dagger.WithLogOutput(os.Stderr)) if err != nil { return err } defer c.Close() return util.WithDevEngine(ctx, c, func(ctx context.Context, c *dagger.Client) error { generated := pythonBase(c). Exec(dagger.ContainerExecOpts{ Args: []string{"hatch", "run", "generate"}, ExperimentalPrivilegedNesting: true, }). Exec(dagger.ContainerExecOpts{ Args: []string{"hatch", "run", "lint:fmt"}, }) for _, f := range pythonGeneratedAPIPaths { contents, err := generated.File(strings.TrimPrefix(f, "sdk/python/")).Contents(ctx) if err != nil { return err } if err := os.WriteFile(f, []byte(contents), 0600); err != nil { return err } } return nil }) } func (t Python) Publish(ctx context.Context, tag string) error { return errors.New("not implemented") } func pythonBase(c *dagger.Client) *dagger.Container {
closed
dagger/dagger
https://github.com/dagger/dagger
3,682
Add Python's CI pipeline to GitHub Actions
## Tasks - [x] Add steps from #3678 - [x] Deploy (trigger on release) - [x] Add test step (trigger on PRs) \cc @gerhard
https://github.com/dagger/dagger/issues/3682
https://github.com/dagger/dagger/pull/3730
cd5fbd323926d1eef68a00f5f00e5e89dc0084b7
94f086f6f0e7ffedc4883d0be8e3f32b7b10a4fd
2022-11-04T16:00:10Z
go
2022-11-09T12:10:25Z
internal/mage/sdk/python.go
src := c.Directory().WithDirectory("/", util.Repository(c).Directory("sdk/python")) base := c.Container().From("python:3.10-alpine"). Exec(dagger.ContainerExecOpts{ Args: []string{"apk", "add", "-U", "--no-cache", "gcc", "musl-dev", "libffi-dev"}, }) base = base. WithEnvVariable("PIP_NO_CACHE_DIR", "off"). WithEnvVariable("PIP_DISABLE_PIP_VERSION_CHECK", "on"). WithEnvVariable("PIP_DEFAULT_TIMEOUT", "100"). Exec(dagger.ContainerExecOpts{ Args: []string{"pip", "install", "hatch"}, }) return base. WithWorkdir("/app"). WithMountedDirectory("/app", src). Exec(dagger.ContainerExecOpts{ Args: []string{"hatch", "env", "create"}, }). Exec(dagger.ContainerExecOpts{ Args: []string{"hatch", "env", "create", "lint"}, }) }
closed
dagger/dagger
https://github.com/dagger/dagger
3,678
Add Python's CI pipeline to mage
Depends on: - #3672 - #3720 - #3730 ## Tasks - [x] Add **generate** step - [x] Need to `lint:fmt` afterwards - [x] Add **lint** (`lint:style`) step - [x] Add **publish** with *build* \cc @aluzzardi
https://github.com/dagger/dagger/issues/3678
https://github.com/dagger/dagger/pull/3730
cd5fbd323926d1eef68a00f5f00e5e89dc0084b7
94f086f6f0e7ffedc4883d0be8e3f32b7b10a4fd
2022-11-04T15:52:19Z
go
2022-11-09T12:10:25Z
internal/mage/sdk/python.go
package sdk import ( "context" "errors" "os" "strings" "dagger.io/dagger" "github.com/dagger/dagger/internal/mage/util" "github.com/magefile/mage/mg" ) var ( pythonGeneratedAPIPaths = []string{ "sdk/python/src/dagger/api/gen.py", "sdk/python/src/dagger/api/gen_sync.py", } ) var _ SDK = Python{} type Python mg.Namespace func (t Python) Lint(ctx context.Context) error { c, err := dagger.Connect(ctx, dagger.WithLogOutput(os.Stderr)) if err != nil { return err } defer c.Close()
closed
dagger/dagger
https://github.com/dagger/dagger
3,678
Add Python's CI pipeline to mage
Depends on: - #3672 - #3720 - #3730 ## Tasks - [x] Add **generate** step - [x] Need to `lint:fmt` afterwards - [x] Add **lint** (`lint:style`) step - [x] Add **publish** with *build* \cc @aluzzardi
https://github.com/dagger/dagger/issues/3678
https://github.com/dagger/dagger/pull/3730
cd5fbd323926d1eef68a00f5f00e5e89dc0084b7
94f086f6f0e7ffedc4883d0be8e3f32b7b10a4fd
2022-11-04T15:52:19Z
go
2022-11-09T12:10:25Z
internal/mage/sdk/python.go
_, err = pythonBase(c). Exec(dagger.ContainerExecOpts{ Args: []string{"hatch", "run", "lint:style"}, }). ExitCode(ctx) if err != nil { return err } return lintGeneratedCode(func() error { return t.Generate(ctx) }, pythonGeneratedAPIPaths...) } func (t Python) Test(ctx context.Context) error { c, err := dagger.Connect(ctx, dagger.WithLogOutput(os.Stderr)) if err != nil { return err } defer c.Close() return util.WithDevEngine(ctx, c, func(ctx context.Context, c *dagger.Client) error { _, err = pythonBase(c). WithEnvVariable("DAGGER_HOST", "unix:///dagger.sock"). Exec(dagger.ContainerExecOpts{ Args: []string{"hatch", "run", "test"}, ExperimentalPrivilegedNesting: true, }). ExitCode(ctx) return err }) } func (t Python) Generate(ctx context.Context) error {
closed
dagger/dagger
https://github.com/dagger/dagger
3,678
Add Python's CI pipeline to mage
Depends on: - #3672 - #3720 - #3730 ## Tasks - [x] Add **generate** step - [x] Need to `lint:fmt` afterwards - [x] Add **lint** (`lint:style`) step - [x] Add **publish** with *build* \cc @aluzzardi
https://github.com/dagger/dagger/issues/3678
https://github.com/dagger/dagger/pull/3730
cd5fbd323926d1eef68a00f5f00e5e89dc0084b7
94f086f6f0e7ffedc4883d0be8e3f32b7b10a4fd
2022-11-04T15:52:19Z
go
2022-11-09T12:10:25Z
internal/mage/sdk/python.go
c, err := dagger.Connect(ctx, dagger.WithLogOutput(os.Stderr)) if err != nil { return err } defer c.Close() return util.WithDevEngine(ctx, c, func(ctx context.Context, c *dagger.Client) error { generated := pythonBase(c). Exec(dagger.ContainerExecOpts{ Args: []string{"hatch", "run", "generate"}, ExperimentalPrivilegedNesting: true, }). Exec(dagger.ContainerExecOpts{ Args: []string{"hatch", "run", "lint:fmt"}, }) for _, f := range pythonGeneratedAPIPaths { contents, err := generated.File(strings.TrimPrefix(f, "sdk/python/")).Contents(ctx) if err != nil { return err } if err := os.WriteFile(f, []byte(contents), 0600); err != nil { return err } } return nil }) } func (t Python) Publish(ctx context.Context, tag string) error { return errors.New("not implemented") } func pythonBase(c *dagger.Client) *dagger.Container {
closed
dagger/dagger
https://github.com/dagger/dagger
3,678
Add Python's CI pipeline to mage
Depends on: - #3672 - #3720 - #3730 ## Tasks - [x] Add **generate** step - [x] Need to `lint:fmt` afterwards - [x] Add **lint** (`lint:style`) step - [x] Add **publish** with *build* \cc @aluzzardi
https://github.com/dagger/dagger/issues/3678
https://github.com/dagger/dagger/pull/3730
cd5fbd323926d1eef68a00f5f00e5e89dc0084b7
94f086f6f0e7ffedc4883d0be8e3f32b7b10a4fd
2022-11-04T15:52:19Z
go
2022-11-09T12:10:25Z
internal/mage/sdk/python.go
src := c.Directory().WithDirectory("/", util.Repository(c).Directory("sdk/python")) base := c.Container().From("python:3.10-alpine"). Exec(dagger.ContainerExecOpts{ Args: []string{"apk", "add", "-U", "--no-cache", "gcc", "musl-dev", "libffi-dev"}, }) base = base. WithEnvVariable("PIP_NO_CACHE_DIR", "off"). WithEnvVariable("PIP_DISABLE_PIP_VERSION_CHECK", "on"). WithEnvVariable("PIP_DEFAULT_TIMEOUT", "100"). Exec(dagger.ContainerExecOpts{ Args: []string{"pip", "install", "hatch"}, }) return base. WithWorkdir("/app"). WithMountedDirectory("/app", src). Exec(dagger.ContainerExecOpts{ Args: []string{"hatch", "env", "create"}, }). Exec(dagger.ContainerExecOpts{ Args: []string{"hatch", "env", "create", "lint"}, }) }
closed
dagger/dagger
https://github.com/dagger/dagger
3,737
Errors getting credentials on macos when using dagger-in-dagger
A few of us running `mage sdk:python:test` are getting very cryptic errors on the first step that runs dagger-in-dagger: ``` #1 resolve image config for docker.io/library/golang:1.19-alpine Error: input:1: container.from error getting credentials - err: signal: killed, out: `` Please visit https://dagger.io/help#go for troubleshooting guidance. #1 ERROR: error getting credentials - err: signal: killed, out: `` ``` But only on macos. I did some digging and eventually found the line where it comes from, forked and added a little extra debug information: https://github.com/sipsma/docker-credential-helpers/blob/9706447df656d46a595e2e2788637eddcf962a4c/client/client.go#L68 With that change it shows the error: ``` error getting credentials - err: signal: killed, prog: docker-credential-desktop get, out: ` ``` When I try to manually invoke docker-credential-desktop get from my terminal, it hangs indefinitely, ignoring even SIGTERM and I have to SIGKILL it. I have no idea why this *seems* to only happen once we get to the dagger-in-dagger step. It is worth confirming that understanding and worth confirming that the credential provider is indeed trying to run `docker-credential-desktop` on macos directly as opposed to inside the Linux container. It's actually not even obvious that it should be trying the macos client auth provider since the buildkit client is technically inside dagger and thus linux. However, buildkit has a lot of logic where it fallsback to trying any connected session, so *maybe* it is trying the macos client that is also connected to buildkit? Overall, kind of mysterious for a number of reasons, needs more investigation.
https://github.com/dagger/dagger/issues/3737
https://github.com/dagger/dagger/pull/3758
15a897278460408ccc4f832fd7e91dd2ddfaa90a
4a797801ef3bb6148d7186dac5d9d544cc913960
2022-11-08T21:58:43Z
go
2022-11-10T00:30:26Z
sdk/go/internal/engineconn/dockerprovision/container.go
package dockerprovision import ( "context" "io" "net" "net/http" "net/url" "os" "runtime" "dagger.io/dagger/internal/engineconn" "github.com/pkg/errors" exec "golang.org/x/sys/execabs" ) func NewDockerContainer(u *url.URL) (engineconn.EngineConn, error) { containerName := u.Host + u.Path if containerName == "" { return nil, errors.New("container name must be specified") } return &DockerContainer{ containerName: containerName, }, nil } type DockerContainer struct {
closed
dagger/dagger
https://github.com/dagger/dagger
3,737
Errors getting credentials on macos when using dagger-in-dagger
A few of us running `mage sdk:python:test` are getting very cryptic errors on the first step that runs dagger-in-dagger: ``` #1 resolve image config for docker.io/library/golang:1.19-alpine Error: input:1: container.from error getting credentials - err: signal: killed, out: `` Please visit https://dagger.io/help#go for troubleshooting guidance. #1 ERROR: error getting credentials - err: signal: killed, out: `` ``` But only on macos. I did some digging and eventually found the line where it comes from, forked and added a little extra debug information: https://github.com/sipsma/docker-credential-helpers/blob/9706447df656d46a595e2e2788637eddcf962a4c/client/client.go#L68 With that change it shows the error: ``` error getting credentials - err: signal: killed, prog: docker-credential-desktop get, out: ` ``` When I try to manually invoke docker-credential-desktop get from my terminal, it hangs indefinitely, ignoring even SIGTERM and I have to SIGKILL it. I have no idea why this *seems* to only happen once we get to the dagger-in-dagger step. It is worth confirming that understanding and worth confirming that the credential provider is indeed trying to run `docker-credential-desktop` on macos directly as opposed to inside the Linux container. It's actually not even obvious that it should be trying the macos client auth provider since the buildkit client is technically inside dagger and thus linux. However, buildkit has a lot of logic where it fallsback to trying any connected session, so *maybe* it is trying the macos client that is also connected to buildkit? Overall, kind of mysterious for a number of reasons, needs more investigation.
https://github.com/dagger/dagger/issues/3737
https://github.com/dagger/dagger/pull/3758
15a897278460408ccc4f832fd7e91dd2ddfaa90a
4a797801ef3bb6148d7186dac5d9d544cc913960
2022-11-08T21:58:43Z
go
2022-11-10T00:30:26Z
sdk/go/internal/engineconn/dockerprovision/container.go
containerName string childStdin io.Closer } func (c *DockerContainer) Connect(ctx context.Context, cfg *engineconn.Config) (*http.Client, error) { tmpbin, err := os.CreateTemp("", "temp-dagger-engine-session"+c.containerName) if err != nil { return nil, err } defer tmpbin.Close() defer os.Remove(tmpbin.Name()) if output, err := exec.CommandContext(ctx, "docker", "cp", c.containerName+":"+containerEngineSessionBinPrefix+runtime.GOOS+"-"+runtime.GOARCH, tmpbin.Name(), ).CombinedOutput(); err != nil { return nil, errors.Wrapf(err, "failed to copy dagger-engine-session bin: %s", output) } if err := tmpbin.Chmod(0700); err != nil { return nil, err } if err := tmpbin.Close(); err != nil { return nil, err } remote := "docker-container://" + c.containerName args := []string{ "--remote", remote,
closed
dagger/dagger
https://github.com/dagger/dagger
3,737
Errors getting credentials on macos when using dagger-in-dagger
A few of us running `mage sdk:python:test` are getting very cryptic errors on the first step that runs dagger-in-dagger: ``` #1 resolve image config for docker.io/library/golang:1.19-alpine Error: input:1: container.from error getting credentials - err: signal: killed, out: `` Please visit https://dagger.io/help#go for troubleshooting guidance. #1 ERROR: error getting credentials - err: signal: killed, out: `` ``` But only on macos. I did some digging and eventually found the line where it comes from, forked and added a little extra debug information: https://github.com/sipsma/docker-credential-helpers/blob/9706447df656d46a595e2e2788637eddcf962a4c/client/client.go#L68 With that change it shows the error: ``` error getting credentials - err: signal: killed, prog: docker-credential-desktop get, out: ` ``` When I try to manually invoke docker-credential-desktop get from my terminal, it hangs indefinitely, ignoring even SIGTERM and I have to SIGKILL it. I have no idea why this *seems* to only happen once we get to the dagger-in-dagger step. It is worth confirming that understanding and worth confirming that the credential provider is indeed trying to run `docker-credential-desktop` on macos directly as opposed to inside the Linux container. It's actually not even obvious that it should be trying the macos client auth provider since the buildkit client is technically inside dagger and thus linux. However, buildkit has a lot of logic where it fallsback to trying any connected session, so *maybe* it is trying the macos client that is also connected to buildkit? Overall, kind of mysterious for a number of reasons, needs more investigation.
https://github.com/dagger/dagger/issues/3737
https://github.com/dagger/dagger/pull/3758
15a897278460408ccc4f832fd7e91dd2ddfaa90a
4a797801ef3bb6148d7186dac5d9d544cc913960
2022-11-08T21:58:43Z
go
2022-11-10T00:30:26Z
sdk/go/internal/engineconn/dockerprovision/container.go
} if cfg.Workdir != "" { args = append(args, "--workdir", cfg.Workdir) } if cfg.ConfigPath != "" { args = append(args, "--project", cfg.ConfigPath) } addr, childStdin, err := startEngineSession(ctx, cfg.LogOutput, tmpbin.Name(), args...) if err != nil { return nil, err } c.childStdin = childStdin return &http.Client{ Transport: &http.Transport{ DialContext: func(_ context.Context, _, _ string) (net.Conn, error) { return net.Dial("tcp", addr) }, }, }, nil } func (c *DockerContainer) Addr() string { return "http://dagger" } func (c *DockerContainer) Close() error { if c.childStdin != nil { return c.childStdin.Close() } return nil }
closed
dagger/dagger
https://github.com/dagger/dagger
3,393
Fix build of shim when execing on non-platform specific llb state
from @marcosnils ``` query Build($file: FileID!, $ref: ContainerAddress!) { container { withMountedFile(path: "/mnt/dagger", source: $file) { exec(args: ["cp", "/mnt/dagger", "/dagger"]) { withEntrypoint(args: ["dagger"]) { publish(address: $ref) } } } } } ``` results in ``` { "data": null, "errors": [ { "message": "build shim: failed to parse target platform unknown: \"unknown\": unknown operating system or architecture: invalid argument", "locations": [ { "line": 4, "column": 7 } ], "path": [ "container", "withMountedFile", "exec" ] } ] } ``` The above query should fail since there's no fs on which to execute `cp` but it shouldn't fail by not being able to build the shim. It's also should be possible in general to, e.g. start at scratch, unpack a static binary and exec it, in which case this shouldn't even be an error case at all.
https://github.com/dagger/dagger/issues/3393
https://github.com/dagger/dagger/pull/3399
51c7941c3c8e7c2ac4242f5c41cec5a56d17e9d3
f8b3c63637cfcca2ec677fea2e020885664bd301
2022-10-14T22:29:08Z
go
2022-11-10T06:01:37Z
core/container.go
package core import ( "context" "encoding/json" "fmt" "io" "os" "path" "path/filepath" "strconv" "strings" "github.com/containerd/containerd/platforms" "github.com/dagger/dagger/core/shim" "github.com/docker/distribution/reference" bkclient "github.com/moby/buildkit/client" "github.com/moby/buildkit/client/llb" "github.com/moby/buildkit/exporter/containerimage/exptypes" dockerfilebuilder "github.com/moby/buildkit/frontend/dockerfile/builder" bkgw "github.com/moby/buildkit/frontend/gateway/client" "github.com/moby/buildkit/solver/pb" "github.com/opencontainers/go-digest" specs "github.com/opencontainers/image-spec/specs-go/v1" "github.com/pkg/errors" ) const ( DaggerSockName = "dagger-sock" DaggerSockPath = "/dagger.sock" ) type Container struct {
closed
dagger/dagger
https://github.com/dagger/dagger
3,393
Fix build of shim when execing on non-platform specific llb state
from @marcosnils ``` query Build($file: FileID!, $ref: ContainerAddress!) { container { withMountedFile(path: "/mnt/dagger", source: $file) { exec(args: ["cp", "/mnt/dagger", "/dagger"]) { withEntrypoint(args: ["dagger"]) { publish(address: $ref) } } } } } ``` results in ``` { "data": null, "errors": [ { "message": "build shim: failed to parse target platform unknown: \"unknown\": unknown operating system or architecture: invalid argument", "locations": [ { "line": 4, "column": 7 } ], "path": [ "container", "withMountedFile", "exec" ] } ] } ``` The above query should fail since there's no fs on which to execute `cp` but it shouldn't fail by not being able to build the shim. It's also should be possible in general to, e.g. start at scratch, unpack a static binary and exec it, in which case this shouldn't even be an error case at all.
https://github.com/dagger/dagger/issues/3393
https://github.com/dagger/dagger/pull/3399
51c7941c3c8e7c2ac4242f5c41cec5a56d17e9d3
f8b3c63637cfcca2ec677fea2e020885664bd301
2022-10-14T22:29:08Z
go
2022-11-10T06:01:37Z
core/container.go
ID ContainerID `json:"id"` } func NewContainer(id ContainerID, platform specs.Platform) (*Container, error) { if id == "" { id, err := (&containerIDPayload{Platform: platform}).Encode() if err != nil { return nil, err } return &Container{ID: id}, nil } return &Container{ID: id}, nil } type ContainerID string func (id ContainerID) decode() (*containerIDPayload, error) { if id == "" { return &containerIDPayload{}, nil } var payload containerIDPayload if err := decodeID(&payload, id); err != nil { return nil, err } return &payload, nil } type containerIDPayload struct {
closed
dagger/dagger
https://github.com/dagger/dagger
3,393
Fix build of shim when execing on non-platform specific llb state
from @marcosnils ``` query Build($file: FileID!, $ref: ContainerAddress!) { container { withMountedFile(path: "/mnt/dagger", source: $file) { exec(args: ["cp", "/mnt/dagger", "/dagger"]) { withEntrypoint(args: ["dagger"]) { publish(address: $ref) } } } } } ``` results in ``` { "data": null, "errors": [ { "message": "build shim: failed to parse target platform unknown: \"unknown\": unknown operating system or architecture: invalid argument", "locations": [ { "line": 4, "column": 7 } ], "path": [ "container", "withMountedFile", "exec" ] } ] } ``` The above query should fail since there's no fs on which to execute `cp` but it shouldn't fail by not being able to build the shim. It's also should be possible in general to, e.g. start at scratch, unpack a static binary and exec it, in which case this shouldn't even be an error case at all.
https://github.com/dagger/dagger/issues/3393
https://github.com/dagger/dagger/pull/3399
51c7941c3c8e7c2ac4242f5c41cec5a56d17e9d3
f8b3c63637cfcca2ec677fea2e020885664bd301
2022-10-14T22:29:08Z
go
2022-11-10T06:01:37Z
core/container.go
FS *pb.Definition `json:"fs"` Config specs.ImageConfig `json:"cfg"` Mounts ContainerMounts `json:"mounts,omitempty"` Meta *pb.Definition `json:"meta,omitempty"` Platform specs.Platform `json:"platform,omitempty"` Secrets []ContainerSecret `json:"secret_env,omitempty"` } type ContainerSecret struct {
closed
dagger/dagger
https://github.com/dagger/dagger
3,393
Fix build of shim when execing on non-platform specific llb state
from @marcosnils ``` query Build($file: FileID!, $ref: ContainerAddress!) { container { withMountedFile(path: "/mnt/dagger", source: $file) { exec(args: ["cp", "/mnt/dagger", "/dagger"]) { withEntrypoint(args: ["dagger"]) { publish(address: $ref) } } } } } ``` results in ``` { "data": null, "errors": [ { "message": "build shim: failed to parse target platform unknown: \"unknown\": unknown operating system or architecture: invalid argument", "locations": [ { "line": 4, "column": 7 } ], "path": [ "container", "withMountedFile", "exec" ] } ] } ``` The above query should fail since there's no fs on which to execute `cp` but it shouldn't fail by not being able to build the shim. It's also should be possible in general to, e.g. start at scratch, unpack a static binary and exec it, in which case this shouldn't even be an error case at all.
https://github.com/dagger/dagger/issues/3393
https://github.com/dagger/dagger/pull/3399
51c7941c3c8e7c2ac4242f5c41cec5a56d17e9d3
f8b3c63637cfcca2ec677fea2e020885664bd301
2022-10-14T22:29:08Z
go
2022-11-10T06:01:37Z
core/container.go
Secret SecretID `json:"secret"` EnvName string `json:"env,omitempty"` MountPath string `json:"path,omitempty"` } func (payload *containerIDPayload) Encode() (ContainerID, error) { id, err := encodeID(payload) if err != nil { return "", err } return ContainerID(id), nil } func (payload *containerIDPayload) FSState() (llb.State, error) { if payload.FS == nil { return llb.Scratch(), nil } return defToState(payload.FS) } const metaMount = "/.dagger_meta_mount" const metaSourcePath = "meta" func (payload *containerIDPayload) MetaState() (*llb.State, error) { if payload.Meta == nil { return nil, nil } metaSt, err := defToState(payload.Meta) if err != nil { return nil, err } return &metaSt, nil } type ContainerMount struct {
closed
dagger/dagger
https://github.com/dagger/dagger
3,393
Fix build of shim when execing on non-platform specific llb state
from @marcosnils ``` query Build($file: FileID!, $ref: ContainerAddress!) { container { withMountedFile(path: "/mnt/dagger", source: $file) { exec(args: ["cp", "/mnt/dagger", "/dagger"]) { withEntrypoint(args: ["dagger"]) { publish(address: $ref) } } } } } ``` results in ``` { "data": null, "errors": [ { "message": "build shim: failed to parse target platform unknown: \"unknown\": unknown operating system or architecture: invalid argument", "locations": [ { "line": 4, "column": 7 } ], "path": [ "container", "withMountedFile", "exec" ] } ] } ``` The above query should fail since there's no fs on which to execute `cp` but it shouldn't fail by not being able to build the shim. It's also should be possible in general to, e.g. start at scratch, unpack a static binary and exec it, in which case this shouldn't even be an error case at all.
https://github.com/dagger/dagger/issues/3393
https://github.com/dagger/dagger/pull/3399
51c7941c3c8e7c2ac4242f5c41cec5a56d17e9d3
f8b3c63637cfcca2ec677fea2e020885664bd301
2022-10-14T22:29:08Z
go
2022-11-10T06:01:37Z
core/container.go
Source *pb.Definition `json:"source,omitempty"` SourcePath string `json:"source_path,omitempty"` Target string `json:"target"` CacheID string `json:"cache_id,omitempty"` CacheSharingMode string `json:"cache_sharing,omitempty"` Tmpfs bool `json:"tmpfs,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 { if mnt.Target == newMnt.Target || strings.HasPrefix(mnt.Target, parent) { continue }
closed
dagger/dagger
https://github.com/dagger/dagger
3,393
Fix build of shim when execing on non-platform specific llb state
from @marcosnils ``` query Build($file: FileID!, $ref: ContainerAddress!) { container { withMountedFile(path: "/mnt/dagger", source: $file) { exec(args: ["cp", "/mnt/dagger", "/dagger"]) { withEntrypoint(args: ["dagger"]) { publish(address: $ref) } } } } } ``` results in ``` { "data": null, "errors": [ { "message": "build shim: failed to parse target platform unknown: \"unknown\": unknown operating system or architecture: invalid argument", "locations": [ { "line": 4, "column": 7 } ], "path": [ "container", "withMountedFile", "exec" ] } ] } ``` The above query should fail since there's no fs on which to execute `cp` but it shouldn't fail by not being able to build the shim. It's also should be possible in general to, e.g. start at scratch, unpack a static binary and exec it, in which case this shouldn't even be an error case at all.
https://github.com/dagger/dagger/issues/3393
https://github.com/dagger/dagger/pull/3399
51c7941c3c8e7c2ac4242f5c41cec5a56d17e9d3
f8b3c63637cfcca2ec677fea2e020885664bd301
2022-10-14T22:29:08Z
go
2022-11-10T06:01:37Z
core/container.go
mntsCp = append(mntsCp, mnt) } mntsCp = append(mntsCp, newMnt) return mntsCp } func (container *Container) From(ctx context.Context, gw bkgw.Client, addr string) (*Container, error) { payload, err := container.ID.decode() if err != nil { return nil, err } platform := payload.Platform refName, err := reference.ParseNormalizedNamed(addr) if err != nil { return nil, err } ref := reference.TagNameOnly(refName).String() _, cfgBytes, err := gw.ResolveImageConfig(ctx, ref, llb.ResolveImageConfigOpt{ Platform: &platform, ResolveMode: llb.ResolveModeDefault.String(), }) if err != nil { return nil, err } var imgSpec specs.Image if err := json.Unmarshal(cfgBytes, &imgSpec); err != nil { return nil, err } dir, err := NewDirectory(ctx, llb.Image(addr), "/", platform) if err != nil { return nil, err
closed
dagger/dagger
https://github.com/dagger/dagger
3,393
Fix build of shim when execing on non-platform specific llb state
from @marcosnils ``` query Build($file: FileID!, $ref: ContainerAddress!) { container { withMountedFile(path: "/mnt/dagger", source: $file) { exec(args: ["cp", "/mnt/dagger", "/dagger"]) { withEntrypoint(args: ["dagger"]) { publish(address: $ref) } } } } } ``` results in ``` { "data": null, "errors": [ { "message": "build shim: failed to parse target platform unknown: \"unknown\": unknown operating system or architecture: invalid argument", "locations": [ { "line": 4, "column": 7 } ], "path": [ "container", "withMountedFile", "exec" ] } ] } ``` The above query should fail since there's no fs on which to execute `cp` but it shouldn't fail by not being able to build the shim. It's also should be possible in general to, e.g. start at scratch, unpack a static binary and exec it, in which case this shouldn't even be an error case at all.
https://github.com/dagger/dagger/issues/3393
https://github.com/dagger/dagger/pull/3399
51c7941c3c8e7c2ac4242f5c41cec5a56d17e9d3
f8b3c63637cfcca2ec677fea2e020885664bd301
2022-10-14T22:29:08Z
go
2022-11-10T06:01:37Z
core/container.go
} ctr, err := container.WithFS(ctx, dir) if err != nil { return nil, err } return ctr.UpdateImageConfig(ctx, func(specs.ImageConfig) specs.ImageConfig { return imgSpec.Config }) } const defaultDockerfileName = "Dockerfile" func (container *Container) Build(ctx context.Context, gw bkgw.Client, context *Directory, dockerfile string) (*Container, error) { payload, err := container.ID.decode() if err != nil { return nil, err } ctxPayload, err := context.ID.Decode() if err != nil { return nil, err } platform := payload.Platform opts := map[string]string{ "platform": platforms.Format(platform), "contextsubdir": ctxPayload.Dir, } if dockerfile != "" { opts["filename"] = filepath.Join(ctxPayload.Dir, dockerfile) } else { opts["filename"] = filepath.Join(ctxPayload.Dir, defaultDockerfileName) } inputs := map[string]*pb.Definition{
closed
dagger/dagger
https://github.com/dagger/dagger
3,393
Fix build of shim when execing on non-platform specific llb state
from @marcosnils ``` query Build($file: FileID!, $ref: ContainerAddress!) { container { withMountedFile(path: "/mnt/dagger", source: $file) { exec(args: ["cp", "/mnt/dagger", "/dagger"]) { withEntrypoint(args: ["dagger"]) { publish(address: $ref) } } } } } ``` results in ``` { "data": null, "errors": [ { "message": "build shim: failed to parse target platform unknown: \"unknown\": unknown operating system or architecture: invalid argument", "locations": [ { "line": 4, "column": 7 } ], "path": [ "container", "withMountedFile", "exec" ] } ] } ``` The above query should fail since there's no fs on which to execute `cp` but it shouldn't fail by not being able to build the shim. It's also should be possible in general to, e.g. start at scratch, unpack a static binary and exec it, in which case this shouldn't even be an error case at all.
https://github.com/dagger/dagger/issues/3393
https://github.com/dagger/dagger/pull/3399
51c7941c3c8e7c2ac4242f5c41cec5a56d17e9d3
f8b3c63637cfcca2ec677fea2e020885664bd301
2022-10-14T22:29:08Z
go
2022-11-10T06:01:37Z
core/container.go
dockerfilebuilder.DefaultLocalNameContext: ctxPayload.LLB, dockerfilebuilder.DefaultLocalNameDockerfile: ctxPayload.LLB, } res, err := gw.Solve(ctx, 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 } st, err := bkref.ToState() if err != nil { return nil, err } def, err := st.Marshal(ctx, llb.Platform(platform)) if err != nil { return nil, err } payload.FS = def.ToPB() cfgBytes, found := res.Metadata[exptypes.ExporterImageConfigKey] if found { var imgSpec specs.Image if err := json.Unmarshal(cfgBytes, &imgSpec); err != nil { return nil, err }
closed
dagger/dagger
https://github.com/dagger/dagger
3,393
Fix build of shim when execing on non-platform specific llb state
from @marcosnils ``` query Build($file: FileID!, $ref: ContainerAddress!) { container { withMountedFile(path: "/mnt/dagger", source: $file) { exec(args: ["cp", "/mnt/dagger", "/dagger"]) { withEntrypoint(args: ["dagger"]) { publish(address: $ref) } } } } } ``` results in ``` { "data": null, "errors": [ { "message": "build shim: failed to parse target platform unknown: \"unknown\": unknown operating system or architecture: invalid argument", "locations": [ { "line": 4, "column": 7 } ], "path": [ "container", "withMountedFile", "exec" ] } ] } ``` The above query should fail since there's no fs on which to execute `cp` but it shouldn't fail by not being able to build the shim. It's also should be possible in general to, e.g. start at scratch, unpack a static binary and exec it, in which case this shouldn't even be an error case at all.
https://github.com/dagger/dagger/issues/3393
https://github.com/dagger/dagger/pull/3399
51c7941c3c8e7c2ac4242f5c41cec5a56d17e9d3
f8b3c63637cfcca2ec677fea2e020885664bd301
2022-10-14T22:29:08Z
go
2022-11-10T06:01:37Z
core/container.go
payload.Config = imgSpec.Config } id, err := payload.Encode() if err != nil { return nil, err } return &Container{ID: id}, nil } func (container *Container) FS(ctx context.Context) (*Directory, error) { payload, err := container.ID.decode() if err != nil { return nil, err } return (&directoryIDPayload{ LLB: payload.FS, Platform: payload.Platform, }).ToDirectory() } func (container *Container) WithFS(ctx context.Context, dir *Directory) (*Container, error) { payload, err := container.ID.decode() if err != nil { return nil, err } dirPayload, err := dir.ID.Decode() if err != nil { return nil, err } payload.FS = dirPayload.LLB id, err := payload.Encode() if err != nil {
closed
dagger/dagger
https://github.com/dagger/dagger
3,393
Fix build of shim when execing on non-platform specific llb state
from @marcosnils ``` query Build($file: FileID!, $ref: ContainerAddress!) { container { withMountedFile(path: "/mnt/dagger", source: $file) { exec(args: ["cp", "/mnt/dagger", "/dagger"]) { withEntrypoint(args: ["dagger"]) { publish(address: $ref) } } } } } ``` results in ``` { "data": null, "errors": [ { "message": "build shim: failed to parse target platform unknown: \"unknown\": unknown operating system or architecture: invalid argument", "locations": [ { "line": 4, "column": 7 } ], "path": [ "container", "withMountedFile", "exec" ] } ] } ``` The above query should fail since there's no fs on which to execute `cp` but it shouldn't fail by not being able to build the shim. It's also should be possible in general to, e.g. start at scratch, unpack a static binary and exec it, in which case this shouldn't even be an error case at all.
https://github.com/dagger/dagger/issues/3393
https://github.com/dagger/dagger/pull/3399
51c7941c3c8e7c2ac4242f5c41cec5a56d17e9d3
f8b3c63637cfcca2ec677fea2e020885664bd301
2022-10-14T22:29:08Z
go
2022-11-10T06:01:37Z
core/container.go
return nil, err } return &Container{ID: id}, nil } func (container *Container) WithMountedDirectory(ctx context.Context, target string, source *Directory) (*Container, error) { payload, err := source.ID.Decode() if err != nil { return nil, err } return container.withMounted(target, payload.LLB, payload.Dir) } func (container *Container) WithMountedFile(ctx context.Context, target string, source *File) (*Container, error) { payload, err := source.ID.decode() if err != nil { return nil, err } return container.withMounted(target, payload.LLB, payload.File) } func (container *Container) WithMountedCache(ctx context.Context, target string, cache CacheID, source *Directory) (*Container, error) { payload, err := container.ID.decode() if err != nil { return nil, err } cachePayload, err := cache.decode() if err != nil { return nil, err } target = absPath(payload.Config.WorkingDir, target) mount := ContainerMount{ Target: target,
closed
dagger/dagger
https://github.com/dagger/dagger
3,393
Fix build of shim when execing on non-platform specific llb state
from @marcosnils ``` query Build($file: FileID!, $ref: ContainerAddress!) { container { withMountedFile(path: "/mnt/dagger", source: $file) { exec(args: ["cp", "/mnt/dagger", "/dagger"]) { withEntrypoint(args: ["dagger"]) { publish(address: $ref) } } } } } ``` results in ``` { "data": null, "errors": [ { "message": "build shim: failed to parse target platform unknown: \"unknown\": unknown operating system or architecture: invalid argument", "locations": [ { "line": 4, "column": 7 } ], "path": [ "container", "withMountedFile", "exec" ] } ] } ``` The above query should fail since there's no fs on which to execute `cp` but it shouldn't fail by not being able to build the shim. It's also should be possible in general to, e.g. start at scratch, unpack a static binary and exec it, in which case this shouldn't even be an error case at all.
https://github.com/dagger/dagger/issues/3393
https://github.com/dagger/dagger/pull/3399
51c7941c3c8e7c2ac4242f5c41cec5a56d17e9d3
f8b3c63637cfcca2ec677fea2e020885664bd301
2022-10-14T22:29:08Z
go
2022-11-10T06:01:37Z
core/container.go
CacheID: cachePayload.Sum(), CacheSharingMode: "shared", } if source != nil { srcPayload, err := source.ID.Decode() if err != nil { return nil, err } mount.Source = srcPayload.LLB mount.SourcePath = srcPayload.Dir } payload.Mounts = payload.Mounts.With(mount) id, err := payload.Encode() if err != nil { return nil, err } return &Container{ID: id}, nil } func (container *Container) WithMountedTemp(ctx context.Context, target string) (*Container, error) { payload, err := container.ID.decode() if err != nil { return nil, err } target = absPath(payload.Config.WorkingDir, target) payload.Mounts = payload.Mounts.With(ContainerMount{ Target: target, Tmpfs: true, }) id, err := payload.Encode() if err != nil {
closed
dagger/dagger
https://github.com/dagger/dagger
3,393
Fix build of shim when execing on non-platform specific llb state
from @marcosnils ``` query Build($file: FileID!, $ref: ContainerAddress!) { container { withMountedFile(path: "/mnt/dagger", source: $file) { exec(args: ["cp", "/mnt/dagger", "/dagger"]) { withEntrypoint(args: ["dagger"]) { publish(address: $ref) } } } } } ``` results in ``` { "data": null, "errors": [ { "message": "build shim: failed to parse target platform unknown: \"unknown\": unknown operating system or architecture: invalid argument", "locations": [ { "line": 4, "column": 7 } ], "path": [ "container", "withMountedFile", "exec" ] } ] } ``` The above query should fail since there's no fs on which to execute `cp` but it shouldn't fail by not being able to build the shim. It's also should be possible in general to, e.g. start at scratch, unpack a static binary and exec it, in which case this shouldn't even be an error case at all.
https://github.com/dagger/dagger/issues/3393
https://github.com/dagger/dagger/pull/3399
51c7941c3c8e7c2ac4242f5c41cec5a56d17e9d3
f8b3c63637cfcca2ec677fea2e020885664bd301
2022-10-14T22:29:08Z
go
2022-11-10T06:01:37Z
core/container.go
return nil, err } return &Container{ID: id}, nil } func (container *Container) WithMountedSecret(ctx context.Context, target string, source *Secret) (*Container, error) { payload, err := container.ID.decode() if err != nil { return nil, err } target = absPath(payload.Config.WorkingDir, target) payload.Secrets = append(payload.Secrets, ContainerSecret{ Secret: source.ID, MountPath: target, }) id, err := payload.Encode() if err != nil { return nil, err } return &Container{ID: id}, nil } func (container *Container) WithoutMount(ctx context.Context, target string) (*Container, error) { payload, err := container.ID.decode() if err != nil { return nil, err } target = absPath(payload.Config.WorkingDir, target) var found bool var foundIdx int for i := len(payload.Mounts) - 1; i >= 0; i-- { if payload.Mounts[i].Target == target {
closed
dagger/dagger
https://github.com/dagger/dagger
3,393
Fix build of shim when execing on non-platform specific llb state
from @marcosnils ``` query Build($file: FileID!, $ref: ContainerAddress!) { container { withMountedFile(path: "/mnt/dagger", source: $file) { exec(args: ["cp", "/mnt/dagger", "/dagger"]) { withEntrypoint(args: ["dagger"]) { publish(address: $ref) } } } } } ``` results in ``` { "data": null, "errors": [ { "message": "build shim: failed to parse target platform unknown: \"unknown\": unknown operating system or architecture: invalid argument", "locations": [ { "line": 4, "column": 7 } ], "path": [ "container", "withMountedFile", "exec" ] } ] } ``` The above query should fail since there's no fs on which to execute `cp` but it shouldn't fail by not being able to build the shim. It's also should be possible in general to, e.g. start at scratch, unpack a static binary and exec it, in which case this shouldn't even be an error case at all.
https://github.com/dagger/dagger/issues/3393
https://github.com/dagger/dagger/pull/3399
51c7941c3c8e7c2ac4242f5c41cec5a56d17e9d3
f8b3c63637cfcca2ec677fea2e020885664bd301
2022-10-14T22:29:08Z
go
2022-11-10T06:01:37Z
core/container.go
found = true foundIdx = i break } } if found { payload.Mounts = append(payload.Mounts[:foundIdx], payload.Mounts[foundIdx+1:]...) } id, err := payload.Encode() if err != nil { return nil, err } return &Container{ID: id}, nil } func (container *Container) Mounts(ctx context.Context) ([]string, error) { payload, err := container.ID.decode() if err != nil { return nil, err } mounts := []string{} for _, mnt := range payload.Mounts { mounts = append(mounts, mnt.Target) } return mounts, nil } func (container *Container) WithSecretVariable(ctx context.Context, name string, secret *Secret) (*Container, error) { payload, err := container.ID.decode() if err != nil { return nil, err }
closed
dagger/dagger
https://github.com/dagger/dagger
3,393
Fix build of shim when execing on non-platform specific llb state
from @marcosnils ``` query Build($file: FileID!, $ref: ContainerAddress!) { container { withMountedFile(path: "/mnt/dagger", source: $file) { exec(args: ["cp", "/mnt/dagger", "/dagger"]) { withEntrypoint(args: ["dagger"]) { publish(address: $ref) } } } } } ``` results in ``` { "data": null, "errors": [ { "message": "build shim: failed to parse target platform unknown: \"unknown\": unknown operating system or architecture: invalid argument", "locations": [ { "line": 4, "column": 7 } ], "path": [ "container", "withMountedFile", "exec" ] } ] } ``` The above query should fail since there's no fs on which to execute `cp` but it shouldn't fail by not being able to build the shim. It's also should be possible in general to, e.g. start at scratch, unpack a static binary and exec it, in which case this shouldn't even be an error case at all.
https://github.com/dagger/dagger/issues/3393
https://github.com/dagger/dagger/pull/3399
51c7941c3c8e7c2ac4242f5c41cec5a56d17e9d3
f8b3c63637cfcca2ec677fea2e020885664bd301
2022-10-14T22:29:08Z
go
2022-11-10T06:01:37Z
core/container.go
payload.Secrets = append(payload.Secrets, ContainerSecret{ Secret: secret.ID, EnvName: name, }) id, err := payload.Encode() if err != nil { return nil, err } return &Container{ID: id}, nil } func (container *Container) Directory(ctx context.Context, gw bkgw.Client, dirPath string) (*Directory, error) { dir, err := locatePath(ctx, container, dirPath, gw, NewDirectory) if err != nil { return nil, err } info, err := dir.Stat(ctx, gw, ".") if err != nil { return nil, err } if !info.IsDir() { return nil, fmt.Errorf("path %s is a file, not a directory", dirPath) } return dir, nil } func (container *Container) File(ctx context.Context, gw bkgw.Client, filePath string) (*File, error) { file, err := locatePath(ctx, container, filePath, gw, NewFile) if err != nil { return nil, err
closed
dagger/dagger
https://github.com/dagger/dagger
3,393
Fix build of shim when execing on non-platform specific llb state
from @marcosnils ``` query Build($file: FileID!, $ref: ContainerAddress!) { container { withMountedFile(path: "/mnt/dagger", source: $file) { exec(args: ["cp", "/mnt/dagger", "/dagger"]) { withEntrypoint(args: ["dagger"]) { publish(address: $ref) } } } } } ``` results in ``` { "data": null, "errors": [ { "message": "build shim: failed to parse target platform unknown: \"unknown\": unknown operating system or architecture: invalid argument", "locations": [ { "line": 4, "column": 7 } ], "path": [ "container", "withMountedFile", "exec" ] } ] } ``` The above query should fail since there's no fs on which to execute `cp` but it shouldn't fail by not being able to build the shim. It's also should be possible in general to, e.g. start at scratch, unpack a static binary and exec it, in which case this shouldn't even be an error case at all.
https://github.com/dagger/dagger/issues/3393
https://github.com/dagger/dagger/pull/3399
51c7941c3c8e7c2ac4242f5c41cec5a56d17e9d3
f8b3c63637cfcca2ec677fea2e020885664bd301
2022-10-14T22:29:08Z
go
2022-11-10T06:01:37Z
core/container.go
} info, err := file.Stat(ctx, gw) if err != nil { return nil, err } if info.IsDir() { return nil, fmt.Errorf("path %s is a directory, not a file", filePath) } return file, nil } func locatePath[T *File | *Directory]( ctx context.Context, container *Container, containerPath string, gw bkgw.Client, init func(context.Context, llb.State, string, specs.Platform) (T, error), ) (T, error) { payload, err := container.ID.decode() if err != nil { return nil, err } containerPath = absPath(payload.Config.WorkingDir, containerPath) var found T for i := len(payload.Mounts) - 1; i >= 0; i-- { mnt := payload.Mounts[i] if containerPath == mnt.Target || strings.HasPrefix(containerPath, mnt.Target+"/") { if mnt.Tmpfs {
closed
dagger/dagger
https://github.com/dagger/dagger
3,393
Fix build of shim when execing on non-platform specific llb state
from @marcosnils ``` query Build($file: FileID!, $ref: ContainerAddress!) { container { withMountedFile(path: "/mnt/dagger", source: $file) { exec(args: ["cp", "/mnt/dagger", "/dagger"]) { withEntrypoint(args: ["dagger"]) { publish(address: $ref) } } } } } ``` results in ``` { "data": null, "errors": [ { "message": "build shim: failed to parse target platform unknown: \"unknown\": unknown operating system or architecture: invalid argument", "locations": [ { "line": 4, "column": 7 } ], "path": [ "container", "withMountedFile", "exec" ] } ] } ``` The above query should fail since there's no fs on which to execute `cp` but it shouldn't fail by not being able to build the shim. It's also should be possible in general to, e.g. start at scratch, unpack a static binary and exec it, in which case this shouldn't even be an error case at all.
https://github.com/dagger/dagger/issues/3393
https://github.com/dagger/dagger/pull/3399
51c7941c3c8e7c2ac4242f5c41cec5a56d17e9d3
f8b3c63637cfcca2ec677fea2e020885664bd301
2022-10-14T22:29:08Z
go
2022-11-10T06:01:37Z
core/container.go
return nil, fmt.Errorf("%s: cannot retrieve path from tmpfs", containerPath) } if mnt.CacheID != "" { return nil, fmt.Errorf("%s: cannot retrieve path from cache", containerPath) } st, err := mnt.SourceState() if err != nil { return nil, err } sub := mnt.SourcePath if containerPath != mnt.Target { dirSub := strings.TrimPrefix(containerPath, mnt.Target+"/") if dirSub != "" { sub = path.Join(sub, dirSub) } } found, err = init(ctx, st, sub, payload.Platform) if err != nil { return nil, err } break } } if found == nil { st, err := payload.FSState() if err != nil { return nil, err } found, err = init(ctx, st, containerPath, payload.Platform)
closed
dagger/dagger
https://github.com/dagger/dagger
3,393
Fix build of shim when execing on non-platform specific llb state
from @marcosnils ``` query Build($file: FileID!, $ref: ContainerAddress!) { container { withMountedFile(path: "/mnt/dagger", source: $file) { exec(args: ["cp", "/mnt/dagger", "/dagger"]) { withEntrypoint(args: ["dagger"]) { publish(address: $ref) } } } } } ``` results in ``` { "data": null, "errors": [ { "message": "build shim: failed to parse target platform unknown: \"unknown\": unknown operating system or architecture: invalid argument", "locations": [ { "line": 4, "column": 7 } ], "path": [ "container", "withMountedFile", "exec" ] } ] } ``` The above query should fail since there's no fs on which to execute `cp` but it shouldn't fail by not being able to build the shim. It's also should be possible in general to, e.g. start at scratch, unpack a static binary and exec it, in which case this shouldn't even be an error case at all.
https://github.com/dagger/dagger/issues/3393
https://github.com/dagger/dagger/pull/3399
51c7941c3c8e7c2ac4242f5c41cec5a56d17e9d3
f8b3c63637cfcca2ec677fea2e020885664bd301
2022-10-14T22:29:08Z
go
2022-11-10T06:01:37Z
core/container.go
if err != nil { return nil, err } } return found, nil } func (container *Container) withMounted(target string, srcDef *pb.Definition, srcPath string) (*Container, error) { payload, err := container.ID.decode() if err != nil { return nil, err } target = absPath(payload.Config.WorkingDir, target) payload.Mounts = payload.Mounts.With(ContainerMount{ Source: srcDef, SourcePath: srcPath, Target: target, }) id, err := payload.Encode() if err != nil { return nil, err } return &Container{ID: id}, nil } func (container *Container) ImageConfig(ctx context.Context) (specs.ImageConfig, error) { payload, err := container.ID.decode() if err != nil { return specs.ImageConfig{}, err } return payload.Config, nil }
closed
dagger/dagger
https://github.com/dagger/dagger
3,393
Fix build of shim when execing on non-platform specific llb state
from @marcosnils ``` query Build($file: FileID!, $ref: ContainerAddress!) { container { withMountedFile(path: "/mnt/dagger", source: $file) { exec(args: ["cp", "/mnt/dagger", "/dagger"]) { withEntrypoint(args: ["dagger"]) { publish(address: $ref) } } } } } ``` results in ``` { "data": null, "errors": [ { "message": "build shim: failed to parse target platform unknown: \"unknown\": unknown operating system or architecture: invalid argument", "locations": [ { "line": 4, "column": 7 } ], "path": [ "container", "withMountedFile", "exec" ] } ] } ``` The above query should fail since there's no fs on which to execute `cp` but it shouldn't fail by not being able to build the shim. It's also should be possible in general to, e.g. start at scratch, unpack a static binary and exec it, in which case this shouldn't even be an error case at all.
https://github.com/dagger/dagger/issues/3393
https://github.com/dagger/dagger/pull/3399
51c7941c3c8e7c2ac4242f5c41cec5a56d17e9d3
f8b3c63637cfcca2ec677fea2e020885664bd301
2022-10-14T22:29:08Z
go
2022-11-10T06:01:37Z
core/container.go
func (container *Container) UpdateImageConfig(ctx context.Context, updateFn func(specs.ImageConfig) specs.ImageConfig) (*Container, error) { payload, err := container.ID.decode() if err != nil { return nil, err } payload.Config = updateFn(payload.Config) id, err := payload.Encode() if err != nil { return nil, err } return &Container{ID: id}, nil } func (container *Container) Exec(ctx context.Context, gw bkgw.Client, opts ContainerExecOpts) (*Container, error) { payload, err := container.ID.decode() if err != nil { return nil, fmt.Errorf("decode id: %w", err) } cfg := payload.Config mounts := payload.Mounts platform := payload.Platform shimSt, err := shim.Build(ctx, gw, platform) if err != nil { return nil, fmt.Errorf("build shim: %w", err) } args := opts.Args if len(args) == 0 { args = cfg.Cmd } if len(cfg.Entrypoint) > 0 {
closed
dagger/dagger
https://github.com/dagger/dagger
3,393
Fix build of shim when execing on non-platform specific llb state
from @marcosnils ``` query Build($file: FileID!, $ref: ContainerAddress!) { container { withMountedFile(path: "/mnt/dagger", source: $file) { exec(args: ["cp", "/mnt/dagger", "/dagger"]) { withEntrypoint(args: ["dagger"]) { publish(address: $ref) } } } } } ``` results in ``` { "data": null, "errors": [ { "message": "build shim: failed to parse target platform unknown: \"unknown\": unknown operating system or architecture: invalid argument", "locations": [ { "line": 4, "column": 7 } ], "path": [ "container", "withMountedFile", "exec" ] } ] } ``` The above query should fail since there's no fs on which to execute `cp` but it shouldn't fail by not being able to build the shim. It's also should be possible in general to, e.g. start at scratch, unpack a static binary and exec it, in which case this shouldn't even be an error case at all.
https://github.com/dagger/dagger/issues/3393
https://github.com/dagger/dagger/pull/3399
51c7941c3c8e7c2ac4242f5c41cec5a56d17e9d3
f8b3c63637cfcca2ec677fea2e020885664bd301
2022-10-14T22:29:08Z
go
2022-11-10T06:01:37Z
core/container.go
args = append(cfg.Entrypoint, args...) } runOpts := []llb.RunOption{ llb.AddMount(shim.Path, shimSt, llb.SourcePath(shim.Path)), llb.Args(append([]string{shim.Path}, args...)), llb.WithCustomName(strings.Join(args, " ")), } if opts.ExperimentalPrivilegedNesting { runOpts = append(runOpts, llb.AddEnv("DAGGER_HOST", "unix:/dagger.sock"), llb.AddSSHSocket( llb.SSHID(DaggerSockName), llb.SSHSocketTarget(DaggerSockPath), ), ) } meta := llb.Mkdir(metaSourcePath, 0777) if opts.Stdin != "" { meta = meta.Mkfile(path.Join(metaSourcePath, "stdin"), 0600, []byte(opts.Stdin)) } runOpts = append(runOpts, llb.AddMount(metaMount, llb.Scratch().File(meta),
closed
dagger/dagger
https://github.com/dagger/dagger
3,393
Fix build of shim when execing on non-platform specific llb state
from @marcosnils ``` query Build($file: FileID!, $ref: ContainerAddress!) { container { withMountedFile(path: "/mnt/dagger", source: $file) { exec(args: ["cp", "/mnt/dagger", "/dagger"]) { withEntrypoint(args: ["dagger"]) { publish(address: $ref) } } } } } ``` results in ``` { "data": null, "errors": [ { "message": "build shim: failed to parse target platform unknown: \"unknown\": unknown operating system or architecture: invalid argument", "locations": [ { "line": 4, "column": 7 } ], "path": [ "container", "withMountedFile", "exec" ] } ] } ``` The above query should fail since there's no fs on which to execute `cp` but it shouldn't fail by not being able to build the shim. It's also should be possible in general to, e.g. start at scratch, unpack a static binary and exec it, in which case this shouldn't even be an error case at all.
https://github.com/dagger/dagger/issues/3393
https://github.com/dagger/dagger/pull/3399
51c7941c3c8e7c2ac4242f5c41cec5a56d17e9d3
f8b3c63637cfcca2ec677fea2e020885664bd301
2022-10-14T22:29:08Z
go
2022-11-10T06:01:37Z
core/container.go
llb.SourcePath(metaSourcePath))) if opts.RedirectStdout != "" { runOpts = append(runOpts, llb.AddEnv("_DAGGER_REDIRECT_STDOUT", opts.RedirectStdout)) } if opts.RedirectStderr != "" { runOpts = append(runOpts, llb.AddEnv("_DAGGER_REDIRECT_STDERR", opts.RedirectStderr)) } if cfg.User != "" { runOpts = append(runOpts, llb.User(cfg.User)) } if cfg.WorkingDir != "" { runOpts = append(runOpts, llb.Dir(cfg.WorkingDir)) } for _, env := range cfg.Env { name, val, ok := strings.Cut(env, "=") if !ok { _ = ok } runOpts = append(runOpts, llb.AddEnv(name, val)) } for i, secret := range payload.Secrets { secretOpts := []llb.SecretOption{llb.SecretID(string(secret.Secret))} var secretDest string switch { case secret.EnvName != "": secretDest = secret.EnvName secretOpts = append(secretOpts, llb.SecretAsEnv(true)) case secret.MountPath != "":
closed
dagger/dagger
https://github.com/dagger/dagger
3,393
Fix build of shim when execing on non-platform specific llb state
from @marcosnils ``` query Build($file: FileID!, $ref: ContainerAddress!) { container { withMountedFile(path: "/mnt/dagger", source: $file) { exec(args: ["cp", "/mnt/dagger", "/dagger"]) { withEntrypoint(args: ["dagger"]) { publish(address: $ref) } } } } } ``` results in ``` { "data": null, "errors": [ { "message": "build shim: failed to parse target platform unknown: \"unknown\": unknown operating system or architecture: invalid argument", "locations": [ { "line": 4, "column": 7 } ], "path": [ "container", "withMountedFile", "exec" ] } ] } ``` The above query should fail since there's no fs on which to execute `cp` but it shouldn't fail by not being able to build the shim. It's also should be possible in general to, e.g. start at scratch, unpack a static binary and exec it, in which case this shouldn't even be an error case at all.
https://github.com/dagger/dagger/issues/3393
https://github.com/dagger/dagger/pull/3399
51c7941c3c8e7c2ac4242f5c41cec5a56d17e9d3
f8b3c63637cfcca2ec677fea2e020885664bd301
2022-10-14T22:29:08Z
go
2022-11-10T06:01:37Z
core/container.go
secretDest = secret.MountPath default: return nil, fmt.Errorf("malformed secret config at index %d", i) } runOpts = append(runOpts, llb.AddSecret(secretDest, secretOpts...)) } fsSt, err := payload.FSState() if err != nil { return nil, fmt.Errorf("fs state: %w", err) } for _, mnt := range mounts { srcSt, err := mnt.SourceState() if err != nil { return nil, fmt.Errorf("mount %s: %w", mnt.Target, err) } mountOpts := []llb.MountOption{} if mnt.SourcePath != "" { mountOpts = append(mountOpts, llb.SourcePath(mnt.SourcePath)) } if mnt.CacheSharingMode != "" { var sharingMode llb.CacheMountSharingMode switch mnt.CacheSharingMode { case "shared": sharingMode = llb.CacheMountShared case "private": sharingMode = llb.CacheMountPrivate case "locked": sharingMode = llb.CacheMountLocked default: return nil, errors.Errorf("invalid cache mount sharing mode %q", mnt.CacheSharingMode)
closed
dagger/dagger
https://github.com/dagger/dagger
3,393
Fix build of shim when execing on non-platform specific llb state
from @marcosnils ``` query Build($file: FileID!, $ref: ContainerAddress!) { container { withMountedFile(path: "/mnt/dagger", source: $file) { exec(args: ["cp", "/mnt/dagger", "/dagger"]) { withEntrypoint(args: ["dagger"]) { publish(address: $ref) } } } } } ``` results in ``` { "data": null, "errors": [ { "message": "build shim: failed to parse target platform unknown: \"unknown\": unknown operating system or architecture: invalid argument", "locations": [ { "line": 4, "column": 7 } ], "path": [ "container", "withMountedFile", "exec" ] } ] } ``` The above query should fail since there's no fs on which to execute `cp` but it shouldn't fail by not being able to build the shim. It's also should be possible in general to, e.g. start at scratch, unpack a static binary and exec it, in which case this shouldn't even be an error case at all.
https://github.com/dagger/dagger/issues/3393
https://github.com/dagger/dagger/pull/3399
51c7941c3c8e7c2ac4242f5c41cec5a56d17e9d3
f8b3c63637cfcca2ec677fea2e020885664bd301
2022-10-14T22:29:08Z
go
2022-11-10T06:01:37Z
core/container.go
} mountOpts = append(mountOpts, llb.AsPersistentCacheDir(mnt.CacheID, sharingMode)) } if mnt.Tmpfs { mountOpts = append(mountOpts, llb.Tmpfs()) } runOpts = append(runOpts, llb.AddMount(mnt.Target, srcSt, mountOpts...)) } execSt := fsSt.Run(runOpts...) execDef, err := execSt.Root().Marshal(ctx, llb.Platform(platform)) if err != nil { return nil, fmt.Errorf("marshal root: %w", err) } payload.FS = execDef.ToPB() metaDef, err := execSt.GetMount(metaMount).Marshal(ctx, llb.Platform(platform)) if err != nil { return nil, fmt.Errorf("get meta mount: %w", err) } payload.Meta = metaDef.ToPB() for i, mnt := range mounts { if mnt.Tmpfs || mnt.CacheID != "" { continue } mountSt := execSt.GetMount(mnt.Target) execMountDef, err := mountSt.Marshal(ctx, llb.Platform(platform)) if err != nil { return nil, fmt.Errorf("propagate %s: %w", mnt.Target, err) } mounts[i].Source = execMountDef.ToPB()
closed
dagger/dagger
https://github.com/dagger/dagger
3,393
Fix build of shim when execing on non-platform specific llb state
from @marcosnils ``` query Build($file: FileID!, $ref: ContainerAddress!) { container { withMountedFile(path: "/mnt/dagger", source: $file) { exec(args: ["cp", "/mnt/dagger", "/dagger"]) { withEntrypoint(args: ["dagger"]) { publish(address: $ref) } } } } } ``` results in ``` { "data": null, "errors": [ { "message": "build shim: failed to parse target platform unknown: \"unknown\": unknown operating system or architecture: invalid argument", "locations": [ { "line": 4, "column": 7 } ], "path": [ "container", "withMountedFile", "exec" ] } ] } ``` The above query should fail since there's no fs on which to execute `cp` but it shouldn't fail by not being able to build the shim. It's also should be possible in general to, e.g. start at scratch, unpack a static binary and exec it, in which case this shouldn't even be an error case at all.
https://github.com/dagger/dagger/issues/3393
https://github.com/dagger/dagger/pull/3399
51c7941c3c8e7c2ac4242f5c41cec5a56d17e9d3
f8b3c63637cfcca2ec677fea2e020885664bd301
2022-10-14T22:29:08Z
go
2022-11-10T06:01:37Z
core/container.go
} payload.Mounts = mounts id, err := payload.Encode() if err != nil { return nil, fmt.Errorf("encode: %w", err) } return &Container{ID: id}, nil } func (container *Container) ExitCode(ctx context.Context, gw bkgw.Client) (*int, error) { file, err := container.MetaFile(ctx, gw, "exitCode") if err != nil { return nil, err } if file == nil { return nil, nil } content, err := file.Contents(ctx, gw) if err != nil { return nil, err } exitCode, err := strconv.Atoi(string(content)) if err != nil { return nil, err } return &exitCode, nil } func (container *Container) MetaFile(ctx context.Context, gw bkgw.Client, filePath string) (*File, error) { payload, err := container.ID.decode() if err != nil { return nil, err
closed
dagger/dagger
https://github.com/dagger/dagger
3,393
Fix build of shim when execing on non-platform specific llb state
from @marcosnils ``` query Build($file: FileID!, $ref: ContainerAddress!) { container { withMountedFile(path: "/mnt/dagger", source: $file) { exec(args: ["cp", "/mnt/dagger", "/dagger"]) { withEntrypoint(args: ["dagger"]) { publish(address: $ref) } } } } } ``` results in ``` { "data": null, "errors": [ { "message": "build shim: failed to parse target platform unknown: \"unknown\": unknown operating system or architecture: invalid argument", "locations": [ { "line": 4, "column": 7 } ], "path": [ "container", "withMountedFile", "exec" ] } ] } ``` The above query should fail since there's no fs on which to execute `cp` but it shouldn't fail by not being able to build the shim. It's also should be possible in general to, e.g. start at scratch, unpack a static binary and exec it, in which case this shouldn't even be an error case at all.
https://github.com/dagger/dagger/issues/3393
https://github.com/dagger/dagger/pull/3399
51c7941c3c8e7c2ac4242f5c41cec5a56d17e9d3
f8b3c63637cfcca2ec677fea2e020885664bd301
2022-10-14T22:29:08Z
go
2022-11-10T06:01:37Z
core/container.go
} meta, err := payload.MetaState() if err != nil { return nil, err } if meta == nil { return nil, nil } return NewFile(ctx, *meta, path.Join(metaSourcePath, filePath), payload.Platform) } func (container *Container) Publish( ctx context.Context, ref string, platformVariants []ContainerID, bkClient *bkclient.Client, solveOpts bkclient.SolveOpt, solveCh chan<- *bkclient.SolveStatus, ) (string, error) { solveOpts.Exports = []bkclient.ExportEntry{ { Type: bkclient.ExporterImage, Attrs: map[string]string{ "name": ref, "push": "true", }, }, } ch, wg := mirrorCh(solveCh) defer wg.Wait()
closed
dagger/dagger
https://github.com/dagger/dagger
3,393
Fix build of shim when execing on non-platform specific llb state
from @marcosnils ``` query Build($file: FileID!, $ref: ContainerAddress!) { container { withMountedFile(path: "/mnt/dagger", source: $file) { exec(args: ["cp", "/mnt/dagger", "/dagger"]) { withEntrypoint(args: ["dagger"]) { publish(address: $ref) } } } } } ``` results in ``` { "data": null, "errors": [ { "message": "build shim: failed to parse target platform unknown: \"unknown\": unknown operating system or architecture: invalid argument", "locations": [ { "line": 4, "column": 7 } ], "path": [ "container", "withMountedFile", "exec" ] } ] } ``` The above query should fail since there's no fs on which to execute `cp` but it shouldn't fail by not being able to build the shim. It's also should be possible in general to, e.g. start at scratch, unpack a static binary and exec it, in which case this shouldn't even be an error case at all.
https://github.com/dagger/dagger/issues/3393
https://github.com/dagger/dagger/pull/3399
51c7941c3c8e7c2ac4242f5c41cec5a56d17e9d3
f8b3c63637cfcca2ec677fea2e020885664bd301
2022-10-14T22:29:08Z
go
2022-11-10T06:01:37Z
core/container.go
res, err := bkClient.Build(ctx, solveOpts, "", func(ctx context.Context, gw bkgw.Client) (*bkgw.Result, error) { return container.export(ctx, gw, platformVariants) }, ch) if err != nil { return "", err } refName, err := reference.ParseNormalizedNamed(ref) if err != nil { return "", err } imageDigest, found := res.ExporterResponse[exptypes.ExporterImageDigestKey] if found { dig, err := digest.Parse(imageDigest) if err != nil { return "", fmt.Errorf("parse digest: %w", err) } withDig, err := reference.WithDigest(refName, dig) if err != nil { return "", fmt.Errorf("with digest: %w", err) } return withDig.String(), nil } return ref, nil } func (container *Container) Platform() (specs.Platform, error) { payload, err := container.ID.decode() if err != nil { return specs.Platform{}, err } return payload.Platform, nil
closed
dagger/dagger
https://github.com/dagger/dagger
3,393
Fix build of shim when execing on non-platform specific llb state
from @marcosnils ``` query Build($file: FileID!, $ref: ContainerAddress!) { container { withMountedFile(path: "/mnt/dagger", source: $file) { exec(args: ["cp", "/mnt/dagger", "/dagger"]) { withEntrypoint(args: ["dagger"]) { publish(address: $ref) } } } } } ``` results in ``` { "data": null, "errors": [ { "message": "build shim: failed to parse target platform unknown: \"unknown\": unknown operating system or architecture: invalid argument", "locations": [ { "line": 4, "column": 7 } ], "path": [ "container", "withMountedFile", "exec" ] } ] } ``` The above query should fail since there's no fs on which to execute `cp` but it shouldn't fail by not being able to build the shim. It's also should be possible in general to, e.g. start at scratch, unpack a static binary and exec it, in which case this shouldn't even be an error case at all.
https://github.com/dagger/dagger/issues/3393
https://github.com/dagger/dagger/pull/3399
51c7941c3c8e7c2ac4242f5c41cec5a56d17e9d3
f8b3c63637cfcca2ec677fea2e020885664bd301
2022-10-14T22:29:08Z
go
2022-11-10T06:01:37Z
core/container.go
} func (container *Container) Export( ctx context.Context, host *Host, dest string, platformVariants []ContainerID, bkClient *bkclient.Client, solveOpts bkclient.SolveOpt, solveCh chan<- *bkclient.SolveStatus, ) error { dest, err := host.NormalizeDest(dest) if err != nil { return err } out, err := os.Create(dest) if err != nil { return err } defer out.Close() return host.Export(ctx, bkclient.ExportEntry{ Type: bkclient.ExporterOCI, Output: func(map[string]string) (io.WriteCloser, error) { return out, nil }, }, dest, bkClient, solveOpts, solveCh, func(ctx context.Context, gw bkgw.Client) (*bkgw.Result, error) { return container.export(ctx, gw, platformVariants) }) } func (container *Container) export( ctx context.Context,
closed
dagger/dagger
https://github.com/dagger/dagger
3,393
Fix build of shim when execing on non-platform specific llb state
from @marcosnils ``` query Build($file: FileID!, $ref: ContainerAddress!) { container { withMountedFile(path: "/mnt/dagger", source: $file) { exec(args: ["cp", "/mnt/dagger", "/dagger"]) { withEntrypoint(args: ["dagger"]) { publish(address: $ref) } } } } } ``` results in ``` { "data": null, "errors": [ { "message": "build shim: failed to parse target platform unknown: \"unknown\": unknown operating system or architecture: invalid argument", "locations": [ { "line": 4, "column": 7 } ], "path": [ "container", "withMountedFile", "exec" ] } ] } ``` The above query should fail since there's no fs on which to execute `cp` but it shouldn't fail by not being able to build the shim. It's also should be possible in general to, e.g. start at scratch, unpack a static binary and exec it, in which case this shouldn't even be an error case at all.
https://github.com/dagger/dagger/issues/3393
https://github.com/dagger/dagger/pull/3399
51c7941c3c8e7c2ac4242f5c41cec5a56d17e9d3
f8b3c63637cfcca2ec677fea2e020885664bd301
2022-10-14T22:29:08Z
go
2022-11-10T06:01:37Z
core/container.go
gw bkgw.Client, platformVariants []ContainerID, ) (*bkgw.Result, error) { var payloads []*containerIDPayload if container.ID != "" { payload, err := container.ID.decode() if err != nil { return nil, err } if payload.FS != nil { payloads = append(payloads, payload) } } for _, id := range platformVariants { payload, err := id.decode() if err != nil { return nil, err } if payload.FS != nil { payloads = append(payloads, payload) } } if len(payloads) == 0 { return nil, errors.New("no containers to export") } if len(payloads) == 1 { payload := payloads[0] st, err := payload.FSState() if err != nil {
closed
dagger/dagger
https://github.com/dagger/dagger
3,393
Fix build of shim when execing on non-platform specific llb state
from @marcosnils ``` query Build($file: FileID!, $ref: ContainerAddress!) { container { withMountedFile(path: "/mnt/dagger", source: $file) { exec(args: ["cp", "/mnt/dagger", "/dagger"]) { withEntrypoint(args: ["dagger"]) { publish(address: $ref) } } } } } ``` results in ``` { "data": null, "errors": [ { "message": "build shim: failed to parse target platform unknown: \"unknown\": unknown operating system or architecture: invalid argument", "locations": [ { "line": 4, "column": 7 } ], "path": [ "container", "withMountedFile", "exec" ] } ] } ``` The above query should fail since there's no fs on which to execute `cp` but it shouldn't fail by not being able to build the shim. It's also should be possible in general to, e.g. start at scratch, unpack a static binary and exec it, in which case this shouldn't even be an error case at all.
https://github.com/dagger/dagger/issues/3393
https://github.com/dagger/dagger/pull/3399
51c7941c3c8e7c2ac4242f5c41cec5a56d17e9d3
f8b3c63637cfcca2ec677fea2e020885664bd301
2022-10-14T22:29:08Z
go
2022-11-10T06:01:37Z
core/container.go
return nil, err } stDef, err := st.Marshal(ctx, llb.Platform(payload.Platform)) if err != nil { return nil, err } res, err := gw.Solve(ctx, bkgw.SolveRequest{ Evaluate: true, Definition: stDef.ToPB(), }) if err != nil { return nil, err } cfgBytes, err := json.Marshal(specs.Image{ Architecture: payload.Platform.Architecture, OS: payload.Platform.OS, OSVersion: payload.Platform.OSVersion, OSFeatures: payload.Platform.OSFeatures, Config: payload.Config, }) if err != nil { return nil, err } res.AddMeta(exptypes.ExporterImageConfigKey, cfgBytes) return res, nil } res := bkgw.NewResult() expPlatforms := &exptypes.Platforms{ Platforms: make([]exptypes.Platform, len(payloads)), }
closed
dagger/dagger
https://github.com/dagger/dagger
3,393
Fix build of shim when execing on non-platform specific llb state
from @marcosnils ``` query Build($file: FileID!, $ref: ContainerAddress!) { container { withMountedFile(path: "/mnt/dagger", source: $file) { exec(args: ["cp", "/mnt/dagger", "/dagger"]) { withEntrypoint(args: ["dagger"]) { publish(address: $ref) } } } } } ``` results in ``` { "data": null, "errors": [ { "message": "build shim: failed to parse target platform unknown: \"unknown\": unknown operating system or architecture: invalid argument", "locations": [ { "line": 4, "column": 7 } ], "path": [ "container", "withMountedFile", "exec" ] } ] } ``` The above query should fail since there's no fs on which to execute `cp` but it shouldn't fail by not being able to build the shim. It's also should be possible in general to, e.g. start at scratch, unpack a static binary and exec it, in which case this shouldn't even be an error case at all.
https://github.com/dagger/dagger/issues/3393
https://github.com/dagger/dagger/pull/3399
51c7941c3c8e7c2ac4242f5c41cec5a56d17e9d3
f8b3c63637cfcca2ec677fea2e020885664bd301
2022-10-14T22:29:08Z
go
2022-11-10T06:01:37Z
core/container.go
for i, payload := range payloads { st, err := payload.FSState() if err != nil { return nil, err } stDef, err := st.Marshal(ctx, llb.Platform(payload.Platform)) if err != nil { return nil, err } r, err := gw.Solve(ctx, bkgw.SolveRequest{ Evaluate: true, Definition: stDef.ToPB(), }) if err != nil { return nil, err } ref, err := r.SingleRef() if err != nil { return nil, err } platformKey := platforms.Format(payload.Platform) res.AddRef(platformKey, ref) expPlatforms.Platforms[i] = exptypes.Platform{ ID: platformKey, Platform: payload.Platform, } cfgBytes, err := json.Marshal(specs.Image{ Architecture: payload.Platform.Architecture, OS: payload.Platform.OS, OSVersion: payload.Platform.OSVersion,
closed
dagger/dagger
https://github.com/dagger/dagger
3,393
Fix build of shim when execing on non-platform specific llb state
from @marcosnils ``` query Build($file: FileID!, $ref: ContainerAddress!) { container { withMountedFile(path: "/mnt/dagger", source: $file) { exec(args: ["cp", "/mnt/dagger", "/dagger"]) { withEntrypoint(args: ["dagger"]) { publish(address: $ref) } } } } } ``` results in ``` { "data": null, "errors": [ { "message": "build shim: failed to parse target platform unknown: \"unknown\": unknown operating system or architecture: invalid argument", "locations": [ { "line": 4, "column": 7 } ], "path": [ "container", "withMountedFile", "exec" ] } ] } ``` The above query should fail since there's no fs on which to execute `cp` but it shouldn't fail by not being able to build the shim. It's also should be possible in general to, e.g. start at scratch, unpack a static binary and exec it, in which case this shouldn't even be an error case at all.
https://github.com/dagger/dagger/issues/3393
https://github.com/dagger/dagger/pull/3399
51c7941c3c8e7c2ac4242f5c41cec5a56d17e9d3
f8b3c63637cfcca2ec677fea2e020885664bd301
2022-10-14T22:29:08Z
go
2022-11-10T06:01:37Z
core/container.go
OSFeatures: payload.Platform.OSFeatures, Config: payload.Config, }) if err != nil { return nil, err } res.AddMeta(fmt.Sprintf("%s/%s", exptypes.ExporterImageConfigKey, platformKey), cfgBytes) } platformBytes, err := json.Marshal(expPlatforms) if err != nil { return nil, err } res.AddMeta(exptypes.ExporterPlatformsKey, platformBytes) return res, nil } type ContainerExecOpts struct { Args []string Stdin string RedirectStdout string RedirectStderr string ExperimentalPrivilegedNesting bool }
closed
dagger/dagger
https://github.com/dagger/dagger
3,393
Fix build of shim when execing on non-platform specific llb state
from @marcosnils ``` query Build($file: FileID!, $ref: ContainerAddress!) { container { withMountedFile(path: "/mnt/dagger", source: $file) { exec(args: ["cp", "/mnt/dagger", "/dagger"]) { withEntrypoint(args: ["dagger"]) { publish(address: $ref) } } } } } ``` results in ``` { "data": null, "errors": [ { "message": "build shim: failed to parse target platform unknown: \"unknown\": unknown operating system or architecture: invalid argument", "locations": [ { "line": 4, "column": 7 } ], "path": [ "container", "withMountedFile", "exec" ] } ] } ``` The above query should fail since there's no fs on which to execute `cp` but it shouldn't fail by not being able to build the shim. It's also should be possible in general to, e.g. start at scratch, unpack a static binary and exec it, in which case this shouldn't even be an error case at all.
https://github.com/dagger/dagger/issues/3393
https://github.com/dagger/dagger/pull/3399
51c7941c3c8e7c2ac4242f5c41cec5a56d17e9d3
f8b3c63637cfcca2ec677fea2e020885664bd301
2022-10-14T22:29:08Z
go
2022-11-10T06:01:37Z
core/integration/container_test.go
package core import ( "context" "os" "path/filepath" "strings" "testing" "dagger.io/dagger" "github.com/dagger/dagger/core" "github.com/dagger/dagger/core/schema" "github.com/dagger/dagger/internal/testutil" "github.com/moby/buildkit/identity" "github.com/stretchr/testify/require" ) func TestContainerScratch(t *testing.T) { t.Parallel() res := struct {
closed
dagger/dagger
https://github.com/dagger/dagger
3,393
Fix build of shim when execing on non-platform specific llb state
from @marcosnils ``` query Build($file: FileID!, $ref: ContainerAddress!) { container { withMountedFile(path: "/mnt/dagger", source: $file) { exec(args: ["cp", "/mnt/dagger", "/dagger"]) { withEntrypoint(args: ["dagger"]) { publish(address: $ref) } } } } } ``` results in ``` { "data": null, "errors": [ { "message": "build shim: failed to parse target platform unknown: \"unknown\": unknown operating system or architecture: invalid argument", "locations": [ { "line": 4, "column": 7 } ], "path": [ "container", "withMountedFile", "exec" ] } ] } ``` The above query should fail since there's no fs on which to execute `cp` but it shouldn't fail by not being able to build the shim. It's also should be possible in general to, e.g. start at scratch, unpack a static binary and exec it, in which case this shouldn't even be an error case at all.
https://github.com/dagger/dagger/issues/3393
https://github.com/dagger/dagger/pull/3399
51c7941c3c8e7c2ac4242f5c41cec5a56d17e9d3
f8b3c63637cfcca2ec677fea2e020885664bd301
2022-10-14T22:29:08Z
go
2022-11-10T06:01:37Z
core/integration/container_test.go
Container struct { ID string Fs struct { Entries []string } } }{} err := testutil.Query( `{ container { id fs { entries } } }`, &res, nil) require.NoError(t, err) require.Empty(t, res.Container.Fs.Entries) } func TestContainerFrom(t *testing.T) { t.Parallel() res := struct {
closed
dagger/dagger
https://github.com/dagger/dagger
3,393
Fix build of shim when execing on non-platform specific llb state
from @marcosnils ``` query Build($file: FileID!, $ref: ContainerAddress!) { container { withMountedFile(path: "/mnt/dagger", source: $file) { exec(args: ["cp", "/mnt/dagger", "/dagger"]) { withEntrypoint(args: ["dagger"]) { publish(address: $ref) } } } } } ``` results in ``` { "data": null, "errors": [ { "message": "build shim: failed to parse target platform unknown: \"unknown\": unknown operating system or architecture: invalid argument", "locations": [ { "line": 4, "column": 7 } ], "path": [ "container", "withMountedFile", "exec" ] } ] } ``` The above query should fail since there's no fs on which to execute `cp` but it shouldn't fail by not being able to build the shim. It's also should be possible in general to, e.g. start at scratch, unpack a static binary and exec it, in which case this shouldn't even be an error case at all.
https://github.com/dagger/dagger/issues/3393
https://github.com/dagger/dagger/pull/3399
51c7941c3c8e7c2ac4242f5c41cec5a56d17e9d3
f8b3c63637cfcca2ec677fea2e020885664bd301
2022-10-14T22:29:08Z
go
2022-11-10T06:01:37Z
core/integration/container_test.go
Container struct { From struct { Fs struct { File struct { Contents string } } } } }{} err := testutil.Query( `{ container { from(address: "alpine:3.16.2") { fs { file(path: "/etc/alpine-release") { contents } } } } }`, &res, nil) require.NoError(t, err) require.Equal(t, res.Container.From.Fs.File.Contents, "3.16.2\n") } func TestContainerBuild(t *testing.T) {
closed
dagger/dagger
https://github.com/dagger/dagger
3,393
Fix build of shim when execing on non-platform specific llb state
from @marcosnils ``` query Build($file: FileID!, $ref: ContainerAddress!) { container { withMountedFile(path: "/mnt/dagger", source: $file) { exec(args: ["cp", "/mnt/dagger", "/dagger"]) { withEntrypoint(args: ["dagger"]) { publish(address: $ref) } } } } } ``` results in ``` { "data": null, "errors": [ { "message": "build shim: failed to parse target platform unknown: \"unknown\": unknown operating system or architecture: invalid argument", "locations": [ { "line": 4, "column": 7 } ], "path": [ "container", "withMountedFile", "exec" ] } ] } ``` The above query should fail since there's no fs on which to execute `cp` but it shouldn't fail by not being able to build the shim. It's also should be possible in general to, e.g. start at scratch, unpack a static binary and exec it, in which case this shouldn't even be an error case at all.
https://github.com/dagger/dagger/issues/3393
https://github.com/dagger/dagger/pull/3399
51c7941c3c8e7c2ac4242f5c41cec5a56d17e9d3
f8b3c63637cfcca2ec677fea2e020885664bd301
2022-10-14T22:29:08Z
go
2022-11-10T06:01:37Z
core/integration/container_test.go
ctx := context.Background() c, err := dagger.Connect(ctx) require.NoError(t, err) defer c.Close() contextDir := c.Directory(). WithNewFile("main.go", dagger.DirectoryWithNewFileOpts{ Contents: `package main import "fmt" import "os" func main() { for _, env := range os.Environ() { fmt.Println(env) } }`, }) t.Run("default Dockerfile location", func(t *testing.T) { src := contextDir. WithNewFile("Dockerfile", dagger.DirectoryWithNewFileOpts{ Contents: `FROM golang:1.18.2-alpine WORKDIR /src COPY main.go . RUN go mod init hello RUN go build -o /usr/bin/goenv main.go ENV FOO=bar CMD goenv `, })
closed
dagger/dagger
https://github.com/dagger/dagger
3,393
Fix build of shim when execing on non-platform specific llb state
from @marcosnils ``` query Build($file: FileID!, $ref: ContainerAddress!) { container { withMountedFile(path: "/mnt/dagger", source: $file) { exec(args: ["cp", "/mnt/dagger", "/dagger"]) { withEntrypoint(args: ["dagger"]) { publish(address: $ref) } } } } } ``` results in ``` { "data": null, "errors": [ { "message": "build shim: failed to parse target platform unknown: \"unknown\": unknown operating system or architecture: invalid argument", "locations": [ { "line": 4, "column": 7 } ], "path": [ "container", "withMountedFile", "exec" ] } ] } ``` The above query should fail since there's no fs on which to execute `cp` but it shouldn't fail by not being able to build the shim. It's also should be possible in general to, e.g. start at scratch, unpack a static binary and exec it, in which case this shouldn't even be an error case at all.
https://github.com/dagger/dagger/issues/3393
https://github.com/dagger/dagger/pull/3399
51c7941c3c8e7c2ac4242f5c41cec5a56d17e9d3
f8b3c63637cfcca2ec677fea2e020885664bd301
2022-10-14T22:29:08Z
go
2022-11-10T06:01:37Z
core/integration/container_test.go
env, err := c.Container().Build(src).Exec().Stdout().Contents(ctx) require.NoError(t, err) require.Contains(t, env, "FOO=bar\n") }) t.Run("custom Dockerfile location", func(t *testing.T) { src := contextDir. WithNewFile("subdir/Dockerfile.whee", dagger.DirectoryWithNewFileOpts{ Contents: `FROM golang:1.18.2-alpine WORKDIR /src COPY main.go . RUN go mod init hello RUN go build -o /usr/bin/goenv main.go ENV FOO=bar CMD goenv `, }) env, err := c.Container().Build(src, dagger.ContainerBuildOpts{ Dockerfile: "subdir/Dockerfile.whee", }).Exec().Stdout().Contents(ctx) require.NoError(t, err) require.Contains(t, env, "FOO=bar\n") }) t.Run("subdirectory with default Dockerfile location", func(t *testing.T) { src := contextDir. WithNewFile("Dockerfile", dagger.DirectoryWithNewFileOpts{ Contents: `FROM golang:1.18.2-alpine WORKDIR /src COPY main.go . RUN go mod init hello RUN go build -o /usr/bin/goenv main.go
closed
dagger/dagger
https://github.com/dagger/dagger
3,393
Fix build of shim when execing on non-platform specific llb state
from @marcosnils ``` query Build($file: FileID!, $ref: ContainerAddress!) { container { withMountedFile(path: "/mnt/dagger", source: $file) { exec(args: ["cp", "/mnt/dagger", "/dagger"]) { withEntrypoint(args: ["dagger"]) { publish(address: $ref) } } } } } ``` results in ``` { "data": null, "errors": [ { "message": "build shim: failed to parse target platform unknown: \"unknown\": unknown operating system or architecture: invalid argument", "locations": [ { "line": 4, "column": 7 } ], "path": [ "container", "withMountedFile", "exec" ] } ] } ``` The above query should fail since there's no fs on which to execute `cp` but it shouldn't fail by not being able to build the shim. It's also should be possible in general to, e.g. start at scratch, unpack a static binary and exec it, in which case this shouldn't even be an error case at all.
https://github.com/dagger/dagger/issues/3393
https://github.com/dagger/dagger/pull/3399
51c7941c3c8e7c2ac4242f5c41cec5a56d17e9d3
f8b3c63637cfcca2ec677fea2e020885664bd301
2022-10-14T22:29:08Z
go
2022-11-10T06:01:37Z
core/integration/container_test.go
ENV FOO=bar CMD goenv `, }) sub := c.Directory().WithDirectory("subcontext", src).Directory("subcontext") env, err := c.Container().Build(sub).Exec().Stdout().Contents(ctx) require.NoError(t, err) require.Contains(t, env, "FOO=bar\n") }) t.Run("subdirectory with custom Dockerfile location", func(t *testing.T) { src := contextDir. WithNewFile("subdir/Dockerfile.whee", dagger.DirectoryWithNewFileOpts{ Contents: `FROM golang:1.18.2-alpine WORKDIR /src COPY main.go . RUN go mod init hello RUN go build -o /usr/bin/goenv main.go ENV FOO=bar CMD goenv `, }) sub := c.Directory().WithDirectory("subcontext", src).Directory("subcontext") env, err := c.Container().Build(sub, dagger.ContainerBuildOpts{ Dockerfile: "subdir/Dockerfile.whee", }).Exec().Stdout().Contents(ctx) require.NoError(t, err) require.Contains(t, env, "FOO=bar\n") }) } func TestContainerWithFS(t *testing.T) {
closed
dagger/dagger
https://github.com/dagger/dagger
3,393
Fix build of shim when execing on non-platform specific llb state
from @marcosnils ``` query Build($file: FileID!, $ref: ContainerAddress!) { container { withMountedFile(path: "/mnt/dagger", source: $file) { exec(args: ["cp", "/mnt/dagger", "/dagger"]) { withEntrypoint(args: ["dagger"]) { publish(address: $ref) } } } } } ``` results in ``` { "data": null, "errors": [ { "message": "build shim: failed to parse target platform unknown: \"unknown\": unknown operating system or architecture: invalid argument", "locations": [ { "line": 4, "column": 7 } ], "path": [ "container", "withMountedFile", "exec" ] } ] } ``` The above query should fail since there's no fs on which to execute `cp` but it shouldn't fail by not being able to build the shim. It's also should be possible in general to, e.g. start at scratch, unpack a static binary and exec it, in which case this shouldn't even be an error case at all.
https://github.com/dagger/dagger/issues/3393
https://github.com/dagger/dagger/pull/3399
51c7941c3c8e7c2ac4242f5c41cec5a56d17e9d3
f8b3c63637cfcca2ec677fea2e020885664bd301
2022-10-14T22:29:08Z
go
2022-11-10T06:01:37Z
core/integration/container_test.go
t.Parallel() ctx := context.Background() c, err := dagger.Connect(ctx) require.NoError(t, err) defer c.Close() alpine316 := c.Container().From("alpine:3.16.2") alpine316ReleaseStr, err := alpine316.File("/etc/alpine-release").Contents(ctx) require.NoError(t, err) alpine316ReleaseStr = strings.TrimSpace(alpine316ReleaseStr) dir := alpine316.FS() exitCode, err := c.Container().WithEnvVariable("ALPINE_RELEASE", alpine316ReleaseStr).WithFS(dir).Exec(dagger.ContainerExecOpts{ Args: []string{ "/bin/sh", "-c", "test -f /etc/alpine-release && test \"$(head -n 1 /etc/alpine-release)\" = \"$ALPINE_RELEASE\"", }, }).ExitCode(ctx) require.NoError(t, err) require.Equal(t, exitCode, 0) alpine315 := c.Container().From("alpine:3.15.6") varVal := "testing123" alpine315WithVar := alpine315.WithEnvVariable("DAGGER_TEST", varVal) varValResp, err := alpine315WithVar.EnvVariable(ctx, "DAGGER_TEST") require.NoError(t, err) require.Equal(t, varVal, varValResp) alpine315ReplacedFS := alpine315WithVar.WithFS(dir)
closed
dagger/dagger
https://github.com/dagger/dagger
3,393
Fix build of shim when execing on non-platform specific llb state
from @marcosnils ``` query Build($file: FileID!, $ref: ContainerAddress!) { container { withMountedFile(path: "/mnt/dagger", source: $file) { exec(args: ["cp", "/mnt/dagger", "/dagger"]) { withEntrypoint(args: ["dagger"]) { publish(address: $ref) } } } } } ``` results in ``` { "data": null, "errors": [ { "message": "build shim: failed to parse target platform unknown: \"unknown\": unknown operating system or architecture: invalid argument", "locations": [ { "line": 4, "column": 7 } ], "path": [ "container", "withMountedFile", "exec" ] } ] } ``` The above query should fail since there's no fs on which to execute `cp` but it shouldn't fail by not being able to build the shim. It's also should be possible in general to, e.g. start at scratch, unpack a static binary and exec it, in which case this shouldn't even be an error case at all.
https://github.com/dagger/dagger/issues/3393
https://github.com/dagger/dagger/pull/3399
51c7941c3c8e7c2ac4242f5c41cec5a56d17e9d3
f8b3c63637cfcca2ec677fea2e020885664bd301
2022-10-14T22:29:08Z
go
2022-11-10T06:01:37Z
core/integration/container_test.go
varValResp, err = alpine315ReplacedFS.EnvVariable(ctx, "DAGGER_TEST") require.NoError(t, err) require.Equal(t, varVal, varValResp) releaseStr, err := alpine315ReplacedFS.File("/etc/alpine-release").Contents(ctx) require.NoError(t, err) require.Equal(t, "3.16.2\n", releaseStr) } func TestContainerExecExitCode(t *testing.T) { t.Parallel() res := struct { Container struct { From struct { Exec struct { ExitCode *int } } } }{} err := testutil.Query( `{ container { from(address: "alpine:3.16.2") { exec(args: ["true"]) { exitCode } } } }`, &res, nil) require.NoError(t, err) require.NotNil(t, res.Container.From.Exec.ExitCode)
closed
dagger/dagger
https://github.com/dagger/dagger
3,393
Fix build of shim when execing on non-platform specific llb state
from @marcosnils ``` query Build($file: FileID!, $ref: ContainerAddress!) { container { withMountedFile(path: "/mnt/dagger", source: $file) { exec(args: ["cp", "/mnt/dagger", "/dagger"]) { withEntrypoint(args: ["dagger"]) { publish(address: $ref) } } } } } ``` results in ``` { "data": null, "errors": [ { "message": "build shim: failed to parse target platform unknown: \"unknown\": unknown operating system or architecture: invalid argument", "locations": [ { "line": 4, "column": 7 } ], "path": [ "container", "withMountedFile", "exec" ] } ] } ``` The above query should fail since there's no fs on which to execute `cp` but it shouldn't fail by not being able to build the shim. It's also should be possible in general to, e.g. start at scratch, unpack a static binary and exec it, in which case this shouldn't even be an error case at all.
https://github.com/dagger/dagger/issues/3393
https://github.com/dagger/dagger/pull/3399
51c7941c3c8e7c2ac4242f5c41cec5a56d17e9d3
f8b3c63637cfcca2ec677fea2e020885664bd301
2022-10-14T22:29:08Z
go
2022-11-10T06:01:37Z
core/integration/container_test.go
require.Equal(t, 0, *res.Container.From.Exec.ExitCode) /* It's not currently possible to get a nonzero exit code back because Buildkit raises an error. We could perhaps have the shim mask the exit status and always exit 0, but we would have to be careful not to let that happen in a big chained LLB since it would prevent short-circuiting. We could only do it when the user requests the exitCode, but then we would actually need to run the command _again_ since we'd need some way to tell the shim what to do. Hmm... err = testutil.Query( `{ container { from(address: "alpine:3.16.2") { exec(args: ["false"]) { exitCode } } } }`, &res, nil) require.NoError(t, err) require.Equal(t, res.Container.From.Exec.ExitCode, 1) */ } func TestContainerExecStdoutStderr(t *testing.T) { t.Parallel() res := struct { Container struct { From struct {
closed
dagger/dagger
https://github.com/dagger/dagger
3,393
Fix build of shim when execing on non-platform specific llb state
from @marcosnils ``` query Build($file: FileID!, $ref: ContainerAddress!) { container { withMountedFile(path: "/mnt/dagger", source: $file) { exec(args: ["cp", "/mnt/dagger", "/dagger"]) { withEntrypoint(args: ["dagger"]) { publish(address: $ref) } } } } } ``` results in ``` { "data": null, "errors": [ { "message": "build shim: failed to parse target platform unknown: \"unknown\": unknown operating system or architecture: invalid argument", "locations": [ { "line": 4, "column": 7 } ], "path": [ "container", "withMountedFile", "exec" ] } ] } ``` The above query should fail since there's no fs on which to execute `cp` but it shouldn't fail by not being able to build the shim. It's also should be possible in general to, e.g. start at scratch, unpack a static binary and exec it, in which case this shouldn't even be an error case at all.
https://github.com/dagger/dagger/issues/3393
https://github.com/dagger/dagger/pull/3399
51c7941c3c8e7c2ac4242f5c41cec5a56d17e9d3
f8b3c63637cfcca2ec677fea2e020885664bd301
2022-10-14T22:29:08Z
go
2022-11-10T06:01:37Z
core/integration/container_test.go
Exec struct { Stdout, Stderr struct { Contents string } } } } }{} err := testutil.Query( `{ container { from(address: "alpine:3.16.2") { exec(args: ["sh", "-c", "echo hello; echo goodbye >/dev/stderr"]) { stdout { contents } stderr { contents } } } } }`, &res, nil) require.NoError(t, err) require.Equal(t, res.Container.From.Exec.Stdout.Contents, "hello\n") require.Equal(t, res.Container.From.Exec.Stderr.Contents, "goodbye\n") } func TestContainerExecStdin(t *testing.T) { t.Parallel() res := struct {
closed
dagger/dagger
https://github.com/dagger/dagger
3,393
Fix build of shim when execing on non-platform specific llb state
from @marcosnils ``` query Build($file: FileID!, $ref: ContainerAddress!) { container { withMountedFile(path: "/mnt/dagger", source: $file) { exec(args: ["cp", "/mnt/dagger", "/dagger"]) { withEntrypoint(args: ["dagger"]) { publish(address: $ref) } } } } } ``` results in ``` { "data": null, "errors": [ { "message": "build shim: failed to parse target platform unknown: \"unknown\": unknown operating system or architecture: invalid argument", "locations": [ { "line": 4, "column": 7 } ], "path": [ "container", "withMountedFile", "exec" ] } ] } ``` The above query should fail since there's no fs on which to execute `cp` but it shouldn't fail by not being able to build the shim. It's also should be possible in general to, e.g. start at scratch, unpack a static binary and exec it, in which case this shouldn't even be an error case at all.
https://github.com/dagger/dagger/issues/3393
https://github.com/dagger/dagger/pull/3399
51c7941c3c8e7c2ac4242f5c41cec5a56d17e9d3
f8b3c63637cfcca2ec677fea2e020885664bd301
2022-10-14T22:29:08Z
go
2022-11-10T06:01:37Z
core/integration/container_test.go
Container struct { From struct { Exec struct { Stdout struct { Contents string } } } } }{} err := testutil.Query( `{ container { from(address: "alpine:3.16.2") { exec(args: ["cat"], stdin: "hello") { stdout { contents } } } } }`, &res, nil) require.NoError(t, err) require.Equal(t, res.Container.From.Exec.Stdout.Contents, "hello") } func TestContainerExecRedirectStdoutStderr(t *testing.T) { t.Parallel() res := struct {
closed
dagger/dagger
https://github.com/dagger/dagger
3,393
Fix build of shim when execing on non-platform specific llb state
from @marcosnils ``` query Build($file: FileID!, $ref: ContainerAddress!) { container { withMountedFile(path: "/mnt/dagger", source: $file) { exec(args: ["cp", "/mnt/dagger", "/dagger"]) { withEntrypoint(args: ["dagger"]) { publish(address: $ref) } } } } } ``` results in ``` { "data": null, "errors": [ { "message": "build shim: failed to parse target platform unknown: \"unknown\": unknown operating system or architecture: invalid argument", "locations": [ { "line": 4, "column": 7 } ], "path": [ "container", "withMountedFile", "exec" ] } ] } ``` The above query should fail since there's no fs on which to execute `cp` but it shouldn't fail by not being able to build the shim. It's also should be possible in general to, e.g. start at scratch, unpack a static binary and exec it, in which case this shouldn't even be an error case at all.
https://github.com/dagger/dagger/issues/3393
https://github.com/dagger/dagger/pull/3399
51c7941c3c8e7c2ac4242f5c41cec5a56d17e9d3
f8b3c63637cfcca2ec677fea2e020885664bd301
2022-10-14T22:29:08Z
go
2022-11-10T06:01:37Z
core/integration/container_test.go
Container struct { From struct { Exec struct { Out, Err struct { Contents string } } } } }{} err := testutil.Query( `{ container { from(address: "alpine:3.16.2") { exec( args: ["sh", "-c", "echo hello; echo goodbye >/dev/stderr"], redirectStdout: "out", redirectStderr: "err" ) { out: file(path: "out") { contents } err: file(path: "err") { contents } } } } }`, &res, nil)
closed
dagger/dagger
https://github.com/dagger/dagger
3,393
Fix build of shim when execing on non-platform specific llb state
from @marcosnils ``` query Build($file: FileID!, $ref: ContainerAddress!) { container { withMountedFile(path: "/mnt/dagger", source: $file) { exec(args: ["cp", "/mnt/dagger", "/dagger"]) { withEntrypoint(args: ["dagger"]) { publish(address: $ref) } } } } } ``` results in ``` { "data": null, "errors": [ { "message": "build shim: failed to parse target platform unknown: \"unknown\": unknown operating system or architecture: invalid argument", "locations": [ { "line": 4, "column": 7 } ], "path": [ "container", "withMountedFile", "exec" ] } ] } ``` The above query should fail since there's no fs on which to execute `cp` but it shouldn't fail by not being able to build the shim. It's also should be possible in general to, e.g. start at scratch, unpack a static binary and exec it, in which case this shouldn't even be an error case at all.
https://github.com/dagger/dagger/issues/3393
https://github.com/dagger/dagger/pull/3399
51c7941c3c8e7c2ac4242f5c41cec5a56d17e9d3
f8b3c63637cfcca2ec677fea2e020885664bd301
2022-10-14T22:29:08Z
go
2022-11-10T06:01:37Z
core/integration/container_test.go
require.NoError(t, err) require.Equal(t, res.Container.From.Exec.Out.Contents, "hello\n") require.Equal(t, res.Container.From.Exec.Err.Contents, "goodbye\n") err = testutil.Query( `{ container { from(address: "alpine:3.16.2") { exec( args: ["sh", "-c", "echo hello; echo goodbye >/dev/stderr"], redirectStdout: "out", redirectStderr: "err" ) { stdout { contents } stderr { contents } } } } }`, &res, nil) require.Error(t, err) require.Contains(t, err.Error(), "stdout: no such file or directory") require.Contains(t, err.Error(), "stderr: no such file or directory") } func TestContainerNullStdoutStderr(t *testing.T) { t.Parallel() res := struct { Container struct {
closed
dagger/dagger
https://github.com/dagger/dagger
3,393
Fix build of shim when execing on non-platform specific llb state
from @marcosnils ``` query Build($file: FileID!, $ref: ContainerAddress!) { container { withMountedFile(path: "/mnt/dagger", source: $file) { exec(args: ["cp", "/mnt/dagger", "/dagger"]) { withEntrypoint(args: ["dagger"]) { publish(address: $ref) } } } } } ``` results in ``` { "data": null, "errors": [ { "message": "build shim: failed to parse target platform unknown: \"unknown\": unknown operating system or architecture: invalid argument", "locations": [ { "line": 4, "column": 7 } ], "path": [ "container", "withMountedFile", "exec" ] } ] } ``` The above query should fail since there's no fs on which to execute `cp` but it shouldn't fail by not being able to build the shim. It's also should be possible in general to, e.g. start at scratch, unpack a static binary and exec it, in which case this shouldn't even be an error case at all.
https://github.com/dagger/dagger/issues/3393
https://github.com/dagger/dagger/pull/3399
51c7941c3c8e7c2ac4242f5c41cec5a56d17e9d3
f8b3c63637cfcca2ec677fea2e020885664bd301
2022-10-14T22:29:08Z
go
2022-11-10T06:01:37Z
core/integration/container_test.go
From struct { Stdout, Stderr *struct { Contents string } } } }{} err := testutil.Query( `{ container { from(address: "alpine:3.16.2") { stdout { contents } stderr { contents } } } }`, &res, nil) require.NoError(t, err) require.Nil(t, res.Container.From.Stdout) require.Nil(t, res.Container.From.Stderr) } func TestContainerExecWithWorkdir(t *testing.T) { t.Parallel() res := struct { Container struct { From struct { WithWorkdir struct {
closed
dagger/dagger
https://github.com/dagger/dagger
3,393
Fix build of shim when execing on non-platform specific llb state
from @marcosnils ``` query Build($file: FileID!, $ref: ContainerAddress!) { container { withMountedFile(path: "/mnt/dagger", source: $file) { exec(args: ["cp", "/mnt/dagger", "/dagger"]) { withEntrypoint(args: ["dagger"]) { publish(address: $ref) } } } } } ``` results in ``` { "data": null, "errors": [ { "message": "build shim: failed to parse target platform unknown: \"unknown\": unknown operating system or architecture: invalid argument", "locations": [ { "line": 4, "column": 7 } ], "path": [ "container", "withMountedFile", "exec" ] } ] } ``` The above query should fail since there's no fs on which to execute `cp` but it shouldn't fail by not being able to build the shim. It's also should be possible in general to, e.g. start at scratch, unpack a static binary and exec it, in which case this shouldn't even be an error case at all.
https://github.com/dagger/dagger/issues/3393
https://github.com/dagger/dagger/pull/3399
51c7941c3c8e7c2ac4242f5c41cec5a56d17e9d3
f8b3c63637cfcca2ec677fea2e020885664bd301
2022-10-14T22:29:08Z
go
2022-11-10T06:01:37Z
core/integration/container_test.go
Exec struct { Stdout struct { Contents string } } } } } }{} err := testutil.Query( `{ container { from(address: "alpine:3.16.2") { withWorkdir(path: "/usr") { exec(args: ["pwd"]) { stdout { contents } } } } } }`, &res, nil) require.NoError(t, err) require.Equal(t, res.Container.From.WithWorkdir.Exec.Stdout.Contents, "/usr\n") } func TestContainerExecWithUser(t *testing.T) { t.Parallel() res := struct { Container struct {
closed
dagger/dagger
https://github.com/dagger/dagger
3,393
Fix build of shim when execing on non-platform specific llb state
from @marcosnils ``` query Build($file: FileID!, $ref: ContainerAddress!) { container { withMountedFile(path: "/mnt/dagger", source: $file) { exec(args: ["cp", "/mnt/dagger", "/dagger"]) { withEntrypoint(args: ["dagger"]) { publish(address: $ref) } } } } } ``` results in ``` { "data": null, "errors": [ { "message": "build shim: failed to parse target platform unknown: \"unknown\": unknown operating system or architecture: invalid argument", "locations": [ { "line": 4, "column": 7 } ], "path": [ "container", "withMountedFile", "exec" ] } ] } ``` The above query should fail since there's no fs on which to execute `cp` but it shouldn't fail by not being able to build the shim. It's also should be possible in general to, e.g. start at scratch, unpack a static binary and exec it, in which case this shouldn't even be an error case at all.
https://github.com/dagger/dagger/issues/3393
https://github.com/dagger/dagger/pull/3399
51c7941c3c8e7c2ac4242f5c41cec5a56d17e9d3
f8b3c63637cfcca2ec677fea2e020885664bd301
2022-10-14T22:29:08Z
go
2022-11-10T06:01:37Z
core/integration/container_test.go
From struct { User string WithUser struct { User string Exec struct { Stdout struct { Contents string } } } } } }{} t.Run("user name", func(t *testing.T) { err := testutil.Query( `{ container { from(address: "alpine:3.16.2") { user withUser(name: "daemon") { user exec(args: ["whoami"]) { stdout { contents } } } } } }`, &res, nil)
closed
dagger/dagger
https://github.com/dagger/dagger
3,393
Fix build of shim when execing on non-platform specific llb state
from @marcosnils ``` query Build($file: FileID!, $ref: ContainerAddress!) { container { withMountedFile(path: "/mnt/dagger", source: $file) { exec(args: ["cp", "/mnt/dagger", "/dagger"]) { withEntrypoint(args: ["dagger"]) { publish(address: $ref) } } } } } ``` results in ``` { "data": null, "errors": [ { "message": "build shim: failed to parse target platform unknown: \"unknown\": unknown operating system or architecture: invalid argument", "locations": [ { "line": 4, "column": 7 } ], "path": [ "container", "withMountedFile", "exec" ] } ] } ``` The above query should fail since there's no fs on which to execute `cp` but it shouldn't fail by not being able to build the shim. It's also should be possible in general to, e.g. start at scratch, unpack a static binary and exec it, in which case this shouldn't even be an error case at all.
https://github.com/dagger/dagger/issues/3393
https://github.com/dagger/dagger/pull/3399
51c7941c3c8e7c2ac4242f5c41cec5a56d17e9d3
f8b3c63637cfcca2ec677fea2e020885664bd301
2022-10-14T22:29:08Z
go
2022-11-10T06:01:37Z
core/integration/container_test.go
require.NoError(t, err) require.Equal(t, "", res.Container.From.User) require.Equal(t, "daemon", res.Container.From.WithUser.User) require.Equal(t, "daemon\n", res.Container.From.WithUser.Exec.Stdout.Contents) }) t.Run("user and group name", func(t *testing.T) { err := testutil.Query( `{ container { from(address: "alpine:3.16.2") { user withUser(name: "daemon:floppy") { user exec(args: ["sh", "-c", "whoami; groups"]) { stdout { contents } } } } } }`, &res, nil) require.NoError(t, err) require.Equal(t, "", res.Container.From.User) require.Equal(t, "daemon:floppy", res.Container.From.WithUser.User) require.Equal(t, "daemon\nfloppy\n", res.Container.From.WithUser.Exec.Stdout.Contents) }) t.Run("user ID", func(t *testing.T) { err := testutil.Query( `{
closed
dagger/dagger
https://github.com/dagger/dagger
3,393
Fix build of shim when execing on non-platform specific llb state
from @marcosnils ``` query Build($file: FileID!, $ref: ContainerAddress!) { container { withMountedFile(path: "/mnt/dagger", source: $file) { exec(args: ["cp", "/mnt/dagger", "/dagger"]) { withEntrypoint(args: ["dagger"]) { publish(address: $ref) } } } } } ``` results in ``` { "data": null, "errors": [ { "message": "build shim: failed to parse target platform unknown: \"unknown\": unknown operating system or architecture: invalid argument", "locations": [ { "line": 4, "column": 7 } ], "path": [ "container", "withMountedFile", "exec" ] } ] } ``` The above query should fail since there's no fs on which to execute `cp` but it shouldn't fail by not being able to build the shim. It's also should be possible in general to, e.g. start at scratch, unpack a static binary and exec it, in which case this shouldn't even be an error case at all.
https://github.com/dagger/dagger/issues/3393
https://github.com/dagger/dagger/pull/3399
51c7941c3c8e7c2ac4242f5c41cec5a56d17e9d3
f8b3c63637cfcca2ec677fea2e020885664bd301
2022-10-14T22:29:08Z
go
2022-11-10T06:01:37Z
core/integration/container_test.go
container { from(address: "alpine:3.16.2") { user withUser(name: "2") { user exec(args: ["whoami"]) { stdout { contents } } } } } }`, &res, nil) require.NoError(t, err) require.Equal(t, "", res.Container.From.User) require.Equal(t, "2", res.Container.From.WithUser.User) require.Equal(t, "daemon\n", res.Container.From.WithUser.Exec.Stdout.Contents) }) t.Run("user and group ID", func(t *testing.T) { err := testutil.Query( `{ container { from(address: "alpine:3.16.2") { user withUser(name: "2:11") { user exec(args: ["sh", "-c", "whoami; groups"]) { stdout { contents
closed
dagger/dagger
https://github.com/dagger/dagger
3,393
Fix build of shim when execing on non-platform specific llb state
from @marcosnils ``` query Build($file: FileID!, $ref: ContainerAddress!) { container { withMountedFile(path: "/mnt/dagger", source: $file) { exec(args: ["cp", "/mnt/dagger", "/dagger"]) { withEntrypoint(args: ["dagger"]) { publish(address: $ref) } } } } } ``` results in ``` { "data": null, "errors": [ { "message": "build shim: failed to parse target platform unknown: \"unknown\": unknown operating system or architecture: invalid argument", "locations": [ { "line": 4, "column": 7 } ], "path": [ "container", "withMountedFile", "exec" ] } ] } ``` The above query should fail since there's no fs on which to execute `cp` but it shouldn't fail by not being able to build the shim. It's also should be possible in general to, e.g. start at scratch, unpack a static binary and exec it, in which case this shouldn't even be an error case at all.
https://github.com/dagger/dagger/issues/3393
https://github.com/dagger/dagger/pull/3399
51c7941c3c8e7c2ac4242f5c41cec5a56d17e9d3
f8b3c63637cfcca2ec677fea2e020885664bd301
2022-10-14T22:29:08Z
go
2022-11-10T06:01:37Z
core/integration/container_test.go
} } } } } }`, &res, nil) require.NoError(t, err) require.Equal(t, "", res.Container.From.User) require.Equal(t, "2:11", res.Container.From.WithUser.User) require.Equal(t, "daemon\nfloppy\n", res.Container.From.WithUser.Exec.Stdout.Contents) }) } func TestContainerExecWithEntrypoint(t *testing.T) { t.Parallel() res := struct { Container struct { From struct { Entrypoint []string WithEntrypoint struct { Entrypoint []string Exec struct { Stdout struct { Contents string } } WithEntrypoint struct { Entrypoint []string } } }
closed
dagger/dagger
https://github.com/dagger/dagger
3,393
Fix build of shim when execing on non-platform specific llb state
from @marcosnils ``` query Build($file: FileID!, $ref: ContainerAddress!) { container { withMountedFile(path: "/mnt/dagger", source: $file) { exec(args: ["cp", "/mnt/dagger", "/dagger"]) { withEntrypoint(args: ["dagger"]) { publish(address: $ref) } } } } } ``` results in ``` { "data": null, "errors": [ { "message": "build shim: failed to parse target platform unknown: \"unknown\": unknown operating system or architecture: invalid argument", "locations": [ { "line": 4, "column": 7 } ], "path": [ "container", "withMountedFile", "exec" ] } ] } ``` The above query should fail since there's no fs on which to execute `cp` but it shouldn't fail by not being able to build the shim. It's also should be possible in general to, e.g. start at scratch, unpack a static binary and exec it, in which case this shouldn't even be an error case at all.
https://github.com/dagger/dagger/issues/3393
https://github.com/dagger/dagger/pull/3399
51c7941c3c8e7c2ac4242f5c41cec5a56d17e9d3
f8b3c63637cfcca2ec677fea2e020885664bd301
2022-10-14T22:29:08Z
go
2022-11-10T06:01:37Z
core/integration/container_test.go
} }{} err := testutil.Query( `{ container { from(address: "alpine:3.16.2") { entrypoint withEntrypoint(args: ["sh", "-c"]) { entrypoint exec(args: ["echo $HOME"]) { stdout { contents } } withEntrypoint(args: []) { entrypoint } } } } }`, &res, nil) require.NoError(t, err) require.Empty(t, res.Container.From.Entrypoint) require.Equal(t, []string{"sh", "-c"}, res.Container.From.WithEntrypoint.Entrypoint) require.Equal(t, "/root\n", res.Container.From.WithEntrypoint.Exec.Stdout.Contents) require.Empty(t, res.Container.From.WithEntrypoint.WithEntrypoint.Entrypoint) } func TestContainerWithDefaultArgs(t *testing.T) { t.Parallel() res := struct {
closed
dagger/dagger
https://github.com/dagger/dagger
3,393
Fix build of shim when execing on non-platform specific llb state
from @marcosnils ``` query Build($file: FileID!, $ref: ContainerAddress!) { container { withMountedFile(path: "/mnt/dagger", source: $file) { exec(args: ["cp", "/mnt/dagger", "/dagger"]) { withEntrypoint(args: ["dagger"]) { publish(address: $ref) } } } } } ``` results in ``` { "data": null, "errors": [ { "message": "build shim: failed to parse target platform unknown: \"unknown\": unknown operating system or architecture: invalid argument", "locations": [ { "line": 4, "column": 7 } ], "path": [ "container", "withMountedFile", "exec" ] } ] } ``` The above query should fail since there's no fs on which to execute `cp` but it shouldn't fail by not being able to build the shim. It's also should be possible in general to, e.g. start at scratch, unpack a static binary and exec it, in which case this shouldn't even be an error case at all.
https://github.com/dagger/dagger/issues/3393
https://github.com/dagger/dagger/pull/3399
51c7941c3c8e7c2ac4242f5c41cec5a56d17e9d3
f8b3c63637cfcca2ec677fea2e020885664bd301
2022-10-14T22:29:08Z
go
2022-11-10T06:01:37Z
core/integration/container_test.go
Container struct { From struct { Entrypoint []string DefaultArgs []string Exec struct { Stdout struct { Contents string } } WithDefaultArgs struct { Entrypoint []string DefaultArgs []string } WithEntrypoint struct { Entrypoint []string DefaultArgs []string Exec struct { Stdout struct { Contents string } } WithDefaultArgs struct { Entrypoint []string DefaultArgs []string Exec struct { Stdout struct { Contents string } } }
closed
dagger/dagger
https://github.com/dagger/dagger
3,393
Fix build of shim when execing on non-platform specific llb state
from @marcosnils ``` query Build($file: FileID!, $ref: ContainerAddress!) { container { withMountedFile(path: "/mnt/dagger", source: $file) { exec(args: ["cp", "/mnt/dagger", "/dagger"]) { withEntrypoint(args: ["dagger"]) { publish(address: $ref) } } } } } ``` results in ``` { "data": null, "errors": [ { "message": "build shim: failed to parse target platform unknown: \"unknown\": unknown operating system or architecture: invalid argument", "locations": [ { "line": 4, "column": 7 } ], "path": [ "container", "withMountedFile", "exec" ] } ] } ``` The above query should fail since there's no fs on which to execute `cp` but it shouldn't fail by not being able to build the shim. It's also should be possible in general to, e.g. start at scratch, unpack a static binary and exec it, in which case this shouldn't even be an error case at all.
https://github.com/dagger/dagger/issues/3393
https://github.com/dagger/dagger/pull/3399
51c7941c3c8e7c2ac4242f5c41cec5a56d17e9d3
f8b3c63637cfcca2ec677fea2e020885664bd301
2022-10-14T22:29:08Z
go
2022-11-10T06:01:37Z
core/integration/container_test.go
} } } }{} err := testutil.Query( `{ container { from(address: "alpine:3.16.2") { entrypoint defaultArgs withDefaultArgs { entrypoint defaultArgs } withEntrypoint(args: ["sh", "-c"]) { entrypoint defaultArgs exec(args: ["echo $HOME"]) { stdout { contents } } withDefaultArgs(args: ["id"]) { entrypoint defaultArgs exec(args: []) { stdout { contents } }
closed
dagger/dagger
https://github.com/dagger/dagger
3,393
Fix build of shim when execing on non-platform specific llb state
from @marcosnils ``` query Build($file: FileID!, $ref: ContainerAddress!) { container { withMountedFile(path: "/mnt/dagger", source: $file) { exec(args: ["cp", "/mnt/dagger", "/dagger"]) { withEntrypoint(args: ["dagger"]) { publish(address: $ref) } } } } } ``` results in ``` { "data": null, "errors": [ { "message": "build shim: failed to parse target platform unknown: \"unknown\": unknown operating system or architecture: invalid argument", "locations": [ { "line": 4, "column": 7 } ], "path": [ "container", "withMountedFile", "exec" ] } ] } ``` The above query should fail since there's no fs on which to execute `cp` but it shouldn't fail by not being able to build the shim. It's also should be possible in general to, e.g. start at scratch, unpack a static binary and exec it, in which case this shouldn't even be an error case at all.
https://github.com/dagger/dagger/issues/3393
https://github.com/dagger/dagger/pull/3399
51c7941c3c8e7c2ac4242f5c41cec5a56d17e9d3
f8b3c63637cfcca2ec677fea2e020885664bd301
2022-10-14T22:29:08Z
go
2022-11-10T06:01:37Z
core/integration/container_test.go
} } } } }`, &res, nil) t.Run("default alpine (no entrypoint)", func(t *testing.T) { require.NoError(t, err) require.Empty(t, res.Container.From.Entrypoint) require.Equal(t, []string{"/bin/sh"}, res.Container.From.DefaultArgs) }) t.Run("with nil default args", func(t *testing.T) { require.Empty(t, res.Container.From.WithDefaultArgs.Entrypoint) require.Empty(t, res.Container.From.WithDefaultArgs.DefaultArgs) }) t.Run("with entrypoint set", func(t *testing.T) { require.Equal(t, []string{"sh", "-c"}, res.Container.From.WithEntrypoint.Entrypoint) require.Equal(t, []string{"/bin/sh"}, res.Container.From.WithEntrypoint.DefaultArgs) }) t.Run("with exec args", func(t *testing.T) { require.Equal(t, "/root\n", res.Container.From.WithEntrypoint.Exec.Stdout.Contents) }) t.Run("with default args set", func(t *testing.T) { require.Equal(t, []string{"sh", "-c"}, res.Container.From.WithEntrypoint.WithDefaultArgs.Entrypoint) require.Equal(t, []string{"id"}, res.Container.From.WithEntrypoint.WithDefaultArgs.DefaultArgs) require.Equal(t, "uid=0(root) gid=0(root) groups=0(root),1(bin),2(daemon),3(sys),4(adm),6(disk),10(wheel),11(floppy),20(dialout),26(tape),27(video)\n", res.Container.From.WithEntrypoint.WithDefaultArgs.Exec.Stdout.Contents) }) } func TestContainerExecWithEnvVariable(t *testing.T) { t.Parallel() res := struct {
closed
dagger/dagger
https://github.com/dagger/dagger
3,393
Fix build of shim when execing on non-platform specific llb state
from @marcosnils ``` query Build($file: FileID!, $ref: ContainerAddress!) { container { withMountedFile(path: "/mnt/dagger", source: $file) { exec(args: ["cp", "/mnt/dagger", "/dagger"]) { withEntrypoint(args: ["dagger"]) { publish(address: $ref) } } } } } ``` results in ``` { "data": null, "errors": [ { "message": "build shim: failed to parse target platform unknown: \"unknown\": unknown operating system or architecture: invalid argument", "locations": [ { "line": 4, "column": 7 } ], "path": [ "container", "withMountedFile", "exec" ] } ] } ``` The above query should fail since there's no fs on which to execute `cp` but it shouldn't fail by not being able to build the shim. It's also should be possible in general to, e.g. start at scratch, unpack a static binary and exec it, in which case this shouldn't even be an error case at all.
https://github.com/dagger/dagger/issues/3393
https://github.com/dagger/dagger/pull/3399
51c7941c3c8e7c2ac4242f5c41cec5a56d17e9d3
f8b3c63637cfcca2ec677fea2e020885664bd301
2022-10-14T22:29:08Z
go
2022-11-10T06:01:37Z
core/integration/container_test.go
Container struct { From struct { WithEnvVariable struct { Exec struct { Stdout struct { Contents string } } } } } }{} err := testutil.Query( `{ container { from(address: "alpine:3.16.2") { withEnvVariable(name: "FOO", value: "bar") { exec(args: ["env"]) { stdout { contents } } } } } }`, &res, nil) require.NoError(t, err) require.Contains(t, res.Container.From.WithEnvVariable.Exec.Stdout.Contents, "FOO=bar\n") } func TestContainerVariables(t *testing.T) {
closed
dagger/dagger
https://github.com/dagger/dagger
3,393
Fix build of shim when execing on non-platform specific llb state
from @marcosnils ``` query Build($file: FileID!, $ref: ContainerAddress!) { container { withMountedFile(path: "/mnt/dagger", source: $file) { exec(args: ["cp", "/mnt/dagger", "/dagger"]) { withEntrypoint(args: ["dagger"]) { publish(address: $ref) } } } } } ``` results in ``` { "data": null, "errors": [ { "message": "build shim: failed to parse target platform unknown: \"unknown\": unknown operating system or architecture: invalid argument", "locations": [ { "line": 4, "column": 7 } ], "path": [ "container", "withMountedFile", "exec" ] } ] } ``` The above query should fail since there's no fs on which to execute `cp` but it shouldn't fail by not being able to build the shim. It's also should be possible in general to, e.g. start at scratch, unpack a static binary and exec it, in which case this shouldn't even be an error case at all.
https://github.com/dagger/dagger/issues/3393
https://github.com/dagger/dagger/pull/3399
51c7941c3c8e7c2ac4242f5c41cec5a56d17e9d3
f8b3c63637cfcca2ec677fea2e020885664bd301
2022-10-14T22:29:08Z
go
2022-11-10T06:01:37Z
core/integration/container_test.go
t.Parallel() res := struct { Container struct { From struct { EnvVariables []schema.EnvVariable Exec struct { Stdout struct { Contents string } } }
closed
dagger/dagger
https://github.com/dagger/dagger
3,393
Fix build of shim when execing on non-platform specific llb state
from @marcosnils ``` query Build($file: FileID!, $ref: ContainerAddress!) { container { withMountedFile(path: "/mnt/dagger", source: $file) { exec(args: ["cp", "/mnt/dagger", "/dagger"]) { withEntrypoint(args: ["dagger"]) { publish(address: $ref) } } } } } ``` results in ``` { "data": null, "errors": [ { "message": "build shim: failed to parse target platform unknown: \"unknown\": unknown operating system or architecture: invalid argument", "locations": [ { "line": 4, "column": 7 } ], "path": [ "container", "withMountedFile", "exec" ] } ] } ``` The above query should fail since there's no fs on which to execute `cp` but it shouldn't fail by not being able to build the shim. It's also should be possible in general to, e.g. start at scratch, unpack a static binary and exec it, in which case this shouldn't even be an error case at all.
https://github.com/dagger/dagger/issues/3393
https://github.com/dagger/dagger/pull/3399
51c7941c3c8e7c2ac4242f5c41cec5a56d17e9d3
f8b3c63637cfcca2ec677fea2e020885664bd301
2022-10-14T22:29:08Z
go
2022-11-10T06:01:37Z
core/integration/container_test.go
} }{} err := testutil.Query( `{ container { from(address: "golang:1.18.2-alpine") { envVariables { name value } exec(args: ["env"]) { stdout { contents } } } } }`, &res, nil) require.NoError(t, err) require.Equal(t, []schema.EnvVariable{ {Name: "PATH", Value: "/go/bin:/usr/local/go/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"}, {Name: "GOLANG_VERSION", Value: "1.18.2"}, {Name: "GOPATH", Value: "/go"}, }, res.Container.From.EnvVariables) require.Contains(t, res.Container.From.Exec.Stdout.Contents, "GOPATH=/go\n") } func TestContainerVariable(t *testing.T) { t.Parallel() res := struct { Container struct {
closed
dagger/dagger
https://github.com/dagger/dagger
3,393
Fix build of shim when execing on non-platform specific llb state
from @marcosnils ``` query Build($file: FileID!, $ref: ContainerAddress!) { container { withMountedFile(path: "/mnt/dagger", source: $file) { exec(args: ["cp", "/mnt/dagger", "/dagger"]) { withEntrypoint(args: ["dagger"]) { publish(address: $ref) } } } } } ``` results in ``` { "data": null, "errors": [ { "message": "build shim: failed to parse target platform unknown: \"unknown\": unknown operating system or architecture: invalid argument", "locations": [ { "line": 4, "column": 7 } ], "path": [ "container", "withMountedFile", "exec" ] } ] } ``` The above query should fail since there's no fs on which to execute `cp` but it shouldn't fail by not being able to build the shim. It's also should be possible in general to, e.g. start at scratch, unpack a static binary and exec it, in which case this shouldn't even be an error case at all.
https://github.com/dagger/dagger/issues/3393
https://github.com/dagger/dagger/pull/3399
51c7941c3c8e7c2ac4242f5c41cec5a56d17e9d3
f8b3c63637cfcca2ec677fea2e020885664bd301
2022-10-14T22:29:08Z
go
2022-11-10T06:01:37Z
core/integration/container_test.go
From struct { EnvVariable *string } } }{} err := testutil.Query( `{ container { from(address: "golang:1.18.2-alpine") { envVariable(name: "GOLANG_VERSION") } } }`, &res, nil) require.NoError(t, err) require.NotNil(t, res.Container.From.EnvVariable) require.Equal(t, "1.18.2", *res.Container.From.EnvVariable) err = testutil.Query( `{ container { from(address: "golang:1.18.2-alpine") { envVariable(name: "UNKNOWN") } } }`, &res, nil) require.NoError(t, err) require.Nil(t, res.Container.From.EnvVariable) } func TestContainerWithoutVariable(t *testing.T) { t.Parallel() res := struct {
closed
dagger/dagger
https://github.com/dagger/dagger
3,393
Fix build of shim when execing on non-platform specific llb state
from @marcosnils ``` query Build($file: FileID!, $ref: ContainerAddress!) { container { withMountedFile(path: "/mnt/dagger", source: $file) { exec(args: ["cp", "/mnt/dagger", "/dagger"]) { withEntrypoint(args: ["dagger"]) { publish(address: $ref) } } } } } ``` results in ``` { "data": null, "errors": [ { "message": "build shim: failed to parse target platform unknown: \"unknown\": unknown operating system or architecture: invalid argument", "locations": [ { "line": 4, "column": 7 } ], "path": [ "container", "withMountedFile", "exec" ] } ] } ``` The above query should fail since there's no fs on which to execute `cp` but it shouldn't fail by not being able to build the shim. It's also should be possible in general to, e.g. start at scratch, unpack a static binary and exec it, in which case this shouldn't even be an error case at all.
https://github.com/dagger/dagger/issues/3393
https://github.com/dagger/dagger/pull/3399
51c7941c3c8e7c2ac4242f5c41cec5a56d17e9d3
f8b3c63637cfcca2ec677fea2e020885664bd301
2022-10-14T22:29:08Z
go
2022-11-10T06:01:37Z
core/integration/container_test.go
Container struct { From struct { WithoutEnvVariable struct { EnvVariables []schema.EnvVariable Exec struct { Stdout struct { Contents string } } } } } }{} err := testutil.Query( `{ container { from(address: "golang:1.18.2-alpine") { withoutEnvVariable(name: "GOLANG_VERSION") { envVariables { name value } exec(args: ["env"]) { stdout { contents } }
closed
dagger/dagger
https://github.com/dagger/dagger
3,393
Fix build of shim when execing on non-platform specific llb state
from @marcosnils ``` query Build($file: FileID!, $ref: ContainerAddress!) { container { withMountedFile(path: "/mnt/dagger", source: $file) { exec(args: ["cp", "/mnt/dagger", "/dagger"]) { withEntrypoint(args: ["dagger"]) { publish(address: $ref) } } } } } ``` results in ``` { "data": null, "errors": [ { "message": "build shim: failed to parse target platform unknown: \"unknown\": unknown operating system or architecture: invalid argument", "locations": [ { "line": 4, "column": 7 } ], "path": [ "container", "withMountedFile", "exec" ] } ] } ``` The above query should fail since there's no fs on which to execute `cp` but it shouldn't fail by not being able to build the shim. It's also should be possible in general to, e.g. start at scratch, unpack a static binary and exec it, in which case this shouldn't even be an error case at all.
https://github.com/dagger/dagger/issues/3393
https://github.com/dagger/dagger/pull/3399
51c7941c3c8e7c2ac4242f5c41cec5a56d17e9d3
f8b3c63637cfcca2ec677fea2e020885664bd301
2022-10-14T22:29:08Z
go
2022-11-10T06:01:37Z
core/integration/container_test.go
} } } }`, &res, nil) require.NoError(t, err) require.Equal(t, res.Container.From.WithoutEnvVariable.EnvVariables, []schema.EnvVariable{ {Name: "PATH", Value: "/go/bin:/usr/local/go/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"}, {Name: "GOPATH", Value: "/go"}, }) require.NotContains(t, res.Container.From.WithoutEnvVariable.Exec.Stdout.Contents, "GOLANG_VERSION") } func TestContainerEnvVariablesReplace(t *testing.T) { t.Parallel() res := struct { Container struct { From struct { WithEnvVariable struct { EnvVariables []schema.EnvVariable Exec struct { Stdout struct { Contents string } } } } } }{} err := testutil.Query( `{ container {
closed
dagger/dagger
https://github.com/dagger/dagger
3,393
Fix build of shim when execing on non-platform specific llb state
from @marcosnils ``` query Build($file: FileID!, $ref: ContainerAddress!) { container { withMountedFile(path: "/mnt/dagger", source: $file) { exec(args: ["cp", "/mnt/dagger", "/dagger"]) { withEntrypoint(args: ["dagger"]) { publish(address: $ref) } } } } } ``` results in ``` { "data": null, "errors": [ { "message": "build shim: failed to parse target platform unknown: \"unknown\": unknown operating system or architecture: invalid argument", "locations": [ { "line": 4, "column": 7 } ], "path": [ "container", "withMountedFile", "exec" ] } ] } ``` The above query should fail since there's no fs on which to execute `cp` but it shouldn't fail by not being able to build the shim. It's also should be possible in general to, e.g. start at scratch, unpack a static binary and exec it, in which case this shouldn't even be an error case at all.
https://github.com/dagger/dagger/issues/3393
https://github.com/dagger/dagger/pull/3399
51c7941c3c8e7c2ac4242f5c41cec5a56d17e9d3
f8b3c63637cfcca2ec677fea2e020885664bd301
2022-10-14T22:29:08Z
go
2022-11-10T06:01:37Z
core/integration/container_test.go
from(address: "golang:1.18.2-alpine") { withEnvVariable(name: "GOPATH", value: "/gone") { envVariables { name value } exec(args: ["env"]) { stdout { contents } } } } } }`, &res, nil) require.NoError(t, err) require.Equal(t, res.Container.From.WithEnvVariable.EnvVariables, []schema.EnvVariable{ {Name: "PATH", Value: "/go/bin:/usr/local/go/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"}, {Name: "GOLANG_VERSION", Value: "1.18.2"}, {Name: "GOPATH", Value: "/gone"}, }) require.Contains(t, res.Container.From.WithEnvVariable.Exec.Stdout.Contents, "GOPATH=/gone\n") } func TestContainerWorkdir(t *testing.T) { t.Parallel() res := struct { Container struct { From struct { Workdir string Exec struct {
closed
dagger/dagger
https://github.com/dagger/dagger
3,393
Fix build of shim when execing on non-platform specific llb state
from @marcosnils ``` query Build($file: FileID!, $ref: ContainerAddress!) { container { withMountedFile(path: "/mnt/dagger", source: $file) { exec(args: ["cp", "/mnt/dagger", "/dagger"]) { withEntrypoint(args: ["dagger"]) { publish(address: $ref) } } } } } ``` results in ``` { "data": null, "errors": [ { "message": "build shim: failed to parse target platform unknown: \"unknown\": unknown operating system or architecture: invalid argument", "locations": [ { "line": 4, "column": 7 } ], "path": [ "container", "withMountedFile", "exec" ] } ] } ``` The above query should fail since there's no fs on which to execute `cp` but it shouldn't fail by not being able to build the shim. It's also should be possible in general to, e.g. start at scratch, unpack a static binary and exec it, in which case this shouldn't even be an error case at all.
https://github.com/dagger/dagger/issues/3393
https://github.com/dagger/dagger/pull/3399
51c7941c3c8e7c2ac4242f5c41cec5a56d17e9d3
f8b3c63637cfcca2ec677fea2e020885664bd301
2022-10-14T22:29:08Z
go
2022-11-10T06:01:37Z
core/integration/container_test.go
Stdout struct { Contents string } } } } }{} err := testutil.Query( `{ container { from(address: "golang:1.18.2-alpine") { workdir exec(args: ["pwd"]) { stdout { contents } } } } }`, &res, nil) require.NoError(t, err) require.Equal(t, res.Container.From.Workdir, "/go") require.Equal(t, res.Container.From.Exec.Stdout.Contents, "/go\n") } func TestContainerWithWorkdir(t *testing.T) { t.Parallel() res := struct { Container struct { From struct { WithWorkdir struct {
closed
dagger/dagger
https://github.com/dagger/dagger
3,393
Fix build of shim when execing on non-platform specific llb state
from @marcosnils ``` query Build($file: FileID!, $ref: ContainerAddress!) { container { withMountedFile(path: "/mnt/dagger", source: $file) { exec(args: ["cp", "/mnt/dagger", "/dagger"]) { withEntrypoint(args: ["dagger"]) { publish(address: $ref) } } } } } ``` results in ``` { "data": null, "errors": [ { "message": "build shim: failed to parse target platform unknown: \"unknown\": unknown operating system or architecture: invalid argument", "locations": [ { "line": 4, "column": 7 } ], "path": [ "container", "withMountedFile", "exec" ] } ] } ``` The above query should fail since there's no fs on which to execute `cp` but it shouldn't fail by not being able to build the shim. It's also should be possible in general to, e.g. start at scratch, unpack a static binary and exec it, in which case this shouldn't even be an error case at all.
https://github.com/dagger/dagger/issues/3393
https://github.com/dagger/dagger/pull/3399
51c7941c3c8e7c2ac4242f5c41cec5a56d17e9d3
f8b3c63637cfcca2ec677fea2e020885664bd301
2022-10-14T22:29:08Z
go
2022-11-10T06:01:37Z
core/integration/container_test.go
Workdir string Exec struct { Stdout struct { Contents string } } } } } }{} err := testutil.Query( `{ container { from(address: "golang:1.18.2-alpine") { withWorkdir(path: "/usr") { workdir exec(args: ["pwd"]) { stdout { contents } } } } } }`, &res, nil) require.NoError(t, err) require.Equal(t, res.Container.From.WithWorkdir.Workdir, "/usr") require.Equal(t, res.Container.From.WithWorkdir.Exec.Stdout.Contents, "/usr\n") } func TestContainerWithMountedDirectory(t *testing.T) {
closed
dagger/dagger
https://github.com/dagger/dagger
3,393
Fix build of shim when execing on non-platform specific llb state
from @marcosnils ``` query Build($file: FileID!, $ref: ContainerAddress!) { container { withMountedFile(path: "/mnt/dagger", source: $file) { exec(args: ["cp", "/mnt/dagger", "/dagger"]) { withEntrypoint(args: ["dagger"]) { publish(address: $ref) } } } } } ``` results in ``` { "data": null, "errors": [ { "message": "build shim: failed to parse target platform unknown: \"unknown\": unknown operating system or architecture: invalid argument", "locations": [ { "line": 4, "column": 7 } ], "path": [ "container", "withMountedFile", "exec" ] } ] } ``` The above query should fail since there's no fs on which to execute `cp` but it shouldn't fail by not being able to build the shim. It's also should be possible in general to, e.g. start at scratch, unpack a static binary and exec it, in which case this shouldn't even be an error case at all.
https://github.com/dagger/dagger/issues/3393
https://github.com/dagger/dagger/pull/3399
51c7941c3c8e7c2ac4242f5c41cec5a56d17e9d3
f8b3c63637cfcca2ec677fea2e020885664bd301
2022-10-14T22:29:08Z
go
2022-11-10T06:01:37Z
core/integration/container_test.go
t.Parallel() dirRes := struct { Directory struct { WithNewFile struct { WithNewFile struct { ID string } } } }{} err := testutil.Query( `{ directory { withNewFile(path: "some-file", contents: "some-content") { withNewFile(path: "some-dir/sub-file", contents: "sub-content") { id } } } }`, &dirRes, nil) require.NoError(t, err) id := dirRes.Directory.WithNewFile.WithNewFile.ID execRes := struct {
closed
dagger/dagger
https://github.com/dagger/dagger
3,393
Fix build of shim when execing on non-platform specific llb state
from @marcosnils ``` query Build($file: FileID!, $ref: ContainerAddress!) { container { withMountedFile(path: "/mnt/dagger", source: $file) { exec(args: ["cp", "/mnt/dagger", "/dagger"]) { withEntrypoint(args: ["dagger"]) { publish(address: $ref) } } } } } ``` results in ``` { "data": null, "errors": [ { "message": "build shim: failed to parse target platform unknown: \"unknown\": unknown operating system or architecture: invalid argument", "locations": [ { "line": 4, "column": 7 } ], "path": [ "container", "withMountedFile", "exec" ] } ] } ``` The above query should fail since there's no fs on which to execute `cp` but it shouldn't fail by not being able to build the shim. It's also should be possible in general to, e.g. start at scratch, unpack a static binary and exec it, in which case this shouldn't even be an error case at all.
https://github.com/dagger/dagger/issues/3393
https://github.com/dagger/dagger/pull/3399
51c7941c3c8e7c2ac4242f5c41cec5a56d17e9d3
f8b3c63637cfcca2ec677fea2e020885664bd301
2022-10-14T22:29:08Z
go
2022-11-10T06:01:37Z
core/integration/container_test.go
Container struct { From struct { WithMountedDirectory struct { Exec struct { Stdout struct { Contents string } Exec struct { Stdout struct { Contents string } } } } } }
closed
dagger/dagger
https://github.com/dagger/dagger
3,393
Fix build of shim when execing on non-platform specific llb state
from @marcosnils ``` query Build($file: FileID!, $ref: ContainerAddress!) { container { withMountedFile(path: "/mnt/dagger", source: $file) { exec(args: ["cp", "/mnt/dagger", "/dagger"]) { withEntrypoint(args: ["dagger"]) { publish(address: $ref) } } } } } ``` results in ``` { "data": null, "errors": [ { "message": "build shim: failed to parse target platform unknown: \"unknown\": unknown operating system or architecture: invalid argument", "locations": [ { "line": 4, "column": 7 } ], "path": [ "container", "withMountedFile", "exec" ] } ] } ``` The above query should fail since there's no fs on which to execute `cp` but it shouldn't fail by not being able to build the shim. It's also should be possible in general to, e.g. start at scratch, unpack a static binary and exec it, in which case this shouldn't even be an error case at all.
https://github.com/dagger/dagger/issues/3393
https://github.com/dagger/dagger/pull/3399
51c7941c3c8e7c2ac4242f5c41cec5a56d17e9d3
f8b3c63637cfcca2ec677fea2e020885664bd301
2022-10-14T22:29:08Z
go
2022-11-10T06:01:37Z
core/integration/container_test.go
}{} err = testutil.Query( `query Test($id: DirectoryID!) { container { from(address: "alpine:3.16.2") { withMountedDirectory(path: "/mnt", source: $id) { exec(args: ["cat", "/mnt/some-file"]) { stdout { contents } exec(args: ["cat", "/mnt/some-dir/sub-file"]) { stdout { contents } } } } } } }`, &execRes, &testutil.QueryOptions{Variables: map[string]any{ "id": id, }}) require.NoError(t, err) require.Equal(t, "some-content", execRes.Container.From.WithMountedDirectory.Exec.Stdout.Contents) require.Equal(t, "sub-content", execRes.Container.From.WithMountedDirectory.Exec.Exec.Stdout.Contents) } func TestContainerWithMountedDirectorySourcePath(t *testing.T) { t.Parallel() dirRes := struct { Directory struct {
closed
dagger/dagger
https://github.com/dagger/dagger
3,393
Fix build of shim when execing on non-platform specific llb state
from @marcosnils ``` query Build($file: FileID!, $ref: ContainerAddress!) { container { withMountedFile(path: "/mnt/dagger", source: $file) { exec(args: ["cp", "/mnt/dagger", "/dagger"]) { withEntrypoint(args: ["dagger"]) { publish(address: $ref) } } } } } ``` results in ``` { "data": null, "errors": [ { "message": "build shim: failed to parse target platform unknown: \"unknown\": unknown operating system or architecture: invalid argument", "locations": [ { "line": 4, "column": 7 } ], "path": [ "container", "withMountedFile", "exec" ] } ] } ``` The above query should fail since there's no fs on which to execute `cp` but it shouldn't fail by not being able to build the shim. It's also should be possible in general to, e.g. start at scratch, unpack a static binary and exec it, in which case this shouldn't even be an error case at all.
https://github.com/dagger/dagger/issues/3393
https://github.com/dagger/dagger/pull/3399
51c7941c3c8e7c2ac4242f5c41cec5a56d17e9d3
f8b3c63637cfcca2ec677fea2e020885664bd301
2022-10-14T22:29:08Z
go
2022-11-10T06:01:37Z
core/integration/container_test.go
WithNewFile struct { WithNewFile struct { Directory struct { ID string } } } } }{} err := testutil.Query( `{ directory { withNewFile(path: "some-file", contents: "some-content") { withNewFile(path: "some-dir/sub-file", contents: "sub-content") { directory(path: "some-dir") { id } } } } }`, &dirRes, nil) require.NoError(t, err) id := dirRes.Directory.WithNewFile.WithNewFile.Directory.ID execRes := struct { Container struct { From struct { WithMountedDirectory struct { Exec struct { Exec struct { Stdout struct {
closed
dagger/dagger
https://github.com/dagger/dagger
3,393
Fix build of shim when execing on non-platform specific llb state
from @marcosnils ``` query Build($file: FileID!, $ref: ContainerAddress!) { container { withMountedFile(path: "/mnt/dagger", source: $file) { exec(args: ["cp", "/mnt/dagger", "/dagger"]) { withEntrypoint(args: ["dagger"]) { publish(address: $ref) } } } } } ``` results in ``` { "data": null, "errors": [ { "message": "build shim: failed to parse target platform unknown: \"unknown\": unknown operating system or architecture: invalid argument", "locations": [ { "line": 4, "column": 7 } ], "path": [ "container", "withMountedFile", "exec" ] } ] } ``` The above query should fail since there's no fs on which to execute `cp` but it shouldn't fail by not being able to build the shim. It's also should be possible in general to, e.g. start at scratch, unpack a static binary and exec it, in which case this shouldn't even be an error case at all.
https://github.com/dagger/dagger/issues/3393
https://github.com/dagger/dagger/pull/3399
51c7941c3c8e7c2ac4242f5c41cec5a56d17e9d3
f8b3c63637cfcca2ec677fea2e020885664bd301
2022-10-14T22:29:08Z
go
2022-11-10T06:01:37Z
core/integration/container_test.go
Contents string } } } } } } }{} err = testutil.Query( `query Test($id: DirectoryID!) { container { from(address: "alpine:3.16.2") { withMountedDirectory(path: "/mnt", source: $id) { exec(args: ["sh", "-c", "echo >> /mnt/sub-file; echo -n more-content >> /mnt/sub-file"]) { exec(args: ["cat", "/mnt/sub-file"]) { stdout { contents } } } } } } }`, &execRes, &testutil.QueryOptions{Variables: map[string]any{ "id": id, }}) require.NoError(t, err) require.Equal(t, "sub-content\nmore-content", execRes.Container.From.WithMountedDirectory.Exec.Exec.Stdout.Contents) } func TestContainerWithMountedDirectoryPropagation(t *testing.T) {
closed
dagger/dagger
https://github.com/dagger/dagger
3,393
Fix build of shim when execing on non-platform specific llb state
from @marcosnils ``` query Build($file: FileID!, $ref: ContainerAddress!) { container { withMountedFile(path: "/mnt/dagger", source: $file) { exec(args: ["cp", "/mnt/dagger", "/dagger"]) { withEntrypoint(args: ["dagger"]) { publish(address: $ref) } } } } } ``` results in ``` { "data": null, "errors": [ { "message": "build shim: failed to parse target platform unknown: \"unknown\": unknown operating system or architecture: invalid argument", "locations": [ { "line": 4, "column": 7 } ], "path": [ "container", "withMountedFile", "exec" ] } ] } ``` The above query should fail since there's no fs on which to execute `cp` but it shouldn't fail by not being able to build the shim. It's also should be possible in general to, e.g. start at scratch, unpack a static binary and exec it, in which case this shouldn't even be an error case at all.
https://github.com/dagger/dagger/issues/3393
https://github.com/dagger/dagger/pull/3399
51c7941c3c8e7c2ac4242f5c41cec5a56d17e9d3
f8b3c63637cfcca2ec677fea2e020885664bd301
2022-10-14T22:29:08Z
go
2022-11-10T06:01:37Z
core/integration/container_test.go
t.Parallel() dirRes := struct { Directory struct { WithNewFile struct { ID core.DirectoryID } } }{} err := testutil.Query( `{ directory { withNewFile(path: "some-file", contents: "some-content") { id } } }`, &dirRes, nil) require.NoError(t, err) id := dirRes.Directory.WithNewFile.ID execRes := struct {
closed
dagger/dagger
https://github.com/dagger/dagger
3,393
Fix build of shim when execing on non-platform specific llb state
from @marcosnils ``` query Build($file: FileID!, $ref: ContainerAddress!) { container { withMountedFile(path: "/mnt/dagger", source: $file) { exec(args: ["cp", "/mnt/dagger", "/dagger"]) { withEntrypoint(args: ["dagger"]) { publish(address: $ref) } } } } } ``` results in ``` { "data": null, "errors": [ { "message": "build shim: failed to parse target platform unknown: \"unknown\": unknown operating system or architecture: invalid argument", "locations": [ { "line": 4, "column": 7 } ], "path": [ "container", "withMountedFile", "exec" ] } ] } ``` The above query should fail since there's no fs on which to execute `cp` but it shouldn't fail by not being able to build the shim. It's also should be possible in general to, e.g. start at scratch, unpack a static binary and exec it, in which case this shouldn't even be an error case at all.
https://github.com/dagger/dagger/issues/3393
https://github.com/dagger/dagger/pull/3399
51c7941c3c8e7c2ac4242f5c41cec5a56d17e9d3
f8b3c63637cfcca2ec677fea2e020885664bd301
2022-10-14T22:29:08Z
go
2022-11-10T06:01:37Z
core/integration/container_test.go
Container struct { From struct { WithMountedDirectory struct { Exec struct { Stdout struct { Contents string } Exec struct { Exec struct { Stdout struct { Contents string } WithMountedDirectory struct { Exec struct { Stdout struct { Contents string } Exec struct { Stdout struct {
closed
dagger/dagger
https://github.com/dagger/dagger
3,393
Fix build of shim when execing on non-platform specific llb state
from @marcosnils ``` query Build($file: FileID!, $ref: ContainerAddress!) { container { withMountedFile(path: "/mnt/dagger", source: $file) { exec(args: ["cp", "/mnt/dagger", "/dagger"]) { withEntrypoint(args: ["dagger"]) { publish(address: $ref) } } } } } ``` results in ``` { "data": null, "errors": [ { "message": "build shim: failed to parse target platform unknown: \"unknown\": unknown operating system or architecture: invalid argument", "locations": [ { "line": 4, "column": 7 } ], "path": [ "container", "withMountedFile", "exec" ] } ] } ``` The above query should fail since there's no fs on which to execute `cp` but it shouldn't fail by not being able to build the shim. It's also should be possible in general to, e.g. start at scratch, unpack a static binary and exec it, in which case this shouldn't even be an error case at all.
https://github.com/dagger/dagger/issues/3393
https://github.com/dagger/dagger/pull/3399
51c7941c3c8e7c2ac4242f5c41cec5a56d17e9d3
f8b3c63637cfcca2ec677fea2e020885664bd301
2022-10-14T22:29:08Z
go
2022-11-10T06:01:37Z
core/integration/container_test.go
Contents string } } } } } } } } } } }{} err = testutil.Query( `query Test($id: DirectoryID!) { container { from(address: "alpine:3.16.2") { withMountedDirectory(path: "/mnt", source: $id) { exec(args: ["cat", "/mnt/some-file"]) { # original content stdout { contents } exec(args: ["sh", "-c", "echo >> /mnt/some-file; echo -n more-content >> /mnt/some-file"]) { exec(args: ["cat", "/mnt/some-file"]) { # modified content should propagate stdout { contents } withMountedDirectory(path: "/mnt", source: $id) { exec(args: ["cat", "/mnt/some-file"]) { # should be back to the original content stdout { contents } exec(args: ["cat", "/mnt/some-file"]) { # original content override should propagate
closed
dagger/dagger
https://github.com/dagger/dagger
3,393
Fix build of shim when execing on non-platform specific llb state
from @marcosnils ``` query Build($file: FileID!, $ref: ContainerAddress!) { container { withMountedFile(path: "/mnt/dagger", source: $file) { exec(args: ["cp", "/mnt/dagger", "/dagger"]) { withEntrypoint(args: ["dagger"]) { publish(address: $ref) } } } } } ``` results in ``` { "data": null, "errors": [ { "message": "build shim: failed to parse target platform unknown: \"unknown\": unknown operating system or architecture: invalid argument", "locations": [ { "line": 4, "column": 7 } ], "path": [ "container", "withMountedFile", "exec" ] } ] } ``` The above query should fail since there's no fs on which to execute `cp` but it shouldn't fail by not being able to build the shim. It's also should be possible in general to, e.g. start at scratch, unpack a static binary and exec it, in which case this shouldn't even be an error case at all.
https://github.com/dagger/dagger/issues/3393
https://github.com/dagger/dagger/pull/3399
51c7941c3c8e7c2ac4242f5c41cec5a56d17e9d3
f8b3c63637cfcca2ec677fea2e020885664bd301
2022-10-14T22:29:08Z
go
2022-11-10T06:01:37Z
core/integration/container_test.go
stdout { contents } } } } } } } } } } }`, &execRes, &testutil.QueryOptions{Variables: map[string]any{ "id": id, }}) require.NoError(t, err) require.Equal(t, "some-content", execRes.Container.From.WithMountedDirectory.Exec.Stdout.Contents) require.Equal(t, "some-content\nmore-content", execRes.Container.From.WithMountedDirectory.Exec.Exec.Exec.Stdout.Contents) require.Equal(t, "some-content", execRes.Container.From.WithMountedDirectory.Exec.Exec.Exec.WithMountedDirectory.Exec.Stdout.Contents) require.Equal(t, "some-content", execRes.Container.From.WithMountedDirectory.Exec.Exec.Exec.WithMountedDirectory.Exec.Exec.Stdout.Contents) } func TestContainerWithMountedFile(t *testing.T) { t.Parallel() dirRes := struct {
closed
dagger/dagger
https://github.com/dagger/dagger
3,393
Fix build of shim when execing on non-platform specific llb state
from @marcosnils ``` query Build($file: FileID!, $ref: ContainerAddress!) { container { withMountedFile(path: "/mnt/dagger", source: $file) { exec(args: ["cp", "/mnt/dagger", "/dagger"]) { withEntrypoint(args: ["dagger"]) { publish(address: $ref) } } } } } ``` results in ``` { "data": null, "errors": [ { "message": "build shim: failed to parse target platform unknown: \"unknown\": unknown operating system or architecture: invalid argument", "locations": [ { "line": 4, "column": 7 } ], "path": [ "container", "withMountedFile", "exec" ] } ] } ``` The above query should fail since there's no fs on which to execute `cp` but it shouldn't fail by not being able to build the shim. It's also should be possible in general to, e.g. start at scratch, unpack a static binary and exec it, in which case this shouldn't even be an error case at all.
https://github.com/dagger/dagger/issues/3393
https://github.com/dagger/dagger/pull/3399
51c7941c3c8e7c2ac4242f5c41cec5a56d17e9d3
f8b3c63637cfcca2ec677fea2e020885664bd301
2022-10-14T22:29:08Z
go
2022-11-10T06:01:37Z
core/integration/container_test.go
Directory struct { WithNewFile struct { File struct { ID core.FileID } } } }{} err := testutil.Query( `{ directory { withNewFile(path: "some-dir/sub-file", contents: "sub-content") { file(path: "some-dir/sub-file") { id } } } }`, &dirRes, nil) require.NoError(t, err) id := dirRes.Directory.WithNewFile.File.ID execRes := struct { Container struct { From struct { WithMountedFile struct { Exec struct { Stdout struct {
closed
dagger/dagger
https://github.com/dagger/dagger
3,393
Fix build of shim when execing on non-platform specific llb state
from @marcosnils ``` query Build($file: FileID!, $ref: ContainerAddress!) { container { withMountedFile(path: "/mnt/dagger", source: $file) { exec(args: ["cp", "/mnt/dagger", "/dagger"]) { withEntrypoint(args: ["dagger"]) { publish(address: $ref) } } } } } ``` results in ``` { "data": null, "errors": [ { "message": "build shim: failed to parse target platform unknown: \"unknown\": unknown operating system or architecture: invalid argument", "locations": [ { "line": 4, "column": 7 } ], "path": [ "container", "withMountedFile", "exec" ] } ] } ``` The above query should fail since there's no fs on which to execute `cp` but it shouldn't fail by not being able to build the shim. It's also should be possible in general to, e.g. start at scratch, unpack a static binary and exec it, in which case this shouldn't even be an error case at all.
https://github.com/dagger/dagger/issues/3393
https://github.com/dagger/dagger/pull/3399
51c7941c3c8e7c2ac4242f5c41cec5a56d17e9d3
f8b3c63637cfcca2ec677fea2e020885664bd301
2022-10-14T22:29:08Z
go
2022-11-10T06:01:37Z
core/integration/container_test.go
Contents string } } } } } }{} err = testutil.Query( `query Test($id: FileID!) { container { from(address: "alpine:3.16.2") { withMountedFile(path: "/mnt/file", source: $id) { exec(args: ["cat", "/mnt/file"]) { stdout { contents } } } } } }`, &execRes, &testutil.QueryOptions{Variables: map[string]any{ "id": id, }}) require.NoError(t, err) require.Equal(t, "sub-content", execRes.Container.From.WithMountedFile.Exec.Stdout.Contents) } func TestContainerWithMountedCache(t *testing.T) { t.Parallel() cacheID := newCache(t) execRes := struct {
closed
dagger/dagger
https://github.com/dagger/dagger
3,393
Fix build of shim when execing on non-platform specific llb state
from @marcosnils ``` query Build($file: FileID!, $ref: ContainerAddress!) { container { withMountedFile(path: "/mnt/dagger", source: $file) { exec(args: ["cp", "/mnt/dagger", "/dagger"]) { withEntrypoint(args: ["dagger"]) { publish(address: $ref) } } } } } ``` results in ``` { "data": null, "errors": [ { "message": "build shim: failed to parse target platform unknown: \"unknown\": unknown operating system or architecture: invalid argument", "locations": [ { "line": 4, "column": 7 } ], "path": [ "container", "withMountedFile", "exec" ] } ] } ``` The above query should fail since there's no fs on which to execute `cp` but it shouldn't fail by not being able to build the shim. It's also should be possible in general to, e.g. start at scratch, unpack a static binary and exec it, in which case this shouldn't even be an error case at all.
https://github.com/dagger/dagger/issues/3393
https://github.com/dagger/dagger/pull/3399
51c7941c3c8e7c2ac4242f5c41cec5a56d17e9d3
f8b3c63637cfcca2ec677fea2e020885664bd301
2022-10-14T22:29:08Z
go
2022-11-10T06:01:37Z
core/integration/container_test.go
Container struct { From struct { WithEnvVariable struct { WithMountedCache struct { Exec struct { Stdout struct { Contents string } } } } } } }{} query := `query Test($cache: CacheID!, $rand: String!) { container { from(address: "alpine:3.16.2") {
closed
dagger/dagger
https://github.com/dagger/dagger
3,393
Fix build of shim when execing on non-platform specific llb state
from @marcosnils ``` query Build($file: FileID!, $ref: ContainerAddress!) { container { withMountedFile(path: "/mnt/dagger", source: $file) { exec(args: ["cp", "/mnt/dagger", "/dagger"]) { withEntrypoint(args: ["dagger"]) { publish(address: $ref) } } } } } ``` results in ``` { "data": null, "errors": [ { "message": "build shim: failed to parse target platform unknown: \"unknown\": unknown operating system or architecture: invalid argument", "locations": [ { "line": 4, "column": 7 } ], "path": [ "container", "withMountedFile", "exec" ] } ] } ``` The above query should fail since there's no fs on which to execute `cp` but it shouldn't fail by not being able to build the shim. It's also should be possible in general to, e.g. start at scratch, unpack a static binary and exec it, in which case this shouldn't even be an error case at all.
https://github.com/dagger/dagger/issues/3393
https://github.com/dagger/dagger/pull/3399
51c7941c3c8e7c2ac4242f5c41cec5a56d17e9d3
f8b3c63637cfcca2ec677fea2e020885664bd301
2022-10-14T22:29:08Z
go
2022-11-10T06:01:37Z
core/integration/container_test.go
withEnvVariable(name: "RAND", value: $rand) { withMountedCache(path: "/mnt/cache", cache: $cache) { exec(args: ["sh", "-c", "echo $RAND >> /mnt/cache/file; cat /mnt/cache/file"]) { stdout { contents } } } } } } }` rand1 := identity.NewID() err := testutil.Query(query, &execRes, &testutil.QueryOptions{Variables: map[string]any{ "cache": cacheID, "rand": rand1, }}) require.NoError(t, err) require.Equal(t, rand1+"\n", execRes.Container.From.WithEnvVariable.WithMountedCache.Exec.Stdout.Contents) rand2 := identity.NewID() err = testutil.Query(query, &execRes, &testutil.QueryOptions{Variables: map[string]any{ "cache": cacheID, "rand": rand2, }}) require.NoError(t, err) require.Equal(t, rand1+"\n"+rand2+"\n", execRes.Container.From.WithEnvVariable.WithMountedCache.Exec.Stdout.Contents) } func TestContainerWithMountedCacheFromDirectory(t *testing.T) { t.Parallel() dirRes := struct {
closed
dagger/dagger
https://github.com/dagger/dagger
3,393
Fix build of shim when execing on non-platform specific llb state
from @marcosnils ``` query Build($file: FileID!, $ref: ContainerAddress!) { container { withMountedFile(path: "/mnt/dagger", source: $file) { exec(args: ["cp", "/mnt/dagger", "/dagger"]) { withEntrypoint(args: ["dagger"]) { publish(address: $ref) } } } } } ``` results in ``` { "data": null, "errors": [ { "message": "build shim: failed to parse target platform unknown: \"unknown\": unknown operating system or architecture: invalid argument", "locations": [ { "line": 4, "column": 7 } ], "path": [ "container", "withMountedFile", "exec" ] } ] } ``` The above query should fail since there's no fs on which to execute `cp` but it shouldn't fail by not being able to build the shim. It's also should be possible in general to, e.g. start at scratch, unpack a static binary and exec it, in which case this shouldn't even be an error case at all.
https://github.com/dagger/dagger/issues/3393
https://github.com/dagger/dagger/pull/3399
51c7941c3c8e7c2ac4242f5c41cec5a56d17e9d3
f8b3c63637cfcca2ec677fea2e020885664bd301
2022-10-14T22:29:08Z
go
2022-11-10T06:01:37Z
core/integration/container_test.go
Directory struct { WithNewFile struct { Directory struct { ID core.FileID } } } }{} err := testutil.Query( `{ directory { withNewFile(path: "some-dir/sub-file", contents: "initial-content\n") { directory(path: "some-dir") { id } } } }`, &dirRes, nil) require.NoError(t, err) initialID := dirRes.Directory.WithNewFile.Directory.ID cacheID := newCache(t) execRes := struct {
closed
dagger/dagger
https://github.com/dagger/dagger
3,393
Fix build of shim when execing on non-platform specific llb state
from @marcosnils ``` query Build($file: FileID!, $ref: ContainerAddress!) { container { withMountedFile(path: "/mnt/dagger", source: $file) { exec(args: ["cp", "/mnt/dagger", "/dagger"]) { withEntrypoint(args: ["dagger"]) { publish(address: $ref) } } } } } ``` results in ``` { "data": null, "errors": [ { "message": "build shim: failed to parse target platform unknown: \"unknown\": unknown operating system or architecture: invalid argument", "locations": [ { "line": 4, "column": 7 } ], "path": [ "container", "withMountedFile", "exec" ] } ] } ``` The above query should fail since there's no fs on which to execute `cp` but it shouldn't fail by not being able to build the shim. It's also should be possible in general to, e.g. start at scratch, unpack a static binary and exec it, in which case this shouldn't even be an error case at all.
https://github.com/dagger/dagger/issues/3393
https://github.com/dagger/dagger/pull/3399
51c7941c3c8e7c2ac4242f5c41cec5a56d17e9d3
f8b3c63637cfcca2ec677fea2e020885664bd301
2022-10-14T22:29:08Z
go
2022-11-10T06:01:37Z
core/integration/container_test.go
Container struct { From struct { WithEnvVariable struct { WithMountedCache struct { Exec struct { Stdout struct { Contents string } } } } } } }{} query := `query Test($cache: CacheID!, $rand: String!, $init: DirectoryID!) { container { from(address: "alpine:3.16.2") { withEnvVariable(name: "RAND", value: $rand) { withMountedCache(path: "/mnt/cache", cache: $cache, source: $init) { exec(args: ["sh", "-c", "echo $RAND >> /mnt/cache/sub-file; cat /mnt/cache/sub-file"]) { stdout { contents
closed
dagger/dagger
https://github.com/dagger/dagger
3,393
Fix build of shim when execing on non-platform specific llb state
from @marcosnils ``` query Build($file: FileID!, $ref: ContainerAddress!) { container { withMountedFile(path: "/mnt/dagger", source: $file) { exec(args: ["cp", "/mnt/dagger", "/dagger"]) { withEntrypoint(args: ["dagger"]) { publish(address: $ref) } } } } } ``` results in ``` { "data": null, "errors": [ { "message": "build shim: failed to parse target platform unknown: \"unknown\": unknown operating system or architecture: invalid argument", "locations": [ { "line": 4, "column": 7 } ], "path": [ "container", "withMountedFile", "exec" ] } ] } ``` The above query should fail since there's no fs on which to execute `cp` but it shouldn't fail by not being able to build the shim. It's also should be possible in general to, e.g. start at scratch, unpack a static binary and exec it, in which case this shouldn't even be an error case at all.
https://github.com/dagger/dagger/issues/3393
https://github.com/dagger/dagger/pull/3399
51c7941c3c8e7c2ac4242f5c41cec5a56d17e9d3
f8b3c63637cfcca2ec677fea2e020885664bd301
2022-10-14T22:29:08Z
go
2022-11-10T06:01:37Z
core/integration/container_test.go
} } } } } } }` rand1 := identity.NewID() err = testutil.Query(query, &execRes, &testutil.QueryOptions{Variables: map[string]any{ "init": initialID, "rand": rand1, "cache": cacheID, }}) require.NoError(t, err) require.Equal(t, "initial-content\n"+rand1+"\n", execRes.Container.From.WithEnvVariable.WithMountedCache.Exec.Stdout.Contents) rand2 := identity.NewID() err = testutil.Query(query, &execRes, &testutil.QueryOptions{Variables: map[string]any{ "init": initialID, "rand": rand2, "cache": cacheID, }}) require.NoError(t, err) require.Equal(t, "initial-content\n"+rand1+"\n"+rand2+"\n", execRes.Container.From.WithEnvVariable.WithMountedCache.Exec.Stdout.Contents) } func TestContainerWithMountedTemp(t *testing.T) { t.Parallel() execRes := struct { Container struct { From struct { WithMountedTemp struct {
closed
dagger/dagger
https://github.com/dagger/dagger
3,393
Fix build of shim when execing on non-platform specific llb state
from @marcosnils ``` query Build($file: FileID!, $ref: ContainerAddress!) { container { withMountedFile(path: "/mnt/dagger", source: $file) { exec(args: ["cp", "/mnt/dagger", "/dagger"]) { withEntrypoint(args: ["dagger"]) { publish(address: $ref) } } } } } ``` results in ``` { "data": null, "errors": [ { "message": "build shim: failed to parse target platform unknown: \"unknown\": unknown operating system or architecture: invalid argument", "locations": [ { "line": 4, "column": 7 } ], "path": [ "container", "withMountedFile", "exec" ] } ] } ``` The above query should fail since there's no fs on which to execute `cp` but it shouldn't fail by not being able to build the shim. It's also should be possible in general to, e.g. start at scratch, unpack a static binary and exec it, in which case this shouldn't even be an error case at all.
https://github.com/dagger/dagger/issues/3393
https://github.com/dagger/dagger/pull/3399
51c7941c3c8e7c2ac4242f5c41cec5a56d17e9d3
f8b3c63637cfcca2ec677fea2e020885664bd301
2022-10-14T22:29:08Z
go
2022-11-10T06:01:37Z
core/integration/container_test.go
Exec struct { Stdout struct { Contents string } } } } } }{} err := testutil.Query(`{ container { from(address: "alpine:3.16.2") { withMountedTemp(path: "/mnt/tmp") { exec(args: ["grep", "/mnt/tmp", "/proc/mounts"]) { stdout { contents } } } } } }`, &execRes, nil) require.NoError(t, err) require.Contains(t, execRes.Container.From.WithMountedTemp.Exec.Stdout.Contents, "tmpfs /mnt/tmp tmpfs") } func TestContainerMountsWithoutMount(t *testing.T) { t.Parallel() dirRes := struct { Directory struct { WithNewFile struct {
closed
dagger/dagger
https://github.com/dagger/dagger
3,393
Fix build of shim when execing on non-platform specific llb state
from @marcosnils ``` query Build($file: FileID!, $ref: ContainerAddress!) { container { withMountedFile(path: "/mnt/dagger", source: $file) { exec(args: ["cp", "/mnt/dagger", "/dagger"]) { withEntrypoint(args: ["dagger"]) { publish(address: $ref) } } } } } ``` results in ``` { "data": null, "errors": [ { "message": "build shim: failed to parse target platform unknown: \"unknown\": unknown operating system or architecture: invalid argument", "locations": [ { "line": 4, "column": 7 } ], "path": [ "container", "withMountedFile", "exec" ] } ] } ``` The above query should fail since there's no fs on which to execute `cp` but it shouldn't fail by not being able to build the shim. It's also should be possible in general to, e.g. start at scratch, unpack a static binary and exec it, in which case this shouldn't even be an error case at all.
https://github.com/dagger/dagger/issues/3393
https://github.com/dagger/dagger/pull/3399
51c7941c3c8e7c2ac4242f5c41cec5a56d17e9d3
f8b3c63637cfcca2ec677fea2e020885664bd301
2022-10-14T22:29:08Z
go
2022-11-10T06:01:37Z
core/integration/container_test.go
WithNewFile struct { ID string } } } }{} err := testutil.Query( `{ directory { withNewFile(path: "some-file", contents: "some-content") { withNewFile(path: "some-dir/sub-file", contents: "sub-content") { id } } } }`, &dirRes, nil) require.NoError(t, err) id := dirRes.Directory.WithNewFile.WithNewFile.ID execRes := struct { Container struct { From struct { WithMountedTemp struct { Mounts []string WithMountedDirectory struct { Mounts []string Exec struct { Stdout struct { Contents string } WithoutMount struct {
closed
dagger/dagger
https://github.com/dagger/dagger
3,393
Fix build of shim when execing on non-platform specific llb state
from @marcosnils ``` query Build($file: FileID!, $ref: ContainerAddress!) { container { withMountedFile(path: "/mnt/dagger", source: $file) { exec(args: ["cp", "/mnt/dagger", "/dagger"]) { withEntrypoint(args: ["dagger"]) { publish(address: $ref) } } } } } ``` results in ``` { "data": null, "errors": [ { "message": "build shim: failed to parse target platform unknown: \"unknown\": unknown operating system or architecture: invalid argument", "locations": [ { "line": 4, "column": 7 } ], "path": [ "container", "withMountedFile", "exec" ] } ] } ``` The above query should fail since there's no fs on which to execute `cp` but it shouldn't fail by not being able to build the shim. It's also should be possible in general to, e.g. start at scratch, unpack a static binary and exec it, in which case this shouldn't even be an error case at all.
https://github.com/dagger/dagger/issues/3393
https://github.com/dagger/dagger/pull/3399
51c7941c3c8e7c2ac4242f5c41cec5a56d17e9d3
f8b3c63637cfcca2ec677fea2e020885664bd301
2022-10-14T22:29:08Z
go
2022-11-10T06:01:37Z
core/integration/container_test.go
Mounts []string Exec struct { Stdout struct { Contents string } } } } } } } } }{} err = testutil.Query( `query Test($id: DirectoryID!) { container { from(address: "alpine:3.16.2") { withMountedTemp(path: "/mnt/tmp") { mounts withMountedDirectory(path: "/mnt/dir", source: $id) { mounts exec(args: ["ls", "/mnt/dir"]) { stdout { contents } withoutMount(path: "/mnt/dir") { mounts exec(args: ["ls", "/mnt/dir"]) { stdout { contents
closed
dagger/dagger
https://github.com/dagger/dagger
3,393
Fix build of shim when execing on non-platform specific llb state
from @marcosnils ``` query Build($file: FileID!, $ref: ContainerAddress!) { container { withMountedFile(path: "/mnt/dagger", source: $file) { exec(args: ["cp", "/mnt/dagger", "/dagger"]) { withEntrypoint(args: ["dagger"]) { publish(address: $ref) } } } } } ``` results in ``` { "data": null, "errors": [ { "message": "build shim: failed to parse target platform unknown: \"unknown\": unknown operating system or architecture: invalid argument", "locations": [ { "line": 4, "column": 7 } ], "path": [ "container", "withMountedFile", "exec" ] } ] } ``` The above query should fail since there's no fs on which to execute `cp` but it shouldn't fail by not being able to build the shim. It's also should be possible in general to, e.g. start at scratch, unpack a static binary and exec it, in which case this shouldn't even be an error case at all.
https://github.com/dagger/dagger/issues/3393
https://github.com/dagger/dagger/pull/3399
51c7941c3c8e7c2ac4242f5c41cec5a56d17e9d3
f8b3c63637cfcca2ec677fea2e020885664bd301
2022-10-14T22:29:08Z
go
2022-11-10T06:01:37Z
core/integration/container_test.go
} } } } } } } } }`, &execRes, &testutil.QueryOptions{Variables: map[string]any{ "id": id, }}) require.NoError(t, err) require.Equal(t, []string{"/mnt/tmp"}, execRes.Container.From.WithMountedTemp.Mounts) require.Equal(t, []string{"/mnt/tmp", "/mnt/dir"}, execRes.Container.From.WithMountedTemp.WithMountedDirectory.Mounts) require.Equal(t, "some-dir\nsome-file\n", execRes.Container.From.WithMountedTemp.WithMountedDirectory.Exec.Stdout.Contents) require.Equal(t, "", execRes.Container.From.WithMountedTemp.WithMountedDirectory.Exec.WithoutMount.Exec.Stdout.Contents) require.Equal(t, []string{"/mnt/tmp"}, execRes.Container.From.WithMountedTemp.WithMountedDirectory.Exec.WithoutMount.Mounts) } func TestContainerReplacedMounts(t *testing.T) { t.Parallel() c, ctx := connect(t) defer c.Close() lower := c.Directory().WithNewFile("some-file", dagger.DirectoryWithNewFileOpts{ Contents: "lower-content", }) upper := c.Directory().WithNewFile("some-file", dagger.DirectoryWithNewFileOpts{ Contents: "upper-content", }) ctr := c.Container(). From("alpine:3.16.2").
closed
dagger/dagger
https://github.com/dagger/dagger
3,393
Fix build of shim when execing on non-platform specific llb state
from @marcosnils ``` query Build($file: FileID!, $ref: ContainerAddress!) { container { withMountedFile(path: "/mnt/dagger", source: $file) { exec(args: ["cp", "/mnt/dagger", "/dagger"]) { withEntrypoint(args: ["dagger"]) { publish(address: $ref) } } } } } ``` results in ``` { "data": null, "errors": [ { "message": "build shim: failed to parse target platform unknown: \"unknown\": unknown operating system or architecture: invalid argument", "locations": [ { "line": 4, "column": 7 } ], "path": [ "container", "withMountedFile", "exec" ] } ] } ``` The above query should fail since there's no fs on which to execute `cp` but it shouldn't fail by not being able to build the shim. It's also should be possible in general to, e.g. start at scratch, unpack a static binary and exec it, in which case this shouldn't even be an error case at all.
https://github.com/dagger/dagger/issues/3393
https://github.com/dagger/dagger/pull/3399
51c7941c3c8e7c2ac4242f5c41cec5a56d17e9d3
f8b3c63637cfcca2ec677fea2e020885664bd301
2022-10-14T22:29:08Z
go
2022-11-10T06:01:37Z
core/integration/container_test.go
WithMountedDirectory("/mnt/dir", lower) t.Run("initial content is lower", func(t *testing.T) { mnts, err := ctr.Mounts(ctx) require.NoError(t, err) require.Equal(t, []string{"/mnt/dir"}, mnts) out, err := ctr.Exec(dagger.ContainerExecOpts{ Args: []string{"cat", "/mnt/dir/some-file"}, }).Stdout().Contents(ctx) require.NoError(t, err) require.Equal(t, "lower-content", out) }) replaced := ctr.WithMountedDirectory("/mnt/dir", upper) t.Run("mounts of same path are replaced", func(t *testing.T) { mnts, err := replaced.Mounts(ctx) require.NoError(t, err) require.Equal(t, []string{"/mnt/dir"}, mnts) out, err := replaced.Exec(dagger.ContainerExecOpts{ Args: []string{"cat", "/mnt/dir/some-file"}, }).Stdout().Contents(ctx) require.NoError(t, err) require.Equal(t, "upper-content", out) }) t.Run("removing a replaced mount does not reveal previous mount", func(t *testing.T) { removed := replaced.WithoutMount("/mnt/dir") mnts, err := removed.Mounts(ctx) require.NoError(t, err) require.Empty(t, mnts) }) clobberedDir := c.Directory().WithNewFile("some-file", dagger.DirectoryWithNewFileOpts{ Contents: "clobbered-content",