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
| 4,588 |
DX: Container.From() and Container.Build() creates fresh container
|
Discord context: https://discord.com/channels/707636530424053791/1074736111131304057/1074747695765405696
Summary:
Container.From() and Container.Build() create a new container. Chaining this with `.client.Container()` instead of directly `client.From()`/`container.Build()`, or `client.ContainerFrom()`/`client.ContainerBuild()` introduces opportunity for potential footguns.
For example:
```js
const foo = await client
.container()
.withEnvVariable('BUST_CACHE', Math.random().toString())
.build(node)
.withExec(['node', '--version'])
.stdout();
```
The cache busting env variable will never actually make it to the engine since the environment is replaced (correct me if this is wrong)
|
https://github.com/dagger/dagger/issues/4588
|
https://github.com/dagger/dagger/pull/5052
|
f5f76fcbda4b772a54aecc43812bd03e51c0d62c
|
7d8738d64889572fd5ac7d9930c2f16b4c3629d2
| 2023-02-13T18:00:22Z |
go
| 2023-05-19T18:05:02Z |
core/integration/container_test.go
|
compression dagger.ImageLayerCompression
expectedDockerMediaType string
expectedOCIMediaType string
}{
{
dagger.Gzip,
"application/vnd.docker.image.rootfs.diff.tar.gzip",
"application/vnd.oci.image.layer.v1.tar+gzip",
},
{
dagger.Zstd,
"application/vnd.docker.image.rootfs.diff.tar.zstd",
"application/vnd.oci.image.layer.v1.tar+zstd",
},
{
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 4,588 |
DX: Container.From() and Container.Build() creates fresh container
|
Discord context: https://discord.com/channels/707636530424053791/1074736111131304057/1074747695765405696
Summary:
Container.From() and Container.Build() create a new container. Chaining this with `.client.Container()` instead of directly `client.From()`/`container.Build()`, or `client.ContainerFrom()`/`client.ContainerBuild()` introduces opportunity for potential footguns.
For example:
```js
const foo = await client
.container()
.withEnvVariable('BUST_CACHE', Math.random().toString())
.build(node)
.withExec(['node', '--version'])
.stdout();
```
The cache busting env variable will never actually make it to the engine since the environment is replaced (correct me if this is wrong)
|
https://github.com/dagger/dagger/issues/4588
|
https://github.com/dagger/dagger/pull/5052
|
f5f76fcbda4b772a54aecc43812bd03e51c0d62c
|
7d8738d64889572fd5ac7d9930c2f16b4c3629d2
| 2023-02-13T18:00:22Z |
go
| 2023-05-19T18:05:02Z |
core/integration/container_test.go
|
dagger.Uncompressed,
"application/vnd.docker.image.rootfs.diff.tar",
"application/vnd.oci.image.layer.v1.tar",
},
{
dagger.Estargz,
"",
"application/vnd.oci.image.layer.v1.tar+gzip",
},
} {
tc := tc
t.Run(string(tc.compression), func(t *testing.T) {
t.Parallel()
c, ctx := connect(t)
defer c.Close()
ref := registryRef("testcontainerpublishforcecompression" + strings.ToLower(string(tc.compression)))
_, err := c.Container().
From("alpine:3.16.2").
Publish(ctx, ref, dagger.ContainerPublishOpts{
ForcedCompression: tc.compression,
})
require.NoError(t, err)
parsedRef, err := name.ParseReference(ref, name.Insecure)
require.NoError(t, err)
imgDesc, err := remote.Get(parsedRef, remote.WithTransport(http.DefaultTransport))
require.NoError(t, err)
img, err := imgDesc.Image()
require.NoError(t, err)
layers, err := img.Layers()
require.NoError(t, err)
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 4,588 |
DX: Container.From() and Container.Build() creates fresh container
|
Discord context: https://discord.com/channels/707636530424053791/1074736111131304057/1074747695765405696
Summary:
Container.From() and Container.Build() create a new container. Chaining this with `.client.Container()` instead of directly `client.From()`/`container.Build()`, or `client.ContainerFrom()`/`client.ContainerBuild()` introduces opportunity for potential footguns.
For example:
```js
const foo = await client
.container()
.withEnvVariable('BUST_CACHE', Math.random().toString())
.build(node)
.withExec(['node', '--version'])
.stdout();
```
The cache busting env variable will never actually make it to the engine since the environment is replaced (correct me if this is wrong)
|
https://github.com/dagger/dagger/issues/4588
|
https://github.com/dagger/dagger/pull/5052
|
f5f76fcbda4b772a54aecc43812bd03e51c0d62c
|
7d8738d64889572fd5ac7d9930c2f16b4c3629d2
| 2023-02-13T18:00:22Z |
go
| 2023-05-19T18:05:02Z |
core/integration/container_test.go
|
for _, layer := range layers {
mediaType, err := layer.MediaType()
require.NoError(t, err)
expectedMediaType := tc.expectedDockerMediaType
if tc.compression == dagger.Estargz {
expectedMediaType = tc.expectedOCIMediaType
}
require.EqualValues(t, expectedMediaType, mediaType)
}
tarPath := filepath.Join(t.TempDir(), "export.tar")
_, err = c.Container().
From("alpine:3.16.2").
Export(ctx, tarPath, dagger.ContainerExportOpts{
ForcedCompression: tc.compression,
})
require.NoError(t, err)
indexBytes := readTarFile(t, tarPath, "index.json")
var index ocispecs.Index
require.NoError(t, json.Unmarshal(indexBytes, &index))
manifestDigest := index.Manifests[0].Digest
manifestBytes := readTarFile(t, tarPath, "blobs/sha256/"+manifestDigest.Encoded())
var manifest ocispecs.Manifest
require.NoError(t, json.Unmarshal(manifestBytes, &manifest))
for _, layer := range manifest.Layers {
require.EqualValues(t, tc.expectedOCIMediaType, layer.MediaType)
}
})
}
}
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 4,588 |
DX: Container.From() and Container.Build() creates fresh container
|
Discord context: https://discord.com/channels/707636530424053791/1074736111131304057/1074747695765405696
Summary:
Container.From() and Container.Build() create a new container. Chaining this with `.client.Container()` instead of directly `client.From()`/`container.Build()`, or `client.ContainerFrom()`/`client.ContainerBuild()` introduces opportunity for potential footguns.
For example:
```js
const foo = await client
.container()
.withEnvVariable('BUST_CACHE', Math.random().toString())
.build(node)
.withExec(['node', '--version'])
.stdout();
```
The cache busting env variable will never actually make it to the engine since the environment is replaced (correct me if this is wrong)
|
https://github.com/dagger/dagger/issues/4588
|
https://github.com/dagger/dagger/pull/5052
|
f5f76fcbda4b772a54aecc43812bd03e51c0d62c
|
7d8738d64889572fd5ac7d9930c2f16b4c3629d2
| 2023-02-13T18:00:22Z |
go
| 2023-05-19T18:05:02Z |
core/util.go
|
package core
import (
"context"
"encoding/base64"
"encoding/json"
"fmt"
"io/fs"
"path"
"strconv"
"strings"
"sync"
"github.com/dagger/dagger/core/reffs"
"github.com/moby/buildkit/client/llb"
bkgw "github.com/moby/buildkit/frontend/gateway/client"
"github.com/moby/buildkit/solver/pb"
specs "github.com/opencontainers/image-spec/specs-go/v1"
"github.com/opencontainers/runc/libcontainer/user"
)
func encodeID[T ~string](payload any) (T, error) {
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 4,588 |
DX: Container.From() and Container.Build() creates fresh container
|
Discord context: https://discord.com/channels/707636530424053791/1074736111131304057/1074747695765405696
Summary:
Container.From() and Container.Build() create a new container. Chaining this with `.client.Container()` instead of directly `client.From()`/`container.Build()`, or `client.ContainerFrom()`/`client.ContainerBuild()` introduces opportunity for potential footguns.
For example:
```js
const foo = await client
.container()
.withEnvVariable('BUST_CACHE', Math.random().toString())
.build(node)
.withExec(['node', '--version'])
.stdout();
```
The cache busting env variable will never actually make it to the engine since the environment is replaced (correct me if this is wrong)
|
https://github.com/dagger/dagger/issues/4588
|
https://github.com/dagger/dagger/pull/5052
|
f5f76fcbda4b772a54aecc43812bd03e51c0d62c
|
7d8738d64889572fd5ac7d9930c2f16b4c3629d2
| 2023-02-13T18:00:22Z |
go
| 2023-05-19T18:05:02Z |
core/util.go
|
jsonBytes, err := json.Marshal(payload)
if err != nil {
return "", err
}
b64Bytes := make([]byte, base64.StdEncoding.EncodedLen(len(jsonBytes)))
base64.StdEncoding.Encode(b64Bytes, jsonBytes)
return T(b64Bytes), nil
}
func decodeID[T ~string](payload any, id T) error {
jsonBytes := make([]byte, base64.StdEncoding.DecodedLen(len(id)))
n, err := base64.StdEncoding.Decode(jsonBytes, []byte(id))
if err != nil {
return fmt.Errorf("failed to decode %T bytes: %v: %w", payload, id, err)
}
jsonBytes = jsonBytes[:n]
return json.Unmarshal(jsonBytes, payload)
}
func absPath(workDir string, containerPath string) string {
if path.IsAbs(containerPath) {
return containerPath
}
if workDir == "" {
workDir = "/"
}
return path.Join(workDir, containerPath)
}
func defToState(def *pb.Definition) (llb.State, error) {
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 4,588 |
DX: Container.From() and Container.Build() creates fresh container
|
Discord context: https://discord.com/channels/707636530424053791/1074736111131304057/1074747695765405696
Summary:
Container.From() and Container.Build() create a new container. Chaining this with `.client.Container()` instead of directly `client.From()`/`container.Build()`, or `client.ContainerFrom()`/`client.ContainerBuild()` introduces opportunity for potential footguns.
For example:
```js
const foo = await client
.container()
.withEnvVariable('BUST_CACHE', Math.random().toString())
.build(node)
.withExec(['node', '--version'])
.stdout();
```
The cache busting env variable will never actually make it to the engine since the environment is replaced (correct me if this is wrong)
|
https://github.com/dagger/dagger/issues/4588
|
https://github.com/dagger/dagger/pull/5052
|
f5f76fcbda4b772a54aecc43812bd03e51c0d62c
|
7d8738d64889572fd5ac7d9930c2f16b4c3629d2
| 2023-02-13T18:00:22Z |
go
| 2023-05-19T18:05:02Z |
core/util.go
|
if def.Def == nil {
return llb.Scratch(), nil
}
defop, err := llb.NewDefinitionOp(def)
if err != nil {
return llb.State{}, err
}
return llb.NewState(defop), nil
}
func mirrorCh[T any](dest chan<- T) (chan T, *sync.WaitGroup) {
wg := new(sync.WaitGroup)
if dest == nil {
return nil, wg
}
mirrorCh := make(chan T)
wg.Add(1)
go func() {
defer wg.Done()
for event := range mirrorCh {
dest <- event
}
}()
return mirrorCh, wg
}
func resolveUIDGID(ctx context.Context, fsSt llb.State, gw bkgw.Client, platform specs.Platform, owner string) (*Ownership, error) {
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 4,588 |
DX: Container.From() and Container.Build() creates fresh container
|
Discord context: https://discord.com/channels/707636530424053791/1074736111131304057/1074747695765405696
Summary:
Container.From() and Container.Build() create a new container. Chaining this with `.client.Container()` instead of directly `client.From()`/`container.Build()`, or `client.ContainerFrom()`/`client.ContainerBuild()` introduces opportunity for potential footguns.
For example:
```js
const foo = await client
.container()
.withEnvVariable('BUST_CACHE', Math.random().toString())
.build(node)
.withExec(['node', '--version'])
.stdout();
```
The cache busting env variable will never actually make it to the engine since the environment is replaced (correct me if this is wrong)
|
https://github.com/dagger/dagger/issues/4588
|
https://github.com/dagger/dagger/pull/5052
|
f5f76fcbda4b772a54aecc43812bd03e51c0d62c
|
7d8738d64889572fd5ac7d9930c2f16b4c3629d2
| 2023-02-13T18:00:22Z |
go
| 2023-05-19T18:05:02Z |
core/util.go
|
uidOrName, gidOrName, hasGroup := strings.Cut(owner, ":")
var uid, gid int
var uname, gname string
uid, err := parseUID(uidOrName)
if err != nil {
uname = uidOrName
}
if hasGroup {
gid, err = parseUID(gidOrName)
if err != nil {
gname = gidOrName
}
}
var fs fs.FS
if uname != "" || gname != "" {
fs, err = reffs.OpenState(ctx, gw, fsSt, llb.Platform(platform))
if err != nil {
return nil, fmt.Errorf("open fs state for name->id: %w", err)
}
}
if uname != "" {
uid, err = findUID(fs, uname)
if err != nil {
return nil, fmt.Errorf("find uid: %w", err)
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 4,588 |
DX: Container.From() and Container.Build() creates fresh container
|
Discord context: https://discord.com/channels/707636530424053791/1074736111131304057/1074747695765405696
Summary:
Container.From() and Container.Build() create a new container. Chaining this with `.client.Container()` instead of directly `client.From()`/`container.Build()`, or `client.ContainerFrom()`/`client.ContainerBuild()` introduces opportunity for potential footguns.
For example:
```js
const foo = await client
.container()
.withEnvVariable('BUST_CACHE', Math.random().toString())
.build(node)
.withExec(['node', '--version'])
.stdout();
```
The cache busting env variable will never actually make it to the engine since the environment is replaced (correct me if this is wrong)
|
https://github.com/dagger/dagger/issues/4588
|
https://github.com/dagger/dagger/pull/5052
|
f5f76fcbda4b772a54aecc43812bd03e51c0d62c
|
7d8738d64889572fd5ac7d9930c2f16b4c3629d2
| 2023-02-13T18:00:22Z |
go
| 2023-05-19T18:05:02Z |
core/util.go
|
}
}
if gname != "" {
gid, err = findGID(fs, gname)
if err != nil {
return nil, fmt.Errorf("find gid: %w", err)
}
}
if !hasGroup {
gid = uid
}
return &Ownership{uid, gid}, nil
}
func findUID(fs fs.FS, uname string) (int, error) {
f, err := fs.Open("/etc/passwd")
if err != nil {
return -1, fmt.Errorf("open /etc/passwd: %w", err)
}
users, err := user.ParsePasswdFilter(f, func(u user.User) bool {
return u.Name == uname
})
if err != nil {
return -1, fmt.Errorf("parse /etc/passwd: %w", err)
}
if len(users) == 0 {
return -1, fmt.Errorf("no such user: %s", uname)
}
return users[0].Uid, nil
}
func findGID(fs fs.FS, gname string) (int, error) {
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 4,588 |
DX: Container.From() and Container.Build() creates fresh container
|
Discord context: https://discord.com/channels/707636530424053791/1074736111131304057/1074747695765405696
Summary:
Container.From() and Container.Build() create a new container. Chaining this with `.client.Container()` instead of directly `client.From()`/`container.Build()`, or `client.ContainerFrom()`/`client.ContainerBuild()` introduces opportunity for potential footguns.
For example:
```js
const foo = await client
.container()
.withEnvVariable('BUST_CACHE', Math.random().toString())
.build(node)
.withExec(['node', '--version'])
.stdout();
```
The cache busting env variable will never actually make it to the engine since the environment is replaced (correct me if this is wrong)
|
https://github.com/dagger/dagger/issues/4588
|
https://github.com/dagger/dagger/pull/5052
|
f5f76fcbda4b772a54aecc43812bd03e51c0d62c
|
7d8738d64889572fd5ac7d9930c2f16b4c3629d2
| 2023-02-13T18:00:22Z |
go
| 2023-05-19T18:05:02Z |
core/util.go
|
f, err := fs.Open("/etc/group")
if err != nil {
return -1, fmt.Errorf("open /etc/passwd: %w", err)
}
groups, err := user.ParseGroupFilter(f, func(g user.Group) bool {
return g.Name == gname
})
if err != nil {
return -1, fmt.Errorf("parse /etc/group: %w", err)
}
if len(groups) == 0 {
return -1, fmt.Errorf("no such group: %s", gname)
}
return groups[0].Gid, nil
}
func parseUID(str string) (int, error) {
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 4,588 |
DX: Container.From() and Container.Build() creates fresh container
|
Discord context: https://discord.com/channels/707636530424053791/1074736111131304057/1074747695765405696
Summary:
Container.From() and Container.Build() create a new container. Chaining this with `.client.Container()` instead of directly `client.From()`/`container.Build()`, or `client.ContainerFrom()`/`client.ContainerBuild()` introduces opportunity for potential footguns.
For example:
```js
const foo = await client
.container()
.withEnvVariable('BUST_CACHE', Math.random().toString())
.build(node)
.withExec(['node', '--version'])
.stdout();
```
The cache busting env variable will never actually make it to the engine since the environment is replaced (correct me if this is wrong)
|
https://github.com/dagger/dagger/issues/4588
|
https://github.com/dagger/dagger/pull/5052
|
f5f76fcbda4b772a54aecc43812bd03e51c0d62c
|
7d8738d64889572fd5ac7d9930c2f16b4c3629d2
| 2023-02-13T18:00:22Z |
go
| 2023-05-19T18:05:02Z |
core/util.go
|
if str == "root" {
return 0, nil
}
uid, err := strconv.ParseInt(str, 10, 32)
if err != nil {
return 0, err
}
return int(uid), nil
}
func clone[T any](src []T) []T {
dst := make([]T, len(src))
copy(dst, src)
return dst
}
func cloneMap[K comparable, T any](src map[K]T) map[K]T {
dst := make(map[K]T, len(src))
for k, v := range src {
dst[k] = v
}
return dst
}
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 5,077 |
Add `(truncated output)` to stdout/stderr errors
|
@helderco mentioned:
> Can we append some notice like "truncated output"? Multiple users have been confused that the output is truncated, reporting it as a bug.
|
https://github.com/dagger/dagger/issues/5077
|
https://github.com/dagger/dagger/pull/5163
|
7d8738d64889572fd5ac7d9930c2f16b4c3629d2
|
e0fecd2682e63b5c0fb18a18e77f4ea001bf6219
| 2023-05-02T21:11:43Z |
go
| 2023-05-22T21:21:17Z |
cmd/shim/main.go
|
package main
import (
"context"
"encoding/json"
"fmt"
"io"
"net"
"net/http"
"os"
"os/exec"
"os/signal"
"path/filepath"
"runtime"
"strconv"
"strings"
"syscall"
"time"
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 5,077 |
Add `(truncated output)` to stdout/stderr errors
|
@helderco mentioned:
> Can we append some notice like "truncated output"? Multiple users have been confused that the output is truncated, reporting it as a bug.
|
https://github.com/dagger/dagger/issues/5077
|
https://github.com/dagger/dagger/pull/5163
|
7d8738d64889572fd5ac7d9930c2f16b4c3629d2
|
e0fecd2682e63b5c0fb18a18e77f4ea001bf6219
| 2023-05-02T21:11:43Z |
go
| 2023-05-22T21:21:17Z |
cmd/shim/main.go
|
"github.com/cenkalti/backoff/v4"
"github.com/dagger/dagger/core"
"github.com/dagger/dagger/engine"
"github.com/dagger/dagger/router"
"github.com/google/uuid"
"github.com/moby/buildkit/identity"
"github.com/opencontainers/runtime-spec/specs-go"
"github.com/vito/progrock"
"golang.org/x/sys/unix"
)
const (
metaMountPath = "/.dagger_meta_mount"
stdinPath = metaMountPath + "/stdin"
exitCodePath = metaMountPath + "/exitCode"
runcPath = "/usr/local/bin/runc"
shimPath = "/_shim"
)
var (
stdoutPath = metaMountPath + "/stdout"
stderrPath = metaMountPath + "/stderr"
)
/*
There are two "subcommands" of this binary:
1. The setupBundle command, which is invoked by buildkitd as the oci executor. It updates the
spec provided by buildkitd's executor to wrap the command in our shim (described below).
It then exec's to runc which will do the actual container setup+execution.
2. The shim, which is included in each Container.Exec and enables us to capture/redirect stdio,
capture the exit code, etc.
*/
func main() {
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 5,077 |
Add `(truncated output)` to stdout/stderr errors
|
@helderco mentioned:
> Can we append some notice like "truncated output"? Multiple users have been confused that the output is truncated, reporting it as a bug.
|
https://github.com/dagger/dagger/issues/5077
|
https://github.com/dagger/dagger/pull/5163
|
7d8738d64889572fd5ac7d9930c2f16b4c3629d2
|
e0fecd2682e63b5c0fb18a18e77f4ea001bf6219
| 2023-05-02T21:11:43Z |
go
| 2023-05-22T21:21:17Z |
cmd/shim/main.go
|
if os.Args[0] == shimPath {
if _, found := internalEnv("_DAGGER_INTERNAL_COMMAND"); found {
os.Exit(internalCommand())
return
}
os.Exit(shim())
} else {
os.Exit(setupBundle())
}
}
func internalCommand() int {
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 5,077 |
Add `(truncated output)` to stdout/stderr errors
|
@helderco mentioned:
> Can we append some notice like "truncated output"? Multiple users have been confused that the output is truncated, reporting it as a bug.
|
https://github.com/dagger/dagger/issues/5077
|
https://github.com/dagger/dagger/pull/5163
|
7d8738d64889572fd5ac7d9930c2f16b4c3629d2
|
e0fecd2682e63b5c0fb18a18e77f4ea001bf6219
| 2023-05-02T21:11:43Z |
go
| 2023-05-22T21:21:17Z |
cmd/shim/main.go
|
if len(os.Args) < 2 {
fmt.Fprintf(os.Stderr, "usage: %s <command> [<args>]\n", os.Args[0])
return 1
}
cmd := os.Args[1]
args := os.Args[2:]
switch cmd {
case "check":
if err := check(args); err != nil {
fmt.Fprintln(os.Stderr, err)
return 1
}
return 0
default:
fmt.Fprintf(os.Stderr, "unknown command: %s\n", cmd)
return 1
}
}
func check(args []string) error {
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 5,077 |
Add `(truncated output)` to stdout/stderr errors
|
@helderco mentioned:
> Can we append some notice like "truncated output"? Multiple users have been confused that the output is truncated, reporting it as a bug.
|
https://github.com/dagger/dagger/issues/5077
|
https://github.com/dagger/dagger/pull/5163
|
7d8738d64889572fd5ac7d9930c2f16b4c3629d2
|
e0fecd2682e63b5c0fb18a18e77f4ea001bf6219
| 2023-05-02T21:11:43Z |
go
| 2023-05-22T21:21:17Z |
cmd/shim/main.go
|
if len(args) == 0 {
return fmt.Errorf("usage: check <host> port/tcp [port/udp ...]")
}
logPrefix := fmt.Sprintf("[check %s]", identity.NewID())
host, ports := args[0], args[1:]
for _, port := range ports {
port, network, ok := strings.Cut(port, "/")
if !ok {
network = "tcp"
}
pollAddr := net.JoinHostPort(host, port)
fmt.Println(logPrefix, "polling for port", pollAddr)
reached, err := pollForPort(logPrefix, network, pollAddr)
if err != nil {
return fmt.Errorf("poll %s: %w", pollAddr, err)
}
fmt.Println(logPrefix, "port is up at", reached)
}
return nil
}
func pollForPort(logPrefix, network, addr string) (string, error) {
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 5,077 |
Add `(truncated output)` to stdout/stderr errors
|
@helderco mentioned:
> Can we append some notice like "truncated output"? Multiple users have been confused that the output is truncated, reporting it as a bug.
|
https://github.com/dagger/dagger/issues/5077
|
https://github.com/dagger/dagger/pull/5163
|
7d8738d64889572fd5ac7d9930c2f16b4c3629d2
|
e0fecd2682e63b5c0fb18a18e77f4ea001bf6219
| 2023-05-02T21:11:43Z |
go
| 2023-05-22T21:21:17Z |
cmd/shim/main.go
|
retry := backoff.NewExponentialBackOff()
retry.InitialInterval = 100 * time.Millisecond
dialer := net.Dialer{
Timeout: time.Second,
}
var reached string
err := backoff.Retry(func() error {
conn, err := dialer.Dial(network, addr)
if err != nil {
fmt.Fprintf(os.Stderr, "%s port not ready: %s; elapsed: %s\n", logPrefix, err, retry.GetElapsedTime())
return err
}
reached = conn.RemoteAddr().String()
_ = conn.Close()
return nil
}, retry)
if err != nil {
return "", err
}
return reached, nil
}
func shim() int {
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 5,077 |
Add `(truncated output)` to stdout/stderr errors
|
@helderco mentioned:
> Can we append some notice like "truncated output"? Multiple users have been confused that the output is truncated, reporting it as a bug.
|
https://github.com/dagger/dagger/issues/5077
|
https://github.com/dagger/dagger/pull/5163
|
7d8738d64889572fd5ac7d9930c2f16b4c3629d2
|
e0fecd2682e63b5c0fb18a18e77f4ea001bf6219
| 2023-05-02T21:11:43Z |
go
| 2023-05-22T21:21:17Z |
cmd/shim/main.go
|
ctx, cancel := context.WithCancel(context.Background())
defer cancel()
if len(os.Args) < 2 {
fmt.Fprintf(os.Stderr, "usage: %s <path> [<args>]\n", os.Args[0])
return 1
}
name := os.Args[1]
args := []string{}
if len(os.Args) > 2 {
args = os.Args[2:]
}
cmd := exec.Command(name, args...)
if stdinFile, err := os.Open(stdinPath); err == nil {
defer stdinFile.Close()
cmd.Stdin = stdinFile
} else {
cmd.Stdin = nil
}
stdoutRedirect, found := internalEnv("_DAGGER_REDIRECT_STDOUT")
if found {
stdoutPath = stdoutRedirect
}
stderrRedirect, found := internalEnv("_DAGGER_REDIRECT_STDERR")
if found {
stderrPath = stderrRedirect
}
if _, found := internalEnv(core.DebugFailedExecEnv); found {
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 5,077 |
Add `(truncated output)` to stdout/stderr errors
|
@helderco mentioned:
> Can we append some notice like "truncated output"? Multiple users have been confused that the output is truncated, reporting it as a bug.
|
https://github.com/dagger/dagger/issues/5077
|
https://github.com/dagger/dagger/pull/5163
|
7d8738d64889572fd5ac7d9930c2f16b4c3629d2
|
e0fecd2682e63b5c0fb18a18e77f4ea001bf6219
| 2023-05-02T21:11:43Z |
go
| 2023-05-22T21:21:17Z |
cmd/shim/main.go
|
stdoutFile, err := os.Open(stdoutPath)
if err == nil {
stdoutFileSize, err := stdoutFile.Seek(0, io.SeekEnd)
if err != nil {
panic(err)
}
seekFromEnd := stdoutFileSize
if seekFromEnd > core.MaxExecErrorOutputBytes {
seekFromEnd = core.MaxExecErrorOutputBytes
}
_, err = stdoutFile.Seek(-int64(seekFromEnd), io.SeekEnd)
if err != nil {
panic(err)
}
_, err = io.Copy(os.Stdout, stdoutFile)
if err != nil {
panic(err)
}
} else if !os.IsNotExist(err) {
panic(err)
}
stderrFile, err := os.Open(stderrPath)
if err == nil {
stderrFileSize, err := stderrFile.Seek(0, io.SeekEnd)
if err != nil {
panic(err)
}
seekFromEnd := stderrFileSize
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 5,077 |
Add `(truncated output)` to stdout/stderr errors
|
@helderco mentioned:
> Can we append some notice like "truncated output"? Multiple users have been confused that the output is truncated, reporting it as a bug.
|
https://github.com/dagger/dagger/issues/5077
|
https://github.com/dagger/dagger/pull/5163
|
7d8738d64889572fd5ac7d9930c2f16b4c3629d2
|
e0fecd2682e63b5c0fb18a18e77f4ea001bf6219
| 2023-05-02T21:11:43Z |
go
| 2023-05-22T21:21:17Z |
cmd/shim/main.go
|
if seekFromEnd > core.MaxExecErrorOutputBytes {
seekFromEnd = core.MaxExecErrorOutputBytes
}
_, err = stderrFile.Seek(-int64(seekFromEnd), io.SeekEnd)
if err != nil {
panic(err)
}
_, err = io.Copy(os.Stderr, stderrFile)
if err != nil {
panic(err)
}
} else if !os.IsNotExist(err) {
panic(err)
}
return 0
}
var secretsToScrub core.SecretToScrubInfo
secretsToScrubVar, found := internalEnv("_DAGGER_SCRUB_SECRETS")
if found {
err := json.Unmarshal([]byte(secretsToScrubVar), &secretsToScrub)
if err != nil {
panic(fmt.Errorf("cannot load secrets to scrub: %w", err))
}
}
currentDirPath := "/"
shimFS := os.DirFS(currentDirPath)
stdoutFile, err := os.Create(stdoutPath)
if err != nil {
panic(err)
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 5,077 |
Add `(truncated output)` to stdout/stderr errors
|
@helderco mentioned:
> Can we append some notice like "truncated output"? Multiple users have been confused that the output is truncated, reporting it as a bug.
|
https://github.com/dagger/dagger/issues/5077
|
https://github.com/dagger/dagger/pull/5163
|
7d8738d64889572fd5ac7d9930c2f16b4c3629d2
|
e0fecd2682e63b5c0fb18a18e77f4ea001bf6219
| 2023-05-02T21:11:43Z |
go
| 2023-05-22T21:21:17Z |
cmd/shim/main.go
|
}
defer stdoutFile.Close()
envToScrub := os.Environ()
outWriter := io.MultiWriter(stdoutFile, os.Stdout)
scrubOutWriter, err := NewSecretScrubWriter(outWriter, currentDirPath, shimFS, envToScrub, secretsToScrub)
if err != nil {
panic(err)
}
cmd.Stdout = scrubOutWriter
stderrFile, err := os.Create(stderrPath)
if err != nil {
panic(err)
}
defer stderrFile.Close()
errWriter := io.MultiWriter(stderrFile, os.Stderr)
scrubErrWriter, err := NewSecretScrubWriter(errWriter, currentDirPath, shimFS, envToScrub, secretsToScrub)
if err != nil {
panic(err)
}
cmd.Stderr = scrubErrWriter
exitCode := 0
if err := runWithNesting(ctx, cmd); err != nil {
exitCode = 1
if exiterr, ok := err.(*exec.ExitError); ok {
exitCode = exiterr.ExitCode()
} else {
panic(err)
}
}
if err := os.WriteFile(exitCodePath, []byte(fmt.Sprintf("%d", exitCode)), 0o600); err != nil {
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 5,077 |
Add `(truncated output)` to stdout/stderr errors
|
@helderco mentioned:
> Can we append some notice like "truncated output"? Multiple users have been confused that the output is truncated, reporting it as a bug.
|
https://github.com/dagger/dagger/issues/5077
|
https://github.com/dagger/dagger/pull/5163
|
7d8738d64889572fd5ac7d9930c2f16b4c3629d2
|
e0fecd2682e63b5c0fb18a18e77f4ea001bf6219
| 2023-05-02T21:11:43Z |
go
| 2023-05-22T21:21:17Z |
cmd/shim/main.go
|
panic(err)
}
return exitCode
}
func setupBundle() int {
var bundleDir string
var isRun bool
for i, arg := range os.Args {
if arg == "--bundle" && i+1 < len(os.Args) {
bundleDir = os.Args[i+1]
}
if arg == "run" {
isRun = true
}
}
if bundleDir == "" || !isRun {
return execRunc()
}
configPath := filepath.Join(bundleDir, "config.json")
configBytes, err := os.ReadFile(configPath)
if err != nil {
fmt.Printf("Error reading config.json: %v\n", err)
return 1
}
var spec specs.Spec
if err := json.Unmarshal(configBytes, &spec); err != nil {
fmt.Printf("Error parsing config.json: %v\n", err)
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 5,077 |
Add `(truncated output)` to stdout/stderr errors
|
@helderco mentioned:
> Can we append some notice like "truncated output"? Multiple users have been confused that the output is truncated, reporting it as a bug.
|
https://github.com/dagger/dagger/issues/5077
|
https://github.com/dagger/dagger/pull/5163
|
7d8738d64889572fd5ac7d9930c2f16b4c3629d2
|
e0fecd2682e63b5c0fb18a18e77f4ea001bf6219
| 2023-05-02T21:11:43Z |
go
| 2023-05-22T21:21:17Z |
cmd/shim/main.go
|
return 1
}
var isDaggerExec bool
for _, mnt := range spec.Mounts {
if mnt.Destination == metaMountPath {
isDaggerExec = true
break
}
}
for _, env := range spec.Process.Env {
if strings.HasPrefix(env, "_DAGGER_INTERNAL_COMMAND=") {
isDaggerExec = true
break
}
}
if isDaggerExec {
selfPath, err := os.Executable()
if err != nil {
fmt.Printf("Error getting self path: %v\n", err)
return 1
}
selfPath, err = filepath.EvalSymlinks(selfPath)
if err != nil {
fmt.Printf("Error getting self path: %v\n", err)
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 5,077 |
Add `(truncated output)` to stdout/stderr errors
|
@helderco mentioned:
> Can we append some notice like "truncated output"? Multiple users have been confused that the output is truncated, reporting it as a bug.
|
https://github.com/dagger/dagger/issues/5077
|
https://github.com/dagger/dagger/pull/5163
|
7d8738d64889572fd5ac7d9930c2f16b4c3629d2
|
e0fecd2682e63b5c0fb18a18e77f4ea001bf6219
| 2023-05-02T21:11:43Z |
go
| 2023-05-22T21:21:17Z |
cmd/shim/main.go
|
return 1
}
spec.Mounts = append(spec.Mounts, specs.Mount{
Destination: shimPath,
Type: "bind",
Source: selfPath,
Options: []string{"rbind", "ro"},
})
spec.Process.Args = append([]string{shimPath}, spec.Process.Args...)
}
var hostsFilePath string
for _, mnt := range spec.Mounts {
if mnt.Destination == "/etc/hosts" {
hostsFilePath = mnt.Source
}
}
keepEnv := []string{}
for _, env := range spec.Process.Env {
switch {
case strings.HasPrefix(env, "_DAGGER_ENABLE_NESTING="):
keepEnv = append(keepEnv, env)
spec.Mounts = append(spec.Mounts, specs.Mount{
Destination: "/.runner.sock",
Type: "bind",
Options: []string{"rbind"},
Source: "/run/buildkit/buildkitd.sock",
})
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 5,077 |
Add `(truncated output)` to stdout/stderr errors
|
@helderco mentioned:
> Can we append some notice like "truncated output"? Multiple users have been confused that the output is truncated, reporting it as a bug.
|
https://github.com/dagger/dagger/issues/5077
|
https://github.com/dagger/dagger/pull/5163
|
7d8738d64889572fd5ac7d9930c2f16b4c3629d2
|
e0fecd2682e63b5c0fb18a18e77f4ea001bf6219
| 2023-05-02T21:11:43Z |
go
| 2023-05-22T21:21:17Z |
cmd/shim/main.go
|
case strings.HasPrefix(env, aliasPrefix):
if err := appendHostAlias(hostsFilePath, env); err != nil {
fmt.Fprintln(os.Stderr, "host alias:", err)
return 1
}
default:
keepEnv = append(keepEnv, env)
}
}
spec.Process.Env = keepEnv
configBytes, err = json.Marshal(spec)
if err != nil {
fmt.Printf("Error marshaling config.json: %v\n", err)
return 1
}
if err := os.WriteFile(configPath, configBytes, 0o600); err != nil {
fmt.Printf("Error writing config.json: %v\n", err)
return 1
}
exitCodeCh := make(chan int)
go func() {
runtime.LockOSThread()
defer runtime.UnlockOSThread()
defer close(exitCodeCh)
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 5,077 |
Add `(truncated output)` to stdout/stderr errors
|
@helderco mentioned:
> Can we append some notice like "truncated output"? Multiple users have been confused that the output is truncated, reporting it as a bug.
|
https://github.com/dagger/dagger/issues/5077
|
https://github.com/dagger/dagger/pull/5163
|
7d8738d64889572fd5ac7d9930c2f16b4c3629d2
|
e0fecd2682e63b5c0fb18a18e77f4ea001bf6219
| 2023-05-02T21:11:43Z |
go
| 2023-05-22T21:21:17Z |
cmd/shim/main.go
|
cmd := exec.Command(runcPath, os.Args[1:]...)
cmd.Stdin = os.Stdin
cmd.Stdout = os.Stdout
cmd.Stderr = os.Stderr
cmd.SysProcAttr = &syscall.SysProcAttr{
Pdeathsig: syscall.SIGKILL,
}
sigCh := make(chan os.Signal, 32)
signal.Notify(sigCh)
if err := cmd.Start(); err != nil {
fmt.Printf("Error starting runc: %v", err)
exitCodeCh <- 1
return
}
go func() {
for sig := range sigCh {
cmd.Process.Signal(sig)
}
}()
if err := cmd.Wait(); err != nil {
if exiterr, ok := err.(*exec.ExitError); ok {
if waitStatus, ok := exiterr.Sys().(syscall.WaitStatus); ok {
exitcode := waitStatus.ExitStatus()
if exitcode < 0 {
exitcode = 255
}
exitCodeCh <- exitcode
return
}
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 5,077 |
Add `(truncated output)` to stdout/stderr errors
|
@helderco mentioned:
> Can we append some notice like "truncated output"? Multiple users have been confused that the output is truncated, reporting it as a bug.
|
https://github.com/dagger/dagger/issues/5077
|
https://github.com/dagger/dagger/pull/5163
|
7d8738d64889572fd5ac7d9930c2f16b4c3629d2
|
e0fecd2682e63b5c0fb18a18e77f4ea001bf6219
| 2023-05-02T21:11:43Z |
go
| 2023-05-22T21:21:17Z |
cmd/shim/main.go
|
}
fmt.Printf("Error waiting for runc: %v", err)
exitCodeCh <- 1
return
}
}()
return <-exitCodeCh
}
const aliasPrefix = "_DAGGER_HOSTNAME_ALIAS_"
func appendHostAlias(hostsFilePath string, env string) error {
alias, target, ok := strings.Cut(strings.TrimPrefix(env, aliasPrefix), "=")
if !ok {
return fmt.Errorf("malformed host alias: %s", env)
}
ips, err := net.LookupIP(target)
if err != nil {
return err
}
hostsFile, err := os.OpenFile(hostsFilePath, os.O_APPEND|os.O_WRONLY, 0o777)
if err != nil {
return err
}
for _, ip := range ips {
if _, err := fmt.Fprintf(hostsFile, "\n%s\t%s\n", ip.String(), alias); err != nil {
return err
}
}
return hostsFile.Close()
}
func execRunc() int {
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 5,077 |
Add `(truncated output)` to stdout/stderr errors
|
@helderco mentioned:
> Can we append some notice like "truncated output"? Multiple users have been confused that the output is truncated, reporting it as a bug.
|
https://github.com/dagger/dagger/issues/5077
|
https://github.com/dagger/dagger/pull/5163
|
7d8738d64889572fd5ac7d9930c2f16b4c3629d2
|
e0fecd2682e63b5c0fb18a18e77f4ea001bf6219
| 2023-05-02T21:11:43Z |
go
| 2023-05-22T21:21:17Z |
cmd/shim/main.go
|
args := []string{runcPath}
args = append(args, os.Args[1:]...)
if err := unix.Exec(runcPath, args, os.Environ()); err != nil {
fmt.Printf("Error execing runc: %v\n", err)
return 1
}
panic("congratulations: you've reached unreachable code, please report a bug!")
}
func internalEnv(name string) (string, bool) {
val, found := os.LookupEnv(name)
if !found {
return "", false
}
os.Unsetenv(name)
return val, true
}
func runWithNesting(ctx context.Context, cmd *exec.Cmd) error {
if _, found := internalEnv("_DAGGER_ENABLE_NESTING"); !found {
return cmd.Run()
}
sessionToken, engineErr := uuid.NewRandom()
if engineErr != nil {
return fmt.Errorf("error generating session token: %w", engineErr)
}
l, engineErr := net.Listen("tcp", "127.0.0.1:0")
if engineErr != nil {
return fmt.Errorf("error listening on session socket: %w", engineErr)
}
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 5,077 |
Add `(truncated output)` to stdout/stderr errors
|
@helderco mentioned:
> Can we append some notice like "truncated output"? Multiple users have been confused that the output is truncated, reporting it as a bug.
|
https://github.com/dagger/dagger/issues/5077
|
https://github.com/dagger/dagger/pull/5163
|
7d8738d64889572fd5ac7d9930c2f16b4c3629d2
|
e0fecd2682e63b5c0fb18a18e77f4ea001bf6219
| 2023-05-02T21:11:43Z |
go
| 2023-05-22T21:21:17Z |
cmd/shim/main.go
|
engineConf := engine.Config{
SessionToken: sessionToken.String(),
RunnerHost: "unix:///.runner.sock",
}
engineConf.LogOutput = os.Stderr
if _, err := os.Stat("/.progrock.sock"); err == nil {
progW, err := progrock.DialRPC("unix", "/.progrock.sock")
if err != nil {
return fmt.Errorf("error connecting to progrock: %w", err)
}
engineConf.ProgrockWriter = progW
} else {
engineConf.LogOutput = os.Stderr
}
os.Setenv("DAGGER_SESSION_PORT", strconv.Itoa(l.Addr().(*net.TCPAddr).Port))
os.Setenv("DAGGER_SESSION_TOKEN", sessionToken.String())
var cmdErr error
engineErr = engine.Start(ctx, engineConf, func(ctx context.Context, r *router.Router) error {
go http.Serve(l, r)
cmdErr = cmd.Run()
return cmdErr
})
if cmdErr != nil {
return cmdErr
}
return engineErr
}
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 5,077 |
Add `(truncated output)` to stdout/stderr errors
|
@helderco mentioned:
> Can we append some notice like "truncated output"? Multiple users have been confused that the output is truncated, reporting it as a bug.
|
https://github.com/dagger/dagger/issues/5077
|
https://github.com/dagger/dagger/pull/5163
|
7d8738d64889572fd5ac7d9930c2f16b4c3629d2
|
e0fecd2682e63b5c0fb18a18e77f4ea001bf6219
| 2023-05-02T21:11:43Z |
go
| 2023-05-22T21:21:17Z |
core/gateway.go
|
package core
import (
"context"
"fmt"
"io"
"strings"
"sync"
"time"
"github.com/armon/circbuf"
"github.com/containerd/containerd/platforms"
"github.com/moby/buildkit/client/llb"
bkgw "github.com/moby/buildkit/frontend/gateway/client"
"github.com/moby/buildkit/solver/errdefs"
"github.com/moby/buildkit/solver/pb"
"github.com/opencontainers/go-digest"
"github.com/pkg/errors"
fstypes "github.com/tonistiigi/fsutil/types"
"github.com/vito/progrock"
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 5,077 |
Add `(truncated output)` to stdout/stderr errors
|
@helderco mentioned:
> Can we append some notice like "truncated output"? Multiple users have been confused that the output is truncated, reporting it as a bug.
|
https://github.com/dagger/dagger/issues/5077
|
https://github.com/dagger/dagger/pull/5163
|
7d8738d64889572fd5ac7d9930c2f16b4c3629d2
|
e0fecd2682e63b5c0fb18a18e77f4ea001bf6219
| 2023-05-02T21:11:43Z |
go
| 2023-05-22T21:21:17Z |
core/gateway.go
|
)
const (
MaxExecErrorOutputBytes = 2 * 1024
MaxFileContentsChunkSize = 15938355
MaxFileContentsSize = 128 << 20
DebugFailedExecEnv = "_DAGGER_SHIM_DEBUG_FAILED_EXEC"
)
type GatewayClient struct {
bkgw.Client
refs map[*ref]struct{}
cacheConfigType string
cacheConfigAttrs map[string]string
mu sync.Mutex
}
func NewGatewayClient(baseClient bkgw.Client, cacheConfigType string, cacheConfigAttrs map[string]string) *GatewayClient {
return &GatewayClient{
Client: recordingGateway{baseClient},
cacheConfigType: cacheConfigType,
cacheConfigAttrs: cacheConfigAttrs,
refs: make(map[*ref]struct{}),
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 5,077 |
Add `(truncated output)` to stdout/stderr errors
|
@helderco mentioned:
> Can we append some notice like "truncated output"? Multiple users have been confused that the output is truncated, reporting it as a bug.
|
https://github.com/dagger/dagger/issues/5077
|
https://github.com/dagger/dagger/pull/5163
|
7d8738d64889572fd5ac7d9930c2f16b4c3629d2
|
e0fecd2682e63b5c0fb18a18e77f4ea001bf6219
| 2023-05-02T21:11:43Z |
go
| 2023-05-22T21:21:17Z |
core/gateway.go
|
}
}
func (g *GatewayClient) Solve(ctx context.Context, req bkgw.SolveRequest) (_ *bkgw.Result, rerr error) {
defer wrapSolveError(&rerr, g.Client)
if g.cacheConfigType != "" {
req.CacheImports = []bkgw.CacheOptionsEntry{{
Type: g.cacheConfigType,
Attrs: g.cacheConfigAttrs,
}}
}
res, err := g.Client.Solve(ctx, req)
if err != nil {
return nil, fmt.Errorf("failed to solve: %w", err)
}
g.mu.Lock()
defer g.mu.Unlock()
if res.Ref != nil {
r := &ref{Reference: res.Ref, gw: g}
g.refs[r] = struct{}{}
res.Ref = r
}
for k, r := range res.Refs {
r := &ref{Reference: r, gw: g}
g.refs[r] = struct{}{}
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 5,077 |
Add `(truncated output)` to stdout/stderr errors
|
@helderco mentioned:
> Can we append some notice like "truncated output"? Multiple users have been confused that the output is truncated, reporting it as a bug.
|
https://github.com/dagger/dagger/issues/5077
|
https://github.com/dagger/dagger/pull/5163
|
7d8738d64889572fd5ac7d9930c2f16b4c3629d2
|
e0fecd2682e63b5c0fb18a18e77f4ea001bf6219
| 2023-05-02T21:11:43Z |
go
| 2023-05-22T21:21:17Z |
core/gateway.go
|
res.Refs[k] = r
}
return res, nil
}
func (g *GatewayClient) CombinedResult(ctx context.Context) (*bkgw.Result, error) {
g.mu.Lock()
defer g.mu.Unlock()
mergeInputs := make([]llb.State, 0, len(g.refs))
for r := range g.refs {
state, err := r.ToState()
if err != nil {
return nil, err
}
mergeInputs = append(mergeInputs, state)
}
llbdef, err := llb.Merge(mergeInputs, llb.WithCustomName("combined session result")).Marshal(ctx)
if err != nil {
return nil, err
}
mergedRes, err := g.Client.Solve(ctx, bkgw.SolveRequest{
Definition: llbdef.ToPB(),
})
if err != nil {
return nil, err
}
return mergedRes, nil
}
type ref struct {
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 5,077 |
Add `(truncated output)` to stdout/stderr errors
|
@helderco mentioned:
> Can we append some notice like "truncated output"? Multiple users have been confused that the output is truncated, reporting it as a bug.
|
https://github.com/dagger/dagger/issues/5077
|
https://github.com/dagger/dagger/pull/5163
|
7d8738d64889572fd5ac7d9930c2f16b4c3629d2
|
e0fecd2682e63b5c0fb18a18e77f4ea001bf6219
| 2023-05-02T21:11:43Z |
go
| 2023-05-22T21:21:17Z |
core/gateway.go
|
bkgw.Reference
gw *GatewayClient
}
func (r *ref) ReadFile(ctx context.Context, req bkgw.ReadRequest) (_ []byte, rerr error) {
defer wrapSolveError(&rerr, r.gw.Client)
return r.Reference.ReadFile(ctx, req)
}
func (r *ref) StatFile(ctx context.Context, req bkgw.StatRequest) (_ *fstypes.Stat, rerr error) {
defer wrapSolveError(&rerr, r.gw.Client)
return r.Reference.StatFile(ctx, req)
}
func (r *ref) ReadDir(ctx context.Context, req bkgw.ReadDirRequest) (_ []*fstypes.Stat, rerr error) {
defer wrapSolveError(&rerr, r.gw.Client)
return r.Reference.ReadDir(ctx, req)
}
func wrapSolveError(inputErr *error, gw bkgw.Client) {
if inputErr == nil || *inputErr == nil {
return
}
returnErr := *inputErr
var se *errdefs.SolveError
if errors.As(returnErr, &se) {
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 5,077 |
Add `(truncated output)` to stdout/stderr errors
|
@helderco mentioned:
> Can we append some notice like "truncated output"? Multiple users have been confused that the output is truncated, reporting it as a bug.
|
https://github.com/dagger/dagger/issues/5077
|
https://github.com/dagger/dagger/pull/5163
|
7d8738d64889572fd5ac7d9930c2f16b4c3629d2
|
e0fecd2682e63b5c0fb18a18e77f4ea001bf6219
| 2023-05-02T21:11:43Z |
go
| 2023-05-22T21:21:17Z |
core/gateway.go
|
ctx, cancel := context.WithTimeout(context.Background(), 30*time.Second)
defer cancel()
op := se.Op
if op == nil || op.Op == nil {
return
}
execOp, ok := se.Op.Op.(*pb.Op_Exec)
if !ok {
return
}
var mounts []bkgw.Mount
for i, mnt := range execOp.Exec.Mounts {
mnt := mnt
if mnt.CacheOpt != nil || mnt.TmpfsOpt != nil {
continue
}
mounts = append(mounts, bkgw.Mount{
Selector: mnt.Selector,
Dest: mnt.Dest,
ResultID: se.MountIDs[i],
Readonly: mnt.Readonly,
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 5,077 |
Add `(truncated output)` to stdout/stderr errors
|
@helderco mentioned:
> Can we append some notice like "truncated output"? Multiple users have been confused that the output is truncated, reporting it as a bug.
|
https://github.com/dagger/dagger/issues/5077
|
https://github.com/dagger/dagger/pull/5163
|
7d8738d64889572fd5ac7d9930c2f16b4c3629d2
|
e0fecd2682e63b5c0fb18a18e77f4ea001bf6219
| 2023-05-02T21:11:43Z |
go
| 2023-05-22T21:21:17Z |
core/gateway.go
|
MountType: mnt.MountType,
CacheOpt: mnt.CacheOpt,
SecretOpt: mnt.SecretOpt,
SSHOpt: mnt.SSHOpt,
})
}
ctr, err := gw.NewContainer(ctx, bkgw.NewContainerRequest{
Mounts: mounts,
NetMode: execOp.Exec.Network,
ExtraHosts: execOp.Exec.Meta.ExtraHosts,
Platform: op.Platform,
Constraints: op.Constraints,
})
if err != nil {
return
}
defer func() {
go ctr.Release(context.Background())
}()
ctrOut, err := circbuf.NewBuffer(MaxExecErrorOutputBytes)
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 5,077 |
Add `(truncated output)` to stdout/stderr errors
|
@helderco mentioned:
> Can we append some notice like "truncated output"? Multiple users have been confused that the output is truncated, reporting it as a bug.
|
https://github.com/dagger/dagger/issues/5077
|
https://github.com/dagger/dagger/pull/5163
|
7d8738d64889572fd5ac7d9930c2f16b4c3629d2
|
e0fecd2682e63b5c0fb18a18e77f4ea001bf6219
| 2023-05-02T21:11:43Z |
go
| 2023-05-22T21:21:17Z |
core/gateway.go
|
if err != nil {
return
}
ctrErr, err := circbuf.NewBuffer(MaxExecErrorOutputBytes)
if err != nil {
return
}
proc, err := ctr.Start(ctx, bkgw.StartRequest{
Args: execOp.Exec.Meta.Args,
Env: append(execOp.Exec.Meta.Env, DebugFailedExecEnv+"=1"),
User: execOp.Exec.Meta.User,
Cwd: execOp.Exec.Meta.Cwd,
Stdout: &nopCloser{ctrOut},
Stderr: &nopCloser{ctrErr},
})
if err != nil {
return
}
if err := proc.Wait(); err != nil {
return
}
stdout := strings.TrimSpace(ctrOut.String())
stderr := strings.TrimSpace(ctrErr.String())
returnErr = fmt.Errorf("%w\nStdout:\n%s\nStderr:\n%s", returnErr, stdout, stderr)
}
*inputErr = returnErr
}
type nopCloser struct {
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 5,077 |
Add `(truncated output)` to stdout/stderr errors
|
@helderco mentioned:
> Can we append some notice like "truncated output"? Multiple users have been confused that the output is truncated, reporting it as a bug.
|
https://github.com/dagger/dagger/issues/5077
|
https://github.com/dagger/dagger/pull/5163
|
7d8738d64889572fd5ac7d9930c2f16b4c3629d2
|
e0fecd2682e63b5c0fb18a18e77f4ea001bf6219
| 2023-05-02T21:11:43Z |
go
| 2023-05-22T21:21:17Z |
core/gateway.go
|
io.Writer
}
func (n *nopCloser) Close() error {
return nil
}
type recordingGateway struct {
bkgw.Client
}
func (g recordingGateway) ResolveImageConfig(ctx context.Context, ref string, opt llb.ResolveImageConfigOpt) (digest.Digest, []byte, error) {
rec := progrock.RecorderFromContext(ctx)
id := ref
if platform := opt.Platform; platform == nil {
id += platforms.Format(platforms.DefaultSpec())
} else {
id += platforms.Format(*platform)
}
rec.Join(digest.FromString(id))
return g.Client.ResolveImageConfig(ctx, ref, opt)
}
func (g recordingGateway) Solve(ctx context.Context, opts bkgw.SolveRequest) (*bkgw.Result, error) {
rec := progrock.RecorderFromContext(ctx)
if opts.Definition != nil {
recordVertexes(rec, opts.Definition)
}
for _, input := range opts.FrontendInputs {
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 5,077 |
Add `(truncated output)` to stdout/stderr errors
|
@helderco mentioned:
> Can we append some notice like "truncated output"? Multiple users have been confused that the output is truncated, reporting it as a bug.
|
https://github.com/dagger/dagger/issues/5077
|
https://github.com/dagger/dagger/pull/5163
|
7d8738d64889572fd5ac7d9930c2f16b4c3629d2
|
e0fecd2682e63b5c0fb18a18e77f4ea001bf6219
| 2023-05-02T21:11:43Z |
go
| 2023-05-22T21:21:17Z |
core/gateway.go
|
if input == nil {
continue
}
recordVertexes(rec, input)
}
return g.Client.Solve(ctx, opts)
}
func recordVertexes(recorder *progrock.Recorder, def *pb.Definition) {
dgsts := []digest.Digest{}
for dgst, meta := range def.Metadata {
_ = meta
if meta.ProgressGroup != nil {
if meta.ProgressGroup.Id != "" && meta.ProgressGroup.Id[0] == '[' {
dgsts = append(dgsts, dgst)
} else {
recorder.WithGroup(meta.ProgressGroup.Name).Join(dgst)
}
} else {
dgsts = append(dgsts, dgst)
}
}
recorder.Join(dgsts...)
}
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 5,077 |
Add `(truncated output)` to stdout/stderr errors
|
@helderco mentioned:
> Can we append some notice like "truncated output"? Multiple users have been confused that the output is truncated, reporting it as a bug.
|
https://github.com/dagger/dagger/issues/5077
|
https://github.com/dagger/dagger/pull/5163
|
7d8738d64889572fd5ac7d9930c2f16b4c3629d2
|
e0fecd2682e63b5c0fb18a18e77f4ea001bf6219
| 2023-05-02T21:11:43Z |
go
| 2023-05-22T21:21:17Z |
core/integration/container_test.go
|
package core
import (
"bytes"
"context"
_ "embed"
"encoding/base64"
"encoding/json"
"errors"
"fmt"
"io"
"net"
"net/http"
"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/google/go-containerregistry/pkg/name"
"github.com/google/go-containerregistry/pkg/v1/remote"
"github.com/google/go-containerregistry/pkg/v1/tarball"
"github.com/moby/buildkit/identity"
ocispecs "github.com/opencontainers/image-spec/specs-go/v1"
"github.com/stretchr/testify/require"
)
func TestContainerScratch(t *testing.T) {
t.Parallel()
res := struct {
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 5,077 |
Add `(truncated output)` to stdout/stderr errors
|
@helderco mentioned:
> Can we append some notice like "truncated output"? Multiple users have been confused that the output is truncated, reporting it as a bug.
|
https://github.com/dagger/dagger/issues/5077
|
https://github.com/dagger/dagger/pull/5163
|
7d8738d64889572fd5ac7d9930c2f16b4c3629d2
|
e0fecd2682e63b5c0fb18a18e77f4ea001bf6219
| 2023-05-02T21:11:43Z |
go
| 2023-05-22T21:21:17Z |
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
| 5,077 |
Add `(truncated output)` to stdout/stderr errors
|
@helderco mentioned:
> Can we append some notice like "truncated output"? Multiple users have been confused that the output is truncated, reporting it as a bug.
|
https://github.com/dagger/dagger/issues/5077
|
https://github.com/dagger/dagger/pull/5163
|
7d8738d64889572fd5ac7d9930c2f16b4c3629d2
|
e0fecd2682e63b5c0fb18a18e77f4ea001bf6219
| 2023-05-02T21:11:43Z |
go
| 2023-05-22T21:21:17Z |
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 TestContainerWith(t *testing.T) {
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 5,077 |
Add `(truncated output)` to stdout/stderr errors
|
@helderco mentioned:
> Can we append some notice like "truncated output"? Multiple users have been confused that the output is truncated, reporting it as a bug.
|
https://github.com/dagger/dagger/issues/5077
|
https://github.com/dagger/dagger/pull/5163
|
7d8738d64889572fd5ac7d9930c2f16b4c3629d2
|
e0fecd2682e63b5c0fb18a18e77f4ea001bf6219
| 2023-05-02T21:11:43Z |
go
| 2023-05-22T21:21:17Z |
core/integration/container_test.go
|
t.Parallel()
ctx := context.Background()
c, err := dagger.Connect(ctx)
require.NoError(t, err)
defer c.Close()
foo := "bar"
alpine := c.Container().From("alpine:3.16.2").With(func(c *dagger.Container) *dagger.Container {
return c.WithEnvVariable("FOO", foo)
})
out, err := alpine.WithExec([]string{"printenv", "FOO"}).Stdout(ctx)
require.NoError(t, err)
require.Equal(t, "bar\n", out)
withFood := func(c *dagger.Container) *dagger.Container {
return c.WithEnvVariable("FOOD", "bar")
}
out, err = c.Container().From("alpine:3.16.2").
With(withFood).
WithExec([]string{"printenv", "FOOD"}).
Stdout(ctx)
require.NoError(t, err)
require.Equal(t, "bar\n", out)
withEnv := func(env, val string) dagger.WithContainerFunc {
return func(c *dagger.Container) *dagger.Container {
return c.WithEnvVariable(env, val)
}
}
env := "HELLO"
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 5,077 |
Add `(truncated output)` to stdout/stderr errors
|
@helderco mentioned:
> Can we append some notice like "truncated output"? Multiple users have been confused that the output is truncated, reporting it as a bug.
|
https://github.com/dagger/dagger/issues/5077
|
https://github.com/dagger/dagger/pull/5163
|
7d8738d64889572fd5ac7d9930c2f16b4c3629d2
|
e0fecd2682e63b5c0fb18a18e77f4ea001bf6219
| 2023-05-02T21:11:43Z |
go
| 2023-05-22T21:21:17Z |
core/integration/container_test.go
|
val := "WORLD"
out, err = c.Container().From("alpine:3.16.2").
With(withEnv(env, val)).
WithExec([]string{"printenv", env}).
Stdout(ctx)
require.NoError(t, err)
require.Equal(t, val+"\n", out)
}
func TestContainerBuild(t *testing.T) {
ctx := context.Background()
c, err := dagger.Connect(ctx)
require.NoError(t, err)
defer c.Close()
contextDir := c.Directory().
WithNewFile("main.go",
`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",
`FROM golang:1.18.2-alpine
WORKDIR /src
COPY main.go .
RUN go mod init hello
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 5,077 |
Add `(truncated output)` to stdout/stderr errors
|
@helderco mentioned:
> Can we append some notice like "truncated output"? Multiple users have been confused that the output is truncated, reporting it as a bug.
|
https://github.com/dagger/dagger/issues/5077
|
https://github.com/dagger/dagger/pull/5163
|
7d8738d64889572fd5ac7d9930c2f16b4c3629d2
|
e0fecd2682e63b5c0fb18a18e77f4ea001bf6219
| 2023-05-02T21:11:43Z |
go
| 2023-05-22T21:21:17Z |
core/integration/container_test.go
|
RUN go build -o /usr/bin/goenv main.go
ENV FOO=bar
CMD goenv
`)
env, err := c.Container().Build(src).Stdout(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",
`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",
}).Stdout(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",
`FROM golang:1.18.2-alpine
WORKDIR /src
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 5,077 |
Add `(truncated output)` to stdout/stderr errors
|
@helderco mentioned:
> Can we append some notice like "truncated output"? Multiple users have been confused that the output is truncated, reporting it as a bug.
|
https://github.com/dagger/dagger/issues/5077
|
https://github.com/dagger/dagger/pull/5163
|
7d8738d64889572fd5ac7d9930c2f16b4c3629d2
|
e0fecd2682e63b5c0fb18a18e77f4ea001bf6219
| 2023-05-02T21:11:43Z |
go
| 2023-05-22T21:21:17Z |
core/integration/container_test.go
|
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).Stdout(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",
`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",
}).Stdout(ctx)
require.NoError(t, err)
require.Contains(t, env, "FOO=bar\n")
})
t.Run("with build args", func(t *testing.T) {
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 5,077 |
Add `(truncated output)` to stdout/stderr errors
|
@helderco mentioned:
> Can we append some notice like "truncated output"? Multiple users have been confused that the output is truncated, reporting it as a bug.
|
https://github.com/dagger/dagger/issues/5077
|
https://github.com/dagger/dagger/pull/5163
|
7d8738d64889572fd5ac7d9930c2f16b4c3629d2
|
e0fecd2682e63b5c0fb18a18e77f4ea001bf6219
| 2023-05-02T21:11:43Z |
go
| 2023-05-22T21:21:17Z |
core/integration/container_test.go
|
src := contextDir.
WithNewFile("Dockerfile",
`FROM golang:1.18.2-alpine
ARG FOOARG=bar
WORKDIR /src
COPY main.go .
RUN go mod init hello
RUN go build -o /usr/bin/goenv main.go
ENV FOO=$FOOARG
CMD goenv
`)
env, err := c.Container().Build(src).Stdout(ctx)
require.NoError(t, err)
require.Contains(t, env, "FOO=bar\n")
env, err = c.Container().Build(src, dagger.ContainerBuildOpts{BuildArgs: []dagger.BuildArg{{Name: "FOOARG", Value: "barbar"}}}).Stdout(ctx)
require.NoError(t, err)
require.Contains(t, env, "FOO=barbar\n")
})
t.Run("with target", func(t *testing.T) {
src := contextDir.
WithNewFile("Dockerfile",
`FROM golang:1.18.2-alpine AS base
CMD echo "base"
FROM base AS stage1
CMD echo "stage1"
FROM base AS stage2
CMD echo "stage2"
`)
output, err := c.Container().Build(src).Stdout(ctx)
require.NoError(t, err)
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 5,077 |
Add `(truncated output)` to stdout/stderr errors
|
@helderco mentioned:
> Can we append some notice like "truncated output"? Multiple users have been confused that the output is truncated, reporting it as a bug.
|
https://github.com/dagger/dagger/issues/5077
|
https://github.com/dagger/dagger/pull/5163
|
7d8738d64889572fd5ac7d9930c2f16b4c3629d2
|
e0fecd2682e63b5c0fb18a18e77f4ea001bf6219
| 2023-05-02T21:11:43Z |
go
| 2023-05-22T21:21:17Z |
core/integration/container_test.go
|
require.Contains(t, output, "stage2\n")
output, err = c.Container().Build(src, dagger.ContainerBuildOpts{Target: "stage1"}).Stdout(ctx)
require.NoError(t, err)
require.Contains(t, output, "stage1\n")
require.NotContains(t, output, "stage2\n")
})
t.Run("with build secrets", func(t *testing.T) {
sec := c.SetSecret("my-secret", "barbar")
require.NoError(t, err)
src := contextDir.
WithNewFile("Dockerfile",
`FROM golang:1.18.2-alpine
WORKDIR /src
RUN --mount=type=secret,id=my-secret test "$(cat /run/secrets/my-secret)" = "barbar"
RUN --mount=type=secret,id=my-secret cp /run/secrets/my-secret /secret
CMD cat /secret
`)
stdout, err := c.Container().Build(src, dagger.ContainerBuildOpts{
Secrets: []*dagger.Secret{sec},
}).Stdout(ctx)
require.NoError(t, err)
require.Contains(t, stdout, "***")
})
t.Run("just build, don't execute", func(t *testing.T) {
src := contextDir.
WithNewFile("Dockerfile", "FROM alpine:3.16.2\nCMD false")
_, err = c.Container().Build(src).Sync(ctx)
require.NoError(t, err)
_, err = c.Container().Build(src).WithExec(nil).Sync(ctx)
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 5,077 |
Add `(truncated output)` to stdout/stderr errors
|
@helderco mentioned:
> Can we append some notice like "truncated output"? Multiple users have been confused that the output is truncated, reporting it as a bug.
|
https://github.com/dagger/dagger/issues/5077
|
https://github.com/dagger/dagger/pull/5163
|
7d8738d64889572fd5ac7d9930c2f16b4c3629d2
|
e0fecd2682e63b5c0fb18a18e77f4ea001bf6219
| 2023-05-02T21:11:43Z |
go
| 2023-05-22T21:21:17Z |
core/integration/container_test.go
|
require.NotEmpty(t, err)
})
t.Run("just build, short-circuit", func(t *testing.T) {
src := contextDir.
WithNewFile("Dockerfile", "FROM alpine:3.16.2\nRUN false")
_, err = c.Container().Build(src).Sync(ctx)
require.NotEmpty(t, err)
})
}
func TestContainerWithRootFS(t *testing.T) {
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.Rootfs()
exitCode, err := c.Container().WithEnvVariable("ALPINE_RELEASE", alpine316ReleaseStr).WithRootfs(dir).WithExec([]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)
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 5,077 |
Add `(truncated output)` to stdout/stderr errors
|
@helderco mentioned:
> Can we append some notice like "truncated output"? Multiple users have been confused that the output is truncated, reporting it as a bug.
|
https://github.com/dagger/dagger/issues/5077
|
https://github.com/dagger/dagger/pull/5163
|
7d8738d64889572fd5ac7d9930c2f16b4c3629d2
|
e0fecd2682e63b5c0fb18a18e77f4ea001bf6219
| 2023-05-02T21:11:43Z |
go
| 2023-05-22T21:21:17Z |
core/integration/container_test.go
|
varValResp, err := alpine315WithVar.EnvVariable(ctx, "DAGGER_TEST")
require.NoError(t, err)
require.Equal(t, varVal, varValResp)
alpine315ReplacedFS := alpine315WithVar.WithRootfs(dir)
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)
}
var helloSrc string
func TestContainerWithRootFSSubdir(t *testing.T) {
t.Parallel()
c, ctx := connect(t)
defer c.Close()
hello := c.Directory().WithNewFile("main.go", helloSrc).File("main.go")
ctr := c.Container().
From("golang:1.20.0-alpine").
WithMountedFile("/src/main.go", hello).
WithEnvVariable("CGO_ENABLED", "0").
WithExec([]string{"go", "build", "-o", "/out/hello", "/src/main.go"})
out, err := c.Container().
WithRootfs(ctr.Directory("/out")).
WithExec([]string{"/hello"}).
Stdout(ctx)
require.NoError(t, err)
require.Equal(t, "Hello, world!\n", out)
}
func TestContainerExecSync(t *testing.T) {
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 5,077 |
Add `(truncated output)` to stdout/stderr errors
|
@helderco mentioned:
> Can we append some notice like "truncated output"? Multiple users have been confused that the output is truncated, reporting it as a bug.
|
https://github.com/dagger/dagger/issues/5077
|
https://github.com/dagger/dagger/pull/5163
|
7d8738d64889572fd5ac7d9930c2f16b4c3629d2
|
e0fecd2682e63b5c0fb18a18e77f4ea001bf6219
| 2023-05-02T21:11:43Z |
go
| 2023-05-22T21:21:17Z |
core/integration/container_test.go
|
t.Parallel()
err := testutil.Query(
`{
container {
from(address: "alpine:3.16.2") {
withExec(args: ["false"]) {
sync
}
}
}
}`, nil, nil)
require.Contains(t, err.Error(), `process "false" did not complete successfully`)
}
func TestContainerExecExitCode(t *testing.T) {
t.Parallel()
res := struct {
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 5,077 |
Add `(truncated output)` to stdout/stderr errors
|
@helderco mentioned:
> Can we append some notice like "truncated output"? Multiple users have been confused that the output is truncated, reporting it as a bug.
|
https://github.com/dagger/dagger/issues/5077
|
https://github.com/dagger/dagger/pull/5163
|
7d8738d64889572fd5ac7d9930c2f16b4c3629d2
|
e0fecd2682e63b5c0fb18a18e77f4ea001bf6219
| 2023-05-02T21:11:43Z |
go
| 2023-05-22T21:21:17Z |
core/integration/container_test.go
|
Container struct {
From struct {
WithExec struct {
ExitCode *int
}
}
}
}{}
err := testutil.Query(
`{
container {
from(address: "alpine:3.16.2") {
withExec(args: ["true"]) {
exitCode
}
}
}
}`, &res, nil)
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 5,077 |
Add `(truncated output)` to stdout/stderr errors
|
@helderco mentioned:
> Can we append some notice like "truncated output"? Multiple users have been confused that the output is truncated, reporting it as a bug.
|
https://github.com/dagger/dagger/issues/5077
|
https://github.com/dagger/dagger/pull/5163
|
7d8738d64889572fd5ac7d9930c2f16b4c3629d2
|
e0fecd2682e63b5c0fb18a18e77f4ea001bf6219
| 2023-05-02T21:11:43Z |
go
| 2023-05-22T21:21:17Z |
core/integration/container_test.go
|
require.NoError(t, err)
require.NotNil(t, res.Container.From.WithExec.ExitCode)
require.Equal(t, 0, *res.Container.From.WithExec.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") {
withExec(args: ["false"]) {
exitCode
}
}
}
}`, &res, nil)
require.NoError(t, err)
require.Equal(t, res.Container.From.WithExec.ExitCode, 1)
*/
}
func TestContainerExecStdoutStderr(t *testing.T) {
t.Parallel()
res := struct {
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 5,077 |
Add `(truncated output)` to stdout/stderr errors
|
@helderco mentioned:
> Can we append some notice like "truncated output"? Multiple users have been confused that the output is truncated, reporting it as a bug.
|
https://github.com/dagger/dagger/issues/5077
|
https://github.com/dagger/dagger/pull/5163
|
7d8738d64889572fd5ac7d9930c2f16b4c3629d2
|
e0fecd2682e63b5c0fb18a18e77f4ea001bf6219
| 2023-05-02T21:11:43Z |
go
| 2023-05-22T21:21:17Z |
core/integration/container_test.go
|
Container struct {
From struct {
WithExec struct {
Stdout string
Stderr string
}
}
}
}{}
err := testutil.Query(
`{
container {
from(address: "alpine:3.16.2") {
withExec(args: ["sh", "-c", "echo hello; echo goodbye >/dev/stderr"]) {
stdout
stderr
}
}
}
}`, &res, nil)
require.NoError(t, err)
require.Equal(t, res.Container.From.WithExec.Stdout, "hello\n")
require.Equal(t, res.Container.From.WithExec.Stderr, "goodbye\n")
}
func TestContainerExecStdin(t *testing.T) {
t.Parallel()
res := struct {
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 5,077 |
Add `(truncated output)` to stdout/stderr errors
|
@helderco mentioned:
> Can we append some notice like "truncated output"? Multiple users have been confused that the output is truncated, reporting it as a bug.
|
https://github.com/dagger/dagger/issues/5077
|
https://github.com/dagger/dagger/pull/5163
|
7d8738d64889572fd5ac7d9930c2f16b4c3629d2
|
e0fecd2682e63b5c0fb18a18e77f4ea001bf6219
| 2023-05-02T21:11:43Z |
go
| 2023-05-22T21:21:17Z |
core/integration/container_test.go
|
Container struct {
From struct {
WithExec struct {
Stdout string
}
}
}
}{}
err := testutil.Query(
`{
container {
from(address: "alpine:3.16.2") {
withExec(args: ["cat"], stdin: "hello") {
stdout
}
}
}
}`, &res, nil)
require.NoError(t, err)
require.Equal(t, res.Container.From.WithExec.Stdout, "hello")
}
func TestContainerExecRedirectStdoutStderr(t *testing.T) {
t.Parallel()
res := struct {
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 5,077 |
Add `(truncated output)` to stdout/stderr errors
|
@helderco mentioned:
> Can we append some notice like "truncated output"? Multiple users have been confused that the output is truncated, reporting it as a bug.
|
https://github.com/dagger/dagger/issues/5077
|
https://github.com/dagger/dagger/pull/5163
|
7d8738d64889572fd5ac7d9930c2f16b4c3629d2
|
e0fecd2682e63b5c0fb18a18e77f4ea001bf6219
| 2023-05-02T21:11:43Z |
go
| 2023-05-22T21:21:17Z |
core/integration/container_test.go
|
Container struct {
From struct {
WithExec struct {
Out, Err struct {
Contents string
}
}
}
}
}{}
err := testutil.Query(
`{
container {
from(address: "alpine:3.16.2") {
withExec(
args: ["sh", "-c", "echo hello; echo goodbye >/dev/stderr"],
redirectStdout: "out",
redirectStderr: "err"
) {
out: file(path: "out") {
contents
}
err: file(path: "err") {
contents
}
}
}
}
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 5,077 |
Add `(truncated output)` to stdout/stderr errors
|
@helderco mentioned:
> Can we append some notice like "truncated output"? Multiple users have been confused that the output is truncated, reporting it as a bug.
|
https://github.com/dagger/dagger/issues/5077
|
https://github.com/dagger/dagger/pull/5163
|
7d8738d64889572fd5ac7d9930c2f16b4c3629d2
|
e0fecd2682e63b5c0fb18a18e77f4ea001bf6219
| 2023-05-02T21:11:43Z |
go
| 2023-05-22T21:21:17Z |
core/integration/container_test.go
|
}`, &res, nil)
require.NoError(t, err)
require.Equal(t, res.Container.From.WithExec.Out.Contents, "hello\n")
require.Equal(t, res.Container.From.WithExec.Err.Contents, "goodbye\n")
c, ctx := connect(t)
defer c.Close()
execWithMount := c.Container().From("alpine:3.16.2").
WithMountedDirectory("/mnt", c.Directory()).
WithExec([]string{"sh", "-c", "echo hello; echo goodbye >/dev/stderr"}, dagger.ContainerWithExecOpts{
RedirectStdout: "/mnt/out",
RedirectStderr: "/mnt/err",
})
stdout, err := execWithMount.File("/mnt/out").Contents(ctx)
require.NoError(t, err)
require.Equal(t, "hello\n", stdout)
stderr, err := execWithMount.File("/mnt/err").Contents(ctx)
require.NoError(t, err)
require.Equal(t, "goodbye\n", stderr)
_, err = execWithMount.Stdout(ctx)
require.Error(t, err)
require.Contains(t, err.Error(), "stdout: no such file or directory")
_, err = execWithMount.Stderr(ctx)
require.Error(t, err)
require.Contains(t, err.Error(), "stderr: no such file or directory")
}
func TestContainerExecWithWorkdir(t *testing.T) {
t.Parallel()
res := struct {
Container struct {
From struct {
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 5,077 |
Add `(truncated output)` to stdout/stderr errors
|
@helderco mentioned:
> Can we append some notice like "truncated output"? Multiple users have been confused that the output is truncated, reporting it as a bug.
|
https://github.com/dagger/dagger/issues/5077
|
https://github.com/dagger/dagger/pull/5163
|
7d8738d64889572fd5ac7d9930c2f16b4c3629d2
|
e0fecd2682e63b5c0fb18a18e77f4ea001bf6219
| 2023-05-02T21:11:43Z |
go
| 2023-05-22T21:21:17Z |
core/integration/container_test.go
|
WithWorkdir struct {
WithExec struct {
Stdout string
}
}
}
}
}{}
err := testutil.Query(
`{
container {
from(address: "alpine:3.16.2") {
withWorkdir(path: "/usr") {
withExec(args: ["pwd"]) {
stdout
}
}
}
}
}`, &res, nil)
require.NoError(t, err)
require.Equal(t, res.Container.From.WithWorkdir.WithExec.Stdout, "/usr\n")
}
func TestContainerExecWithUser(t *testing.T) {
t.Parallel()
res := struct {
Container struct {
From struct {
User string
WithUser struct {
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 5,077 |
Add `(truncated output)` to stdout/stderr errors
|
@helderco mentioned:
> Can we append some notice like "truncated output"? Multiple users have been confused that the output is truncated, reporting it as a bug.
|
https://github.com/dagger/dagger/issues/5077
|
https://github.com/dagger/dagger/pull/5163
|
7d8738d64889572fd5ac7d9930c2f16b4c3629d2
|
e0fecd2682e63b5c0fb18a18e77f4ea001bf6219
| 2023-05-02T21:11:43Z |
go
| 2023-05-22T21:21:17Z |
core/integration/container_test.go
|
User string
WithExec struct {
Stdout string
}
}
}
}
}{}
t.Run("user name", func(t *testing.T) {
err := testutil.Query(
`{
container {
from(address: "alpine:3.16.2") {
user
withUser(name: "daemon") {
user
withExec(args: ["whoami"]) {
stdout
}
}
}
}
}`, &res, nil)
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.WithExec.Stdout)
})
t.Run("user and group name", func(t *testing.T) {
err := testutil.Query(
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 5,077 |
Add `(truncated output)` to stdout/stderr errors
|
@helderco mentioned:
> Can we append some notice like "truncated output"? Multiple users have been confused that the output is truncated, reporting it as a bug.
|
https://github.com/dagger/dagger/issues/5077
|
https://github.com/dagger/dagger/pull/5163
|
7d8738d64889572fd5ac7d9930c2f16b4c3629d2
|
e0fecd2682e63b5c0fb18a18e77f4ea001bf6219
| 2023-05-02T21:11:43Z |
go
| 2023-05-22T21:21:17Z |
core/integration/container_test.go
|
`{
container {
from(address: "alpine:3.16.2") {
user
withUser(name: "daemon:floppy") {
user
withExec(args: ["sh", "-c", "whoami; groups"]) {
stdout
}
}
}
}
}`, &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.WithExec.Stdout)
})
t.Run("user ID", func(t *testing.T) {
err := testutil.Query(
`{
container {
from(address: "alpine:3.16.2") {
user
withUser(name: "2") {
user
withExec(args: ["whoami"]) {
stdout
}
}
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 5,077 |
Add `(truncated output)` to stdout/stderr errors
|
@helderco mentioned:
> Can we append some notice like "truncated output"? Multiple users have been confused that the output is truncated, reporting it as a bug.
|
https://github.com/dagger/dagger/issues/5077
|
https://github.com/dagger/dagger/pull/5163
|
7d8738d64889572fd5ac7d9930c2f16b4c3629d2
|
e0fecd2682e63b5c0fb18a18e77f4ea001bf6219
| 2023-05-02T21:11:43Z |
go
| 2023-05-22T21:21:17Z |
core/integration/container_test.go
|
}
}
}`, &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.WithExec.Stdout)
})
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
withExec(args: ["sh", "-c", "whoami; groups"]) {
stdout
}
}
}
}
}`, &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.WithExec.Stdout)
})
}
func TestContainerExecWithEntrypoint(t *testing.T) {
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 5,077 |
Add `(truncated output)` to stdout/stderr errors
|
@helderco mentioned:
> Can we append some notice like "truncated output"? Multiple users have been confused that the output is truncated, reporting it as a bug.
|
https://github.com/dagger/dagger/issues/5077
|
https://github.com/dagger/dagger/pull/5163
|
7d8738d64889572fd5ac7d9930c2f16b4c3629d2
|
e0fecd2682e63b5c0fb18a18e77f4ea001bf6219
| 2023-05-02T21:11:43Z |
go
| 2023-05-22T21:21:17Z |
core/integration/container_test.go
|
t.Parallel()
c, ctx := connect(t)
defer c.Close()
base := c.Container().From("alpine:3.16.2")
before, err := base.Entrypoint(ctx)
require.NoError(t, err)
require.Empty(t, before)
withEntry := base.WithEntrypoint([]string{"sh"})
after, err := withEntry.Entrypoint(ctx)
require.NoError(t, err)
require.Equal(t, []string{"sh"}, after)
used, err := withEntry.WithExec([]string{"-c", "echo $HOME"}).Stdout(ctx)
require.NoError(t, err)
require.Equal(t, "/root\n", used)
_, err = withEntry.WithExec([]string{"sh", "-c", "echo $HOME"}).Sync(ctx)
require.Error(t, err)
skipped, err := withEntry.WithExec([]string{"sh", "-c", "echo $HOME"}, dagger.ContainerWithExecOpts{
SkipEntrypoint: true,
}).Stdout(ctx)
require.NoError(t, err)
require.Equal(t, "/root\n", skipped)
withoutEntry := withEntry.WithEntrypoint(nil)
removed, err := withoutEntry.Entrypoint(ctx)
require.NoError(t, err)
require.Empty(t, removed)
}
func TestContainerWithDefaultArgs(t *testing.T) {
t.Parallel()
res := struct {
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 5,077 |
Add `(truncated output)` to stdout/stderr errors
|
@helderco mentioned:
> Can we append some notice like "truncated output"? Multiple users have been confused that the output is truncated, reporting it as a bug.
|
https://github.com/dagger/dagger/issues/5077
|
https://github.com/dagger/dagger/pull/5163
|
7d8738d64889572fd5ac7d9930c2f16b4c3629d2
|
e0fecd2682e63b5c0fb18a18e77f4ea001bf6219
| 2023-05-02T21:11:43Z |
go
| 2023-05-22T21:21:17Z |
core/integration/container_test.go
|
Container struct {
From struct {
Entrypoint []string
DefaultArgs []string
WithExec struct {
Stdout string
}
WithDefaultArgs struct {
Entrypoint []string
DefaultArgs []string
}
WithEntrypoint struct {
Entrypoint []string
DefaultArgs []string
WithExec struct {
Stdout string
}
WithDefaultArgs struct {
Entrypoint []string
DefaultArgs []string
WithExec struct {
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 5,077 |
Add `(truncated output)` to stdout/stderr errors
|
@helderco mentioned:
> Can we append some notice like "truncated output"? Multiple users have been confused that the output is truncated, reporting it as a bug.
|
https://github.com/dagger/dagger/issues/5077
|
https://github.com/dagger/dagger/pull/5163
|
7d8738d64889572fd5ac7d9930c2f16b4c3629d2
|
e0fecd2682e63b5c0fb18a18e77f4ea001bf6219
| 2023-05-02T21:11:43Z |
go
| 2023-05-22T21:21:17Z |
core/integration/container_test.go
|
Stdout string
}
}
}
}
}
}{}
err := testutil.Query(
`{
container {
from(address: "alpine:3.16.2") {
entrypoint
defaultArgs
withDefaultArgs {
entrypoint
defaultArgs
}
withEntrypoint(args: ["sh", "-c"]) {
entrypoint
defaultArgs
withExec(args: ["echo $HOME"]) {
stdout
}
withDefaultArgs(args: ["id"]) {
entrypoint
defaultArgs
withExec(args: []) {
stdout
}
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 5,077 |
Add `(truncated output)` to stdout/stderr errors
|
@helderco mentioned:
> Can we append some notice like "truncated output"? Multiple users have been confused that the output is truncated, reporting it as a bug.
|
https://github.com/dagger/dagger/issues/5077
|
https://github.com/dagger/dagger/pull/5163
|
7d8738d64889572fd5ac7d9930c2f16b4c3629d2
|
e0fecd2682e63b5c0fb18a18e77f4ea001bf6219
| 2023-05-02T21:11:43Z |
go
| 2023-05-22T21:21:17Z |
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.WithExec.Stdout)
})
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.WithExec.Stdout)
})
}
func TestContainerExecWithEnvVariable(t *testing.T) {
t.Parallel()
res := struct {
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 5,077 |
Add `(truncated output)` to stdout/stderr errors
|
@helderco mentioned:
> Can we append some notice like "truncated output"? Multiple users have been confused that the output is truncated, reporting it as a bug.
|
https://github.com/dagger/dagger/issues/5077
|
https://github.com/dagger/dagger/pull/5163
|
7d8738d64889572fd5ac7d9930c2f16b4c3629d2
|
e0fecd2682e63b5c0fb18a18e77f4ea001bf6219
| 2023-05-02T21:11:43Z |
go
| 2023-05-22T21:21:17Z |
core/integration/container_test.go
|
Container struct {
From struct {
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 5,077 |
Add `(truncated output)` to stdout/stderr errors
|
@helderco mentioned:
> Can we append some notice like "truncated output"? Multiple users have been confused that the output is truncated, reporting it as a bug.
|
https://github.com/dagger/dagger/issues/5077
|
https://github.com/dagger/dagger/pull/5163
|
7d8738d64889572fd5ac7d9930c2f16b4c3629d2
|
e0fecd2682e63b5c0fb18a18e77f4ea001bf6219
| 2023-05-02T21:11:43Z |
go
| 2023-05-22T21:21:17Z |
core/integration/container_test.go
|
WithEnvVariable struct {
WithExec struct {
Stdout string
}
}
}
}
}{}
err := testutil.Query(
`{
container {
from(address: "alpine:3.16.2") {
withEnvVariable(name: "FOO", value: "bar") {
withExec(args: ["env"]) {
stdout
}
}
}
}
}`, &res, nil)
require.NoError(t, err)
require.Contains(t, res.Container.From.WithEnvVariable.WithExec.Stdout, "FOO=bar\n")
}
func TestContainerVariables(t *testing.T) {
t.Parallel()
res := struct {
Container struct {
From struct {
EnvVariables []schema.EnvVariable
WithExec struct {
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 5,077 |
Add `(truncated output)` to stdout/stderr errors
|
@helderco mentioned:
> Can we append some notice like "truncated output"? Multiple users have been confused that the output is truncated, reporting it as a bug.
|
https://github.com/dagger/dagger/issues/5077
|
https://github.com/dagger/dagger/pull/5163
|
7d8738d64889572fd5ac7d9930c2f16b4c3629d2
|
e0fecd2682e63b5c0fb18a18e77f4ea001bf6219
| 2023-05-02T21:11:43Z |
go
| 2023-05-22T21:21:17Z |
core/integration/container_test.go
|
Stdout string
}
}
}
}{}
err := testutil.Query(
`{
container {
from(address: "golang:1.18.2-alpine") {
envVariables {
name
value
}
withExec(args: ["env"]) {
stdout
}
}
}
}`, &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.WithExec.Stdout, "GOPATH=/go\n")
}
func TestContainerVariable(t *testing.T) {
t.Parallel()
res := struct {
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 5,077 |
Add `(truncated output)` to stdout/stderr errors
|
@helderco mentioned:
> Can we append some notice like "truncated output"? Multiple users have been confused that the output is truncated, reporting it as a bug.
|
https://github.com/dagger/dagger/issues/5077
|
https://github.com/dagger/dagger/pull/5163
|
7d8738d64889572fd5ac7d9930c2f16b4c3629d2
|
e0fecd2682e63b5c0fb18a18e77f4ea001bf6219
| 2023-05-02T21:11:43Z |
go
| 2023-05-22T21:21:17Z |
core/integration/container_test.go
|
Container struct {
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) {
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 5,077 |
Add `(truncated output)` to stdout/stderr errors
|
@helderco mentioned:
> Can we append some notice like "truncated output"? Multiple users have been confused that the output is truncated, reporting it as a bug.
|
https://github.com/dagger/dagger/issues/5077
|
https://github.com/dagger/dagger/pull/5163
|
7d8738d64889572fd5ac7d9930c2f16b4c3629d2
|
e0fecd2682e63b5c0fb18a18e77f4ea001bf6219
| 2023-05-02T21:11:43Z |
go
| 2023-05-22T21:21:17Z |
core/integration/container_test.go
|
t.Parallel()
res := struct {
Container struct {
From struct {
WithoutEnvVariable struct {
EnvVariables []schema.EnvVariable
WithExec struct {
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 5,077 |
Add `(truncated output)` to stdout/stderr errors
|
@helderco mentioned:
> Can we append some notice like "truncated output"? Multiple users have been confused that the output is truncated, reporting it as a bug.
|
https://github.com/dagger/dagger/issues/5077
|
https://github.com/dagger/dagger/pull/5163
|
7d8738d64889572fd5ac7d9930c2f16b4c3629d2
|
e0fecd2682e63b5c0fb18a18e77f4ea001bf6219
| 2023-05-02T21:11:43Z |
go
| 2023-05-22T21:21:17Z |
core/integration/container_test.go
|
Stdout string
}
}
}
}
}{}
err := testutil.Query(
`{
container {
from(address: "golang:1.18.2-alpine") {
withoutEnvVariable(name: "GOLANG_VERSION") {
envVariables {
name
value
}
withExec(args: ["env"]) {
stdout
}
}
}
}
}`, &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.WithExec.Stdout, "GOLANG_VERSION")
}
func TestContainerEnvVariablesReplace(t *testing.T) {
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 5,077 |
Add `(truncated output)` to stdout/stderr errors
|
@helderco mentioned:
> Can we append some notice like "truncated output"? Multiple users have been confused that the output is truncated, reporting it as a bug.
|
https://github.com/dagger/dagger/issues/5077
|
https://github.com/dagger/dagger/pull/5163
|
7d8738d64889572fd5ac7d9930c2f16b4c3629d2
|
e0fecd2682e63b5c0fb18a18e77f4ea001bf6219
| 2023-05-02T21:11:43Z |
go
| 2023-05-22T21:21:17Z |
core/integration/container_test.go
|
t.Parallel()
res := struct {
Container struct {
From struct {
WithEnvVariable struct {
EnvVariables []schema.EnvVariable
WithExec struct {
Stdout string
}
}
}
}
}{}
err := testutil.Query(
`{
container {
from(address: "golang:1.18.2-alpine") {
withEnvVariable(name: "GOPATH", value: "/gone") {
envVariables {
name
value
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 5,077 |
Add `(truncated output)` to stdout/stderr errors
|
@helderco mentioned:
> Can we append some notice like "truncated output"? Multiple users have been confused that the output is truncated, reporting it as a bug.
|
https://github.com/dagger/dagger/issues/5077
|
https://github.com/dagger/dagger/pull/5163
|
7d8738d64889572fd5ac7d9930c2f16b4c3629d2
|
e0fecd2682e63b5c0fb18a18e77f4ea001bf6219
| 2023-05-02T21:11:43Z |
go
| 2023-05-22T21:21:17Z |
core/integration/container_test.go
|
}
withExec(args: ["env"]) {
stdout
}
}
}
}
}`, &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.WithExec.Stdout, "GOPATH=/gone\n")
}
func TestContainerLabel(t *testing.T) {
ctx := context.Background()
c, err := dagger.Connect(ctx)
require.NoError(t, err)
defer c.Close()
t.Run("container with new label", func(t *testing.T) {
label, err := c.Container().From("alpine:3.16.2").WithLabel("FOO", "BAR").Label(ctx, "FOO")
require.NoError(t, err)
require.Contains(t, label, "BAR")
})
t.Run("container labels", func(t *testing.T) {
res := struct {
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 5,077 |
Add `(truncated output)` to stdout/stderr errors
|
@helderco mentioned:
> Can we append some notice like "truncated output"? Multiple users have been confused that the output is truncated, reporting it as a bug.
|
https://github.com/dagger/dagger/issues/5077
|
https://github.com/dagger/dagger/pull/5163
|
7d8738d64889572fd5ac7d9930c2f16b4c3629d2
|
e0fecd2682e63b5c0fb18a18e77f4ea001bf6219
| 2023-05-02T21:11:43Z |
go
| 2023-05-22T21:21:17Z |
core/integration/container_test.go
|
Container struct {
From struct {
Labels []schema.Label
}
}
}{}
err := testutil.Query(
`{
container {
from(address: "nginx") {
labels {
name
value
}
}
}
}`, &res, nil)
require.NoError(t, err)
require.Equal(t, []schema.Label{
{Name: "maintainer", Value: "NGINX Docker Maintainers <[email protected]>"},
}, res.Container.From.Labels)
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 5,077 |
Add `(truncated output)` to stdout/stderr errors
|
@helderco mentioned:
> Can we append some notice like "truncated output"? Multiple users have been confused that the output is truncated, reporting it as a bug.
|
https://github.com/dagger/dagger/issues/5077
|
https://github.com/dagger/dagger/pull/5163
|
7d8738d64889572fd5ac7d9930c2f16b4c3629d2
|
e0fecd2682e63b5c0fb18a18e77f4ea001bf6219
| 2023-05-02T21:11:43Z |
go
| 2023-05-22T21:21:17Z |
core/integration/container_test.go
|
})
t.Run("container without label", func(t *testing.T) {
label, err := c.Container().From("nginx").WithoutLabel("maintainer").Label(ctx, "maintainer")
require.NoError(t, err)
require.Empty(t, label)
})
t.Run("container replace label", func(t *testing.T) {
label, err := c.Container().From("nginx").WithLabel("maintainer", "bar").Label(ctx, "maintainer")
require.NoError(t, err)
require.Contains(t, label, "bar")
})
t.Run("container with new label - nil panics", func(t *testing.T) {
label, err := c.Container().WithLabel("FOO", "BAR").Label(ctx, "FOO")
require.NoError(t, err)
require.Contains(t, label, "BAR")
})
t.Run("container label - nil panics", func(t *testing.T) {
label, err := c.Container().Label(ctx, "FOO")
require.NoError(t, err)
require.Empty(t, label)
})
t.Run("container without label - nil panics", func(t *testing.T) {
label, err := c.Container().WithoutLabel("maintainer").Label(ctx, "maintainer")
require.NoError(t, err)
require.Empty(t, label)
})
t.Run("container labels - nil panics", func(t *testing.T) {
res := struct {
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 5,077 |
Add `(truncated output)` to stdout/stderr errors
|
@helderco mentioned:
> Can we append some notice like "truncated output"? Multiple users have been confused that the output is truncated, reporting it as a bug.
|
https://github.com/dagger/dagger/issues/5077
|
https://github.com/dagger/dagger/pull/5163
|
7d8738d64889572fd5ac7d9930c2f16b4c3629d2
|
e0fecd2682e63b5c0fb18a18e77f4ea001bf6219
| 2023-05-02T21:11:43Z |
go
| 2023-05-22T21:21:17Z |
core/integration/container_test.go
|
Container struct {
From struct {
Labels []schema.Label
}
}
}{}
err := testutil.Query(
`{
container {
labels {
name
value
}
}
}`, &res, nil)
require.NoError(t, err)
require.Empty(t, res.Container.From.Labels)
})
}
func TestContainerWorkdir(t *testing.T) {
t.Parallel()
res := struct {
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 5,077 |
Add `(truncated output)` to stdout/stderr errors
|
@helderco mentioned:
> Can we append some notice like "truncated output"? Multiple users have been confused that the output is truncated, reporting it as a bug.
|
https://github.com/dagger/dagger/issues/5077
|
https://github.com/dagger/dagger/pull/5163
|
7d8738d64889572fd5ac7d9930c2f16b4c3629d2
|
e0fecd2682e63b5c0fb18a18e77f4ea001bf6219
| 2023-05-02T21:11:43Z |
go
| 2023-05-22T21:21:17Z |
core/integration/container_test.go
|
Container struct {
From struct {
Workdir string
WithExec struct {
Stdout string
}
}
}
}{}
err := testutil.Query(
`{
container {
from(address: "golang:1.18.2-alpine") {
workdir
withExec(args: ["pwd"]) {
stdout
}
}
}
}`, &res, nil)
require.NoError(t, err)
require.Equal(t, res.Container.From.Workdir, "/go")
require.Equal(t, res.Container.From.WithExec.Stdout, "/go\n")
}
func TestContainerWithWorkdir(t *testing.T) {
t.Parallel()
res := struct {
Container struct {
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 5,077 |
Add `(truncated output)` to stdout/stderr errors
|
@helderco mentioned:
> Can we append some notice like "truncated output"? Multiple users have been confused that the output is truncated, reporting it as a bug.
|
https://github.com/dagger/dagger/issues/5077
|
https://github.com/dagger/dagger/pull/5163
|
7d8738d64889572fd5ac7d9930c2f16b4c3629d2
|
e0fecd2682e63b5c0fb18a18e77f4ea001bf6219
| 2023-05-02T21:11:43Z |
go
| 2023-05-22T21:21:17Z |
core/integration/container_test.go
|
From struct {
WithWorkdir struct {
Workdir string
WithExec struct {
Stdout string
}
}
}
}
}{}
err := testutil.Query(
`{
container {
from(address: "golang:1.18.2-alpine") {
withWorkdir(path: "/usr") {
workdir
withExec(args: ["pwd"]) {
stdout
}
}
}
}
}`, &res, nil)
require.NoError(t, err)
require.Equal(t, res.Container.From.WithWorkdir.Workdir, "/usr")
require.Equal(t, res.Container.From.WithWorkdir.WithExec.Stdout, "/usr\n")
}
func TestContainerWithMountedDirectory(t *testing.T) {
t.Parallel()
dirRes := struct {
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 5,077 |
Add `(truncated output)` to stdout/stderr errors
|
@helderco mentioned:
> Can we append some notice like "truncated output"? Multiple users have been confused that the output is truncated, reporting it as a bug.
|
https://github.com/dagger/dagger/issues/5077
|
https://github.com/dagger/dagger/pull/5163
|
7d8738d64889572fd5ac7d9930c2f16b4c3629d2
|
e0fecd2682e63b5c0fb18a18e77f4ea001bf6219
| 2023-05-02T21:11:43Z |
go
| 2023-05-22T21:21:17Z |
core/integration/container_test.go
|
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 {
Container struct {
From struct {
WithMountedDirectory struct {
WithExec struct {
Stdout string
WithExec struct {
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 5,077 |
Add `(truncated output)` to stdout/stderr errors
|
@helderco mentioned:
> Can we append some notice like "truncated output"? Multiple users have been confused that the output is truncated, reporting it as a bug.
|
https://github.com/dagger/dagger/issues/5077
|
https://github.com/dagger/dagger/pull/5163
|
7d8738d64889572fd5ac7d9930c2f16b4c3629d2
|
e0fecd2682e63b5c0fb18a18e77f4ea001bf6219
| 2023-05-02T21:11:43Z |
go
| 2023-05-22T21:21:17Z |
core/integration/container_test.go
|
Stdout string
}
}
}
}
}
}{}
err = testutil.Query(
`query Test($id: DirectoryID!) {
container {
from(address: "alpine:3.16.2") {
withMountedDirectory(path: "/mnt", source: $id) {
withExec(args: ["cat", "/mnt/some-file"]) {
stdout
withExec(args: ["cat", "/mnt/some-dir/sub-file"]) {
stdout
}
}
}
}
}
}`, &execRes, &testutil.QueryOptions{Variables: map[string]any{
"id": id,
}})
require.NoError(t, err)
require.Equal(t, "some-content", execRes.Container.From.WithMountedDirectory.WithExec.Stdout)
require.Equal(t, "sub-content", execRes.Container.From.WithMountedDirectory.WithExec.WithExec.Stdout)
}
func TestContainerWithMountedDirectorySourcePath(t *testing.T) {
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 5,077 |
Add `(truncated output)` to stdout/stderr errors
|
@helderco mentioned:
> Can we append some notice like "truncated output"? Multiple users have been confused that the output is truncated, reporting it as a bug.
|
https://github.com/dagger/dagger/issues/5077
|
https://github.com/dagger/dagger/pull/5163
|
7d8738d64889572fd5ac7d9930c2f16b4c3629d2
|
e0fecd2682e63b5c0fb18a18e77f4ea001bf6219
| 2023-05-02T21:11:43Z |
go
| 2023-05-22T21:21:17Z |
core/integration/container_test.go
|
t.Parallel()
dirRes := struct {
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 5,077 |
Add `(truncated output)` to stdout/stderr errors
|
@helderco mentioned:
> Can we append some notice like "truncated output"? Multiple users have been confused that the output is truncated, reporting it as a bug.
|
https://github.com/dagger/dagger/issues/5077
|
https://github.com/dagger/dagger/pull/5163
|
7d8738d64889572fd5ac7d9930c2f16b4c3629d2
|
e0fecd2682e63b5c0fb18a18e77f4ea001bf6219
| 2023-05-02T21:11:43Z |
go
| 2023-05-22T21:21:17Z |
core/integration/container_test.go
|
Directory struct {
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 {
WithExec struct {
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 5,077 |
Add `(truncated output)` to stdout/stderr errors
|
@helderco mentioned:
> Can we append some notice like "truncated output"? Multiple users have been confused that the output is truncated, reporting it as a bug.
|
https://github.com/dagger/dagger/issues/5077
|
https://github.com/dagger/dagger/pull/5163
|
7d8738d64889572fd5ac7d9930c2f16b4c3629d2
|
e0fecd2682e63b5c0fb18a18e77f4ea001bf6219
| 2023-05-02T21:11:43Z |
go
| 2023-05-22T21:21:17Z |
core/integration/container_test.go
|
WithExec struct {
Stdout string
}
}
}
}
}
}{}
err = testutil.Query(
`query Test($id: DirectoryID!) {
container {
from(address: "alpine:3.16.2") {
withMountedDirectory(path: "/mnt", source: $id) {
withExec(args: ["sh", "-c", "echo >> /mnt/sub-file; echo -n more-content >> /mnt/sub-file"]) {
withExec(args: ["cat", "/mnt/sub-file"]) {
stdout
}
}
}
}
}
}`, &execRes, &testutil.QueryOptions{Variables: map[string]any{
"id": id,
}})
require.NoError(t, err)
require.Equal(t, "sub-content\nmore-content", execRes.Container.From.WithMountedDirectory.WithExec.WithExec.Stdout)
}
func TestContainerWithMountedDirectoryPropagation(t *testing.T) {
t.Parallel()
dirRes := struct {
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 5,077 |
Add `(truncated output)` to stdout/stderr errors
|
@helderco mentioned:
> Can we append some notice like "truncated output"? Multiple users have been confused that the output is truncated, reporting it as a bug.
|
https://github.com/dagger/dagger/issues/5077
|
https://github.com/dagger/dagger/pull/5163
|
7d8738d64889572fd5ac7d9930c2f16b4c3629d2
|
e0fecd2682e63b5c0fb18a18e77f4ea001bf6219
| 2023-05-02T21:11:43Z |
go
| 2023-05-22T21:21:17Z |
core/integration/container_test.go
|
Directory struct {
WithNewFile struct {
ID core.DirectoryID
}
}
}{}
err := testutil.Query(
`{
directory {
withNewFile(path: "some-file", contents: "some-content") {
id
}
}
}`, &dirRes, nil, dagger.WithLogOutput(os.Stdout))
require.NoError(t, err)
id := dirRes.Directory.WithNewFile.ID
execRes := struct {
Container struct {
From struct {
WithMountedDirectory struct {
WithExec struct {
Stdout string
WithExec struct {
WithExec struct {
Stdout string
WithMountedDirectory struct {
WithExec struct {
Stdout string
WithExec struct {
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 5,077 |
Add `(truncated output)` to stdout/stderr errors
|
@helderco mentioned:
> Can we append some notice like "truncated output"? Multiple users have been confused that the output is truncated, reporting it as a bug.
|
https://github.com/dagger/dagger/issues/5077
|
https://github.com/dagger/dagger/pull/5163
|
7d8738d64889572fd5ac7d9930c2f16b4c3629d2
|
e0fecd2682e63b5c0fb18a18e77f4ea001bf6219
| 2023-05-02T21:11:43Z |
go
| 2023-05-22T21:21:17Z |
core/integration/container_test.go
|
Stdout string
}
}
}
}
}
}
}
}
}
}{}
err = testutil.Query(
`query Test($id: DirectoryID!) {
container {
from(address: "alpine:3.16.2") {
withMountedDirectory(path: "/mnt", source: $id) {
withExec(args: ["cat", "/mnt/some-file"]) {
# original content
stdout
withExec(args: ["sh", "-c", "echo >> /mnt/some-file; echo -n more-content >> /mnt/some-file"]) {
withExec(args: ["cat", "/mnt/some-file"]) {
# modified content should propagate
stdout
withMountedDirectory(path: "/mnt", source: $id) {
withExec(args: ["cat", "/mnt/some-file"]) {
# should be back to the original content
stdout
withExec(args: ["cat", "/mnt/some-file"]) {
# original content override should propagate
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 5,077 |
Add `(truncated output)` to stdout/stderr errors
|
@helderco mentioned:
> Can we append some notice like "truncated output"? Multiple users have been confused that the output is truncated, reporting it as a bug.
|
https://github.com/dagger/dagger/issues/5077
|
https://github.com/dagger/dagger/pull/5163
|
7d8738d64889572fd5ac7d9930c2f16b4c3629d2
|
e0fecd2682e63b5c0fb18a18e77f4ea001bf6219
| 2023-05-02T21:11:43Z |
go
| 2023-05-22T21:21:17Z |
core/integration/container_test.go
|
stdout
}
}
}
}
}
}
}
}
}
}`, &execRes, &testutil.QueryOptions{Variables: map[string]any{
"id": id,
}}, dagger.WithLogOutput(os.Stdout))
require.NoError(t, err)
require.Equal(t,
"some-content",
execRes.Container.From.WithMountedDirectory.WithExec.Stdout)
require.Equal(t,
"some-content\nmore-content",
execRes.Container.From.WithMountedDirectory.WithExec.WithExec.WithExec.Stdout)
require.Equal(t,
"some-content",
execRes.Container.From.WithMountedDirectory.WithExec.WithExec.WithExec.WithMountedDirectory.WithExec.Stdout)
require.Equal(t,
"some-content",
execRes.Container.From.WithMountedDirectory.WithExec.WithExec.WithExec.WithMountedDirectory.WithExec.WithExec.Stdout)
}
func TestContainerWithMountedFile(t *testing.T) {
t.Parallel()
dirRes := struct {
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 5,077 |
Add `(truncated output)` to stdout/stderr errors
|
@helderco mentioned:
> Can we append some notice like "truncated output"? Multiple users have been confused that the output is truncated, reporting it as a bug.
|
https://github.com/dagger/dagger/issues/5077
|
https://github.com/dagger/dagger/pull/5163
|
7d8738d64889572fd5ac7d9930c2f16b4c3629d2
|
e0fecd2682e63b5c0fb18a18e77f4ea001bf6219
| 2023-05-02T21:11:43Z |
go
| 2023-05-22T21:21:17Z |
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 {
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 5,077 |
Add `(truncated output)` to stdout/stderr errors
|
@helderco mentioned:
> Can we append some notice like "truncated output"? Multiple users have been confused that the output is truncated, reporting it as a bug.
|
https://github.com/dagger/dagger/issues/5077
|
https://github.com/dagger/dagger/pull/5163
|
7d8738d64889572fd5ac7d9930c2f16b4c3629d2
|
e0fecd2682e63b5c0fb18a18e77f4ea001bf6219
| 2023-05-02T21:11:43Z |
go
| 2023-05-22T21:21:17Z |
core/integration/container_test.go
|
From struct {
WithMountedFile struct {
WithExec struct {
Stdout string
}
}
}
}
}{}
err = testutil.Query(
`query Test($id: FileID!) {
container {
from(address: "alpine:3.16.2") {
withMountedFile(path: "/mnt/file", source: $id) {
withExec(args: ["cat", "/mnt/file"]) {
stdout
}
}
}
}
}`, &execRes, &testutil.QueryOptions{Variables: map[string]any{
"id": id,
}})
require.NoError(t, err)
require.Equal(t, "sub-content", execRes.Container.From.WithMountedFile.WithExec.Stdout)
}
func TestContainerWithMountedCache(t *testing.T) {
t.Parallel()
cacheID := newCache(t)
execRes := struct {
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 5,077 |
Add `(truncated output)` to stdout/stderr errors
|
@helderco mentioned:
> Can we append some notice like "truncated output"? Multiple users have been confused that the output is truncated, reporting it as a bug.
|
https://github.com/dagger/dagger/issues/5077
|
https://github.com/dagger/dagger/pull/5163
|
7d8738d64889572fd5ac7d9930c2f16b4c3629d2
|
e0fecd2682e63b5c0fb18a18e77f4ea001bf6219
| 2023-05-02T21:11:43Z |
go
| 2023-05-22T21:21:17Z |
core/integration/container_test.go
|
Container struct {
From struct {
WithEnvVariable struct {
WithMountedCache struct {
WithExec struct {
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 5,077 |
Add `(truncated output)` to stdout/stderr errors
|
@helderco mentioned:
> Can we append some notice like "truncated output"? Multiple users have been confused that the output is truncated, reporting it as a bug.
|
https://github.com/dagger/dagger/issues/5077
|
https://github.com/dagger/dagger/pull/5163
|
7d8738d64889572fd5ac7d9930c2f16b4c3629d2
|
e0fecd2682e63b5c0fb18a18e77f4ea001bf6219
| 2023-05-02T21:11:43Z |
go
| 2023-05-22T21:21:17Z |
core/integration/container_test.go
|
Stdout string
}
}
}
}
}
}{}
query := `query Test($cache: CacheID!, $rand: String!) {
container {
from(address: "alpine:3.16.2") {
withEnvVariable(name: "RAND", value: $rand) {
withMountedCache(path: "/mnt/cache", cache: $cache) {
withExec(args: ["sh", "-c", "echo $RAND >> /mnt/cache/file; cat /mnt/cache/file"]) {
stdout
}
}
}
}
}
}`
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.WithExec.Stdout)
rand2 := identity.NewID()
err = testutil.Query(query, &execRes, &testutil.QueryOptions{Variables: map[string]any{
"cache": cacheID,
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 5,077 |
Add `(truncated output)` to stdout/stderr errors
|
@helderco mentioned:
> Can we append some notice like "truncated output"? Multiple users have been confused that the output is truncated, reporting it as a bug.
|
https://github.com/dagger/dagger/issues/5077
|
https://github.com/dagger/dagger/pull/5163
|
7d8738d64889572fd5ac7d9930c2f16b4c3629d2
|
e0fecd2682e63b5c0fb18a18e77f4ea001bf6219
| 2023-05-02T21:11:43Z |
go
| 2023-05-22T21:21:17Z |
core/integration/container_test.go
|
"rand": rand2,
}})
require.NoError(t, err)
require.Equal(t, rand1+"\n"+rand2+"\n", execRes.Container.From.WithEnvVariable.WithMountedCache.WithExec.Stdout)
}
func TestContainerWithMountedCacheFromDirectory(t *testing.T) {
t.Parallel()
dirRes := struct {
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
| 5,077 |
Add `(truncated output)` to stdout/stderr errors
|
@helderco mentioned:
> Can we append some notice like "truncated output"? Multiple users have been confused that the output is truncated, reporting it as a bug.
|
https://github.com/dagger/dagger/issues/5077
|
https://github.com/dagger/dagger/pull/5163
|
7d8738d64889572fd5ac7d9930c2f16b4c3629d2
|
e0fecd2682e63b5c0fb18a18e77f4ea001bf6219
| 2023-05-02T21:11:43Z |
go
| 2023-05-22T21:21:17Z |
core/integration/container_test.go
|
Container struct {
From struct {
WithEnvVariable struct {
WithMountedCache struct {
WithExec struct {
Stdout string
}
}
}
}
}
}{}
query := `query Test($cache: CacheID!, $rand: String!, $init: DirectoryID!) {
container {
from(address: "alpine:3.16.2") {
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 5,077 |
Add `(truncated output)` to stdout/stderr errors
|
@helderco mentioned:
> Can we append some notice like "truncated output"? Multiple users have been confused that the output is truncated, reporting it as a bug.
|
https://github.com/dagger/dagger/issues/5077
|
https://github.com/dagger/dagger/pull/5163
|
7d8738d64889572fd5ac7d9930c2f16b4c3629d2
|
e0fecd2682e63b5c0fb18a18e77f4ea001bf6219
| 2023-05-02T21:11:43Z |
go
| 2023-05-22T21:21:17Z |
core/integration/container_test.go
|
withEnvVariable(name: "RAND", value: $rand) {
withMountedCache(path: "/mnt/cache", cache: $cache, source: $init) {
withExec(args: ["sh", "-c", "echo $RAND >> /mnt/cache/sub-file; cat /mnt/cache/sub-file"]) {
stdout
}
}
}
}
}
}`
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.WithExec.Stdout)
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.WithExec.Stdout)
}
func TestContainerWithMountedTemp(t *testing.T) {
t.Parallel()
execRes := struct {
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 5,077 |
Add `(truncated output)` to stdout/stderr errors
|
@helderco mentioned:
> Can we append some notice like "truncated output"? Multiple users have been confused that the output is truncated, reporting it as a bug.
|
https://github.com/dagger/dagger/issues/5077
|
https://github.com/dagger/dagger/pull/5163
|
7d8738d64889572fd5ac7d9930c2f16b4c3629d2
|
e0fecd2682e63b5c0fb18a18e77f4ea001bf6219
| 2023-05-02T21:11:43Z |
go
| 2023-05-22T21:21:17Z |
core/integration/container_test.go
|
Container struct {
From struct {
WithMountedTemp struct {
WithExec struct {
Stdout string
}
}
}
}
}{}
err := testutil.Query(`{
container {
from(address: "alpine:3.16.2") {
withMountedTemp(path: "/mnt/tmp") {
withExec(args: ["grep", "/mnt/tmp", "/proc/mounts"]) {
stdout
}
}
}
}
}`, &execRes, nil)
require.NoError(t, err)
require.Contains(t, execRes.Container.From.WithMountedTemp.WithExec.Stdout, "tmpfs /mnt/tmp tmpfs")
}
func TestContainerWithDirectory(t *testing.T) {
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 5,077 |
Add `(truncated output)` to stdout/stderr errors
|
@helderco mentioned:
> Can we append some notice like "truncated output"? Multiple users have been confused that the output is truncated, reporting it as a bug.
|
https://github.com/dagger/dagger/issues/5077
|
https://github.com/dagger/dagger/pull/5163
|
7d8738d64889572fd5ac7d9930c2f16b4c3629d2
|
e0fecd2682e63b5c0fb18a18e77f4ea001bf6219
| 2023-05-02T21:11:43Z |
go
| 2023-05-22T21:21:17Z |
core/integration/container_test.go
|
t.Parallel()
c, ctx := connect(t)
defer c.Close()
dir := c.Directory().
WithNewFile("some-file", "some-content").
WithNewFile("some-dir/sub-file", "sub-content").
Directory("some-dir")
ctr := c.Container().
From("alpine:3.16.2").
WithWorkdir("/workdir").
WithDirectory("with-dir", dir)
contents, err := ctr.WithExec([]string{"cat", "with-dir/sub-file"}).
Stdout(ctx)
require.NoError(t, err)
require.Equal(t, "sub-content", contents)
contents, err = ctr.WithExec([]string{"cat", "/workdir/with-dir/sub-file"}).
Stdout(ctx)
require.NoError(t, err)
require.Equal(t, "sub-content", contents)
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 5,077 |
Add `(truncated output)` to stdout/stderr errors
|
@helderco mentioned:
> Can we append some notice like "truncated output"? Multiple users have been confused that the output is truncated, reporting it as a bug.
|
https://github.com/dagger/dagger/issues/5077
|
https://github.com/dagger/dagger/pull/5163
|
7d8738d64889572fd5ac7d9930c2f16b4c3629d2
|
e0fecd2682e63b5c0fb18a18e77f4ea001bf6219
| 2023-05-02T21:11:43Z |
go
| 2023-05-22T21:21:17Z |
core/integration/container_test.go
|
mount := c.Directory().
WithNewFile("mounted-file", "mounted-content")
ctr = c.Container().
From("alpine:3.16.2").
WithWorkdir("/workdir").
WithMountedDirectory("mnt/mount", mount).
WithDirectory("mnt/mount/dst/with-dir", dir)
contents, err = ctr.WithExec([]string{"cat", "mnt/mount/mounted-file"}).
Stdout(ctx)
require.NoError(t, err)
require.Equal(t, "mounted-content", contents)
contents, err = ctr.WithExec([]string{"cat", "mnt/mount/dst/with-dir/sub-file"}).
Stdout(ctx)
require.NoError(t, err)
require.Equal(t, "sub-content", contents)
mnt := c.Directory().WithNewDirectory("/a/b/c")
ctr = c.Container().
From("alpine:3.16.2").
WithMountedDirectory("/mnt", mnt)
dir = c.Directory().
WithNewDirectory("/foo").
WithNewFile("/foo/some-file", "some-content")
ctr = ctr.WithDirectory("/mnt/a/b/foo", dir)
contents, err = ctr.WithExec([]string{"cat", "/mnt/a/b/foo/foo/some-file"}).
Stdout(ctx)
require.NoError(t, err)
require.Equal(t, "some-content", contents)
}
func TestContainerWithFile(t *testing.T) {
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 5,077 |
Add `(truncated output)` to stdout/stderr errors
|
@helderco mentioned:
> Can we append some notice like "truncated output"? Multiple users have been confused that the output is truncated, reporting it as a bug.
|
https://github.com/dagger/dagger/issues/5077
|
https://github.com/dagger/dagger/pull/5163
|
7d8738d64889572fd5ac7d9930c2f16b4c3629d2
|
e0fecd2682e63b5c0fb18a18e77f4ea001bf6219
| 2023-05-02T21:11:43Z |
go
| 2023-05-22T21:21:17Z |
core/integration/container_test.go
|
t.Parallel()
c, ctx := connect(t)
defer c.Close()
file := c.Directory().
WithNewFile("some-file", "some-content").
File("some-file")
ctr := c.Container().
From("alpine:3.16.2").
WithWorkdir("/workdir").
WithFile("target-file", file)
contents, err := ctr.WithExec([]string{"cat", "target-file"}).
Stdout(ctx)
require.NoError(t, err)
require.Equal(t, "some-content", contents)
contents, err = ctr.WithExec([]string{"cat", "/workdir/target-file"}).
Stdout(ctx)
require.NoError(t, err)
require.Equal(t, "some-content", contents)
}
func TestContainerWithNewFile(t *testing.T) {
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 5,077 |
Add `(truncated output)` to stdout/stderr errors
|
@helderco mentioned:
> Can we append some notice like "truncated output"? Multiple users have been confused that the output is truncated, reporting it as a bug.
|
https://github.com/dagger/dagger/issues/5077
|
https://github.com/dagger/dagger/pull/5163
|
7d8738d64889572fd5ac7d9930c2f16b4c3629d2
|
e0fecd2682e63b5c0fb18a18e77f4ea001bf6219
| 2023-05-02T21:11:43Z |
go
| 2023-05-22T21:21:17Z |
core/integration/container_test.go
|
t.Parallel()
c, ctx := connect(t)
defer c.Close()
ctr := c.Container().
From("alpine:3.16.2").
WithWorkdir("/workdir").
WithNewFile("some-file", dagger.ContainerWithNewFileOpts{
Contents: "some-content",
})
contents, err := ctr.WithExec([]string{"cat", "some-file"}).
Stdout(ctx)
require.NoError(t, err)
require.Equal(t, "some-content", contents)
contents, err = ctr.WithExec([]string{"cat", "/workdir/some-file"}).
Stdout(ctx)
require.NoError(t, err)
require.Equal(t, "some-content", contents)
}
func TestContainerMountsWithoutMount(t *testing.T) {
t.Parallel()
dirRes := struct {
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 5,077 |
Add `(truncated output)` to stdout/stderr errors
|
@helderco mentioned:
> Can we append some notice like "truncated output"? Multiple users have been confused that the output is truncated, reporting it as a bug.
|
https://github.com/dagger/dagger/issues/5077
|
https://github.com/dagger/dagger/pull/5163
|
7d8738d64889572fd5ac7d9930c2f16b4c3629d2
|
e0fecd2682e63b5c0fb18a18e77f4ea001bf6219
| 2023-05-02T21:11:43Z |
go
| 2023-05-22T21:21:17Z |
core/integration/container_test.go
|
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
| 5,077 |
Add `(truncated output)` to stdout/stderr errors
|
@helderco mentioned:
> Can we append some notice like "truncated output"? Multiple users have been confused that the output is truncated, reporting it as a bug.
|
https://github.com/dagger/dagger/issues/5077
|
https://github.com/dagger/dagger/pull/5163
|
7d8738d64889572fd5ac7d9930c2f16b4c3629d2
|
e0fecd2682e63b5c0fb18a18e77f4ea001bf6219
| 2023-05-02T21:11:43Z |
go
| 2023-05-22T21:21:17Z |
core/integration/container_test.go
|
Container struct {
From struct {
WithDirectory struct {
WithMountedTemp struct {
Mounts []string
WithMountedDirectory struct {
Mounts []string
WithExec struct {
Stdout string
WithoutMount struct {
Mounts []string
WithExec struct {
Stdout string
}
}
}
}
}
}
}
}
}{}
err = testutil.Query(
`query Test($id: DirectoryID!) {
container {
from(address: "alpine:3.16.2") {
|
closed
|
dagger/dagger
|
https://github.com/dagger/dagger
| 5,077 |
Add `(truncated output)` to stdout/stderr errors
|
@helderco mentioned:
> Can we append some notice like "truncated output"? Multiple users have been confused that the output is truncated, reporting it as a bug.
|
https://github.com/dagger/dagger/issues/5077
|
https://github.com/dagger/dagger/pull/5163
|
7d8738d64889572fd5ac7d9930c2f16b4c3629d2
|
e0fecd2682e63b5c0fb18a18e77f4ea001bf6219
| 2023-05-02T21:11:43Z |
go
| 2023-05-22T21:21:17Z |
core/integration/container_test.go
|
withDirectory(path: "/mnt/dir", directory: "") {
withMountedTemp(path: "/mnt/tmp") {
mounts
withMountedDirectory(path: "/mnt/dir", source: $id) {
mounts
withExec(args: ["ls", "/mnt/dir"]) {
stdout
withoutMount(path: "/mnt/dir") {
mounts
withExec(args: ["ls", "/mnt/dir"]) {
stdout
}
}
}
}
}
}
}
}
}`, &execRes, &testutil.QueryOptions{Variables: map[string]any{
"id": id,
}})
require.NoError(t, err)
require.Equal(t, []string{"/mnt/tmp"}, execRes.Container.From.WithDirectory.WithMountedTemp.Mounts)
require.Equal(t, []string{"/mnt/tmp", "/mnt/dir"}, execRes.Container.From.WithDirectory.WithMountedTemp.WithMountedDirectory.Mounts)
require.Equal(t, "some-dir\nsome-file\n", execRes.Container.From.WithDirectory.WithMountedTemp.WithMountedDirectory.WithExec.Stdout)
require.Equal(t, "", execRes.Container.From.WithDirectory.WithMountedTemp.WithMountedDirectory.WithExec.WithoutMount.WithExec.Stdout)
require.Equal(t, []string{"/mnt/tmp"}, execRes.Container.From.WithDirectory.WithMountedTemp.WithMountedDirectory.WithExec.WithoutMount.Mounts)
}
func TestContainerReplacedMounts(t *testing.T) {
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.