status
stringclasses
1 value
repo_name
stringclasses
31 values
repo_url
stringclasses
31 values
issue_id
int64
1
104k
title
stringlengths
4
233
body
stringlengths
0
186k
issue_url
stringlengths
38
56
pull_url
stringlengths
37
54
before_fix_sha
stringlengths
40
40
after_fix_sha
stringlengths
40
40
report_datetime
timestamp[us, tz=UTC]
language
stringclasses
5 values
commit_datetime
timestamp[us, tz=UTC]
updated_file
stringlengths
7
188
chunk_content
stringlengths
1
1.03M
closed
dagger/dagger
https://github.com/dagger/dagger
6,374
Update buildkit past ca71a44
Currently, we are stuck on the current version of buildkit, since https://github.com/moby/buildkit/pull/4347#issuecomment-1872217571 seems to have introduced a deadlock. To reproduce: update buildkit in `go.mod` to `ca71a446d9f4e31ca7c4fa30fb8fb8861b8b0117`, and run a large number of integration tests. The engine will lock up after some time - after sending `SIGUIT` to the engine, you can observe the stack trace: ``` goroutine 441 [sync.Mutex.Lock, 4 minutes]: runtime.gopark(0xc01d5ebbf0?, 0xc00aef48e1?, 0xc0?, 0xf?, 0xc017641870?) /usr/local/go/src/runtime/proc.go:398 +0xce fp=0xc017641790 sp=0xc017641770 pc=0x43e42e runtime.goparkunlock(...) /usr/local/go/src/runtime/proc.go:404 runtime.semacquire1(0xc01d77eb74, 0x0?, 0x3, 0x1, 0x21?) /usr/local/go/src/runtime/sema.go:160 +0x218 fp=0xc0176417f8 sp=0xc017641790 pc=0x44f918 sync.runtime_SemacquireMutex(0xffffffffffffffff?, 0x0?, 0xc00ed7c4b0?) /usr/local/go/src/runtime/sema.go:77 +0x25 fp=0xc017641830 sp=0xc0176417f8 pc=0x46d545 sync.(*Mutex).lockSlow(0xc01d77eb70) /usr/local/go/src/sync/mutex.go:171 +0x15d fp=0xc017641880 sp=0xc017641830 pc=0x488f1d sync.(*Mutex).Lock(...) /usr/local/go/src/sync/mutex.go:90 github.com/moby/buildkit/util/progress.(*MultiWriter).writeRawProgress(0xc01d77eb70, 0xc004bd6e00) /go/pkg/mod/github.com/moby/[email protected]/util/progress/multiwriter.go:91 +0x5c fp=0xc017641960 sp=0xc017641880 pc=0xcb537c github.com/moby/buildkit/util/progress.(*MultiWriter).WriteRawProgress(0xc01d77eb70?, 0xc004bd6e00?) /go/pkg/mod/github.com/moby/[email protected]/util/progress/multiwriter.go:87 +0xac fp=0xc017641a28 sp=0xc017641960 pc=0xcb516c github.com/moby/buildkit/util/progress.(*MultiWriter).writeRawProgress(0xc01dfe5da0, 0xc004bd6e00) /go/pkg/mod/github.com/moby/[email protected]/util/progress/multiwriter.go:95 +0x17e fp=0xc017641b08 sp=0xc017641a28 pc=0xcb549e github.com/moby/buildkit/util/progress.(*MultiWriter).WriteRawProgress(0xc01dfe5da0?, 0xc004bd6e00?) /go/pkg/mod/github.com/moby/[email protected]/util/progress/multiwriter.go:87 +0xac fp=0xc017641bd0 sp=0xc017641b08 pc=0xcb516c github.com/moby/buildkit/util/progress.(*MultiWriter).Add(0xc01d77eb70, {0x1f7e8b0?, 0xc01dfe5da0?}) /go/pkg/mod/github.com/moby/[email protected]/util/progress/multiwriter.go:46 +0x190 fp=0xc017641c60 sp=0xc017641bd0 pc=0xcb4d70 github.com/moby/buildkit/solver.(*state).setEdge(0xc01dfe3440, 0x2, 0xc003975a40, 0xc0165fcb40) /go/pkg/mod/github.com/moby/[email protected]/solver/jobs.go:178 +0x370 fp=0xc017641ce8 sp=0xc017641c60 pc=0xdef3f0 github.com/moby/buildkit/solver.(*Solver).setEdge(0xc0007071a0, {0xc003975a40?, {0x1f92360?, 0xc004bd6480?}}, 0xc003975a40) /go/pkg/mod/github.com/moby/[email protected]/solver/jobs.go:295 +0x125 fp=0xc017641d58 sp=0xc017641ce8 pc=0xdf0265 github.com/moby/buildkit/solver.(*scheduler).dispatch(0xc0002fc770, 0xc01356a140) /go/pkg/mod/github.com/moby/[email protected]/solver/scheduler.go:177 +0xbdb fp=0xc017641f68 sp=0xc017641d58 pc=0xdfe87b github.com/moby/buildkit/solver.(*scheduler).loop(0xc0002fc770) /go/pkg/mod/github.com/moby/[email protected]/solver/scheduler.go:104 +0x1d4 fp=0xc017641fc8 sp=0xc017641f68 pc=0xdfdb34 github.com/moby/buildkit/solver.newScheduler.func1() /go/pkg/mod/github.com/moby/[email protected]/solver/scheduler.go:35 +0x25 fp=0xc017641fe0 sp=0xc017641fc8 pc=0xdfd865 runtime.goexit() /usr/local/go/src/runtime/asm_amd64.s:1650 +0x1 fp=0xc017641fe8 sp=0xc017641fe0 pc=0x4715e1 created by github.com/moby/buildkit/solver.newScheduler in goroutine 1 /go/pkg/mod/github.com/moby/[email protected]/solver/scheduler.go:35 +0x22d ``` See https://github.com/dagger/dagger/pull/6169 for more information on when this was originally discovered. Next steps: - Wait until upstream PRs are merged :tada:
https://github.com/dagger/dagger/issues/6374
https://github.com/dagger/dagger/pull/6481
2aefe558d80c355fb6868145e79763ef73c0e6b9
faaa0d18ec2f8f4ddb425298e672c079869017e7
2024-01-08T18:47:15Z
go
2024-01-24T17:07:57Z
engine/buildkit/filesync.go
} mountable, err := ref.getMountable(ctx) if err != nil { return fmt.Errorf("failed to get mountable: %s", err) } mounter := snapshot.LocalMounter(mountable) mountPath, err := mounter.Mount() if err != nil { return fmt.Errorf("failed to mount: %s", err) } defer mounter.Unmount() mntFilePath, err := fs.RootPath(mountPath, filePath) if err != nil { return fmt.Errorf("failed to get root path: %s", err) } file, err := os.Open(mntFilePath) if err != nil { return fmt.Errorf("failed to open file: %s", err) } defer file.Close() stat, err := file.Stat() if err != nil { return fmt.Errorf("failed to stat file: %s", err) } clientMetadata, err := engine.ClientMetadataFromContext(ctx) if err != nil { return fmt.Errorf("failed to get requester session ID: %s", err) } ctx = engine.LocalExportOpts{ DestClientID: clientMetadata.ClientID,
closed
dagger/dagger
https://github.com/dagger/dagger
6,374
Update buildkit past ca71a44
Currently, we are stuck on the current version of buildkit, since https://github.com/moby/buildkit/pull/4347#issuecomment-1872217571 seems to have introduced a deadlock. To reproduce: update buildkit in `go.mod` to `ca71a446d9f4e31ca7c4fa30fb8fb8861b8b0117`, and run a large number of integration tests. The engine will lock up after some time - after sending `SIGUIT` to the engine, you can observe the stack trace: ``` goroutine 441 [sync.Mutex.Lock, 4 minutes]: runtime.gopark(0xc01d5ebbf0?, 0xc00aef48e1?, 0xc0?, 0xf?, 0xc017641870?) /usr/local/go/src/runtime/proc.go:398 +0xce fp=0xc017641790 sp=0xc017641770 pc=0x43e42e runtime.goparkunlock(...) /usr/local/go/src/runtime/proc.go:404 runtime.semacquire1(0xc01d77eb74, 0x0?, 0x3, 0x1, 0x21?) /usr/local/go/src/runtime/sema.go:160 +0x218 fp=0xc0176417f8 sp=0xc017641790 pc=0x44f918 sync.runtime_SemacquireMutex(0xffffffffffffffff?, 0x0?, 0xc00ed7c4b0?) /usr/local/go/src/runtime/sema.go:77 +0x25 fp=0xc017641830 sp=0xc0176417f8 pc=0x46d545 sync.(*Mutex).lockSlow(0xc01d77eb70) /usr/local/go/src/sync/mutex.go:171 +0x15d fp=0xc017641880 sp=0xc017641830 pc=0x488f1d sync.(*Mutex).Lock(...) /usr/local/go/src/sync/mutex.go:90 github.com/moby/buildkit/util/progress.(*MultiWriter).writeRawProgress(0xc01d77eb70, 0xc004bd6e00) /go/pkg/mod/github.com/moby/[email protected]/util/progress/multiwriter.go:91 +0x5c fp=0xc017641960 sp=0xc017641880 pc=0xcb537c github.com/moby/buildkit/util/progress.(*MultiWriter).WriteRawProgress(0xc01d77eb70?, 0xc004bd6e00?) /go/pkg/mod/github.com/moby/[email protected]/util/progress/multiwriter.go:87 +0xac fp=0xc017641a28 sp=0xc017641960 pc=0xcb516c github.com/moby/buildkit/util/progress.(*MultiWriter).writeRawProgress(0xc01dfe5da0, 0xc004bd6e00) /go/pkg/mod/github.com/moby/[email protected]/util/progress/multiwriter.go:95 +0x17e fp=0xc017641b08 sp=0xc017641a28 pc=0xcb549e github.com/moby/buildkit/util/progress.(*MultiWriter).WriteRawProgress(0xc01dfe5da0?, 0xc004bd6e00?) /go/pkg/mod/github.com/moby/[email protected]/util/progress/multiwriter.go:87 +0xac fp=0xc017641bd0 sp=0xc017641b08 pc=0xcb516c github.com/moby/buildkit/util/progress.(*MultiWriter).Add(0xc01d77eb70, {0x1f7e8b0?, 0xc01dfe5da0?}) /go/pkg/mod/github.com/moby/[email protected]/util/progress/multiwriter.go:46 +0x190 fp=0xc017641c60 sp=0xc017641bd0 pc=0xcb4d70 github.com/moby/buildkit/solver.(*state).setEdge(0xc01dfe3440, 0x2, 0xc003975a40, 0xc0165fcb40) /go/pkg/mod/github.com/moby/[email protected]/solver/jobs.go:178 +0x370 fp=0xc017641ce8 sp=0xc017641c60 pc=0xdef3f0 github.com/moby/buildkit/solver.(*Solver).setEdge(0xc0007071a0, {0xc003975a40?, {0x1f92360?, 0xc004bd6480?}}, 0xc003975a40) /go/pkg/mod/github.com/moby/[email protected]/solver/jobs.go:295 +0x125 fp=0xc017641d58 sp=0xc017641ce8 pc=0xdf0265 github.com/moby/buildkit/solver.(*scheduler).dispatch(0xc0002fc770, 0xc01356a140) /go/pkg/mod/github.com/moby/[email protected]/solver/scheduler.go:177 +0xbdb fp=0xc017641f68 sp=0xc017641d58 pc=0xdfe87b github.com/moby/buildkit/solver.(*scheduler).loop(0xc0002fc770) /go/pkg/mod/github.com/moby/[email protected]/solver/scheduler.go:104 +0x1d4 fp=0xc017641fc8 sp=0xc017641f68 pc=0xdfdb34 github.com/moby/buildkit/solver.newScheduler.func1() /go/pkg/mod/github.com/moby/[email protected]/solver/scheduler.go:35 +0x25 fp=0xc017641fe0 sp=0xc017641fc8 pc=0xdfd865 runtime.goexit() /usr/local/go/src/runtime/asm_amd64.s:1650 +0x1 fp=0xc017641fe8 sp=0xc017641fe0 pc=0x4715e1 created by github.com/moby/buildkit/solver.newScheduler in goroutine 1 /go/pkg/mod/github.com/moby/[email protected]/solver/scheduler.go:35 +0x22d ``` See https://github.com/dagger/dagger/pull/6169 for more information on when this was originally discovered. Next steps: - Wait until upstream PRs are merged :tada:
https://github.com/dagger/dagger/issues/6374
https://github.com/dagger/dagger/pull/6481
2aefe558d80c355fb6868145e79763ef73c0e6b9
faaa0d18ec2f8f4ddb425298e672c079869017e7
2024-01-08T18:47:15Z
go
2024-01-24T17:07:57Z
engine/buildkit/filesync.go
Path: destPath, IsFileStream: true, FileOriginalName: filepath.Base(filePath), AllowParentDirPath: allowParentDirPath, FileMode: stat.Mode().Perm(), }.AppendToOutgoingContext(ctx) clientCaller, err := c.SessionManager.Get(ctx, clientMetadata.ClientID, false) if err != nil { return fmt.Errorf("failed to get requester session: %s", err) } diffCopyClient, err := filesync.NewFileSendClient(clientCaller.Conn()).DiffCopy(ctx) if err != nil { return fmt.Errorf("failed to create diff copy client: %s", err) } defer diffCopyClient.CloseSend() fileSizeLeft := stat.Size() chunkSize := int64(MaxFileContentsChunkSize) for fileSizeLeft > 0 { buf := new(bytes.Buffer) n, err := io.CopyN(buf, file, chunkSize) if errors.Is(err, io.EOF) { err = nil } if err != nil { return fmt.Errorf("failed to read file: %s", err) } fileSizeLeft -= n err = diffCopyClient.SendMsg(&filesync.BytesMessage{Data: buf.Bytes()}) if errors.Is(err, io.EOF) { err := diffCopyClient.RecvMsg(struct{}{})
closed
dagger/dagger
https://github.com/dagger/dagger
6,374
Update buildkit past ca71a44
Currently, we are stuck on the current version of buildkit, since https://github.com/moby/buildkit/pull/4347#issuecomment-1872217571 seems to have introduced a deadlock. To reproduce: update buildkit in `go.mod` to `ca71a446d9f4e31ca7c4fa30fb8fb8861b8b0117`, and run a large number of integration tests. The engine will lock up after some time - after sending `SIGUIT` to the engine, you can observe the stack trace: ``` goroutine 441 [sync.Mutex.Lock, 4 minutes]: runtime.gopark(0xc01d5ebbf0?, 0xc00aef48e1?, 0xc0?, 0xf?, 0xc017641870?) /usr/local/go/src/runtime/proc.go:398 +0xce fp=0xc017641790 sp=0xc017641770 pc=0x43e42e runtime.goparkunlock(...) /usr/local/go/src/runtime/proc.go:404 runtime.semacquire1(0xc01d77eb74, 0x0?, 0x3, 0x1, 0x21?) /usr/local/go/src/runtime/sema.go:160 +0x218 fp=0xc0176417f8 sp=0xc017641790 pc=0x44f918 sync.runtime_SemacquireMutex(0xffffffffffffffff?, 0x0?, 0xc00ed7c4b0?) /usr/local/go/src/runtime/sema.go:77 +0x25 fp=0xc017641830 sp=0xc0176417f8 pc=0x46d545 sync.(*Mutex).lockSlow(0xc01d77eb70) /usr/local/go/src/sync/mutex.go:171 +0x15d fp=0xc017641880 sp=0xc017641830 pc=0x488f1d sync.(*Mutex).Lock(...) /usr/local/go/src/sync/mutex.go:90 github.com/moby/buildkit/util/progress.(*MultiWriter).writeRawProgress(0xc01d77eb70, 0xc004bd6e00) /go/pkg/mod/github.com/moby/[email protected]/util/progress/multiwriter.go:91 +0x5c fp=0xc017641960 sp=0xc017641880 pc=0xcb537c github.com/moby/buildkit/util/progress.(*MultiWriter).WriteRawProgress(0xc01d77eb70?, 0xc004bd6e00?) /go/pkg/mod/github.com/moby/[email protected]/util/progress/multiwriter.go:87 +0xac fp=0xc017641a28 sp=0xc017641960 pc=0xcb516c github.com/moby/buildkit/util/progress.(*MultiWriter).writeRawProgress(0xc01dfe5da0, 0xc004bd6e00) /go/pkg/mod/github.com/moby/[email protected]/util/progress/multiwriter.go:95 +0x17e fp=0xc017641b08 sp=0xc017641a28 pc=0xcb549e github.com/moby/buildkit/util/progress.(*MultiWriter).WriteRawProgress(0xc01dfe5da0?, 0xc004bd6e00?) /go/pkg/mod/github.com/moby/[email protected]/util/progress/multiwriter.go:87 +0xac fp=0xc017641bd0 sp=0xc017641b08 pc=0xcb516c github.com/moby/buildkit/util/progress.(*MultiWriter).Add(0xc01d77eb70, {0x1f7e8b0?, 0xc01dfe5da0?}) /go/pkg/mod/github.com/moby/[email protected]/util/progress/multiwriter.go:46 +0x190 fp=0xc017641c60 sp=0xc017641bd0 pc=0xcb4d70 github.com/moby/buildkit/solver.(*state).setEdge(0xc01dfe3440, 0x2, 0xc003975a40, 0xc0165fcb40) /go/pkg/mod/github.com/moby/[email protected]/solver/jobs.go:178 +0x370 fp=0xc017641ce8 sp=0xc017641c60 pc=0xdef3f0 github.com/moby/buildkit/solver.(*Solver).setEdge(0xc0007071a0, {0xc003975a40?, {0x1f92360?, 0xc004bd6480?}}, 0xc003975a40) /go/pkg/mod/github.com/moby/[email protected]/solver/jobs.go:295 +0x125 fp=0xc017641d58 sp=0xc017641ce8 pc=0xdf0265 github.com/moby/buildkit/solver.(*scheduler).dispatch(0xc0002fc770, 0xc01356a140) /go/pkg/mod/github.com/moby/[email protected]/solver/scheduler.go:177 +0xbdb fp=0xc017641f68 sp=0xc017641d58 pc=0xdfe87b github.com/moby/buildkit/solver.(*scheduler).loop(0xc0002fc770) /go/pkg/mod/github.com/moby/[email protected]/solver/scheduler.go:104 +0x1d4 fp=0xc017641fc8 sp=0xc017641f68 pc=0xdfdb34 github.com/moby/buildkit/solver.newScheduler.func1() /go/pkg/mod/github.com/moby/[email protected]/solver/scheduler.go:35 +0x25 fp=0xc017641fe0 sp=0xc017641fc8 pc=0xdfd865 runtime.goexit() /usr/local/go/src/runtime/asm_amd64.s:1650 +0x1 fp=0xc017641fe8 sp=0xc017641fe0 pc=0x4715e1 created by github.com/moby/buildkit/solver.newScheduler in goroutine 1 /go/pkg/mod/github.com/moby/[email protected]/solver/scheduler.go:35 +0x22d ``` See https://github.com/dagger/dagger/pull/6169 for more information on when this was originally discovered. Next steps: - Wait until upstream PRs are merged :tada:
https://github.com/dagger/dagger/issues/6374
https://github.com/dagger/dagger/pull/6481
2aefe558d80c355fb6868145e79763ef73c0e6b9
faaa0d18ec2f8f4ddb425298e672c079869017e7
2024-01-08T18:47:15Z
go
2024-01-24T17:07:57Z
engine/buildkit/filesync.go
if err != nil { return fmt.Errorf("diff copy client error: %s", err) } } else if err != nil { return fmt.Errorf("failed to send file chunk: %s", err) } } if err := diffCopyClient.CloseSend(); err != nil { return fmt.Errorf("failed to close send: %s", err) } var msg filesync.BytesMessage if err := diffCopyClient.RecvMsg(&msg); err != io.EOF { return fmt.Errorf("unexpected closing recv msg: %s", err) } return nil } func (c *Client) IOReaderExport(ctx context.Context, r io.Reader, destPath string, destMode os.FileMode) (rerr error) { ctx = bklog.WithLogger(ctx, bklog.G(ctx).WithField("export_path", destPath)) bklog.G(ctx).Debug("exporting bytes")
closed
dagger/dagger
https://github.com/dagger/dagger
6,374
Update buildkit past ca71a44
Currently, we are stuck on the current version of buildkit, since https://github.com/moby/buildkit/pull/4347#issuecomment-1872217571 seems to have introduced a deadlock. To reproduce: update buildkit in `go.mod` to `ca71a446d9f4e31ca7c4fa30fb8fb8861b8b0117`, and run a large number of integration tests. The engine will lock up after some time - after sending `SIGUIT` to the engine, you can observe the stack trace: ``` goroutine 441 [sync.Mutex.Lock, 4 minutes]: runtime.gopark(0xc01d5ebbf0?, 0xc00aef48e1?, 0xc0?, 0xf?, 0xc017641870?) /usr/local/go/src/runtime/proc.go:398 +0xce fp=0xc017641790 sp=0xc017641770 pc=0x43e42e runtime.goparkunlock(...) /usr/local/go/src/runtime/proc.go:404 runtime.semacquire1(0xc01d77eb74, 0x0?, 0x3, 0x1, 0x21?) /usr/local/go/src/runtime/sema.go:160 +0x218 fp=0xc0176417f8 sp=0xc017641790 pc=0x44f918 sync.runtime_SemacquireMutex(0xffffffffffffffff?, 0x0?, 0xc00ed7c4b0?) /usr/local/go/src/runtime/sema.go:77 +0x25 fp=0xc017641830 sp=0xc0176417f8 pc=0x46d545 sync.(*Mutex).lockSlow(0xc01d77eb70) /usr/local/go/src/sync/mutex.go:171 +0x15d fp=0xc017641880 sp=0xc017641830 pc=0x488f1d sync.(*Mutex).Lock(...) /usr/local/go/src/sync/mutex.go:90 github.com/moby/buildkit/util/progress.(*MultiWriter).writeRawProgress(0xc01d77eb70, 0xc004bd6e00) /go/pkg/mod/github.com/moby/[email protected]/util/progress/multiwriter.go:91 +0x5c fp=0xc017641960 sp=0xc017641880 pc=0xcb537c github.com/moby/buildkit/util/progress.(*MultiWriter).WriteRawProgress(0xc01d77eb70?, 0xc004bd6e00?) /go/pkg/mod/github.com/moby/[email protected]/util/progress/multiwriter.go:87 +0xac fp=0xc017641a28 sp=0xc017641960 pc=0xcb516c github.com/moby/buildkit/util/progress.(*MultiWriter).writeRawProgress(0xc01dfe5da0, 0xc004bd6e00) /go/pkg/mod/github.com/moby/[email protected]/util/progress/multiwriter.go:95 +0x17e fp=0xc017641b08 sp=0xc017641a28 pc=0xcb549e github.com/moby/buildkit/util/progress.(*MultiWriter).WriteRawProgress(0xc01dfe5da0?, 0xc004bd6e00?) /go/pkg/mod/github.com/moby/[email protected]/util/progress/multiwriter.go:87 +0xac fp=0xc017641bd0 sp=0xc017641b08 pc=0xcb516c github.com/moby/buildkit/util/progress.(*MultiWriter).Add(0xc01d77eb70, {0x1f7e8b0?, 0xc01dfe5da0?}) /go/pkg/mod/github.com/moby/[email protected]/util/progress/multiwriter.go:46 +0x190 fp=0xc017641c60 sp=0xc017641bd0 pc=0xcb4d70 github.com/moby/buildkit/solver.(*state).setEdge(0xc01dfe3440, 0x2, 0xc003975a40, 0xc0165fcb40) /go/pkg/mod/github.com/moby/[email protected]/solver/jobs.go:178 +0x370 fp=0xc017641ce8 sp=0xc017641c60 pc=0xdef3f0 github.com/moby/buildkit/solver.(*Solver).setEdge(0xc0007071a0, {0xc003975a40?, {0x1f92360?, 0xc004bd6480?}}, 0xc003975a40) /go/pkg/mod/github.com/moby/[email protected]/solver/jobs.go:295 +0x125 fp=0xc017641d58 sp=0xc017641ce8 pc=0xdf0265 github.com/moby/buildkit/solver.(*scheduler).dispatch(0xc0002fc770, 0xc01356a140) /go/pkg/mod/github.com/moby/[email protected]/solver/scheduler.go:177 +0xbdb fp=0xc017641f68 sp=0xc017641d58 pc=0xdfe87b github.com/moby/buildkit/solver.(*scheduler).loop(0xc0002fc770) /go/pkg/mod/github.com/moby/[email protected]/solver/scheduler.go:104 +0x1d4 fp=0xc017641fc8 sp=0xc017641f68 pc=0xdfdb34 github.com/moby/buildkit/solver.newScheduler.func1() /go/pkg/mod/github.com/moby/[email protected]/solver/scheduler.go:35 +0x25 fp=0xc017641fe0 sp=0xc017641fc8 pc=0xdfd865 runtime.goexit() /usr/local/go/src/runtime/asm_amd64.s:1650 +0x1 fp=0xc017641fe8 sp=0xc017641fe0 pc=0x4715e1 created by github.com/moby/buildkit/solver.newScheduler in goroutine 1 /go/pkg/mod/github.com/moby/[email protected]/solver/scheduler.go:35 +0x22d ``` See https://github.com/dagger/dagger/pull/6169 for more information on when this was originally discovered. Next steps: - Wait until upstream PRs are merged :tada:
https://github.com/dagger/dagger/issues/6374
https://github.com/dagger/dagger/pull/6481
2aefe558d80c355fb6868145e79763ef73c0e6b9
faaa0d18ec2f8f4ddb425298e672c079869017e7
2024-01-08T18:47:15Z
go
2024-01-24T17:07:57Z
engine/buildkit/filesync.go
defer func() { lg := bklog.G(ctx) if rerr != nil { lg = lg.WithError(rerr) } lg.Debug("finished exporting bytes") }() clientMetadata, err := engine.ClientMetadataFromContext(ctx) if err != nil { return fmt.Errorf("failed to get requester session ID: %s", err) } ctx = engine.LocalExportOpts{ DestClientID: clientMetadata.ClientID, Path: destPath, IsFileStream: true, FileOriginalName: filepath.Base(destPath), FileMode: destMode, }.AppendToOutgoingContext(ctx) clientCaller, err := c.SessionManager.Get(ctx, clientMetadata.ClientID, false) if err != nil { return fmt.Errorf("failed to get requester session: %s", err) } diffCopyClient, err := filesync.NewFileSendClient(clientCaller.Conn()).DiffCopy(ctx) if err != nil { return fmt.Errorf("failed to create diff copy client: %s", err) } defer diffCopyClient.CloseSend() chunkSize := int64(MaxFileContentsChunkSize) keepGoing := true for keepGoing {
closed
dagger/dagger
https://github.com/dagger/dagger
6,374
Update buildkit past ca71a44
Currently, we are stuck on the current version of buildkit, since https://github.com/moby/buildkit/pull/4347#issuecomment-1872217571 seems to have introduced a deadlock. To reproduce: update buildkit in `go.mod` to `ca71a446d9f4e31ca7c4fa30fb8fb8861b8b0117`, and run a large number of integration tests. The engine will lock up after some time - after sending `SIGUIT` to the engine, you can observe the stack trace: ``` goroutine 441 [sync.Mutex.Lock, 4 minutes]: runtime.gopark(0xc01d5ebbf0?, 0xc00aef48e1?, 0xc0?, 0xf?, 0xc017641870?) /usr/local/go/src/runtime/proc.go:398 +0xce fp=0xc017641790 sp=0xc017641770 pc=0x43e42e runtime.goparkunlock(...) /usr/local/go/src/runtime/proc.go:404 runtime.semacquire1(0xc01d77eb74, 0x0?, 0x3, 0x1, 0x21?) /usr/local/go/src/runtime/sema.go:160 +0x218 fp=0xc0176417f8 sp=0xc017641790 pc=0x44f918 sync.runtime_SemacquireMutex(0xffffffffffffffff?, 0x0?, 0xc00ed7c4b0?) /usr/local/go/src/runtime/sema.go:77 +0x25 fp=0xc017641830 sp=0xc0176417f8 pc=0x46d545 sync.(*Mutex).lockSlow(0xc01d77eb70) /usr/local/go/src/sync/mutex.go:171 +0x15d fp=0xc017641880 sp=0xc017641830 pc=0x488f1d sync.(*Mutex).Lock(...) /usr/local/go/src/sync/mutex.go:90 github.com/moby/buildkit/util/progress.(*MultiWriter).writeRawProgress(0xc01d77eb70, 0xc004bd6e00) /go/pkg/mod/github.com/moby/[email protected]/util/progress/multiwriter.go:91 +0x5c fp=0xc017641960 sp=0xc017641880 pc=0xcb537c github.com/moby/buildkit/util/progress.(*MultiWriter).WriteRawProgress(0xc01d77eb70?, 0xc004bd6e00?) /go/pkg/mod/github.com/moby/[email protected]/util/progress/multiwriter.go:87 +0xac fp=0xc017641a28 sp=0xc017641960 pc=0xcb516c github.com/moby/buildkit/util/progress.(*MultiWriter).writeRawProgress(0xc01dfe5da0, 0xc004bd6e00) /go/pkg/mod/github.com/moby/[email protected]/util/progress/multiwriter.go:95 +0x17e fp=0xc017641b08 sp=0xc017641a28 pc=0xcb549e github.com/moby/buildkit/util/progress.(*MultiWriter).WriteRawProgress(0xc01dfe5da0?, 0xc004bd6e00?) /go/pkg/mod/github.com/moby/[email protected]/util/progress/multiwriter.go:87 +0xac fp=0xc017641bd0 sp=0xc017641b08 pc=0xcb516c github.com/moby/buildkit/util/progress.(*MultiWriter).Add(0xc01d77eb70, {0x1f7e8b0?, 0xc01dfe5da0?}) /go/pkg/mod/github.com/moby/[email protected]/util/progress/multiwriter.go:46 +0x190 fp=0xc017641c60 sp=0xc017641bd0 pc=0xcb4d70 github.com/moby/buildkit/solver.(*state).setEdge(0xc01dfe3440, 0x2, 0xc003975a40, 0xc0165fcb40) /go/pkg/mod/github.com/moby/[email protected]/solver/jobs.go:178 +0x370 fp=0xc017641ce8 sp=0xc017641c60 pc=0xdef3f0 github.com/moby/buildkit/solver.(*Solver).setEdge(0xc0007071a0, {0xc003975a40?, {0x1f92360?, 0xc004bd6480?}}, 0xc003975a40) /go/pkg/mod/github.com/moby/[email protected]/solver/jobs.go:295 +0x125 fp=0xc017641d58 sp=0xc017641ce8 pc=0xdf0265 github.com/moby/buildkit/solver.(*scheduler).dispatch(0xc0002fc770, 0xc01356a140) /go/pkg/mod/github.com/moby/[email protected]/solver/scheduler.go:177 +0xbdb fp=0xc017641f68 sp=0xc017641d58 pc=0xdfe87b github.com/moby/buildkit/solver.(*scheduler).loop(0xc0002fc770) /go/pkg/mod/github.com/moby/[email protected]/solver/scheduler.go:104 +0x1d4 fp=0xc017641fc8 sp=0xc017641f68 pc=0xdfdb34 github.com/moby/buildkit/solver.newScheduler.func1() /go/pkg/mod/github.com/moby/[email protected]/solver/scheduler.go:35 +0x25 fp=0xc017641fe0 sp=0xc017641fc8 pc=0xdfd865 runtime.goexit() /usr/local/go/src/runtime/asm_amd64.s:1650 +0x1 fp=0xc017641fe8 sp=0xc017641fe0 pc=0x4715e1 created by github.com/moby/buildkit/solver.newScheduler in goroutine 1 /go/pkg/mod/github.com/moby/[email protected]/solver/scheduler.go:35 +0x22d ``` See https://github.com/dagger/dagger/pull/6169 for more information on when this was originally discovered. Next steps: - Wait until upstream PRs are merged :tada:
https://github.com/dagger/dagger/issues/6374
https://github.com/dagger/dagger/pull/6481
2aefe558d80c355fb6868145e79763ef73c0e6b9
faaa0d18ec2f8f4ddb425298e672c079869017e7
2024-01-08T18:47:15Z
go
2024-01-24T17:07:57Z
engine/buildkit/filesync.go
buf := new(bytes.Buffer) _, err := io.CopyN(buf, r, chunkSize) if errors.Is(err, io.EOF) { keepGoing = false err = nil } if err != nil { return fmt.Errorf("failed to read file: %s", err) } err = diffCopyClient.SendMsg(&filesync.BytesMessage{Data: buf.Bytes()}) if errors.Is(err, io.EOF) { err := diffCopyClient.RecvMsg(struct{}{}) if err != nil { return fmt.Errorf("diff copy client error: %s", err) } } else if err != nil { return fmt.Errorf("failed to send file chunk: %s", err) } } if err := diffCopyClient.CloseSend(); err != nil { return fmt.Errorf("failed to close send: %s", err) } var msg filesync.BytesMessage if err := diffCopyClient.RecvMsg(&msg); err != io.EOF { return fmt.Errorf("unexpected closing recv msg: %s", err) } return nil }
closed
dagger/dagger
https://github.com/dagger/dagger
6,374
Update buildkit past ca71a44
Currently, we are stuck on the current version of buildkit, since https://github.com/moby/buildkit/pull/4347#issuecomment-1872217571 seems to have introduced a deadlock. To reproduce: update buildkit in `go.mod` to `ca71a446d9f4e31ca7c4fa30fb8fb8861b8b0117`, and run a large number of integration tests. The engine will lock up after some time - after sending `SIGUIT` to the engine, you can observe the stack trace: ``` goroutine 441 [sync.Mutex.Lock, 4 minutes]: runtime.gopark(0xc01d5ebbf0?, 0xc00aef48e1?, 0xc0?, 0xf?, 0xc017641870?) /usr/local/go/src/runtime/proc.go:398 +0xce fp=0xc017641790 sp=0xc017641770 pc=0x43e42e runtime.goparkunlock(...) /usr/local/go/src/runtime/proc.go:404 runtime.semacquire1(0xc01d77eb74, 0x0?, 0x3, 0x1, 0x21?) /usr/local/go/src/runtime/sema.go:160 +0x218 fp=0xc0176417f8 sp=0xc017641790 pc=0x44f918 sync.runtime_SemacquireMutex(0xffffffffffffffff?, 0x0?, 0xc00ed7c4b0?) /usr/local/go/src/runtime/sema.go:77 +0x25 fp=0xc017641830 sp=0xc0176417f8 pc=0x46d545 sync.(*Mutex).lockSlow(0xc01d77eb70) /usr/local/go/src/sync/mutex.go:171 +0x15d fp=0xc017641880 sp=0xc017641830 pc=0x488f1d sync.(*Mutex).Lock(...) /usr/local/go/src/sync/mutex.go:90 github.com/moby/buildkit/util/progress.(*MultiWriter).writeRawProgress(0xc01d77eb70, 0xc004bd6e00) /go/pkg/mod/github.com/moby/[email protected]/util/progress/multiwriter.go:91 +0x5c fp=0xc017641960 sp=0xc017641880 pc=0xcb537c github.com/moby/buildkit/util/progress.(*MultiWriter).WriteRawProgress(0xc01d77eb70?, 0xc004bd6e00?) /go/pkg/mod/github.com/moby/[email protected]/util/progress/multiwriter.go:87 +0xac fp=0xc017641a28 sp=0xc017641960 pc=0xcb516c github.com/moby/buildkit/util/progress.(*MultiWriter).writeRawProgress(0xc01dfe5da0, 0xc004bd6e00) /go/pkg/mod/github.com/moby/[email protected]/util/progress/multiwriter.go:95 +0x17e fp=0xc017641b08 sp=0xc017641a28 pc=0xcb549e github.com/moby/buildkit/util/progress.(*MultiWriter).WriteRawProgress(0xc01dfe5da0?, 0xc004bd6e00?) /go/pkg/mod/github.com/moby/[email protected]/util/progress/multiwriter.go:87 +0xac fp=0xc017641bd0 sp=0xc017641b08 pc=0xcb516c github.com/moby/buildkit/util/progress.(*MultiWriter).Add(0xc01d77eb70, {0x1f7e8b0?, 0xc01dfe5da0?}) /go/pkg/mod/github.com/moby/[email protected]/util/progress/multiwriter.go:46 +0x190 fp=0xc017641c60 sp=0xc017641bd0 pc=0xcb4d70 github.com/moby/buildkit/solver.(*state).setEdge(0xc01dfe3440, 0x2, 0xc003975a40, 0xc0165fcb40) /go/pkg/mod/github.com/moby/[email protected]/solver/jobs.go:178 +0x370 fp=0xc017641ce8 sp=0xc017641c60 pc=0xdef3f0 github.com/moby/buildkit/solver.(*Solver).setEdge(0xc0007071a0, {0xc003975a40?, {0x1f92360?, 0xc004bd6480?}}, 0xc003975a40) /go/pkg/mod/github.com/moby/[email protected]/solver/jobs.go:295 +0x125 fp=0xc017641d58 sp=0xc017641ce8 pc=0xdf0265 github.com/moby/buildkit/solver.(*scheduler).dispatch(0xc0002fc770, 0xc01356a140) /go/pkg/mod/github.com/moby/[email protected]/solver/scheduler.go:177 +0xbdb fp=0xc017641f68 sp=0xc017641d58 pc=0xdfe87b github.com/moby/buildkit/solver.(*scheduler).loop(0xc0002fc770) /go/pkg/mod/github.com/moby/[email protected]/solver/scheduler.go:104 +0x1d4 fp=0xc017641fc8 sp=0xc017641f68 pc=0xdfdb34 github.com/moby/buildkit/solver.newScheduler.func1() /go/pkg/mod/github.com/moby/[email protected]/solver/scheduler.go:35 +0x25 fp=0xc017641fe0 sp=0xc017641fc8 pc=0xdfd865 runtime.goexit() /usr/local/go/src/runtime/asm_amd64.s:1650 +0x1 fp=0xc017641fe8 sp=0xc017641fe0 pc=0x4715e1 created by github.com/moby/buildkit/solver.newScheduler in goroutine 1 /go/pkg/mod/github.com/moby/[email protected]/solver/scheduler.go:35 +0x22d ``` See https://github.com/dagger/dagger/pull/6169 for more information on when this was originally discovered. Next steps: - Wait until upstream PRs are merged :tada:
https://github.com/dagger/dagger/issues/6374
https://github.com/dagger/dagger/pull/6481
2aefe558d80c355fb6868145e79763ef73c0e6b9
faaa0d18ec2f8f4ddb425298e672c079869017e7
2024-01-08T18:47:15Z
go
2024-01-24T17:07:57Z
engine/client/buildkit.go
package client import ( "context" "fmt" "net/url" "time" "github.com/dagger/dagger/engine" bkclient "github.com/moby/buildkit/client" "github.com/moby/buildkit/util/tracing/detect" "github.com/vito/progrock" "go.opentelemetry.io/otel" _ "github.com/moby/buildkit/client/connhelper/dockercontainer" _ "github.com/moby/buildkit/client/connhelper/kubepod" _ "github.com/moby/buildkit/client/connhelper/podmancontainer" _ "github.com/moby/buildkit/client/connhelper/ssh" ) func newBuildkitClient(ctx context.Context, rec *progrock.VertexRecorder, remote *url.URL, userAgent string) (*bkclient.Client, *bkclient.Info, error) {
closed
dagger/dagger
https://github.com/dagger/dagger
6,374
Update buildkit past ca71a44
Currently, we are stuck on the current version of buildkit, since https://github.com/moby/buildkit/pull/4347#issuecomment-1872217571 seems to have introduced a deadlock. To reproduce: update buildkit in `go.mod` to `ca71a446d9f4e31ca7c4fa30fb8fb8861b8b0117`, and run a large number of integration tests. The engine will lock up after some time - after sending `SIGUIT` to the engine, you can observe the stack trace: ``` goroutine 441 [sync.Mutex.Lock, 4 minutes]: runtime.gopark(0xc01d5ebbf0?, 0xc00aef48e1?, 0xc0?, 0xf?, 0xc017641870?) /usr/local/go/src/runtime/proc.go:398 +0xce fp=0xc017641790 sp=0xc017641770 pc=0x43e42e runtime.goparkunlock(...) /usr/local/go/src/runtime/proc.go:404 runtime.semacquire1(0xc01d77eb74, 0x0?, 0x3, 0x1, 0x21?) /usr/local/go/src/runtime/sema.go:160 +0x218 fp=0xc0176417f8 sp=0xc017641790 pc=0x44f918 sync.runtime_SemacquireMutex(0xffffffffffffffff?, 0x0?, 0xc00ed7c4b0?) /usr/local/go/src/runtime/sema.go:77 +0x25 fp=0xc017641830 sp=0xc0176417f8 pc=0x46d545 sync.(*Mutex).lockSlow(0xc01d77eb70) /usr/local/go/src/sync/mutex.go:171 +0x15d fp=0xc017641880 sp=0xc017641830 pc=0x488f1d sync.(*Mutex).Lock(...) /usr/local/go/src/sync/mutex.go:90 github.com/moby/buildkit/util/progress.(*MultiWriter).writeRawProgress(0xc01d77eb70, 0xc004bd6e00) /go/pkg/mod/github.com/moby/[email protected]/util/progress/multiwriter.go:91 +0x5c fp=0xc017641960 sp=0xc017641880 pc=0xcb537c github.com/moby/buildkit/util/progress.(*MultiWriter).WriteRawProgress(0xc01d77eb70?, 0xc004bd6e00?) /go/pkg/mod/github.com/moby/[email protected]/util/progress/multiwriter.go:87 +0xac fp=0xc017641a28 sp=0xc017641960 pc=0xcb516c github.com/moby/buildkit/util/progress.(*MultiWriter).writeRawProgress(0xc01dfe5da0, 0xc004bd6e00) /go/pkg/mod/github.com/moby/[email protected]/util/progress/multiwriter.go:95 +0x17e fp=0xc017641b08 sp=0xc017641a28 pc=0xcb549e github.com/moby/buildkit/util/progress.(*MultiWriter).WriteRawProgress(0xc01dfe5da0?, 0xc004bd6e00?) /go/pkg/mod/github.com/moby/[email protected]/util/progress/multiwriter.go:87 +0xac fp=0xc017641bd0 sp=0xc017641b08 pc=0xcb516c github.com/moby/buildkit/util/progress.(*MultiWriter).Add(0xc01d77eb70, {0x1f7e8b0?, 0xc01dfe5da0?}) /go/pkg/mod/github.com/moby/[email protected]/util/progress/multiwriter.go:46 +0x190 fp=0xc017641c60 sp=0xc017641bd0 pc=0xcb4d70 github.com/moby/buildkit/solver.(*state).setEdge(0xc01dfe3440, 0x2, 0xc003975a40, 0xc0165fcb40) /go/pkg/mod/github.com/moby/[email protected]/solver/jobs.go:178 +0x370 fp=0xc017641ce8 sp=0xc017641c60 pc=0xdef3f0 github.com/moby/buildkit/solver.(*Solver).setEdge(0xc0007071a0, {0xc003975a40?, {0x1f92360?, 0xc004bd6480?}}, 0xc003975a40) /go/pkg/mod/github.com/moby/[email protected]/solver/jobs.go:295 +0x125 fp=0xc017641d58 sp=0xc017641ce8 pc=0xdf0265 github.com/moby/buildkit/solver.(*scheduler).dispatch(0xc0002fc770, 0xc01356a140) /go/pkg/mod/github.com/moby/[email protected]/solver/scheduler.go:177 +0xbdb fp=0xc017641f68 sp=0xc017641d58 pc=0xdfe87b github.com/moby/buildkit/solver.(*scheduler).loop(0xc0002fc770) /go/pkg/mod/github.com/moby/[email protected]/solver/scheduler.go:104 +0x1d4 fp=0xc017641fc8 sp=0xc017641f68 pc=0xdfdb34 github.com/moby/buildkit/solver.newScheduler.func1() /go/pkg/mod/github.com/moby/[email protected]/solver/scheduler.go:35 +0x25 fp=0xc017641fe0 sp=0xc017641fc8 pc=0xdfd865 runtime.goexit() /usr/local/go/src/runtime/asm_amd64.s:1650 +0x1 fp=0xc017641fe8 sp=0xc017641fe0 pc=0x4715e1 created by github.com/moby/buildkit/solver.newScheduler in goroutine 1 /go/pkg/mod/github.com/moby/[email protected]/solver/scheduler.go:35 +0x22d ``` See https://github.com/dagger/dagger/pull/6169 for more information on when this was originally discovered. Next steps: - Wait until upstream PRs are merged :tada:
https://github.com/dagger/dagger/issues/6374
https://github.com/dagger/dagger/pull/6481
2aefe558d80c355fb6868145e79763ef73c0e6b9
faaa0d18ec2f8f4ddb425298e672c079869017e7
2024-01-08T18:47:15Z
go
2024-01-24T17:07:57Z
engine/client/buildkit.go
var c *bkclient.Client var err error switch remote.Scheme { case DockerImageProvider: c, err = buildkitConnectDocker(ctx, rec, remote, userAgent) default: task := rec.Task("starting engine") c, err = buildkitConnectDefault(ctx, rec, remote) task.Done(err) } if err != nil { return nil, nil, err } info, err := c.Info(ctx) if err != nil { return nil, nil, err } if info.BuildkitVersion.Package != engine.Package { return nil, nil, fmt.Errorf("remote is not a valid dagger server (expected %q, got %q)", engine.Package, info.BuildkitVersion.Package) } return c, info, nil } func buildkitConnectDefault(ctx context.Context, rec *progrock.VertexRecorder, remote *url.URL) (*bkclient.Client, error) {
closed
dagger/dagger
https://github.com/dagger/dagger
6,374
Update buildkit past ca71a44
Currently, we are stuck on the current version of buildkit, since https://github.com/moby/buildkit/pull/4347#issuecomment-1872217571 seems to have introduced a deadlock. To reproduce: update buildkit in `go.mod` to `ca71a446d9f4e31ca7c4fa30fb8fb8861b8b0117`, and run a large number of integration tests. The engine will lock up after some time - after sending `SIGUIT` to the engine, you can observe the stack trace: ``` goroutine 441 [sync.Mutex.Lock, 4 minutes]: runtime.gopark(0xc01d5ebbf0?, 0xc00aef48e1?, 0xc0?, 0xf?, 0xc017641870?) /usr/local/go/src/runtime/proc.go:398 +0xce fp=0xc017641790 sp=0xc017641770 pc=0x43e42e runtime.goparkunlock(...) /usr/local/go/src/runtime/proc.go:404 runtime.semacquire1(0xc01d77eb74, 0x0?, 0x3, 0x1, 0x21?) /usr/local/go/src/runtime/sema.go:160 +0x218 fp=0xc0176417f8 sp=0xc017641790 pc=0x44f918 sync.runtime_SemacquireMutex(0xffffffffffffffff?, 0x0?, 0xc00ed7c4b0?) /usr/local/go/src/runtime/sema.go:77 +0x25 fp=0xc017641830 sp=0xc0176417f8 pc=0x46d545 sync.(*Mutex).lockSlow(0xc01d77eb70) /usr/local/go/src/sync/mutex.go:171 +0x15d fp=0xc017641880 sp=0xc017641830 pc=0x488f1d sync.(*Mutex).Lock(...) /usr/local/go/src/sync/mutex.go:90 github.com/moby/buildkit/util/progress.(*MultiWriter).writeRawProgress(0xc01d77eb70, 0xc004bd6e00) /go/pkg/mod/github.com/moby/[email protected]/util/progress/multiwriter.go:91 +0x5c fp=0xc017641960 sp=0xc017641880 pc=0xcb537c github.com/moby/buildkit/util/progress.(*MultiWriter).WriteRawProgress(0xc01d77eb70?, 0xc004bd6e00?) /go/pkg/mod/github.com/moby/[email protected]/util/progress/multiwriter.go:87 +0xac fp=0xc017641a28 sp=0xc017641960 pc=0xcb516c github.com/moby/buildkit/util/progress.(*MultiWriter).writeRawProgress(0xc01dfe5da0, 0xc004bd6e00) /go/pkg/mod/github.com/moby/[email protected]/util/progress/multiwriter.go:95 +0x17e fp=0xc017641b08 sp=0xc017641a28 pc=0xcb549e github.com/moby/buildkit/util/progress.(*MultiWriter).WriteRawProgress(0xc01dfe5da0?, 0xc004bd6e00?) /go/pkg/mod/github.com/moby/[email protected]/util/progress/multiwriter.go:87 +0xac fp=0xc017641bd0 sp=0xc017641b08 pc=0xcb516c github.com/moby/buildkit/util/progress.(*MultiWriter).Add(0xc01d77eb70, {0x1f7e8b0?, 0xc01dfe5da0?}) /go/pkg/mod/github.com/moby/[email protected]/util/progress/multiwriter.go:46 +0x190 fp=0xc017641c60 sp=0xc017641bd0 pc=0xcb4d70 github.com/moby/buildkit/solver.(*state).setEdge(0xc01dfe3440, 0x2, 0xc003975a40, 0xc0165fcb40) /go/pkg/mod/github.com/moby/[email protected]/solver/jobs.go:178 +0x370 fp=0xc017641ce8 sp=0xc017641c60 pc=0xdef3f0 github.com/moby/buildkit/solver.(*Solver).setEdge(0xc0007071a0, {0xc003975a40?, {0x1f92360?, 0xc004bd6480?}}, 0xc003975a40) /go/pkg/mod/github.com/moby/[email protected]/solver/jobs.go:295 +0x125 fp=0xc017641d58 sp=0xc017641ce8 pc=0xdf0265 github.com/moby/buildkit/solver.(*scheduler).dispatch(0xc0002fc770, 0xc01356a140) /go/pkg/mod/github.com/moby/[email protected]/solver/scheduler.go:177 +0xbdb fp=0xc017641f68 sp=0xc017641d58 pc=0xdfe87b github.com/moby/buildkit/solver.(*scheduler).loop(0xc0002fc770) /go/pkg/mod/github.com/moby/[email protected]/solver/scheduler.go:104 +0x1d4 fp=0xc017641fc8 sp=0xc017641f68 pc=0xdfdb34 github.com/moby/buildkit/solver.newScheduler.func1() /go/pkg/mod/github.com/moby/[email protected]/solver/scheduler.go:35 +0x25 fp=0xc017641fe0 sp=0xc017641fc8 pc=0xdfd865 runtime.goexit() /usr/local/go/src/runtime/asm_amd64.s:1650 +0x1 fp=0xc017641fe8 sp=0xc017641fe0 pc=0x4715e1 created by github.com/moby/buildkit/solver.newScheduler in goroutine 1 /go/pkg/mod/github.com/moby/[email protected]/solver/scheduler.go:35 +0x22d ``` See https://github.com/dagger/dagger/pull/6169 for more information on when this was originally discovered. Next steps: - Wait until upstream PRs are merged :tada:
https://github.com/dagger/dagger/issues/6374
https://github.com/dagger/dagger/pull/6481
2aefe558d80c355fb6868145e79763ef73c0e6b9
faaa0d18ec2f8f4ddb425298e672c079869017e7
2024-01-08T18:47:15Z
go
2024-01-24T17:07:57Z
engine/client/buildkit.go
opts := []bkclient.ClientOpt{ bkclient.WithFailFast(), bkclient.WithTracerProvider(otel.GetTracerProvider()), } exp, err := detect.Exporter() if err == nil { if td, ok := exp.(bkclient.TracerDelegate); ok { opts = append(opts, bkclient.WithTracerDelegate(td)) } } else { fmt.Fprintln(rec.Stdout(), "failed to detect opentelemetry exporter: ", err) } c, err := bkclient.New(ctx, remote.String(), opts...) if err != nil { return nil, fmt.Errorf("buildkit client: %w", err) } ctx, cancel := context.WithTimeout(ctx, 10*time.Minute) defer cancel() if err := c.Wait(ctx); err != nil { return nil, err } return c, nil }
closed
dagger/dagger
https://github.com/dagger/dagger
6,359
CLI: update handling of various core types
As described in [this comment](https://github.com/dagger/dagger/issues/6229#issuecomment-1863649336) (and that issue generally), we need to make some adjustments to the CLIs behavior when `dagger call` ends in various core types. There's a handful of related adjustments needed here. Creating as a checklist for now to save issue spam; can break down into more issues if useful though. I'm including my initial suggestions on how to handle these, but to be clear these are not finalized decisions and the final call can be made as part of implementing this - [ ] Handle arbitrary user objects - Print fields (as in `TypeDef` fields, so just trivially resolvable values) as a json object - [x] Handle container - call `sync` only, rely on progress output for anything else - [x] Handle directory - call `sync` only, rely on progress output for anything else - [x] Handle file - call `sync` only, rely on progress output for anything else - [ ] Handle IDs returned by `sync` (i.e. the case where the user explicitly chains `sync`) - just rely on progress output, don't show the id
https://github.com/dagger/dagger/issues/6359
https://github.com/dagger/dagger/pull/6482
2999573c5a34e85b8baac8c0150881d9c08a86b8
d91ac42c196873830c2e0876b251f3bf4d62ea49
2024-01-03T20:19:06Z
go
2024-01-26T18:48:04Z
cmd/dagger/call.go
package main import ( "fmt" "io" "os" "path/filepath" "github.com/spf13/cobra" ) var outputPath string var outputExport bool var callCmd = &FuncCommand{ Name: "call", Short: "Call a module function", Long: "Call a module function and print the result.\n\nOn a container, the stdout will be returned. On a directory, the list of entries, and on a file, its contents.",
closed
dagger/dagger
https://github.com/dagger/dagger
6,359
CLI: update handling of various core types
As described in [this comment](https://github.com/dagger/dagger/issues/6229#issuecomment-1863649336) (and that issue generally), we need to make some adjustments to the CLIs behavior when `dagger call` ends in various core types. There's a handful of related adjustments needed here. Creating as a checklist for now to save issue spam; can break down into more issues if useful though. I'm including my initial suggestions on how to handle these, but to be clear these are not finalized decisions and the final call can be made as part of implementing this - [ ] Handle arbitrary user objects - Print fields (as in `TypeDef` fields, so just trivially resolvable values) as a json object - [x] Handle container - call `sync` only, rely on progress output for anything else - [x] Handle directory - call `sync` only, rely on progress output for anything else - [x] Handle file - call `sync` only, rely on progress output for anything else - [ ] Handle IDs returned by `sync` (i.e. the case where the user explicitly chains `sync`) - just rely on progress output, don't show the id
https://github.com/dagger/dagger/issues/6359
https://github.com/dagger/dagger/pull/6482
2999573c5a34e85b8baac8c0150881d9c08a86b8
d91ac42c196873830c2e0876b251f3bf4d62ea49
2024-01-03T20:19:06Z
go
2024-01-26T18:48:04Z
cmd/dagger/call.go
Init: func(cmd *cobra.Command) { cmd.PersistentFlags().StringVarP(&outputPath, "output", "o", "", "Path in the host to save the result to") }, OnSelectObjectLeaf: func(c *FuncCommand, name string) error { switch name { case Container: if outputPath != "" { c.Select("export") c.Arg("path", outputPath) outputExport = true return nil } c.Select("stdout") case Directory: if outputPath != "" { c.Select("export") c.Arg("path", outputPath) outputExport = true return nil } c.Select("entries") case File: if outputPath != "" { c.Select("export") c.Arg("path", outputPath) c.Arg("allowParentDirPath", true) outputExport = true return nil
closed
dagger/dagger
https://github.com/dagger/dagger
6,359
CLI: update handling of various core types
As described in [this comment](https://github.com/dagger/dagger/issues/6229#issuecomment-1863649336) (and that issue generally), we need to make some adjustments to the CLIs behavior when `dagger call` ends in various core types. There's a handful of related adjustments needed here. Creating as a checklist for now to save issue spam; can break down into more issues if useful though. I'm including my initial suggestions on how to handle these, but to be clear these are not finalized decisions and the final call can be made as part of implementing this - [ ] Handle arbitrary user objects - Print fields (as in `TypeDef` fields, so just trivially resolvable values) as a json object - [x] Handle container - call `sync` only, rely on progress output for anything else - [x] Handle directory - call `sync` only, rely on progress output for anything else - [x] Handle file - call `sync` only, rely on progress output for anything else - [ ] Handle IDs returned by `sync` (i.e. the case where the user explicitly chains `sync`) - just rely on progress output, don't show the id
https://github.com/dagger/dagger/issues/6359
https://github.com/dagger/dagger/pull/6482
2999573c5a34e85b8baac8c0150881d9c08a86b8
d91ac42c196873830c2e0876b251f3bf4d62ea49
2024-01-03T20:19:06Z
go
2024-01-26T18:48:04Z
cmd/dagger/call.go
} c.Select("contents") case Terminal: c.Select("websocketEndpoint") default: return fmt.Errorf("return type %q requires a sub-command", name) } return nil }, BeforeRequest: func(_ *FuncCommand, _ *cobra.Command, modType *modTypeDef) error { if modType.Name() != Terminal { return nil } if silent || !(progress == "auto" && autoTTY || progress == "tty") { return fmt.Errorf("running shell without the TUI is not supported") } if debug { return fmt.Errorf("running shell with --debug is not supported") } return nil }, AfterResponse: func(c *FuncCommand, cmd *cobra.Command, modType *modTypeDef, response any) error { switch modType.Name() { case Terminal: termEndpoint, ok := response.(string) if !ok { return fmt.Errorf("unexpected response %T: %+v", response, response)
closed
dagger/dagger
https://github.com/dagger/dagger
6,359
CLI: update handling of various core types
As described in [this comment](https://github.com/dagger/dagger/issues/6229#issuecomment-1863649336) (and that issue generally), we need to make some adjustments to the CLIs behavior when `dagger call` ends in various core types. There's a handful of related adjustments needed here. Creating as a checklist for now to save issue spam; can break down into more issues if useful though. I'm including my initial suggestions on how to handle these, but to be clear these are not finalized decisions and the final call can be made as part of implementing this - [ ] Handle arbitrary user objects - Print fields (as in `TypeDef` fields, so just trivially resolvable values) as a json object - [x] Handle container - call `sync` only, rely on progress output for anything else - [x] Handle directory - call `sync` only, rely on progress output for anything else - [x] Handle file - call `sync` only, rely on progress output for anything else - [ ] Handle IDs returned by `sync` (i.e. the case where the user explicitly chains `sync`) - just rely on progress output, don't show the id
https://github.com/dagger/dagger/issues/6359
https://github.com/dagger/dagger/pull/6482
2999573c5a34e85b8baac8c0150881d9c08a86b8
d91ac42c196873830c2e0876b251f3bf4d62ea49
2024-01-03T20:19:06Z
go
2024-01-26T18:48:04Z
cmd/dagger/call.go
} return attachToShell(cmd.Context(), c.c, termEndpoint) default: writer := cmd.OutOrStdout() if outputPath != "" { if outputExport { logOutputSuccess(cmd, outputPath) return nil } file, err := openOutputFile(outputPath) if err != nil { return fmt.Errorf("couldn't write output to file: %w", err) } defer func() { file.Close() logOutputSuccess(cmd, outputPath) }() writer = io.MultiWriter(writer, file) } return printFunctionResult(writer, response) } }, } func openOutputFile(path string) (*os.File, error) { if err := os.MkdirAll(filepath.Dir(path), 0o755); err != nil { return nil, err } return os.OpenFile(path, os.O_RDWR|os.O_CREATE|os.O_TRUNC, 0o644) } func logOutputSuccess(cmd *cobra.Command, path string) {
closed
dagger/dagger
https://github.com/dagger/dagger
6,359
CLI: update handling of various core types
As described in [this comment](https://github.com/dagger/dagger/issues/6229#issuecomment-1863649336) (and that issue generally), we need to make some adjustments to the CLIs behavior when `dagger call` ends in various core types. There's a handful of related adjustments needed here. Creating as a checklist for now to save issue spam; can break down into more issues if useful though. I'm including my initial suggestions on how to handle these, but to be clear these are not finalized decisions and the final call can be made as part of implementing this - [ ] Handle arbitrary user objects - Print fields (as in `TypeDef` fields, so just trivially resolvable values) as a json object - [x] Handle container - call `sync` only, rely on progress output for anything else - [x] Handle directory - call `sync` only, rely on progress output for anything else - [x] Handle file - call `sync` only, rely on progress output for anything else - [ ] Handle IDs returned by `sync` (i.e. the case where the user explicitly chains `sync`) - just rely on progress output, don't show the id
https://github.com/dagger/dagger/issues/6359
https://github.com/dagger/dagger/pull/6482
2999573c5a34e85b8baac8c0150881d9c08a86b8
d91ac42c196873830c2e0876b251f3bf4d62ea49
2024-01-03T20:19:06Z
go
2024-01-26T18:48:04Z
cmd/dagger/call.go
path, err := filepath.Abs(path) if err != nil { cmd.PrintErrf("WARNING: failed to get absolute path: %s\n", err) path = outputPath } cmd.PrintErrf("Saved output to %q.\n", path) } func printFunctionResult(w io.Writer, r any) error { switch t := r.(type) { case []any: for _, v := range t { if err := printFunctionResult(w, v); err != nil { return err } } return nil case map[string]any: for _, v := range t { if err := printFunctionResult(w, v); err != nil { return err } } return nil default: fmt.Fprintf(w, "%+v\n", t) } return nil }
closed
dagger/dagger
https://github.com/dagger/dagger
6,359
CLI: update handling of various core types
As described in [this comment](https://github.com/dagger/dagger/issues/6229#issuecomment-1863649336) (and that issue generally), we need to make some adjustments to the CLIs behavior when `dagger call` ends in various core types. There's a handful of related adjustments needed here. Creating as a checklist for now to save issue spam; can break down into more issues if useful though. I'm including my initial suggestions on how to handle these, but to be clear these are not finalized decisions and the final call can be made as part of implementing this - [ ] Handle arbitrary user objects - Print fields (as in `TypeDef` fields, so just trivially resolvable values) as a json object - [x] Handle container - call `sync` only, rely on progress output for anything else - [x] Handle directory - call `sync` only, rely on progress output for anything else - [x] Handle file - call `sync` only, rely on progress output for anything else - [ ] Handle IDs returned by `sync` (i.e. the case where the user explicitly chains `sync`) - just rely on progress output, don't show the id
https://github.com/dagger/dagger/issues/6359
https://github.com/dagger/dagger/pull/6482
2999573c5a34e85b8baac8c0150881d9c08a86b8
d91ac42c196873830c2e0876b251f3bf4d62ea49
2024-01-03T20:19:06Z
go
2024-01-26T18:48:04Z
core/integration/module_call_test.go
package core import ( "fmt" "strings" "testing" "dagger.io/dagger" "github.com/stretchr/testify/require" ) func TestModuleDaggerCallArgTypes(t *testing.T) { t.Parallel() c, ctx := connect(t) t.Run("service args", func(t *testing.T) { t.Parallel() t.Run("used as service binding", func(t *testing.T) { t.Parallel() modGen := c.Container().From(golangImage). WithMountedFile(testCLIBinPath, daggerCliFile(t, c)). WithWorkdir("/work"). With(daggerExec("mod", "init", "--name=test", "--sdk=go")). WithNewFile("main.go", dagger.ContainerWithNewFileOpts{
closed
dagger/dagger
https://github.com/dagger/dagger
6,359
CLI: update handling of various core types
As described in [this comment](https://github.com/dagger/dagger/issues/6229#issuecomment-1863649336) (and that issue generally), we need to make some adjustments to the CLIs behavior when `dagger call` ends in various core types. There's a handful of related adjustments needed here. Creating as a checklist for now to save issue spam; can break down into more issues if useful though. I'm including my initial suggestions on how to handle these, but to be clear these are not finalized decisions and the final call can be made as part of implementing this - [ ] Handle arbitrary user objects - Print fields (as in `TypeDef` fields, so just trivially resolvable values) as a json object - [x] Handle container - call `sync` only, rely on progress output for anything else - [x] Handle directory - call `sync` only, rely on progress output for anything else - [x] Handle file - call `sync` only, rely on progress output for anything else - [ ] Handle IDs returned by `sync` (i.e. the case where the user explicitly chains `sync`) - just rely on progress output, don't show the id
https://github.com/dagger/dagger/issues/6359
https://github.com/dagger/dagger/pull/6482
2999573c5a34e85b8baac8c0150881d9c08a86b8
d91ac42c196873830c2e0876b251f3bf4d62ea49
2024-01-03T20:19:06Z
go
2024-01-26T18:48:04Z
core/integration/module_call_test.go
Contents: `package main import ( "context" ) type Test struct {} func (m *Test) Fn(ctx context.Context, svc *Service) (string, error) { return dag.Container().From("alpine:3.18").WithExec([]string{"apk", "add", "curl"}). WithServiceBinding("daserver", svc). WithExec([]string{"curl", "http://daserver:8000"}). Stdout(ctx) } `, }) logGen(ctx, t, modGen.Directory(".")) httpServer, _ := httpService(ctx, t, c, "im up") endpoint, err := httpServer.Endpoint(ctx) require.NoError(t, err) out, err := modGen. WithServiceBinding("testserver", httpServer). With(daggerCall("fn", "--svc", "tcp://"+endpoint)).Stdout(ctx) require.NoError(t, err) require.Equal(t, strings.TrimSpace(out), "im up") }) t.Run("used directly", func(t *testing.T) { t.Parallel() modGen := c.Container().From(golangImage). WithMountedFile(testCLIBinPath, daggerCliFile(t, c)). WithWorkdir("/work"). With(daggerExec("mod", "init", "--name=test", "--sdk=go")). WithNewFile("main.go", dagger.ContainerWithNewFileOpts{
closed
dagger/dagger
https://github.com/dagger/dagger
6,359
CLI: update handling of various core types
As described in [this comment](https://github.com/dagger/dagger/issues/6229#issuecomment-1863649336) (and that issue generally), we need to make some adjustments to the CLIs behavior when `dagger call` ends in various core types. There's a handful of related adjustments needed here. Creating as a checklist for now to save issue spam; can break down into more issues if useful though. I'm including my initial suggestions on how to handle these, but to be clear these are not finalized decisions and the final call can be made as part of implementing this - [ ] Handle arbitrary user objects - Print fields (as in `TypeDef` fields, so just trivially resolvable values) as a json object - [x] Handle container - call `sync` only, rely on progress output for anything else - [x] Handle directory - call `sync` only, rely on progress output for anything else - [x] Handle file - call `sync` only, rely on progress output for anything else - [ ] Handle IDs returned by `sync` (i.e. the case where the user explicitly chains `sync`) - just rely on progress output, don't show the id
https://github.com/dagger/dagger/issues/6359
https://github.com/dagger/dagger/pull/6482
2999573c5a34e85b8baac8c0150881d9c08a86b8
d91ac42c196873830c2e0876b251f3bf4d62ea49
2024-01-03T20:19:06Z
go
2024-01-26T18:48:04Z
core/integration/module_call_test.go
Contents: `package main import ( "context" "fmt" "strings" ) type Test struct {} func (m *Test) Fn(ctx context.Context, svc *Service) (string, error) { ports, err := svc.Ports(ctx) if err != nil { return "", err } var out []string out = append(out, fmt.Sprintf("%d exposed ports:", len(ports))) for _, port := range ports { number, err := port.Port(ctx) if err != nil { return "", err } out = append(out, fmt.Sprintf("- TCP/%d", number)) } return strings.Join(out, "\n"), nil } `, }) logGen(ctx, t, modGen.Directory(".")) httpServer, _ := httpService(ctx, t, c, "im up") endpoint, err := httpServer.Endpoint(ctx) require.NoError(t, err) out, err := modGen.
closed
dagger/dagger
https://github.com/dagger/dagger
6,359
CLI: update handling of various core types
As described in [this comment](https://github.com/dagger/dagger/issues/6229#issuecomment-1863649336) (and that issue generally), we need to make some adjustments to the CLIs behavior when `dagger call` ends in various core types. There's a handful of related adjustments needed here. Creating as a checklist for now to save issue spam; can break down into more issues if useful though. I'm including my initial suggestions on how to handle these, but to be clear these are not finalized decisions and the final call can be made as part of implementing this - [ ] Handle arbitrary user objects - Print fields (as in `TypeDef` fields, so just trivially resolvable values) as a json object - [x] Handle container - call `sync` only, rely on progress output for anything else - [x] Handle directory - call `sync` only, rely on progress output for anything else - [x] Handle file - call `sync` only, rely on progress output for anything else - [ ] Handle IDs returned by `sync` (i.e. the case where the user explicitly chains `sync`) - just rely on progress output, don't show the id
https://github.com/dagger/dagger/issues/6359
https://github.com/dagger/dagger/pull/6482
2999573c5a34e85b8baac8c0150881d9c08a86b8
d91ac42c196873830c2e0876b251f3bf4d62ea49
2024-01-03T20:19:06Z
go
2024-01-26T18:48:04Z
core/integration/module_call_test.go
WithServiceBinding("testserver", httpServer). With(daggerCall("fn", "--svc", "tcp://"+endpoint)).Stdout(ctx) require.NoError(t, err) require.Equal(t, strings.TrimSpace(out), "1 exposed ports:\n- TCP/8000") }) }) t.Run("list args", func(t *testing.T) { t.Parallel() modGen := c.Container().From(golangImage). WithMountedFile(testCLIBinPath, daggerCliFile(t, c)). WithWorkdir("/work"). With(daggerExec("mod", "init", "--name=minimal", "--sdk=go")). WithNewFile("foo.txt", dagger.ContainerWithNewFileOpts{ Contents: "bar", }). WithNewFile("main.go", dagger.ContainerWithNewFileOpts{ Contents: `package main import ( "context" "strings" ) type Minimal struct {} func (m *Minimal) Hello(msgs []string) string { return strings.Join(msgs, "+") } func (m *Minimal) Reads(ctx context.Context, files []File) (string, error) { var contents []string for _, f := range files { content, err := f.Contents(ctx) if err != nil {
closed
dagger/dagger
https://github.com/dagger/dagger
6,359
CLI: update handling of various core types
As described in [this comment](https://github.com/dagger/dagger/issues/6229#issuecomment-1863649336) (and that issue generally), we need to make some adjustments to the CLIs behavior when `dagger call` ends in various core types. There's a handful of related adjustments needed here. Creating as a checklist for now to save issue spam; can break down into more issues if useful though. I'm including my initial suggestions on how to handle these, but to be clear these are not finalized decisions and the final call can be made as part of implementing this - [ ] Handle arbitrary user objects - Print fields (as in `TypeDef` fields, so just trivially resolvable values) as a json object - [x] Handle container - call `sync` only, rely on progress output for anything else - [x] Handle directory - call `sync` only, rely on progress output for anything else - [x] Handle file - call `sync` only, rely on progress output for anything else - [ ] Handle IDs returned by `sync` (i.e. the case where the user explicitly chains `sync`) - just rely on progress output, don't show the id
https://github.com/dagger/dagger/issues/6359
https://github.com/dagger/dagger/pull/6482
2999573c5a34e85b8baac8c0150881d9c08a86b8
d91ac42c196873830c2e0876b251f3bf4d62ea49
2024-01-03T20:19:06Z
go
2024-01-26T18:48:04Z
core/integration/module_call_test.go
return "", err } contents = append(contents, content) } return strings.Join(contents, "+"), nil } `, }) logGen(ctx, t, modGen.Directory(".")) out, err := modGen.With(daggerCall("hello", "--msgs", "yo", "--msgs", "my", "--msgs", "friend")).Stdout(ctx) require.NoError(t, err) require.Equal(t, strings.TrimSpace(out), "yo+my+friend") out, err = modGen.With(daggerCall("reads", "--files=foo.txt", "--files=foo.txt")).Stdout(ctx) require.NoError(t, err) require.Equal(t, strings.TrimSpace(out), "bar+bar") }) t.Run("directory arg inputs", func(t *testing.T) { t.Parallel() t.Run("local dir", func(t *testing.T) { t.Parallel() modGen := c.Container().From(golangImage). WithMountedFile(testCLIBinPath, daggerCliFile(t, c)). WithWorkdir("/work"). With(daggerExec("mod", "init", "--name=test", "--sdk=go")). WithNewFile("/dir/subdir/foo.txt", dagger.ContainerWithNewFileOpts{ Contents: "foo", }). WithNewFile("/dir/subdir/bar.txt", dagger.ContainerWithNewFileOpts{ Contents: "bar", }).
closed
dagger/dagger
https://github.com/dagger/dagger
6,359
CLI: update handling of various core types
As described in [this comment](https://github.com/dagger/dagger/issues/6229#issuecomment-1863649336) (and that issue generally), we need to make some adjustments to the CLIs behavior when `dagger call` ends in various core types. There's a handful of related adjustments needed here. Creating as a checklist for now to save issue spam; can break down into more issues if useful though. I'm including my initial suggestions on how to handle these, but to be clear these are not finalized decisions and the final call can be made as part of implementing this - [ ] Handle arbitrary user objects - Print fields (as in `TypeDef` fields, so just trivially resolvable values) as a json object - [x] Handle container - call `sync` only, rely on progress output for anything else - [x] Handle directory - call `sync` only, rely on progress output for anything else - [x] Handle file - call `sync` only, rely on progress output for anything else - [ ] Handle IDs returned by `sync` (i.e. the case where the user explicitly chains `sync`) - just rely on progress output, don't show the id
https://github.com/dagger/dagger/issues/6359
https://github.com/dagger/dagger/pull/6482
2999573c5a34e85b8baac8c0150881d9c08a86b8
d91ac42c196873830c2e0876b251f3bf4d62ea49
2024-01-03T20:19:06Z
go
2024-01-26T18:48:04Z
core/integration/module_call_test.go
WithNewFile("main.go", dagger.ContainerWithNewFileOpts{ Contents: `package main type Test struct {} func (m *Test) Fn(dir *Directory) *Directory { return dir } `, }) out, err := modGen.With(daggerCall("fn", "--dir", "/dir/subdir")).Stdout(ctx) require.NoError(t, err) require.Equal(t, strings.TrimSpace(out), "bar.txt\nfoo.txt") out, err = modGen.With(daggerCall("fn", "--dir", "file:///dir/subdir")).Stdout(ctx) require.NoError(t, err) require.Equal(t, strings.TrimSpace(out), "bar.txt\nfoo.txt") }) t.Run("git dir", func(t *testing.T) { t.Parallel() modGen := c.Container().From(golangImage). WithMountedFile(testCLIBinPath, daggerCliFile(t, c)). WithWorkdir("/work"). With(daggerExec("mod", "init", "--name=test", "--sdk=go")). WithNewFile("main.go", dagger.ContainerWithNewFileOpts{ Contents: `package main type Test struct {} func (m *Test) Fn(dir *Directory, subpath Optional[string]) *Directory { return dir.Directory(subpath.GetOr(".")) } `, }) for _, tc := range []struct {
closed
dagger/dagger
https://github.com/dagger/dagger
6,359
CLI: update handling of various core types
As described in [this comment](https://github.com/dagger/dagger/issues/6229#issuecomment-1863649336) (and that issue generally), we need to make some adjustments to the CLIs behavior when `dagger call` ends in various core types. There's a handful of related adjustments needed here. Creating as a checklist for now to save issue spam; can break down into more issues if useful though. I'm including my initial suggestions on how to handle these, but to be clear these are not finalized decisions and the final call can be made as part of implementing this - [ ] Handle arbitrary user objects - Print fields (as in `TypeDef` fields, so just trivially resolvable values) as a json object - [x] Handle container - call `sync` only, rely on progress output for anything else - [x] Handle directory - call `sync` only, rely on progress output for anything else - [x] Handle file - call `sync` only, rely on progress output for anything else - [ ] Handle IDs returned by `sync` (i.e. the case where the user explicitly chains `sync`) - just rely on progress output, don't show the id
https://github.com/dagger/dagger/issues/6359
https://github.com/dagger/dagger/pull/6482
2999573c5a34e85b8baac8c0150881d9c08a86b8
d91ac42c196873830c2e0876b251f3bf4d62ea49
2024-01-03T20:19:06Z
go
2024-01-26T18:48:04Z
core/integration/module_call_test.go
baseURL string subpath string }{ { baseURL: "https://github.com/dagger/dagger", }, { baseURL: "https://github.com/dagger/dagger", subpath: ".changes", }, { baseURL: "https://github.com/dagger/dagger.git", }, { baseURL: "https://github.com/dagger/dagger.git", subpath: ".changes", }, } { tc := tc t.Run(fmt.Sprintf("%s:%s", tc.baseURL, tc.subpath), func(t *testing.T) { t.Parallel() url := tc.baseURL + "#v0.9.1" if tc.subpath != "" { url += ":" + tc.subpath } args := []string{"fn", "--dir", url} if tc.subpath == "" { args = append(args, "--subpath", ".changes")
closed
dagger/dagger
https://github.com/dagger/dagger
6,359
CLI: update handling of various core types
As described in [this comment](https://github.com/dagger/dagger/issues/6229#issuecomment-1863649336) (and that issue generally), we need to make some adjustments to the CLIs behavior when `dagger call` ends in various core types. There's a handful of related adjustments needed here. Creating as a checklist for now to save issue spam; can break down into more issues if useful though. I'm including my initial suggestions on how to handle these, but to be clear these are not finalized decisions and the final call can be made as part of implementing this - [ ] Handle arbitrary user objects - Print fields (as in `TypeDef` fields, so just trivially resolvable values) as a json object - [x] Handle container - call `sync` only, rely on progress output for anything else - [x] Handle directory - call `sync` only, rely on progress output for anything else - [x] Handle file - call `sync` only, rely on progress output for anything else - [ ] Handle IDs returned by `sync` (i.e. the case where the user explicitly chains `sync`) - just rely on progress output, don't show the id
https://github.com/dagger/dagger/issues/6359
https://github.com/dagger/dagger/pull/6482
2999573c5a34e85b8baac8c0150881d9c08a86b8
d91ac42c196873830c2e0876b251f3bf4d62ea49
2024-01-03T20:19:06Z
go
2024-01-26T18:48:04Z
core/integration/module_call_test.go
} out, err := modGen.With(daggerCall(args...)).Stdout(ctx) require.NoError(t, err) require.Contains(t, out, "v0.9.1.md") require.NotContains(t, out, "v0.9.2.md") }) } }) }) t.Run("secret args", func(t *testing.T) { t.Parallel() modGen := c.Container().From(golangImage). WithMountedFile(testCLIBinPath, daggerCliFile(t, c)). WithWorkdir("/work"). With(daggerExec("mod", "init", "--name=test", "--sdk=go")). WithNewFile("main.go", dagger.ContainerWithNewFileOpts{ Contents: `package main import "context" type Test struct {} func (m *Test) Insecure(ctx context.Context, token *Secret) (string, error) { return token.Plaintext(ctx) } `, }). WithEnvVariable("TOPSECRET", "shhh"). WithNewFile("/mysupersecret", dagger.ContainerWithNewFileOpts{Contents: "file shhh"}) t.Run("explicit env", func(t *testing.T) { t.Parallel() t.Run("happy", func(t *testing.T) { t.Parallel()
closed
dagger/dagger
https://github.com/dagger/dagger
6,359
CLI: update handling of various core types
As described in [this comment](https://github.com/dagger/dagger/issues/6229#issuecomment-1863649336) (and that issue generally), we need to make some adjustments to the CLIs behavior when `dagger call` ends in various core types. There's a handful of related adjustments needed here. Creating as a checklist for now to save issue spam; can break down into more issues if useful though. I'm including my initial suggestions on how to handle these, but to be clear these are not finalized decisions and the final call can be made as part of implementing this - [ ] Handle arbitrary user objects - Print fields (as in `TypeDef` fields, so just trivially resolvable values) as a json object - [x] Handle container - call `sync` only, rely on progress output for anything else - [x] Handle directory - call `sync` only, rely on progress output for anything else - [x] Handle file - call `sync` only, rely on progress output for anything else - [ ] Handle IDs returned by `sync` (i.e. the case where the user explicitly chains `sync`) - just rely on progress output, don't show the id
https://github.com/dagger/dagger/issues/6359
https://github.com/dagger/dagger/pull/6482
2999573c5a34e85b8baac8c0150881d9c08a86b8
d91ac42c196873830c2e0876b251f3bf4d62ea49
2024-01-03T20:19:06Z
go
2024-01-26T18:48:04Z
core/integration/module_call_test.go
out, err := modGen.With(daggerCall("insecure", "--token", "env:TOPSECRET")).Stdout(ctx) require.NoError(t, err) require.Equal(t, "shhh", strings.TrimSpace(out)) }) t.Run("sad", func(t *testing.T) { t.Parallel() _, err := modGen.With(daggerCall("insecure", "--token", "env:NOWHERETOBEFOUND")).Stdout(ctx) require.ErrorContains(t, err, `secret env var not found: "NOW..."`) }) }) t.Run("implicit env", func(t *testing.T) { t.Parallel() t.Run("happy", func(t *testing.T) { t.Parallel() out, err := modGen.With(daggerCall("insecure", "--token", "TOPSECRET")).Stdout(ctx) require.NoError(t, err) require.Equal(t, "shhh", strings.TrimSpace(out)) }) t.Run("sad", func(t *testing.T) { t.Parallel() _, err := modGen.With(daggerCall("insecure", "--token", "NOWHERETOBEFOUND")).Stdout(ctx) require.ErrorContains(t, err, `secret env var not found: "NOW..."`) }) }) t.Run("file", func(t *testing.T) { t.Parallel() t.Run("happy", func(t *testing.T) { t.Parallel() out, err := modGen.With(daggerCall("insecure", "--token", "file:/mysupersecret")).Stdout(ctx) require.NoError(t, err)
closed
dagger/dagger
https://github.com/dagger/dagger
6,359
CLI: update handling of various core types
As described in [this comment](https://github.com/dagger/dagger/issues/6229#issuecomment-1863649336) (and that issue generally), we need to make some adjustments to the CLIs behavior when `dagger call` ends in various core types. There's a handful of related adjustments needed here. Creating as a checklist for now to save issue spam; can break down into more issues if useful though. I'm including my initial suggestions on how to handle these, but to be clear these are not finalized decisions and the final call can be made as part of implementing this - [ ] Handle arbitrary user objects - Print fields (as in `TypeDef` fields, so just trivially resolvable values) as a json object - [x] Handle container - call `sync` only, rely on progress output for anything else - [x] Handle directory - call `sync` only, rely on progress output for anything else - [x] Handle file - call `sync` only, rely on progress output for anything else - [ ] Handle IDs returned by `sync` (i.e. the case where the user explicitly chains `sync`) - just rely on progress output, don't show the id
https://github.com/dagger/dagger/issues/6359
https://github.com/dagger/dagger/pull/6482
2999573c5a34e85b8baac8c0150881d9c08a86b8
d91ac42c196873830c2e0876b251f3bf4d62ea49
2024-01-03T20:19:06Z
go
2024-01-26T18:48:04Z
core/integration/module_call_test.go
require.Equal(t, "file shhh", strings.TrimSpace(out)) }) t.Run("sad", func(t *testing.T) { t.Parallel() _, err := modGen.With(daggerCall("insecure", "--token", "file:/nowheretobefound")).Stdout(ctx) require.ErrorContains(t, err, `failed to read secret file "/nowheretobefound": open /nowheretobefound: no such file or directory`) }) }) t.Run("cmd", func(t *testing.T) { t.Parallel() t.Run("happy", func(t *testing.T) { t.Parallel() out, err := modGen.With(daggerCall("insecure", "--token", "cmd:echo -n cmd shhh")).Stdout(ctx) require.NoError(t, err) require.Equal(t, "cmd shhh", strings.TrimSpace(out)) }) t.Run("sad", func(t *testing.T) { t.Parallel() _, err := modGen.With(daggerCall("insecure", "--token", "cmd:exit 1")).Stdout(ctx) require.ErrorContains(t, err, `failed to run secret command "exit 1": exit status 1`) }) }) t.Run("invalid source", func(t *testing.T) { t.Parallel() _, err := modGen.With(daggerCall("insecure", "--token", "wtf:HUH")).Stdout(ctx) require.ErrorContains(t, err, `unsupported secret arg source: "wtf"`) }) }) } func TestModuleDaggerCallReturnTypes(t *testing.T) {
closed
dagger/dagger
https://github.com/dagger/dagger
6,359
CLI: update handling of various core types
As described in [this comment](https://github.com/dagger/dagger/issues/6229#issuecomment-1863649336) (and that issue generally), we need to make some adjustments to the CLIs behavior when `dagger call` ends in various core types. There's a handful of related adjustments needed here. Creating as a checklist for now to save issue spam; can break down into more issues if useful though. I'm including my initial suggestions on how to handle these, but to be clear these are not finalized decisions and the final call can be made as part of implementing this - [ ] Handle arbitrary user objects - Print fields (as in `TypeDef` fields, so just trivially resolvable values) as a json object - [x] Handle container - call `sync` only, rely on progress output for anything else - [x] Handle directory - call `sync` only, rely on progress output for anything else - [x] Handle file - call `sync` only, rely on progress output for anything else - [ ] Handle IDs returned by `sync` (i.e. the case where the user explicitly chains `sync`) - just rely on progress output, don't show the id
https://github.com/dagger/dagger/issues/6359
https://github.com/dagger/dagger/pull/6482
2999573c5a34e85b8baac8c0150881d9c08a86b8
d91ac42c196873830c2e0876b251f3bf4d62ea49
2024-01-03T20:19:06Z
go
2024-01-26T18:48:04Z
core/integration/module_call_test.go
t.Parallel() c, ctx := connect(t) t.Run("return list objects", func(t *testing.T) { t.Parallel() modGen := c.Container().From(golangImage). WithMountedFile(testCLIBinPath, daggerCliFile(t, c)). WithWorkdir("/work"). With(daggerExec("mod", "init", "--name=minimal", "--sdk=go")). WithNewFile("main.go", dagger.ContainerWithNewFileOpts{ Contents: `package main type Minimal struct {} type Foo struct { Bar int ` + "`" + `json:"bar"` + "`" + ` } func (m *Minimal) Fn() []*Foo { var foos []*Foo for i := 0; i < 3; i++ { foos = append(foos, &Foo{Bar: i}) } return foos } `,
closed
dagger/dagger
https://github.com/dagger/dagger
6,359
CLI: update handling of various core types
As described in [this comment](https://github.com/dagger/dagger/issues/6229#issuecomment-1863649336) (and that issue generally), we need to make some adjustments to the CLIs behavior when `dagger call` ends in various core types. There's a handful of related adjustments needed here. Creating as a checklist for now to save issue spam; can break down into more issues if useful though. I'm including my initial suggestions on how to handle these, but to be clear these are not finalized decisions and the final call can be made as part of implementing this - [ ] Handle arbitrary user objects - Print fields (as in `TypeDef` fields, so just trivially resolvable values) as a json object - [x] Handle container - call `sync` only, rely on progress output for anything else - [x] Handle directory - call `sync` only, rely on progress output for anything else - [x] Handle file - call `sync` only, rely on progress output for anything else - [ ] Handle IDs returned by `sync` (i.e. the case where the user explicitly chains `sync`) - just rely on progress output, don't show the id
https://github.com/dagger/dagger/issues/6359
https://github.com/dagger/dagger/pull/6482
2999573c5a34e85b8baac8c0150881d9c08a86b8
d91ac42c196873830c2e0876b251f3bf4d62ea49
2024-01-03T20:19:06Z
go
2024-01-26T18:48:04Z
core/integration/module_call_test.go
}) logGen(ctx, t, modGen.Directory(".")) expected := "0\n1\n2" t.Run("print", func(t *testing.T) { t.Parallel() out, err := modGen.With(daggerCall("fn", "bar")).Stdout(ctx) require.NoError(t, err) require.Equal(t, expected, strings.TrimSpace(out)) }) t.Run("output", func(t *testing.T) { t.Parallel() out, err := modGen. With(daggerCall("fn", "bar", "-o", "./outfile")). File("./outfile"). Contents(ctx) require.NoError(t, err) require.Equal(t, expected, strings.TrimSpace(out)) }) }) t.Run("return container", func(t *testing.T) { t.Parallel() modGen := c.Container().From(golangImage). WithMountedFile(testCLIBinPath, daggerCliFile(t, c)). WithWorkdir("/work"). With(daggerExec("mod", "init", "--name=test", "--sdk=go")). WithNewFile("main.go", dagger.ContainerWithNewFileOpts{ Contents: `package main func New() *Test { return &Test{Ctr: dag.Container().From("alpine:3.18").WithExec([]string{"echo", "hello", "world"})} }
closed
dagger/dagger
https://github.com/dagger/dagger
6,359
CLI: update handling of various core types
As described in [this comment](https://github.com/dagger/dagger/issues/6229#issuecomment-1863649336) (and that issue generally), we need to make some adjustments to the CLIs behavior when `dagger call` ends in various core types. There's a handful of related adjustments needed here. Creating as a checklist for now to save issue spam; can break down into more issues if useful though. I'm including my initial suggestions on how to handle these, but to be clear these are not finalized decisions and the final call can be made as part of implementing this - [ ] Handle arbitrary user objects - Print fields (as in `TypeDef` fields, so just trivially resolvable values) as a json object - [x] Handle container - call `sync` only, rely on progress output for anything else - [x] Handle directory - call `sync` only, rely on progress output for anything else - [x] Handle file - call `sync` only, rely on progress output for anything else - [ ] Handle IDs returned by `sync` (i.e. the case where the user explicitly chains `sync`) - just rely on progress output, don't show the id
https://github.com/dagger/dagger/issues/6359
https://github.com/dagger/dagger/pull/6482
2999573c5a34e85b8baac8c0150881d9c08a86b8
d91ac42c196873830c2e0876b251f3bf4d62ea49
2024-01-03T20:19:06Z
go
2024-01-26T18:48:04Z
core/integration/module_call_test.go
type Test struct { Ctr *Container } `, }) logGen(ctx, t, modGen.Directory(".")) t.Run("print", func(t *testing.T) { t.Parallel() out, err := modGen.With(daggerCall("ctr")).Stdout(ctx) require.NoError(t, err) require.Equal(t, "hello world", strings.TrimSpace(out)) }) t.Run("output", func(t *testing.T) { t.Parallel() modGen, err := modGen.With(daggerCall("ctr", "-o", "./container.tar")).Sync(ctx) require.NoError(t, err) size, err := modGen.File("./container.tar").Size(ctx) require.NoError(t, err) require.Greater(t, size, 0) _, err = modGen.WithExec([]string{"tar", "tf", "./container.tar", "oci-layout"}).Sync(ctx) require.NoError(t, err) }) }) t.Run("return directory", func(t *testing.T) { t.Parallel() modGen := c.Container().From(golangImage). WithMountedFile(testCLIBinPath, daggerCliFile(t, c)). WithWorkdir("/work"). With(daggerExec("mod", "init", "--name=test", "--sdk=go")). WithNewFile("main.go", dagger.ContainerWithNewFileOpts{
closed
dagger/dagger
https://github.com/dagger/dagger
6,359
CLI: update handling of various core types
As described in [this comment](https://github.com/dagger/dagger/issues/6229#issuecomment-1863649336) (and that issue generally), we need to make some adjustments to the CLIs behavior when `dagger call` ends in various core types. There's a handful of related adjustments needed here. Creating as a checklist for now to save issue spam; can break down into more issues if useful though. I'm including my initial suggestions on how to handle these, but to be clear these are not finalized decisions and the final call can be made as part of implementing this - [ ] Handle arbitrary user objects - Print fields (as in `TypeDef` fields, so just trivially resolvable values) as a json object - [x] Handle container - call `sync` only, rely on progress output for anything else - [x] Handle directory - call `sync` only, rely on progress output for anything else - [x] Handle file - call `sync` only, rely on progress output for anything else - [ ] Handle IDs returned by `sync` (i.e. the case where the user explicitly chains `sync`) - just rely on progress output, don't show the id
https://github.com/dagger/dagger/issues/6359
https://github.com/dagger/dagger/pull/6482
2999573c5a34e85b8baac8c0150881d9c08a86b8
d91ac42c196873830c2e0876b251f3bf4d62ea49
2024-01-03T20:19:06Z
go
2024-01-26T18:48:04Z
core/integration/module_call_test.go
Contents: `package main func New() *Test { return &Test{ Dir: dag.Directory().WithNewFile("foo.txt", "foo").WithNewFile("bar.txt", "bar"), } } type Test struct { Dir *Directory } `, }) logGen(ctx, t, modGen.Directory(".")) t.Run("print", func(t *testing.T) { t.Parallel() out, err := modGen.With(daggerCall("dir")).Stdout(ctx) require.NoError(t, err) require.Equal(t, "bar.txt\nfoo.txt", strings.TrimSpace(out)) }) t.Run("output", func(t *testing.T) { t.Parallel() modGen, err := modGen.With(daggerCall("dir", "-o", "./outdir")).Sync(ctx) require.NoError(t, err) entries, err := modGen.Directory("./outdir").Entries(ctx) require.NoError(t, err) require.Equal(t, "bar.txt\nfoo.txt", strings.Join(entries, "\n")) foo, err := modGen.Directory("./outdir").File("foo.txt").Contents(ctx) require.NoError(t, err) require.Equal(t, "foo", strings.TrimSpace(foo)) bar, err := modGen.Directory("./outdir").File("bar.txt").Contents(ctx) require.NoError(t, err)
closed
dagger/dagger
https://github.com/dagger/dagger
6,359
CLI: update handling of various core types
As described in [this comment](https://github.com/dagger/dagger/issues/6229#issuecomment-1863649336) (and that issue generally), we need to make some adjustments to the CLIs behavior when `dagger call` ends in various core types. There's a handful of related adjustments needed here. Creating as a checklist for now to save issue spam; can break down into more issues if useful though. I'm including my initial suggestions on how to handle these, but to be clear these are not finalized decisions and the final call can be made as part of implementing this - [ ] Handle arbitrary user objects - Print fields (as in `TypeDef` fields, so just trivially resolvable values) as a json object - [x] Handle container - call `sync` only, rely on progress output for anything else - [x] Handle directory - call `sync` only, rely on progress output for anything else - [x] Handle file - call `sync` only, rely on progress output for anything else - [ ] Handle IDs returned by `sync` (i.e. the case where the user explicitly chains `sync`) - just rely on progress output, don't show the id
https://github.com/dagger/dagger/issues/6359
https://github.com/dagger/dagger/pull/6482
2999573c5a34e85b8baac8c0150881d9c08a86b8
d91ac42c196873830c2e0876b251f3bf4d62ea49
2024-01-03T20:19:06Z
go
2024-01-26T18:48:04Z
core/integration/module_call_test.go
require.Equal(t, "bar", strings.TrimSpace(bar)) }) }) t.Run("return file", func(t *testing.T) { t.Parallel() modGen := c.Container().From(golangImage). WithMountedFile(testCLIBinPath, daggerCliFile(t, c)). WithWorkdir("/work"). With(daggerExec("mod", "init", "--name=test", "--sdk=go")). WithNewFile("main.go", dagger.ContainerWithNewFileOpts{ Contents: `package main func New() *Test { return &Test{ File: dag.Directory().WithNewFile("foo.txt", "foo").File("foo.txt"), } } type Test struct { File *File } `, }) logGen(ctx, t, modGen.Directory(".")) t.Run("print", func(t *testing.T) { t.Parallel() out, err := modGen.With(daggerCall("file")).Stdout(ctx) require.NoError(t, err) require.Equal(t, "foo", strings.TrimSpace(out)) }) t.Run("output", func(t *testing.T) { t.Parallel()
closed
dagger/dagger
https://github.com/dagger/dagger
6,359
CLI: update handling of various core types
As described in [this comment](https://github.com/dagger/dagger/issues/6229#issuecomment-1863649336) (and that issue generally), we need to make some adjustments to the CLIs behavior when `dagger call` ends in various core types. There's a handful of related adjustments needed here. Creating as a checklist for now to save issue spam; can break down into more issues if useful though. I'm including my initial suggestions on how to handle these, but to be clear these are not finalized decisions and the final call can be made as part of implementing this - [ ] Handle arbitrary user objects - Print fields (as in `TypeDef` fields, so just trivially resolvable values) as a json object - [x] Handle container - call `sync` only, rely on progress output for anything else - [x] Handle directory - call `sync` only, rely on progress output for anything else - [x] Handle file - call `sync` only, rely on progress output for anything else - [ ] Handle IDs returned by `sync` (i.e. the case where the user explicitly chains `sync`) - just rely on progress output, don't show the id
https://github.com/dagger/dagger/issues/6359
https://github.com/dagger/dagger/pull/6482
2999573c5a34e85b8baac8c0150881d9c08a86b8
d91ac42c196873830c2e0876b251f3bf4d62ea49
2024-01-03T20:19:06Z
go
2024-01-26T18:48:04Z
core/integration/module_call_test.go
out, err := modGen. With(daggerCall("file", "-o", "./outfile")). File("./outfile"). Contents(ctx) require.NoError(t, err) require.Equal(t, "foo", strings.TrimSpace(out)) }) }) t.Run("sync", func(t *testing.T) { t.Parallel() modGen := c.Container().From(golangImage). WithMountedFile(testCLIBinPath, daggerCliFile(t, c)). WithWorkdir("/work"). With(daggerExec("mod", "init", "--name=test", "--sdk=go")). WithNewFile("main.go", dagger.ContainerWithNewFileOpts{ Contents: `package main func New() *Test { return &Test{Ctr: dag.Container().From("alpine:3.18").WithExec([]string{"echo", "hello", "world"})} } type Test struct { Ctr *Container } `, }) _, err := modGen.With(daggerCall("ctr", "sync")).Stdout(ctx) require.NoError(t, err) }) } func TestModuleDaggerCallCoreChaining(t *testing.T) {
closed
dagger/dagger
https://github.com/dagger/dagger
6,359
CLI: update handling of various core types
As described in [this comment](https://github.com/dagger/dagger/issues/6229#issuecomment-1863649336) (and that issue generally), we need to make some adjustments to the CLIs behavior when `dagger call` ends in various core types. There's a handful of related adjustments needed here. Creating as a checklist for now to save issue spam; can break down into more issues if useful though. I'm including my initial suggestions on how to handle these, but to be clear these are not finalized decisions and the final call can be made as part of implementing this - [ ] Handle arbitrary user objects - Print fields (as in `TypeDef` fields, so just trivially resolvable values) as a json object - [x] Handle container - call `sync` only, rely on progress output for anything else - [x] Handle directory - call `sync` only, rely on progress output for anything else - [x] Handle file - call `sync` only, rely on progress output for anything else - [ ] Handle IDs returned by `sync` (i.e. the case where the user explicitly chains `sync`) - just rely on progress output, don't show the id
https://github.com/dagger/dagger/issues/6359
https://github.com/dagger/dagger/pull/6482
2999573c5a34e85b8baac8c0150881d9c08a86b8
d91ac42c196873830c2e0876b251f3bf4d62ea49
2024-01-03T20:19:06Z
go
2024-01-26T18:48:04Z
core/integration/module_call_test.go
t.Parallel() c, ctx := connect(t) t.Run("container", func(t *testing.T) { t.Parallel() modGen := c.Container().From(golangImage). WithMountedFile(testCLIBinPath, daggerCliFile(t, c)). WithWorkdir("/work"). With(daggerExec("mod", "init", "--name=test", "--sdk=go")). WithNewFile("main.go", dagger.ContainerWithNewFileOpts{ Contents: `package main func New() *Test { return &Test{Ctr: dag.Container().From("alpine:3.18.5")} } type Test struct { Ctr *Container } `, }) t.Run("file", func(t *testing.T) { t.Parallel()
closed
dagger/dagger
https://github.com/dagger/dagger
6,359
CLI: update handling of various core types
As described in [this comment](https://github.com/dagger/dagger/issues/6229#issuecomment-1863649336) (and that issue generally), we need to make some adjustments to the CLIs behavior when `dagger call` ends in various core types. There's a handful of related adjustments needed here. Creating as a checklist for now to save issue spam; can break down into more issues if useful though. I'm including my initial suggestions on how to handle these, but to be clear these are not finalized decisions and the final call can be made as part of implementing this - [ ] Handle arbitrary user objects - Print fields (as in `TypeDef` fields, so just trivially resolvable values) as a json object - [x] Handle container - call `sync` only, rely on progress output for anything else - [x] Handle directory - call `sync` only, rely on progress output for anything else - [x] Handle file - call `sync` only, rely on progress output for anything else - [ ] Handle IDs returned by `sync` (i.e. the case where the user explicitly chains `sync`) - just rely on progress output, don't show the id
https://github.com/dagger/dagger/issues/6359
https://github.com/dagger/dagger/pull/6482
2999573c5a34e85b8baac8c0150881d9c08a86b8
d91ac42c196873830c2e0876b251f3bf4d62ea49
2024-01-03T20:19:06Z
go
2024-01-26T18:48:04Z
core/integration/module_call_test.go
out, err := modGen.With(daggerCall("ctr", "file", "--path=/etc/alpine-release", "contents")).Stdout(ctx) require.NoError(t, err) require.Equal(t, "3.18.5", strings.TrimSpace(out)) }) t.Run("export", func(t *testing.T) { t.Parallel() modGen, err := modGen.With(daggerCall("ctr", "export", "--path=./container.tar.gz")).Sync(ctx) require.NoError(t, err) size, err := modGen.File("./container.tar.gz").Size(ctx) require.NoError(t, err) require.Greater(t, size, 0) }) }) t.Run("directory", func(t *testing.T) { t.Parallel() modGen := c.Container().From(golangImage). WithMountedFile(testCLIBinPath, daggerCliFile(t, c)). WithWorkdir("/work"). With(daggerExec("mod", "init", "--name=test", "--sdk=go")). WithNewFile("main.go", dagger.ContainerWithNewFileOpts{ Contents: `package main func New() *Test { return &Test{ Dir: dag.Directory().WithNewFile("foo.txt", "foo").WithNewFile("bar.txt", "bar"), } } type Test struct { Dir *Directory } `,
closed
dagger/dagger
https://github.com/dagger/dagger
6,359
CLI: update handling of various core types
As described in [this comment](https://github.com/dagger/dagger/issues/6229#issuecomment-1863649336) (and that issue generally), we need to make some adjustments to the CLIs behavior when `dagger call` ends in various core types. There's a handful of related adjustments needed here. Creating as a checklist for now to save issue spam; can break down into more issues if useful though. I'm including my initial suggestions on how to handle these, but to be clear these are not finalized decisions and the final call can be made as part of implementing this - [ ] Handle arbitrary user objects - Print fields (as in `TypeDef` fields, so just trivially resolvable values) as a json object - [x] Handle container - call `sync` only, rely on progress output for anything else - [x] Handle directory - call `sync` only, rely on progress output for anything else - [x] Handle file - call `sync` only, rely on progress output for anything else - [ ] Handle IDs returned by `sync` (i.e. the case where the user explicitly chains `sync`) - just rely on progress output, don't show the id
https://github.com/dagger/dagger/issues/6359
https://github.com/dagger/dagger/pull/6482
2999573c5a34e85b8baac8c0150881d9c08a86b8
d91ac42c196873830c2e0876b251f3bf4d62ea49
2024-01-03T20:19:06Z
go
2024-01-26T18:48:04Z
core/integration/module_call_test.go
}) t.Run("file", func(t *testing.T) { t.Parallel() out, err := modGen.With(daggerCall("dir", "file", "--path=foo.txt", "contents")).Stdout(ctx) require.NoError(t, err) require.Equal(t, "foo", strings.TrimSpace(out)) }) t.Run("export", func(t *testing.T) { t.Parallel() modGen, err := modGen.With(daggerCall("dir", "export", "--path=./outdir")).Sync(ctx) require.NoError(t, err) ents, err := modGen.Directory("./outdir").Entries(ctx) require.NoError(t, err) require.Equal(t, []string{"bar.txt", "foo.txt"}, ents) }) }) t.Run("return file", func(t *testing.T) { t.Parallel() modGen := c.Container().From(golangImage). WithMountedFile(testCLIBinPath, daggerCliFile(t, c)). WithWorkdir("/work"). With(daggerExec("mod", "init", "--name=test", "--sdk=go")). WithNewFile("main.go", dagger.ContainerWithNewFileOpts{ Contents: `package main func New() *Test { return &Test{ File: dag.Directory().WithNewFile("foo.txt", "foo").File("foo.txt"), } } type Test struct {
closed
dagger/dagger
https://github.com/dagger/dagger
6,359
CLI: update handling of various core types
As described in [this comment](https://github.com/dagger/dagger/issues/6229#issuecomment-1863649336) (and that issue generally), we need to make some adjustments to the CLIs behavior when `dagger call` ends in various core types. There's a handful of related adjustments needed here. Creating as a checklist for now to save issue spam; can break down into more issues if useful though. I'm including my initial suggestions on how to handle these, but to be clear these are not finalized decisions and the final call can be made as part of implementing this - [ ] Handle arbitrary user objects - Print fields (as in `TypeDef` fields, so just trivially resolvable values) as a json object - [x] Handle container - call `sync` only, rely on progress output for anything else - [x] Handle directory - call `sync` only, rely on progress output for anything else - [x] Handle file - call `sync` only, rely on progress output for anything else - [ ] Handle IDs returned by `sync` (i.e. the case where the user explicitly chains `sync`) - just rely on progress output, don't show the id
https://github.com/dagger/dagger/issues/6359
https://github.com/dagger/dagger/pull/6482
2999573c5a34e85b8baac8c0150881d9c08a86b8
d91ac42c196873830c2e0876b251f3bf4d62ea49
2024-01-03T20:19:06Z
go
2024-01-26T18:48:04Z
core/integration/module_call_test.go
File *File } `, }) t.Run("size", func(t *testing.T) { t.Parallel() out, err := modGen.With(daggerCall("file", "size")).Stdout(ctx) require.NoError(t, err) require.Equal(t, "3", strings.TrimSpace(out)) }) t.Run("export", func(t *testing.T) { t.Parallel() modGen, err := modGen.With(daggerCall("file", "export", "--path=./outfile")).Sync(ctx) require.NoError(t, err) contents, err := modGen.File("./outfile").Contents(ctx) require.NoError(t, err) require.Equal(t, "foo", strings.TrimSpace(contents)) }) }) } func TestModuleDaggerCallSaveOutput(t *testing.T) { t.Parallel() c, ctx := connect(t) modGen := c.Container().From(golangImage). WithMountedFile(testCLIBinPath, daggerCliFile(t, c)). WithWorkdir("/work"). With(daggerExec("mod", "init", "--name=test", "--sdk=go")). WithNewFile("main.go", dagger.ContainerWithNewFileOpts{ Contents: `package main
closed
dagger/dagger
https://github.com/dagger/dagger
6,359
CLI: update handling of various core types
As described in [this comment](https://github.com/dagger/dagger/issues/6229#issuecomment-1863649336) (and that issue generally), we need to make some adjustments to the CLIs behavior when `dagger call` ends in various core types. There's a handful of related adjustments needed here. Creating as a checklist for now to save issue spam; can break down into more issues if useful though. I'm including my initial suggestions on how to handle these, but to be clear these are not finalized decisions and the final call can be made as part of implementing this - [ ] Handle arbitrary user objects - Print fields (as in `TypeDef` fields, so just trivially resolvable values) as a json object - [x] Handle container - call `sync` only, rely on progress output for anything else - [x] Handle directory - call `sync` only, rely on progress output for anything else - [x] Handle file - call `sync` only, rely on progress output for anything else - [ ] Handle IDs returned by `sync` (i.e. the case where the user explicitly chains `sync`) - just rely on progress output, don't show the id
https://github.com/dagger/dagger/issues/6359
https://github.com/dagger/dagger/pull/6482
2999573c5a34e85b8baac8c0150881d9c08a86b8
d91ac42c196873830c2e0876b251f3bf4d62ea49
2024-01-03T20:19:06Z
go
2024-01-26T18:48:04Z
core/integration/module_call_test.go
type Test struct { } func (t *Test) Hello() string { return "hello" } func (t *Test) File() *File { return dag.Directory().WithNewFile("foo.txt", "foo").File("foo.txt") } `, }) logGen(ctx, t, modGen.Directory(".")) t.Run("truncate file", func(t *testing.T) { t.Parallel() out, err := modGen. WithNewFile("foo.txt", dagger.ContainerWithNewFileOpts{ Contents: "foobar", }). With(daggerCall("hello", "-o", "foo.txt")). File("foo.txt"). Contents(ctx) require.NoError(t, err) require.Equal(t, "hello", strings.TrimSpace(out)) }) t.Run("not a file", func(t *testing.T) { t.Parallel() _, err := modGen.With(daggerCall("hello", "-o", ".")).Sync(ctx) require.ErrorContains(t, err, "is a directory") }) t.Run("allow dir for file", func(t *testing.T) { t.Parallel()
closed
dagger/dagger
https://github.com/dagger/dagger
6,359
CLI: update handling of various core types
As described in [this comment](https://github.com/dagger/dagger/issues/6229#issuecomment-1863649336) (and that issue generally), we need to make some adjustments to the CLIs behavior when `dagger call` ends in various core types. There's a handful of related adjustments needed here. Creating as a checklist for now to save issue spam; can break down into more issues if useful though. I'm including my initial suggestions on how to handle these, but to be clear these are not finalized decisions and the final call can be made as part of implementing this - [ ] Handle arbitrary user objects - Print fields (as in `TypeDef` fields, so just trivially resolvable values) as a json object - [x] Handle container - call `sync` only, rely on progress output for anything else - [x] Handle directory - call `sync` only, rely on progress output for anything else - [x] Handle file - call `sync` only, rely on progress output for anything else - [ ] Handle IDs returned by `sync` (i.e. the case where the user explicitly chains `sync`) - just rely on progress output, don't show the id
https://github.com/dagger/dagger/issues/6359
https://github.com/dagger/dagger/pull/6482
2999573c5a34e85b8baac8c0150881d9c08a86b8
d91ac42c196873830c2e0876b251f3bf4d62ea49
2024-01-03T20:19:06Z
go
2024-01-26T18:48:04Z
core/integration/module_call_test.go
out, err := modGen. With(daggerCall("file", "-o", ".")). File("foo.txt"). Contents(ctx) require.NoError(t, err) require.Equal(t, "foo", strings.TrimSpace(out)) }) t.Run("create parent dirs", func(t *testing.T) { t.Parallel() ctr, err := modGen.With(daggerCall("hello", "-o", "foo/bar.txt")).Sync(ctx) require.NoError(t, err) t.Run("print success", func(t *testing.T) { t.Parallel() out, err := ctr.Stderr(ctx) require.NoError(t, err) require.Contains(t, out, `Saved output to "/work/foo/bar.txt"`) }) t.Run("check directory permissions", func(t *testing.T) { t.Parallel() out, err := ctr.WithExec([]string{"stat", "-c", "%a", "foo"}).Stdout(ctx) require.NoError(t, err) require.Equal(t, "755", strings.TrimSpace(out)) }) t.Run("check file permissions", func(t *testing.T) { t.Parallel() out, err := ctr.WithExec([]string{"stat", "-c", "%a", "foo/bar.txt"}).Stdout(ctx) require.NoError(t, err) require.Equal(t, "644", strings.TrimSpace(out)) })
closed
dagger/dagger
https://github.com/dagger/dagger
6,359
CLI: update handling of various core types
As described in [this comment](https://github.com/dagger/dagger/issues/6229#issuecomment-1863649336) (and that issue generally), we need to make some adjustments to the CLIs behavior when `dagger call` ends in various core types. There's a handful of related adjustments needed here. Creating as a checklist for now to save issue spam; can break down into more issues if useful though. I'm including my initial suggestions on how to handle these, but to be clear these are not finalized decisions and the final call can be made as part of implementing this - [ ] Handle arbitrary user objects - Print fields (as in `TypeDef` fields, so just trivially resolvable values) as a json object - [x] Handle container - call `sync` only, rely on progress output for anything else - [x] Handle directory - call `sync` only, rely on progress output for anything else - [x] Handle file - call `sync` only, rely on progress output for anything else - [ ] Handle IDs returned by `sync` (i.e. the case where the user explicitly chains `sync`) - just rely on progress output, don't show the id
https://github.com/dagger/dagger/issues/6359
https://github.com/dagger/dagger/pull/6482
2999573c5a34e85b8baac8c0150881d9c08a86b8
d91ac42c196873830c2e0876b251f3bf4d62ea49
2024-01-03T20:19:06Z
go
2024-01-26T18:48:04Z
core/integration/module_call_test.go
}) t.Run("check umask", func(t *testing.T) { t.Parallel() ctr, err := modGen. WithNewFile("/entrypoint.sh", dagger.ContainerWithNewFileOpts{ Contents: `#!/bin/sh umask 027 exec "$@" `, Permissions: 0o750, }). WithEntrypoint([]string{"/entrypoint.sh"}). With(daggerCall("hello", "-o", "/tmp/foo/bar.txt")). Sync(ctx) require.NoError(t, err) t.Run("directory", func(t *testing.T) { t.Parallel() out, err := ctr.WithExec([]string{"stat", "-c", "%a", "/tmp/foo"}).Stdout(ctx) require.NoError(t, err) require.Equal(t, "750", strings.TrimSpace(out)) }) t.Run("file", func(t *testing.T) { t.Parallel() out, err := ctr.WithExec([]string{"stat", "-c", "%a", "/tmp/foo/bar.txt"}).Stdout(ctx) require.NoError(t, err) require.Equal(t, "640", strings.TrimSpace(out)) }) }) }
closed
dagger/dagger
https://github.com/dagger/dagger
6,359
CLI: update handling of various core types
As described in [this comment](https://github.com/dagger/dagger/issues/6229#issuecomment-1863649336) (and that issue generally), we need to make some adjustments to the CLIs behavior when `dagger call` ends in various core types. There's a handful of related adjustments needed here. Creating as a checklist for now to save issue spam; can break down into more issues if useful though. I'm including my initial suggestions on how to handle these, but to be clear these are not finalized decisions and the final call can be made as part of implementing this - [ ] Handle arbitrary user objects - Print fields (as in `TypeDef` fields, so just trivially resolvable values) as a json object - [x] Handle container - call `sync` only, rely on progress output for anything else - [x] Handle directory - call `sync` only, rely on progress output for anything else - [x] Handle file - call `sync` only, rely on progress output for anything else - [ ] Handle IDs returned by `sync` (i.e. the case where the user explicitly chains `sync`) - just rely on progress output, don't show the id
https://github.com/dagger/dagger/issues/6359
https://github.com/dagger/dagger/pull/6482
2999573c5a34e85b8baac8c0150881d9c08a86b8
d91ac42c196873830c2e0876b251f3bf4d62ea49
2024-01-03T20:19:06Z
go
2024-01-26T18:48:04Z
core/integration/module_test.go
package core import ( "context" _ "embed" "encoding/json" "fmt" "go/format" "os" "os/exec" "path/filepath" "strings" "testing" "time" "github.com/dagger/dagger/dagql/idproto" "github.com/iancoleman/strcase" "github.com/moby/buildkit/identity" "github.com/stretchr/testify/require" "github.com/tidwall/gjson" "golang.org/x/sync/errgroup" "dagger.io/dagger" "github.com/dagger/dagger/cmd/codegen/introspection" "github.com/dagger/dagger/core/modules" ) func TestModuleGoInit(t *testing.T) {
closed
dagger/dagger
https://github.com/dagger/dagger
6,359
CLI: update handling of various core types
As described in [this comment](https://github.com/dagger/dagger/issues/6229#issuecomment-1863649336) (and that issue generally), we need to make some adjustments to the CLIs behavior when `dagger call` ends in various core types. There's a handful of related adjustments needed here. Creating as a checklist for now to save issue spam; can break down into more issues if useful though. I'm including my initial suggestions on how to handle these, but to be clear these are not finalized decisions and the final call can be made as part of implementing this - [ ] Handle arbitrary user objects - Print fields (as in `TypeDef` fields, so just trivially resolvable values) as a json object - [x] Handle container - call `sync` only, rely on progress output for anything else - [x] Handle directory - call `sync` only, rely on progress output for anything else - [x] Handle file - call `sync` only, rely on progress output for anything else - [ ] Handle IDs returned by `sync` (i.e. the case where the user explicitly chains `sync`) - just rely on progress output, don't show the id
https://github.com/dagger/dagger/issues/6359
https://github.com/dagger/dagger/pull/6482
2999573c5a34e85b8baac8c0150881d9c08a86b8
d91ac42c196873830c2e0876b251f3bf4d62ea49
2024-01-03T20:19:06Z
go
2024-01-26T18:48:04Z
core/integration/module_test.go
t.Run("from scratch", func(t *testing.T) { t.Parallel() c, ctx := connect(t) modGen := c.Container().From(golangImage). WithMountedFile(testCLIBinPath, daggerCliFile(t, c)). WithWorkdir("/work"). With(daggerExec("mod", "init", "--name=bare", "--sdk=go")) logGen(ctx, t, modGen.Directory(".")) out, err := modGen. With(daggerQuery(`{bare{containerEcho(stringArg:"hello"){stdout}}}`)). Stdout(ctx) require.NoError(t, err) require.JSONEq(t, `{"bare":{"containerEcho":{"stdout":"hello\n"}}}`, out) })
closed
dagger/dagger
https://github.com/dagger/dagger
6,359
CLI: update handling of various core types
As described in [this comment](https://github.com/dagger/dagger/issues/6229#issuecomment-1863649336) (and that issue generally), we need to make some adjustments to the CLIs behavior when `dagger call` ends in various core types. There's a handful of related adjustments needed here. Creating as a checklist for now to save issue spam; can break down into more issues if useful though. I'm including my initial suggestions on how to handle these, but to be clear these are not finalized decisions and the final call can be made as part of implementing this - [ ] Handle arbitrary user objects - Print fields (as in `TypeDef` fields, so just trivially resolvable values) as a json object - [x] Handle container - call `sync` only, rely on progress output for anything else - [x] Handle directory - call `sync` only, rely on progress output for anything else - [x] Handle file - call `sync` only, rely on progress output for anything else - [ ] Handle IDs returned by `sync` (i.e. the case where the user explicitly chains `sync`) - just rely on progress output, don't show the id
https://github.com/dagger/dagger/issues/6359
https://github.com/dagger/dagger/pull/6482
2999573c5a34e85b8baac8c0150881d9c08a86b8
d91ac42c196873830c2e0876b251f3bf4d62ea49
2024-01-03T20:19:06Z
go
2024-01-26T18:48:04Z
core/integration/module_test.go
t.Run("reserved go.mod name", func(t *testing.T) { t.Parallel() c, ctx := connect(t) modGen := c.Container().From(golangImage). WithMountedFile(testCLIBinPath, daggerCliFile(t, c)). WithWorkdir("/work"). With(daggerExec("mod", "init", "--name=go", "--sdk=go")) logGen(ctx, t, modGen.Directory(".")) out, err := modGen. With(daggerQuery(`{go{containerEcho(stringArg:"hello"){stdout}}}`)). Stdout(ctx) require.NoError(t, err) require.JSONEq(t, `{"go":{"containerEcho":{"stdout":"hello\n"}}}`, out) }) t.Run("uses expected Go module name, camel-cases Dagger module name", func(t *testing.T) { t.Parallel() c, ctx := connect(t) modGen := c.Container().From(golangImage). WithMountedFile(testCLIBinPath, daggerCliFile(t, c)). WithWorkdir("/work"). With(daggerExec("mod", "init", "--name=My-Module", "--sdk=go")) logGen(ctx, t, modGen.Directory(".")) out, err := modGen. With(daggerQuery(`{myModule{containerEcho(stringArg:"hello"){stdout}}}`)). Stdout(ctx) require.NoError(t, err) require.JSONEq(t, `{"myModule":{"containerEcho":{"stdout":"hello\n"}}}`, out) generated, err := modGen.File("go.mod").Contents(ctx) require.NoError(t, err) require.Contains(t, generated, "module main")
closed
dagger/dagger
https://github.com/dagger/dagger
6,359
CLI: update handling of various core types
As described in [this comment](https://github.com/dagger/dagger/issues/6229#issuecomment-1863649336) (and that issue generally), we need to make some adjustments to the CLIs behavior when `dagger call` ends in various core types. There's a handful of related adjustments needed here. Creating as a checklist for now to save issue spam; can break down into more issues if useful though. I'm including my initial suggestions on how to handle these, but to be clear these are not finalized decisions and the final call can be made as part of implementing this - [ ] Handle arbitrary user objects - Print fields (as in `TypeDef` fields, so just trivially resolvable values) as a json object - [x] Handle container - call `sync` only, rely on progress output for anything else - [x] Handle directory - call `sync` only, rely on progress output for anything else - [x] Handle file - call `sync` only, rely on progress output for anything else - [ ] Handle IDs returned by `sync` (i.e. the case where the user explicitly chains `sync`) - just rely on progress output, don't show the id
https://github.com/dagger/dagger/issues/6359
https://github.com/dagger/dagger/pull/6482
2999573c5a34e85b8baac8c0150881d9c08a86b8
d91ac42c196873830c2e0876b251f3bf4d62ea49
2024-01-03T20:19:06Z
go
2024-01-26T18:48:04Z
core/integration/module_test.go
}) t.Run("creates go.mod beneath an existing go.mod if root points beneath it", func(t *testing.T) { t.Parallel() c, ctx := connect(t) modGen := c.Container().From(golangImage). WithMountedFile(testCLIBinPath, daggerCliFile(t, c)). WithWorkdir("/work"). WithNewFile("/work/go.mod", dagger.ContainerWithNewFileOpts{ Contents: "module example.com/test\n", }). WithNewFile("/work/foo.go", dagger.ContainerWithNewFileOpts{ Contents: "package foo\n", }). WithWorkdir("/work/ci"). With(daggerExec("mod", "init", "--name=beneathGoMod", "--sdk=go")) logGen(ctx, t, modGen.Directory(".")) out, err := modGen. With(daggerQuery(`{beneathGoMod{containerEcho(stringArg:"hello"){stdout}}}`)). Stdout(ctx) require.NoError(t, err) require.JSONEq(t, `{"beneathGoMod":{"containerEcho":{"stdout":"hello\n"}}}`, out) t.Run("names Go module after Dagger module", func(t *testing.T) { generated, err := modGen.File("go.mod").Contents(ctx) require.NoError(t, err) require.Contains(t, generated, "module main") }) }) t.Run("respects existing go.mod", func(t *testing.T) { t.Parallel() c, ctx := connect(t)
closed
dagger/dagger
https://github.com/dagger/dagger
6,359
CLI: update handling of various core types
As described in [this comment](https://github.com/dagger/dagger/issues/6229#issuecomment-1863649336) (and that issue generally), we need to make some adjustments to the CLIs behavior when `dagger call` ends in various core types. There's a handful of related adjustments needed here. Creating as a checklist for now to save issue spam; can break down into more issues if useful though. I'm including my initial suggestions on how to handle these, but to be clear these are not finalized decisions and the final call can be made as part of implementing this - [ ] Handle arbitrary user objects - Print fields (as in `TypeDef` fields, so just trivially resolvable values) as a json object - [x] Handle container - call `sync` only, rely on progress output for anything else - [x] Handle directory - call `sync` only, rely on progress output for anything else - [x] Handle file - call `sync` only, rely on progress output for anything else - [ ] Handle IDs returned by `sync` (i.e. the case where the user explicitly chains `sync`) - just rely on progress output, don't show the id
https://github.com/dagger/dagger/issues/6359
https://github.com/dagger/dagger/pull/6482
2999573c5a34e85b8baac8c0150881d9c08a86b8
d91ac42c196873830c2e0876b251f3bf4d62ea49
2024-01-03T20:19:06Z
go
2024-01-26T18:48:04Z
core/integration/module_test.go
modGen := c.Container().From(golangImage). WithMountedFile(testCLIBinPath, daggerCliFile(t, c)). WithWorkdir("/work"). WithExec([]string{"go", "mod", "init", "example.com/test"}). With(daggerExec("mod", "init", "--name=hasGoMod", "--sdk=go")) logGen(ctx, t, modGen.Directory(".")) out, err := modGen. With(daggerQuery(`{hasGoMod{containerEcho(stringArg:"hello"){stdout}}}`)). Stdout(ctx) require.NoError(t, err) require.JSONEq(t, `{"hasGoMod":{"containerEcho":{"stdout":"hello\n"}}}`, out) t.Run("preserves module name", func(t *testing.T) { generated, err := modGen.File("go.mod").Contents(ctx) require.NoError(t, err) require.Contains(t, generated, "module example.com/test") }) }) t.Run("respects parent go.mod if root points to it", func(t *testing.T) { t.Parallel() c, ctx := connect(t) modGen := c.Container().From(golangImage). WithMountedFile(testCLIBinPath, daggerCliFile(t, c)). WithWorkdir("/work"). WithExec([]string{"go", "mod", "init", "example.com/test"}). WithNewFile("/work/foo.go", dagger.ContainerWithNewFileOpts{ Contents: "package foo\n", }). WithWorkdir("/work/child"). With(daggerExec("mod", "init", "--name=child", "--sdk=go", "--root=..")). WithNewFile("/work/child/main.go", dagger.ContainerWithNewFileOpts{
closed
dagger/dagger
https://github.com/dagger/dagger
6,359
CLI: update handling of various core types
As described in [this comment](https://github.com/dagger/dagger/issues/6229#issuecomment-1863649336) (and that issue generally), we need to make some adjustments to the CLIs behavior when `dagger call` ends in various core types. There's a handful of related adjustments needed here. Creating as a checklist for now to save issue spam; can break down into more issues if useful though. I'm including my initial suggestions on how to handle these, but to be clear these are not finalized decisions and the final call can be made as part of implementing this - [ ] Handle arbitrary user objects - Print fields (as in `TypeDef` fields, so just trivially resolvable values) as a json object - [x] Handle container - call `sync` only, rely on progress output for anything else - [x] Handle directory - call `sync` only, rely on progress output for anything else - [x] Handle file - call `sync` only, rely on progress output for anything else - [ ] Handle IDs returned by `sync` (i.e. the case where the user explicitly chains `sync`) - just rely on progress output, don't show the id
https://github.com/dagger/dagger/issues/6359
https://github.com/dagger/dagger/pull/6482
2999573c5a34e85b8baac8c0150881d9c08a86b8
d91ac42c196873830c2e0876b251f3bf4d62ea49
2024-01-03T20:19:06Z
go
2024-01-26T18:48:04Z
core/integration/module_test.go
Contents: ` package main import "os" type Child struct{} func (m *Child) Root() *Directory { wd, err := os.Getwd() if err != nil { panic(err) } return dag.Host().Directory(wd+"/..") } `, }) generated := modGen. With(daggerExec("mod", "sync")). Directory(".") logGen(ctx, t, generated) out, err := modGen. With(daggerQuery(`{child{root{entries}}}`)). Stdout(ctx) require.NoError(t, err) require.JSONEq(t, `{"child":{"root":{"entries":["child","foo.go","go.mod","go.sum"]}}}`, out) childEntries, err := generated.Entries(ctx) require.NoError(t, err) require.NotContains(t, childEntries, "go.mod") t.Run("preserves parent module name", func(t *testing.T) { generated, err := modGen.File("/work/go.mod").Contents(ctx) require.NoError(t, err) require.Contains(t, generated, "module example.com/test")
closed
dagger/dagger
https://github.com/dagger/dagger
6,359
CLI: update handling of various core types
As described in [this comment](https://github.com/dagger/dagger/issues/6229#issuecomment-1863649336) (and that issue generally), we need to make some adjustments to the CLIs behavior when `dagger call` ends in various core types. There's a handful of related adjustments needed here. Creating as a checklist for now to save issue spam; can break down into more issues if useful though. I'm including my initial suggestions on how to handle these, but to be clear these are not finalized decisions and the final call can be made as part of implementing this - [ ] Handle arbitrary user objects - Print fields (as in `TypeDef` fields, so just trivially resolvable values) as a json object - [x] Handle container - call `sync` only, rely on progress output for anything else - [x] Handle directory - call `sync` only, rely on progress output for anything else - [x] Handle file - call `sync` only, rely on progress output for anything else - [ ] Handle IDs returned by `sync` (i.e. the case where the user explicitly chains `sync`) - just rely on progress output, don't show the id
https://github.com/dagger/dagger/issues/6359
https://github.com/dagger/dagger/pull/6482
2999573c5a34e85b8baac8c0150881d9c08a86b8
d91ac42c196873830c2e0876b251f3bf4d62ea49
2024-01-03T20:19:06Z
go
2024-01-26T18:48:04Z
core/integration/module_test.go
}) }) t.Run("respects existing go.mod even if root points to parent that has go.mod", func(t *testing.T) { t.Parallel() c, ctx := connect(t) modGen := c.Container().From(golangImage). WithMountedFile(testCLIBinPath, daggerCliFile(t, c)). WithWorkdir("/work"). WithExec([]string{"go", "mod", "init", "example.com/test"}). WithNewFile("/work/foo.go", dagger.ContainerWithNewFileOpts{ Contents: "package foo\n", }). WithWorkdir("/work/child"). WithExec([]string{"go", "mod", "init", "my-mod"}). With(daggerExec("mod", "init", "--name=child", "--sdk=go", "--root=..")). WithNewFile("/work/child/main.go", dagger.ContainerWithNewFileOpts{ Contents: ` package main import "os" type Child struct{} func (m *Child) Root() *Directory { wd, err := os.Getwd() if err != nil { panic(err) } return dag.Host().Directory(wd+"/..") } `, }) generated := modGen.
closed
dagger/dagger
https://github.com/dagger/dagger
6,359
CLI: update handling of various core types
As described in [this comment](https://github.com/dagger/dagger/issues/6229#issuecomment-1863649336) (and that issue generally), we need to make some adjustments to the CLIs behavior when `dagger call` ends in various core types. There's a handful of related adjustments needed here. Creating as a checklist for now to save issue spam; can break down into more issues if useful though. I'm including my initial suggestions on how to handle these, but to be clear these are not finalized decisions and the final call can be made as part of implementing this - [ ] Handle arbitrary user objects - Print fields (as in `TypeDef` fields, so just trivially resolvable values) as a json object - [x] Handle container - call `sync` only, rely on progress output for anything else - [x] Handle directory - call `sync` only, rely on progress output for anything else - [x] Handle file - call `sync` only, rely on progress output for anything else - [ ] Handle IDs returned by `sync` (i.e. the case where the user explicitly chains `sync`) - just rely on progress output, don't show the id
https://github.com/dagger/dagger/issues/6359
https://github.com/dagger/dagger/pull/6482
2999573c5a34e85b8baac8c0150881d9c08a86b8
d91ac42c196873830c2e0876b251f3bf4d62ea49
2024-01-03T20:19:06Z
go
2024-01-26T18:48:04Z
core/integration/module_test.go
With(daggerExec("mod", "sync")). Directory(".") logGen(ctx, t, generated) out, err := modGen. With(daggerQuery(`{child{root{entries}}}`)). Stdout(ctx) require.NoError(t, err) require.JSONEq(t, `{"child":{"root":{"entries":["child","foo.go","go.mod"]}}}`, out) childEntries, err := generated.Entries(ctx) require.NoError(t, err) require.Contains(t, childEntries, "go.mod") require.Contains(t, childEntries, "go.sum") }) t.Run("respects existing main.go", func(t *testing.T) { t.Parallel() c, ctx := connect(t) modGen := c.Container().From(golangImage). WithMountedFile(testCLIBinPath, daggerCliFile(t, c)). WithWorkdir("/work"). WithNewFile("/work/main.go", dagger.ContainerWithNewFileOpts{ Contents: ` package main type HasMainGo struct {} func (m *HasMainGo) Hello() string { return "Hello, world!" } `, }). With(daggerExec("mod", "init", "--name=hasMainGo", "--sdk=go")) logGen(ctx, t, modGen.Directory("."))
closed
dagger/dagger
https://github.com/dagger/dagger
6,359
CLI: update handling of various core types
As described in [this comment](https://github.com/dagger/dagger/issues/6229#issuecomment-1863649336) (and that issue generally), we need to make some adjustments to the CLIs behavior when `dagger call` ends in various core types. There's a handful of related adjustments needed here. Creating as a checklist for now to save issue spam; can break down into more issues if useful though. I'm including my initial suggestions on how to handle these, but to be clear these are not finalized decisions and the final call can be made as part of implementing this - [ ] Handle arbitrary user objects - Print fields (as in `TypeDef` fields, so just trivially resolvable values) as a json object - [x] Handle container - call `sync` only, rely on progress output for anything else - [x] Handle directory - call `sync` only, rely on progress output for anything else - [x] Handle file - call `sync` only, rely on progress output for anything else - [ ] Handle IDs returned by `sync` (i.e. the case where the user explicitly chains `sync`) - just rely on progress output, don't show the id
https://github.com/dagger/dagger/issues/6359
https://github.com/dagger/dagger/pull/6482
2999573c5a34e85b8baac8c0150881d9c08a86b8
d91ac42c196873830c2e0876b251f3bf4d62ea49
2024-01-03T20:19:06Z
go
2024-01-26T18:48:04Z
core/integration/module_test.go
out, err := modGen. With(daggerQuery(`{hasMainGo{hello}}`)). Stdout(ctx) require.NoError(t, err) require.JSONEq(t, `{"hasMainGo":{"hello":"Hello, world!"}}`, out) }) t.Run("respects existing main.go even if it uses types not generated yet", func(t *testing.T) { t.Parallel() c, ctx := connect(t) modGen := c.Container().From(golangImage). WithMountedFile(testCLIBinPath, daggerCliFile(t, c)). WithWorkdir("/work"). WithNewFile("/work/main.go", dagger.ContainerWithNewFileOpts{ Contents: ` package main type HasDaggerTypes struct {} func (m *HasDaggerTypes) Hello() *Container { return dag.Container(). From("` + alpineImage + `"). WithExec([]string{"echo", "Hello, world!"}) } `, }). With(daggerExec("mod", "init", "--name=hasDaggerTypes", "--sdk=go")) logGen(ctx, t, modGen.Directory(".")) out, err := modGen. With(daggerQuery(`{hasDaggerTypes{hello{stdout}}}`)). Stdout(ctx) require.NoError(t, err) require.JSONEq(t, `{"hasDaggerTypes":{"hello":{"stdout":"Hello, world!\n"}}}`, out)
closed
dagger/dagger
https://github.com/dagger/dagger
6,359
CLI: update handling of various core types
As described in [this comment](https://github.com/dagger/dagger/issues/6229#issuecomment-1863649336) (and that issue generally), we need to make some adjustments to the CLIs behavior when `dagger call` ends in various core types. There's a handful of related adjustments needed here. Creating as a checklist for now to save issue spam; can break down into more issues if useful though. I'm including my initial suggestions on how to handle these, but to be clear these are not finalized decisions and the final call can be made as part of implementing this - [ ] Handle arbitrary user objects - Print fields (as in `TypeDef` fields, so just trivially resolvable values) as a json object - [x] Handle container - call `sync` only, rely on progress output for anything else - [x] Handle directory - call `sync` only, rely on progress output for anything else - [x] Handle file - call `sync` only, rely on progress output for anything else - [ ] Handle IDs returned by `sync` (i.e. the case where the user explicitly chains `sync`) - just rely on progress output, don't show the id
https://github.com/dagger/dagger/issues/6359
https://github.com/dagger/dagger/pull/6482
2999573c5a34e85b8baac8c0150881d9c08a86b8
d91ac42c196873830c2e0876b251f3bf4d62ea49
2024-01-03T20:19:06Z
go
2024-01-26T18:48:04Z
core/integration/module_test.go
}) t.Run("respects existing package without creating main.go", func(t *testing.T) { t.Parallel() c, ctx := connect(t) modGen := c.Container().From(golangImage). WithMountedFile(testCLIBinPath, daggerCliFile(t, c)). WithWorkdir("/work"). WithNewFile("/work/notmain.go", dagger.ContainerWithNewFileOpts{ Contents: `package main type HasNotMainGo struct {} func (m *HasNotMainGo) Hello() string { return "Hello, world!" } `, }). With(daggerExec("mod", "init", "--name=hasNotMainGo", "--sdk=go")) logGen(ctx, t, modGen.Directory(".")) out, err := modGen. With(daggerQuery(`{hasNotMainGo{hello}}`)). Stdout(ctx) require.NoError(t, err) require.JSONEq(t, `{"hasNotMainGo":{"hello":"Hello, world!"}}`, out) }) } func TestModulePythonInit(t *testing.T) { t.Run("from scratch", func(t *testing.T) { t.Parallel() c, ctx := connect(t) modGen := c.Container().From(golangImage). WithMountedFile(testCLIBinPath, daggerCliFile(t, c)). WithWorkdir("/work"). With(daggerExec("mod", "init", "--name=bare", "--sdk=python"))
closed
dagger/dagger
https://github.com/dagger/dagger
6,359
CLI: update handling of various core types
As described in [this comment](https://github.com/dagger/dagger/issues/6229#issuecomment-1863649336) (and that issue generally), we need to make some adjustments to the CLIs behavior when `dagger call` ends in various core types. There's a handful of related adjustments needed here. Creating as a checklist for now to save issue spam; can break down into more issues if useful though. I'm including my initial suggestions on how to handle these, but to be clear these are not finalized decisions and the final call can be made as part of implementing this - [ ] Handle arbitrary user objects - Print fields (as in `TypeDef` fields, so just trivially resolvable values) as a json object - [x] Handle container - call `sync` only, rely on progress output for anything else - [x] Handle directory - call `sync` only, rely on progress output for anything else - [x] Handle file - call `sync` only, rely on progress output for anything else - [ ] Handle IDs returned by `sync` (i.e. the case where the user explicitly chains `sync`) - just rely on progress output, don't show the id
https://github.com/dagger/dagger/issues/6359
https://github.com/dagger/dagger/pull/6482
2999573c5a34e85b8baac8c0150881d9c08a86b8
d91ac42c196873830c2e0876b251f3bf4d62ea49
2024-01-03T20:19:06Z
go
2024-01-26T18:48:04Z
core/integration/module_test.go
out, err := modGen. With(daggerQuery(`{bare{containerEcho(stringArg:"hello"){stdout}}}`)). Stdout(ctx) require.NoError(t, err) require.JSONEq(t, `{"bare":{"containerEcho":{"stdout":"hello\n"}}}`, out) }) t.Run("with different root", func(t *testing.T) { t.Parallel() c, ctx := connect(t) modGen := c.Container().From(golangImage). WithMountedFile(testCLIBinPath, daggerCliFile(t, c)). WithWorkdir("/work/child"). With(daggerExec("mod", "init", "--name=bare", "--sdk=python", "--root=..")) out, err := modGen. With(daggerQuery(`{bare{containerEcho(stringArg:"hello"){stdout}}}`)). Stdout(ctx) require.NoError(t, err) require.JSONEq(t, `{"bare":{"containerEcho":{"stdout":"hello\n"}}}`, out) }) t.Run("respects existing pyproject.toml", func(t *testing.T) { t.Parallel() c, ctx := connect(t) modGen := c.Container().From(golangImage). WithMountedFile(testCLIBinPath, daggerCliFile(t, c)). WithWorkdir("/work"). WithNewFile("pyproject.toml", dagger.ContainerWithNewFileOpts{ Contents: `[project] name = "has-pyproject" version = "0.0.0" `,
closed
dagger/dagger
https://github.com/dagger/dagger
6,359
CLI: update handling of various core types
As described in [this comment](https://github.com/dagger/dagger/issues/6229#issuecomment-1863649336) (and that issue generally), we need to make some adjustments to the CLIs behavior when `dagger call` ends in various core types. There's a handful of related adjustments needed here. Creating as a checklist for now to save issue spam; can break down into more issues if useful though. I'm including my initial suggestions on how to handle these, but to be clear these are not finalized decisions and the final call can be made as part of implementing this - [ ] Handle arbitrary user objects - Print fields (as in `TypeDef` fields, so just trivially resolvable values) as a json object - [x] Handle container - call `sync` only, rely on progress output for anything else - [x] Handle directory - call `sync` only, rely on progress output for anything else - [x] Handle file - call `sync` only, rely on progress output for anything else - [ ] Handle IDs returned by `sync` (i.e. the case where the user explicitly chains `sync`) - just rely on progress output, don't show the id
https://github.com/dagger/dagger/issues/6359
https://github.com/dagger/dagger/pull/6482
2999573c5a34e85b8baac8c0150881d9c08a86b8
d91ac42c196873830c2e0876b251f3bf4d62ea49
2024-01-03T20:19:06Z
go
2024-01-26T18:48:04Z
core/integration/module_test.go
}). With(daggerExec("mod", "init", "--name=hasPyproject", "--sdk=python")) out, err := modGen. With(daggerQuery(`{hasPyproject{containerEcho(stringArg:"hello"){stdout}}}`)). Stdout(ctx) require.NoError(t, err) require.JSONEq(t, `{"hasPyproject":{"containerEcho":{"stdout":"hello\n"}}}`, out) t.Run("preserves module name", func(t *testing.T) { generated, err := modGen.File("pyproject.toml").Contents(ctx) require.NoError(t, err) require.Contains(t, generated, `name = "has-pyproject"`) }) }) t.Run("respects existing main.py", func(t *testing.T) { t.Parallel() c, ctx := connect(t) modGen := c.Container().From(golangImage). WithMountedFile(testCLIBinPath, daggerCliFile(t, c)). WithWorkdir("/work"). WithNewFile("/work/src/main/__init__.py", dagger.ContainerWithNewFileOpts{ Contents: "from . import notmain\n", }). WithNewFile("/work/src/main/notmain.py", dagger.ContainerWithNewFileOpts{ Contents: `from dagger import function @function def hello() -> str: return "Hello, world!" `, }). With(daggerExec("mod", "init", "--name=hasMainPy", "--sdk=python"))
closed
dagger/dagger
https://github.com/dagger/dagger
6,359
CLI: update handling of various core types
As described in [this comment](https://github.com/dagger/dagger/issues/6229#issuecomment-1863649336) (and that issue generally), we need to make some adjustments to the CLIs behavior when `dagger call` ends in various core types. There's a handful of related adjustments needed here. Creating as a checklist for now to save issue spam; can break down into more issues if useful though. I'm including my initial suggestions on how to handle these, but to be clear these are not finalized decisions and the final call can be made as part of implementing this - [ ] Handle arbitrary user objects - Print fields (as in `TypeDef` fields, so just trivially resolvable values) as a json object - [x] Handle container - call `sync` only, rely on progress output for anything else - [x] Handle directory - call `sync` only, rely on progress output for anything else - [x] Handle file - call `sync` only, rely on progress output for anything else - [ ] Handle IDs returned by `sync` (i.e. the case where the user explicitly chains `sync`) - just rely on progress output, don't show the id
https://github.com/dagger/dagger/issues/6359
https://github.com/dagger/dagger/pull/6482
2999573c5a34e85b8baac8c0150881d9c08a86b8
d91ac42c196873830c2e0876b251f3bf4d62ea49
2024-01-03T20:19:06Z
go
2024-01-26T18:48:04Z
core/integration/module_test.go
out, err := modGen. With(daggerQuery(`{hasMainPy{hello}}`)). Stdout(ctx) require.NoError(t, err) require.JSONEq(t, `{"hasMainPy":{"hello":"Hello, world!"}}`, out) }) t.Run("uses expected field casing", func(t *testing.T) { t.Parallel() c, ctx := connect(t) modGen := c.Container().From(golangImage). WithMountedFile(testCLIBinPath, daggerCliFile(t, c)). WithWorkdir("/work"). With(daggerExec("mod", "init", "--name=hello-world", "--sdk=python")). With(sdkSource("python", `from dagger import field, function, object_type @object_type class HelloWorld: my_name: str = field(default="World") @function def message(self) -> str: return f"Hello, {self.my_name}!" `, )) out, err := modGen. With(daggerQuery(`{helloWorld(myName: "Monde"){message}}`)). Stdout(ctx) require.NoError(t, err) require.JSONEq(t, `{"helloWorld":{"message":"Hello, Monde!"}}`, out) }) } func TestModuleInitLICENSE(t *testing.T) {
closed
dagger/dagger
https://github.com/dagger/dagger
6,359
CLI: update handling of various core types
As described in [this comment](https://github.com/dagger/dagger/issues/6229#issuecomment-1863649336) (and that issue generally), we need to make some adjustments to the CLIs behavior when `dagger call` ends in various core types. There's a handful of related adjustments needed here. Creating as a checklist for now to save issue spam; can break down into more issues if useful though. I'm including my initial suggestions on how to handle these, but to be clear these are not finalized decisions and the final call can be made as part of implementing this - [ ] Handle arbitrary user objects - Print fields (as in `TypeDef` fields, so just trivially resolvable values) as a json object - [x] Handle container - call `sync` only, rely on progress output for anything else - [x] Handle directory - call `sync` only, rely on progress output for anything else - [x] Handle file - call `sync` only, rely on progress output for anything else - [ ] Handle IDs returned by `sync` (i.e. the case where the user explicitly chains `sync`) - just rely on progress output, don't show the id
https://github.com/dagger/dagger/issues/6359
https://github.com/dagger/dagger/pull/6482
2999573c5a34e85b8baac8c0150881d9c08a86b8
d91ac42c196873830c2e0876b251f3bf4d62ea49
2024-01-03T20:19:06Z
go
2024-01-26T18:48:04Z
core/integration/module_test.go
t.Run("bootstraps Apache-2.0 LICENSE file if none found", func(t *testing.T) { t.Parallel() c, ctx := connect(t) modGen := c.Container().From(golangImage). WithMountedFile(testCLIBinPath, daggerCliFile(t, c)). WithWorkdir("/work"). With(daggerExec("mod", "init", "--name=licensed-to-ill", "--sdk=go")) content, err := modGen.File("LICENSE").Contents(ctx) require.NoError(t, err) require.Contains(t, content, "Apache License, Version 2.0") }) t.Run("creates LICENSE file in the directory specified by -m", func(t *testing.T) { t.Parallel() c, ctx := connect(t) modGen := c.Container().From(golangImage). WithMountedFile(testCLIBinPath, daggerCliFile(t, c)). WithWorkdir("/work"). With(daggerExec("mod", "init", "-m", "./mymod", "--name=licensed-to-ill", "--sdk=go")) content, err := modGen.File("mymod/LICENSE").Contents(ctx) require.NoError(t, err) require.Contains(t, content, "Apache License, Version 2.0") }) t.Run("does not bootstrap LICENSE file if it exists in the parent dir", func(t *testing.T) { t.Parallel() c, ctx := connect(t)
closed
dagger/dagger
https://github.com/dagger/dagger
6,359
CLI: update handling of various core types
As described in [this comment](https://github.com/dagger/dagger/issues/6229#issuecomment-1863649336) (and that issue generally), we need to make some adjustments to the CLIs behavior when `dagger call` ends in various core types. There's a handful of related adjustments needed here. Creating as a checklist for now to save issue spam; can break down into more issues if useful though. I'm including my initial suggestions on how to handle these, but to be clear these are not finalized decisions and the final call can be made as part of implementing this - [ ] Handle arbitrary user objects - Print fields (as in `TypeDef` fields, so just trivially resolvable values) as a json object - [x] Handle container - call `sync` only, rely on progress output for anything else - [x] Handle directory - call `sync` only, rely on progress output for anything else - [x] Handle file - call `sync` only, rely on progress output for anything else - [ ] Handle IDs returned by `sync` (i.e. the case where the user explicitly chains `sync`) - just rely on progress output, don't show the id
https://github.com/dagger/dagger/issues/6359
https://github.com/dagger/dagger/pull/6482
2999573c5a34e85b8baac8c0150881d9c08a86b8
d91ac42c196873830c2e0876b251f3bf4d62ea49
2024-01-03T20:19:06Z
go
2024-01-26T18:48:04Z
core/integration/module_test.go
modGen := c.Container().From(golangImage). WithMountedFile(testCLIBinPath, daggerCliFile(t, c)). WithWorkdir("/work"). WithNewFile("/work/LICENSE", dagger.ContainerWithNewFileOpts{ Contents: "doesnt matter", }). WithWorkdir("/work/sub"). With(daggerExec("mod", "init", "--name=licensed-to-ill", "--sdk=go")) _, err := modGen.File("LICENSE").Contents(ctx) require.Error(t, err) }) t.Run("bootstraps a LICENSE file when requested, even if it exists in the parent dir", func(t *testing.T) { t.Parallel() c, ctx := connect(t) modGen := c.Container().From(golangImage). WithMountedFile(testCLIBinPath, daggerCliFile(t, c)). WithWorkdir("/work"). WithNewFile("/work/LICENSE", dagger.ContainerWithNewFileOpts{ Contents: "doesnt matter", }). WithWorkdir("/work/sub"). With(daggerExec("mod", "init", "--name=licensed-to-ill", "--sdk=go", "--license=MIT")) content, err := modGen.File("LICENSE").Contents(ctx) require.NoError(t, err) require.Contains(t, content, "MIT License") }) } func TestModuleGit(t *testing.T) { t.Parallel() type testCase struct {
closed
dagger/dagger
https://github.com/dagger/dagger
6,359
CLI: update handling of various core types
As described in [this comment](https://github.com/dagger/dagger/issues/6229#issuecomment-1863649336) (and that issue generally), we need to make some adjustments to the CLIs behavior when `dagger call` ends in various core types. There's a handful of related adjustments needed here. Creating as a checklist for now to save issue spam; can break down into more issues if useful though. I'm including my initial suggestions on how to handle these, but to be clear these are not finalized decisions and the final call can be made as part of implementing this - [ ] Handle arbitrary user objects - Print fields (as in `TypeDef` fields, so just trivially resolvable values) as a json object - [x] Handle container - call `sync` only, rely on progress output for anything else - [x] Handle directory - call `sync` only, rely on progress output for anything else - [x] Handle file - call `sync` only, rely on progress output for anything else - [ ] Handle IDs returned by `sync` (i.e. the case where the user explicitly chains `sync`) - just rely on progress output, don't show the id
https://github.com/dagger/dagger/issues/6359
https://github.com/dagger/dagger/pull/6482
2999573c5a34e85b8baac8c0150881d9c08a86b8
d91ac42c196873830c2e0876b251f3bf4d62ea49
2024-01-03T20:19:06Z
go
2024-01-26T18:48:04Z
core/integration/module_test.go
sdk string gitignores []string } for _, tc := range []testCase{ { sdk: "go", gitignores: []string{ "/dagger.gen.go\n", "/querybuilder/\n", }, }, { sdk: "python", gitignores: []string{ "/sdk\n", }, }, { sdk: "typescript", gitignores: []string{
closed
dagger/dagger
https://github.com/dagger/dagger
6,359
CLI: update handling of various core types
As described in [this comment](https://github.com/dagger/dagger/issues/6229#issuecomment-1863649336) (and that issue generally), we need to make some adjustments to the CLIs behavior when `dagger call` ends in various core types. There's a handful of related adjustments needed here. Creating as a checklist for now to save issue spam; can break down into more issues if useful though. I'm including my initial suggestions on how to handle these, but to be clear these are not finalized decisions and the final call can be made as part of implementing this - [ ] Handle arbitrary user objects - Print fields (as in `TypeDef` fields, so just trivially resolvable values) as a json object - [x] Handle container - call `sync` only, rely on progress output for anything else - [x] Handle directory - call `sync` only, rely on progress output for anything else - [x] Handle file - call `sync` only, rely on progress output for anything else - [ ] Handle IDs returned by `sync` (i.e. the case where the user explicitly chains `sync`) - just rely on progress output, don't show the id
https://github.com/dagger/dagger/issues/6359
https://github.com/dagger/dagger/pull/6482
2999573c5a34e85b8baac8c0150881d9c08a86b8
d91ac42c196873830c2e0876b251f3bf4d62ea49
2024-01-03T20:19:06Z
go
2024-01-26T18:48:04Z
core/integration/module_test.go
"/sdk\n", "/node_modules\n", }, }, } { tc := tc t.Run(fmt.Sprintf("module %s git", tc.sdk), func(t *testing.T) { t.Parallel() c, ctx := connect(t) modGen := goGitBase(t, c). With(daggerExec("mod", "init", "--name=bare", "--sdk="+tc.sdk)) if tc.sdk == "go" { logGen(ctx, t, modGen.Directory(".")) } out, err := modGen. With(daggerQuery(`{bare{containerEcho(stringArg:"hello"){stdout}}}`)). Stdout(ctx) require.NoError(t, err) require.JSONEq(t, `{"bare":{"containerEcho":{"stdout":"hello\n"}}}`, out) t.Run("configures .gitignore", func(t *testing.T) { ignore, err := modGen.File(".gitignore").Contents(ctx) require.NoError(t, err) for _, gitignore := range tc.gitignores { require.Contains(t, ignore, gitignore) } }) }) } } func TestModuleGoGitRemovesIgnored(t *testing.T) {
closed
dagger/dagger
https://github.com/dagger/dagger
6,359
CLI: update handling of various core types
As described in [this comment](https://github.com/dagger/dagger/issues/6229#issuecomment-1863649336) (and that issue generally), we need to make some adjustments to the CLIs behavior when `dagger call` ends in various core types. There's a handful of related adjustments needed here. Creating as a checklist for now to save issue spam; can break down into more issues if useful though. I'm including my initial suggestions on how to handle these, but to be clear these are not finalized decisions and the final call can be made as part of implementing this - [ ] Handle arbitrary user objects - Print fields (as in `TypeDef` fields, so just trivially resolvable values) as a json object - [x] Handle container - call `sync` only, rely on progress output for anything else - [x] Handle directory - call `sync` only, rely on progress output for anything else - [x] Handle file - call `sync` only, rely on progress output for anything else - [ ] Handle IDs returned by `sync` (i.e. the case where the user explicitly chains `sync`) - just rely on progress output, don't show the id
https://github.com/dagger/dagger/issues/6359
https://github.com/dagger/dagger/pull/6482
2999573c5a34e85b8baac8c0150881d9c08a86b8
d91ac42c196873830c2e0876b251f3bf4d62ea49
2024-01-03T20:19:06Z
go
2024-01-26T18:48:04Z
core/integration/module_test.go
t.Parallel() c, ctx := connect(t) committedModGen := goGitBase(t, c). With(daggerExec("mod", "init", "--name=bare", "--sdk=go")). WithExec([]string{"rm", ".gitignore"}). WithExec([]string{"mkdir", "./internal"}). WithExec([]string{"cp", "-a", "./querybuilder", "./internal/querybuilder"}). WithExec([]string{"git", "add", "."}). WithExec([]string{"git", "commit", "-m", "init with generated files"}) changedAfterSync, err := committedModGen. With(daggerExec("mod", "sync")). WithExec([]string{"git", "diff"}). WithExec([]string{"git", "status", "--short"}). Stdout(ctx) require.NoError(t, err) t.Logf("changed after sync:\n%s", changedAfterSync) require.Contains(t, changedAfterSync, "D dagger.gen.go\n") require.Contains(t, changedAfterSync, "D querybuilder/marshal.go\n") require.Contains(t, changedAfterSync, "D querybuilder/querybuilder.go\n") require.Contains(t, changedAfterSync, "D internal/querybuilder/marshal.go\n") require.Contains(t, changedAfterSync, "D internal/querybuilder/querybuilder.go\n") } func TestModulePythonGitRemovesIgnored(t *testing.T) {
closed
dagger/dagger
https://github.com/dagger/dagger
6,359
CLI: update handling of various core types
As described in [this comment](https://github.com/dagger/dagger/issues/6229#issuecomment-1863649336) (and that issue generally), we need to make some adjustments to the CLIs behavior when `dagger call` ends in various core types. There's a handful of related adjustments needed here. Creating as a checklist for now to save issue spam; can break down into more issues if useful though. I'm including my initial suggestions on how to handle these, but to be clear these are not finalized decisions and the final call can be made as part of implementing this - [ ] Handle arbitrary user objects - Print fields (as in `TypeDef` fields, so just trivially resolvable values) as a json object - [x] Handle container - call `sync` only, rely on progress output for anything else - [x] Handle directory - call `sync` only, rely on progress output for anything else - [x] Handle file - call `sync` only, rely on progress output for anything else - [ ] Handle IDs returned by `sync` (i.e. the case where the user explicitly chains `sync`) - just rely on progress output, don't show the id
https://github.com/dagger/dagger/issues/6359
https://github.com/dagger/dagger/pull/6482
2999573c5a34e85b8baac8c0150881d9c08a86b8
d91ac42c196873830c2e0876b251f3bf4d62ea49
2024-01-03T20:19:06Z
go
2024-01-26T18:48:04Z
core/integration/module_test.go
t.Parallel() c, ctx := connect(t) committedModGen := goGitBase(t, c). With(daggerExec("mod", "init", "--name=bare", "--sdk=python")). WithExec([]string{"rm", ".gitignore"}). WithExec([]string{"git", "add", "."}). WithExec([]string{"git", "commit", "-m", "init with generated files"}) changedAfterSync, err := committedModGen. With(daggerExec("mod", "sync")). WithExec([]string{"git", "diff"}). WithExec([]string{"git", "status", "--short"}). Stdout(ctx) require.NoError(t, err) t.Logf("changed after sync:\n%s", changedAfterSync) require.Contains(t, changedAfterSync, "D sdk/pyproject.toml\n") require.Contains(t, changedAfterSync, "D sdk/src/dagger/__init__.py\n") } func TestModuleTypescriptGitRemovesIgnored(t *testing.T) {
closed
dagger/dagger
https://github.com/dagger/dagger
6,359
CLI: update handling of various core types
As described in [this comment](https://github.com/dagger/dagger/issues/6229#issuecomment-1863649336) (and that issue generally), we need to make some adjustments to the CLIs behavior when `dagger call` ends in various core types. There's a handful of related adjustments needed here. Creating as a checklist for now to save issue spam; can break down into more issues if useful though. I'm including my initial suggestions on how to handle these, but to be clear these are not finalized decisions and the final call can be made as part of implementing this - [ ] Handle arbitrary user objects - Print fields (as in `TypeDef` fields, so just trivially resolvable values) as a json object - [x] Handle container - call `sync` only, rely on progress output for anything else - [x] Handle directory - call `sync` only, rely on progress output for anything else - [x] Handle file - call `sync` only, rely on progress output for anything else - [ ] Handle IDs returned by `sync` (i.e. the case where the user explicitly chains `sync`) - just rely on progress output, don't show the id
https://github.com/dagger/dagger/issues/6359
https://github.com/dagger/dagger/pull/6482
2999573c5a34e85b8baac8c0150881d9c08a86b8
d91ac42c196873830c2e0876b251f3bf4d62ea49
2024-01-03T20:19:06Z
go
2024-01-26T18:48:04Z
core/integration/module_test.go
t.Parallel() c, ctx := connect(t) committedModGen := goGitBase(t, c). With(daggerExec("mod", "init", "--name=bare", "--sdk=typescript")). WithExec([]string{"rm", ".gitignore"}). WithExec([]string{"git", "add", "."}). WithExec([]string{"git", "commit", "-m", "init with generated files"}) changedAfterSync, err := committedModGen. With(daggerExec("mod", "sync")). WithExec([]string{"git", "diff"}). WithExec([]string{"git", "status", "--short"}). Stdout(ctx) require.NoError(t, err) t.Logf("changed after sync:\n%s", changedAfterSync) require.Contains(t, changedAfterSync, "D sdk/index.ts\n") require.Contains(t, changedAfterSync, "D sdk/entrypoint/entrypoint.ts\n") } var goSignatures string func TestModuleGoSignatures(t *testing.T) { t.Parallel() c, ctx := connect(t) modGen := c.Container().From(golangImage). WithMountedFile(testCLIBinPath, daggerCliFile(t, c)). WithWorkdir("/work"). With(daggerExec("mod", "init", "--name=minimal", "--sdk=go")). WithNewFile("main.go", dagger.ContainerWithNewFileOpts{
closed
dagger/dagger
https://github.com/dagger/dagger
6,359
CLI: update handling of various core types
As described in [this comment](https://github.com/dagger/dagger/issues/6229#issuecomment-1863649336) (and that issue generally), we need to make some adjustments to the CLIs behavior when `dagger call` ends in various core types. There's a handful of related adjustments needed here. Creating as a checklist for now to save issue spam; can break down into more issues if useful though. I'm including my initial suggestions on how to handle these, but to be clear these are not finalized decisions and the final call can be made as part of implementing this - [ ] Handle arbitrary user objects - Print fields (as in `TypeDef` fields, so just trivially resolvable values) as a json object - [x] Handle container - call `sync` only, rely on progress output for anything else - [x] Handle directory - call `sync` only, rely on progress output for anything else - [x] Handle file - call `sync` only, rely on progress output for anything else - [ ] Handle IDs returned by `sync` (i.e. the case where the user explicitly chains `sync`) - just rely on progress output, don't show the id
https://github.com/dagger/dagger/issues/6359
https://github.com/dagger/dagger/pull/6482
2999573c5a34e85b8baac8c0150881d9c08a86b8
d91ac42c196873830c2e0876b251f3bf4d62ea49
2024-01-03T20:19:06Z
go
2024-01-26T18:48:04Z
core/integration/module_test.go
Contents: goSignatures, }) logGen(ctx, t, modGen.Directory(".")) t.Run("func Hello() string", func(t *testing.T) { t.Parallel() out, err := modGen.With(daggerQuery(`{minimal{hello}}`)).Stdout(ctx) require.NoError(t, err) require.JSONEq(t, `{"minimal":{"hello":"hello"}}`, out) }) t.Run("func Echo(string) string", func(t *testing.T) { t.Parallel() out, err := modGen.With(daggerQuery(`{minimal{echo(msg: "hello")}}`)).Stdout(ctx) require.NoError(t, err) require.JSONEq(t, `{"minimal":{"echo":"hello...hello...hello..."}}`, out) }) t.Run("func EchoPointer(*string) string", func(t *testing.T) { t.Parallel() out, err := modGen.With(daggerQuery(`{minimal{echoPointer(msg: "hello")}}`)).Stdout(ctx) require.NoError(t, err) require.JSONEq(t, `{"minimal":{"echoPointer":"hello...hello...hello..."}}`, out) }) t.Run("func EchoPointerPointer(**string) string", func(t *testing.T) { t.Parallel() out, err := modGen.With(daggerQuery(`{minimal{echoPointerPointer(msg: "hello")}}`)).Stdout(ctx) require.NoError(t, err) require.JSONEq(t, `{"minimal":{"echoPointerPointer":"hello...hello...hello..."}}`, out) }) t.Run("func EchoOptional(string) string", func(t *testing.T) { t.Parallel() out, err := modGen.With(daggerQuery(`{minimal{echoOptional(msg: "hello")}}`)).Stdout(ctx)
closed
dagger/dagger
https://github.com/dagger/dagger
6,359
CLI: update handling of various core types
As described in [this comment](https://github.com/dagger/dagger/issues/6229#issuecomment-1863649336) (and that issue generally), we need to make some adjustments to the CLIs behavior when `dagger call` ends in various core types. There's a handful of related adjustments needed here. Creating as a checklist for now to save issue spam; can break down into more issues if useful though. I'm including my initial suggestions on how to handle these, but to be clear these are not finalized decisions and the final call can be made as part of implementing this - [ ] Handle arbitrary user objects - Print fields (as in `TypeDef` fields, so just trivially resolvable values) as a json object - [x] Handle container - call `sync` only, rely on progress output for anything else - [x] Handle directory - call `sync` only, rely on progress output for anything else - [x] Handle file - call `sync` only, rely on progress output for anything else - [ ] Handle IDs returned by `sync` (i.e. the case where the user explicitly chains `sync`) - just rely on progress output, don't show the id
https://github.com/dagger/dagger/issues/6359
https://github.com/dagger/dagger/pull/6482
2999573c5a34e85b8baac8c0150881d9c08a86b8
d91ac42c196873830c2e0876b251f3bf4d62ea49
2024-01-03T20:19:06Z
go
2024-01-26T18:48:04Z
core/integration/module_test.go
require.NoError(t, err) require.JSONEq(t, `{"minimal":{"echoOptional":"hello...hello...hello..."}}`, out) out, err = modGen.With(daggerQuery(`{minimal{echoOptional}}`)).Stdout(ctx) require.NoError(t, err) require.JSONEq(t, `{"minimal":{"echoOptional":"default...default...default..."}}`, out) }) t.Run("func EchoOptionalPointer(string) string", func(t *testing.T) { t.Parallel() out, err := modGen.With(daggerQuery(`{minimal{echoOptionalPointer(msg: "hello")}}`)).Stdout(ctx) require.NoError(t, err) require.JSONEq(t, `{"minimal":{"echoOptionalPointer":"hello...hello...hello..."}}`, out) out, err = modGen.With(daggerQuery(`{minimal{echoOptionalPointer}}`)).Stdout(ctx) require.NoError(t, err) require.JSONEq(t, `{"minimal":{"echoOptionalPointer":"default...default...default..."}}`, out) }) t.Run("func EchoOptionalSlice([]string) string", func(t *testing.T) { t.Parallel() out, err := modGen.With(daggerQuery(`{minimal{echoOptionalSlice(msg: ["hello", "there"])}}`)).Stdout(ctx) require.NoError(t, err) require.JSONEq(t, `{"minimal":{"echoOptionalSlice":"hello+there...hello+there...hello+there..."}}`, out) out, err = modGen.With(daggerQuery(`{minimal{echoOptionalSlice}}`)).Stdout(ctx) require.NoError(t, err) require.JSONEq(t, `{"minimal":{"echoOptionalSlice":"foobar...foobar...foobar..."}}`, out) }) t.Run("func Echoes([]string) []string", func(t *testing.T) { t.Parallel() out, err := modGen.With(daggerQuery(`{minimal{echoes(msgs: ["hello"])}}`)).Stdout(ctx) require.NoError(t, err) require.JSONEq(t, `{"minimal":{"echoes":["hello...hello...hello..."]}}`, out) })
closed
dagger/dagger
https://github.com/dagger/dagger
6,359
CLI: update handling of various core types
As described in [this comment](https://github.com/dagger/dagger/issues/6229#issuecomment-1863649336) (and that issue generally), we need to make some adjustments to the CLIs behavior when `dagger call` ends in various core types. There's a handful of related adjustments needed here. Creating as a checklist for now to save issue spam; can break down into more issues if useful though. I'm including my initial suggestions on how to handle these, but to be clear these are not finalized decisions and the final call can be made as part of implementing this - [ ] Handle arbitrary user objects - Print fields (as in `TypeDef` fields, so just trivially resolvable values) as a json object - [x] Handle container - call `sync` only, rely on progress output for anything else - [x] Handle directory - call `sync` only, rely on progress output for anything else - [x] Handle file - call `sync` only, rely on progress output for anything else - [ ] Handle IDs returned by `sync` (i.e. the case where the user explicitly chains `sync`) - just rely on progress output, don't show the id
https://github.com/dagger/dagger/issues/6359
https://github.com/dagger/dagger/pull/6482
2999573c5a34e85b8baac8c0150881d9c08a86b8
d91ac42c196873830c2e0876b251f3bf4d62ea49
2024-01-03T20:19:06Z
go
2024-01-26T18:48:04Z
core/integration/module_test.go
t.Run("func EchoesVariadic(...string) string", func(t *testing.T) { t.Parallel() out, err := modGen.With(daggerQuery(`{minimal{echoesVariadic(msgs: ["hello"])}}`)).Stdout(ctx) require.NoError(t, err) require.JSONEq(t, `{"minimal":{"echoesVariadic":"hello...hello...hello..."}}`, out) }) t.Run("func HelloContext(context.Context) string", func(t *testing.T) { t.Parallel() out, err := modGen.With(daggerQuery(`{minimal{helloContext}}`)).Stdout(ctx) require.NoError(t, err) require.JSONEq(t, `{"minimal":{"helloContext":"hello context"}}`, out) }) t.Run("func EchoContext(context.Context, string) string", func(t *testing.T) { t.Parallel() out, err := modGen.With(daggerQuery(`{minimal{echoContext(msg: "hello")}}`)).Stdout(ctx) require.NoError(t, err) require.JSONEq(t, `{"minimal":{"echoContext":"ctx.hello...ctx.hello...ctx.hello..."}}`, out) }) t.Run("func HelloStringError() (string, error)", func(t *testing.T) { t.Parallel() out, err := modGen.With(daggerQuery(`{minimal{helloStringError}}`)).Stdout(ctx) require.NoError(t, err) require.JSONEq(t, `{"minimal":{"helloStringError":"hello i worked"}}`, out) }) t.Run("func HelloVoid()", func(t *testing.T) { t.Parallel() out, err := modGen.With(daggerQuery(`{minimal{helloVoid}}`)).Stdout(ctx) require.NoError(t, err) require.JSONEq(t, `{"minimal":{"helloVoid":null}}`, out) })
closed
dagger/dagger
https://github.com/dagger/dagger
6,359
CLI: update handling of various core types
As described in [this comment](https://github.com/dagger/dagger/issues/6229#issuecomment-1863649336) (and that issue generally), we need to make some adjustments to the CLIs behavior when `dagger call` ends in various core types. There's a handful of related adjustments needed here. Creating as a checklist for now to save issue spam; can break down into more issues if useful though. I'm including my initial suggestions on how to handle these, but to be clear these are not finalized decisions and the final call can be made as part of implementing this - [ ] Handle arbitrary user objects - Print fields (as in `TypeDef` fields, so just trivially resolvable values) as a json object - [x] Handle container - call `sync` only, rely on progress output for anything else - [x] Handle directory - call `sync` only, rely on progress output for anything else - [x] Handle file - call `sync` only, rely on progress output for anything else - [ ] Handle IDs returned by `sync` (i.e. the case where the user explicitly chains `sync`) - just rely on progress output, don't show the id
https://github.com/dagger/dagger/issues/6359
https://github.com/dagger/dagger/pull/6482
2999573c5a34e85b8baac8c0150881d9c08a86b8
d91ac42c196873830c2e0876b251f3bf4d62ea49
2024-01-03T20:19:06Z
go
2024-01-26T18:48:04Z
core/integration/module_test.go
t.Run("func HelloVoidError() error", func(t *testing.T) { t.Parallel() out, err := modGen.With(daggerQuery(`{minimal{helloVoidError}}`)).Stdout(ctx) require.NoError(t, err) require.JSONEq(t, `{"minimal":{"helloVoidError":null}}`, out) }) t.Run("func EchoOpts(string, string, int) error", func(t *testing.T) { t.Parallel() out, err := modGen.With(daggerQuery(`{minimal{echoOpts(msg: "hi")}}`)).Stdout(ctx) require.NoError(t, err) require.JSONEq(t, `{"minimal":{"echoOpts":"hi"}}`, out) out, err = modGen.With(daggerQuery(`{minimal{echoOpts(msg: "hi", suffix: "!", times: 2)}}`)).Stdout(ctx) require.NoError(t, err) require.JSONEq(t, `{"minimal":{"echoOpts":"hi!hi!"}}`, out) }) t.Run("func EchoOptsInline(struct{string, string, int}) error", func(t *testing.T) { t.Parallel() out, err := modGen.With(daggerQuery(`{minimal{echoOptsInline(msg: "hi")}}`)).Stdout(ctx) require.NoError(t, err) require.JSONEq(t, `{"minimal":{"echoOptsInline":"hi"}}`, out) out, err = modGen.With(daggerQuery(`{minimal{echoOptsInline(msg: "hi", suffix: "!", times: 2)}}`)).Stdout(ctx) require.NoError(t, err) require.JSONEq(t, `{"minimal":{"echoOptsInline":"hi!hi!"}}`, out) }) t.Run("func EchoOptsInlinePointer(*struct{string, string, int}) error", func(t *testing.T) { t.Parallel() out, err := modGen.With(daggerQuery(`{minimal{echoOptsInlinePointer(msg: "hi")}}`)).Stdout(ctx) require.NoError(t, err) require.JSONEq(t, `{"minimal":{"echoOptsInlinePointer":"hi"}}`, out) out, err = modGen.With(daggerQuery(`{minimal{echoOptsInlinePointer(msg: "hi", suffix: "!", times: 2)}}`)).Stdout(ctx)
closed
dagger/dagger
https://github.com/dagger/dagger
6,359
CLI: update handling of various core types
As described in [this comment](https://github.com/dagger/dagger/issues/6229#issuecomment-1863649336) (and that issue generally), we need to make some adjustments to the CLIs behavior when `dagger call` ends in various core types. There's a handful of related adjustments needed here. Creating as a checklist for now to save issue spam; can break down into more issues if useful though. I'm including my initial suggestions on how to handle these, but to be clear these are not finalized decisions and the final call can be made as part of implementing this - [ ] Handle arbitrary user objects - Print fields (as in `TypeDef` fields, so just trivially resolvable values) as a json object - [x] Handle container - call `sync` only, rely on progress output for anything else - [x] Handle directory - call `sync` only, rely on progress output for anything else - [x] Handle file - call `sync` only, rely on progress output for anything else - [ ] Handle IDs returned by `sync` (i.e. the case where the user explicitly chains `sync`) - just rely on progress output, don't show the id
https://github.com/dagger/dagger/issues/6359
https://github.com/dagger/dagger/pull/6482
2999573c5a34e85b8baac8c0150881d9c08a86b8
d91ac42c196873830c2e0876b251f3bf4d62ea49
2024-01-03T20:19:06Z
go
2024-01-26T18:48:04Z
core/integration/module_test.go
require.NoError(t, err) require.JSONEq(t, `{"minimal":{"echoOptsInlinePointer":"hi!hi!"}}`, out) }) t.Run("func EchoOptsInlineCtx(ctx, struct{string, string, int}) error", func(t *testing.T) { t.Parallel() out, err := modGen.With(daggerQuery(`{minimal{echoOptsInlineCtx(msg: "hi")}}`)).Stdout(ctx) require.NoError(t, err) require.JSONEq(t, `{"minimal":{"echoOptsInlineCtx":"hi"}}`, out) out, err = modGen.With(daggerQuery(`{minimal{echoOptsInlineCtx(msg: "hi", suffix: "!", times: 2)}}`)).Stdout(ctx) require.NoError(t, err) require.JSONEq(t, `{"minimal":{"echoOptsInlineCtx":"hi!hi!"}}`, out) }) t.Run("func EchoOptsInlineTags(struct{string, string, int}) error", func(t *testing.T) { t.Parallel() out, err := modGen.With(daggerQuery(`{minimal{echoOptsInlineTags(msg: "hi")}}`)).Stdout(ctx) require.NoError(t, err) require.JSONEq(t, `{"minimal":{"echoOptsInlineTags":"hi"}}`, out) out, err = modGen.With(daggerQuery(`{minimal{echoOptsInlineTags(msg: "hi", suffix: "!", times: 2)}}`)).Stdout(ctx) require.NoError(t, err) require.JSONEq(t, `{"minimal":{"echoOptsInlineTags":"hi!hi!"}}`, out) }) t.Run("func EchoOptsPragmas(string, string, int) error", func(t *testing.T) { t.Parallel() out, err := modGen.With(daggerQuery(`{minimal{echoOptsPragmas(msg: "hi")}}`)).Stdout(ctx) require.NoError(t, err) require.JSONEq(t, `{"minimal":{"echoOptsPragmas":"hi...hi...hi..."}}`, out) }) } var tsSignatures string func TestModuleTypescriptSignatures(t *testing.T) {
closed
dagger/dagger
https://github.com/dagger/dagger
6,359
CLI: update handling of various core types
As described in [this comment](https://github.com/dagger/dagger/issues/6229#issuecomment-1863649336) (and that issue generally), we need to make some adjustments to the CLIs behavior when `dagger call` ends in various core types. There's a handful of related adjustments needed here. Creating as a checklist for now to save issue spam; can break down into more issues if useful though. I'm including my initial suggestions on how to handle these, but to be clear these are not finalized decisions and the final call can be made as part of implementing this - [ ] Handle arbitrary user objects - Print fields (as in `TypeDef` fields, so just trivially resolvable values) as a json object - [x] Handle container - call `sync` only, rely on progress output for anything else - [x] Handle directory - call `sync` only, rely on progress output for anything else - [x] Handle file - call `sync` only, rely on progress output for anything else - [ ] Handle IDs returned by `sync` (i.e. the case where the user explicitly chains `sync`) - just rely on progress output, don't show the id
https://github.com/dagger/dagger/issues/6359
https://github.com/dagger/dagger/pull/6482
2999573c5a34e85b8baac8c0150881d9c08a86b8
d91ac42c196873830c2e0876b251f3bf4d62ea49
2024-01-03T20:19:06Z
go
2024-01-26T18:48:04Z
core/integration/module_test.go
t.Parallel() c, ctx := connect(t) modGen := c.Container().From(golangImage). WithMountedFile(testCLIBinPath, daggerCliFile(t, c)). WithWorkdir("/work"). With(daggerExec("mod", "init", "--name=minimal", "--sdk=typescript")). WithNewFile("src/index.ts", dagger.ContainerWithNewFileOpts{ Contents: tsSignatures, }) t.Run("hello(): string", func(t *testing.T) { t.Parallel() out, err := modGen.With(daggerQuery(`{minimal{hello}}`)).Stdout(ctx) require.NoError(t, err) require.JSONEq(t, `{"minimal":{"hello":"hello"}}`, out) }) t.Run("echoes(msgs: string[]): string[]", func(t *testing.T) { t.Parallel() out, err := modGen.With(daggerQuery(`{minimal{echoes(msgs: ["hello"])}}`)).Stdout(ctx) require.NoError(t, err) require.JSONEq(t, `{"minimal":{"echoes":["hello...hello...hello..."]}}`, out) }) t.Run("echoOptional(msg = 'default'): string", func(t *testing.T) { t.Parallel() out, err := modGen.With(daggerQuery(`{minimal{echoOptional(msg: "hello")}}`)).Stdout(ctx) require.NoError(t, err) require.JSONEq(t, `{"minimal":{"echoOptional":"hello...hello...hello..."}}`, out) out, err = modGen.With(daggerQuery(`{minimal{echoOptional}}`)).Stdout(ctx)
closed
dagger/dagger
https://github.com/dagger/dagger
6,359
CLI: update handling of various core types
As described in [this comment](https://github.com/dagger/dagger/issues/6229#issuecomment-1863649336) (and that issue generally), we need to make some adjustments to the CLIs behavior when `dagger call` ends in various core types. There's a handful of related adjustments needed here. Creating as a checklist for now to save issue spam; can break down into more issues if useful though. I'm including my initial suggestions on how to handle these, but to be clear these are not finalized decisions and the final call can be made as part of implementing this - [ ] Handle arbitrary user objects - Print fields (as in `TypeDef` fields, so just trivially resolvable values) as a json object - [x] Handle container - call `sync` only, rely on progress output for anything else - [x] Handle directory - call `sync` only, rely on progress output for anything else - [x] Handle file - call `sync` only, rely on progress output for anything else - [ ] Handle IDs returned by `sync` (i.e. the case where the user explicitly chains `sync`) - just rely on progress output, don't show the id
https://github.com/dagger/dagger/issues/6359
https://github.com/dagger/dagger/pull/6482
2999573c5a34e85b8baac8c0150881d9c08a86b8
d91ac42c196873830c2e0876b251f3bf4d62ea49
2024-01-03T20:19:06Z
go
2024-01-26T18:48:04Z
core/integration/module_test.go
require.NoError(t, err) require.JSONEq(t, `{"minimal":{"echoOptional":"default...default...default..."}}`, out) }) t.Run("echoesVariadic(...msgs: string[]): string", func(t *testing.T) { t.Parallel() out, err := modGen.With(daggerQuery(`{minimal{echoesVariadic(msgs: ["hello"])}}`)).Stdout(ctx) require.NoError(t, err) require.JSONEq(t, `{"minimal":{"echoesVariadic":"hello...hello...hello..."}}`, out) }) t.Run("echo(msg: string): string", func(t *testing.T) { t.Parallel() out, err := modGen.With(daggerQuery(`{minimal{echo(msg: "hello")}}`)).Stdout(ctx) require.NoError(t, err) require.JSONEq(t, `{"minimal":{"echo":"hello...hello...hello..."}}`, out) }) t.Run("echoOptionalSlice(msg = ['foobar']): string", func(t *testing.T) { t.Parallel() out, err := modGen.With(daggerQuery(`{minimal{echoOptionalSlice(msg: ["hello", "there"])}}`)).Stdout(ctx) require.NoError(t, err) require.JSONEq(t, `{"minimal":{"echoOptionalSlice":"hello+there...hello+there...hello+there..."}}`, out) out, err = modGen.With(daggerQuery(`{minimal{echoOptionalSlice}}`)).Stdout(ctx) require.NoError(t, err) require.JSONEq(t, `{"minimal":{"echoOptionalSlice":"foobar...foobar...foobar..."}}`, out) }) t.Run("helloVoid(): void", func(t *testing.T) { t.Parallel() out, err := modGen.With(daggerQuery(`{minimal{helloVoid}}`)).Stdout(ctx) require.NoError(t, err) require.JSONEq(t, `{"minimal":{"helloVoid":null}}`, out) })
closed
dagger/dagger
https://github.com/dagger/dagger
6,359
CLI: update handling of various core types
As described in [this comment](https://github.com/dagger/dagger/issues/6229#issuecomment-1863649336) (and that issue generally), we need to make some adjustments to the CLIs behavior when `dagger call` ends in various core types. There's a handful of related adjustments needed here. Creating as a checklist for now to save issue spam; can break down into more issues if useful though. I'm including my initial suggestions on how to handle these, but to be clear these are not finalized decisions and the final call can be made as part of implementing this - [ ] Handle arbitrary user objects - Print fields (as in `TypeDef` fields, so just trivially resolvable values) as a json object - [x] Handle container - call `sync` only, rely on progress output for anything else - [x] Handle directory - call `sync` only, rely on progress output for anything else - [x] Handle file - call `sync` only, rely on progress output for anything else - [ ] Handle IDs returned by `sync` (i.e. the case where the user explicitly chains `sync`) - just rely on progress output, don't show the id
https://github.com/dagger/dagger/issues/6359
https://github.com/dagger/dagger/pull/6482
2999573c5a34e85b8baac8c0150881d9c08a86b8
d91ac42c196873830c2e0876b251f3bf4d62ea49
2024-01-03T20:19:06Z
go
2024-01-26T18:48:04Z
core/integration/module_test.go
t.Run("echoOpts(msg: string, suffix: string = '', times: number = 1): string", func(t *testing.T) { t.Parallel() out, err := modGen.With(daggerQuery(`{minimal{echoOpts(msg: "hi")}}`)).Stdout(ctx) require.NoError(t, err) require.JSONEq(t, `{"minimal":{"echoOpts":"hi"}}`, out) out, err = modGen.With(daggerQuery(`{minimal{echoOpts(msg: "hi", suffix: "!", times: 2)}}`)).Stdout(ctx) require.NoError(t, err) require.JSONEq(t, `{"minimal":{"echoOpts":"hi!hi!"}}`, out) t.Run("execute with unordered args", func(t *testing.T) { out, err = modGen.With(daggerQuery(`{minimal{echoOpts(times: 2, msg: "order", suffix: "?")}}`)).Stdout(ctx) require.NoError(t, err) require.JSONEq(t, `{"minimal":{"echoOpts":"order?order?"}}`, out) }) }) t.Run("echoMaybe(msg: string, isQuestion = false): string", func(t *testing.T) { t.Parallel() out, err := modGen.With(daggerQuery(`{minimal{echoMaybe(msg: "hi")}}`)).Stdout(ctx) require.NoError(t, err) require.JSONEq(t, `{"minimal":{"echoMaybe":"hi...hi...hi..."}}`, out) out, err = modGen.With(daggerQuery(`{minimal{echoMaybe(msg: "hi", isQuestion: true)}}`)).Stdout(ctx) require.NoError(t, err) require.JSONEq(t, `{"minimal":{"echoMaybe":"hi?...hi?...hi?..."}}`, out) t.Run("execute with unordered args", func(t *testing.T) { out, err = modGen.With(daggerQuery(`{minimal{echoMaybe(isQuestion: false, msg: "hi")}}`)).Stdout(ctx) require.NoError(t, err) require.JSONEq(t, `{"minimal":{"echoMaybe":"hi...hi...hi..."}}`, out) }) }) } func TestModuleGoSignaturesBuiltinTypes(t *testing.T) {
closed
dagger/dagger
https://github.com/dagger/dagger
6,359
CLI: update handling of various core types
As described in [this comment](https://github.com/dagger/dagger/issues/6229#issuecomment-1863649336) (and that issue generally), we need to make some adjustments to the CLIs behavior when `dagger call` ends in various core types. There's a handful of related adjustments needed here. Creating as a checklist for now to save issue spam; can break down into more issues if useful though. I'm including my initial suggestions on how to handle these, but to be clear these are not finalized decisions and the final call can be made as part of implementing this - [ ] Handle arbitrary user objects - Print fields (as in `TypeDef` fields, so just trivially resolvable values) as a json object - [x] Handle container - call `sync` only, rely on progress output for anything else - [x] Handle directory - call `sync` only, rely on progress output for anything else - [x] Handle file - call `sync` only, rely on progress output for anything else - [ ] Handle IDs returned by `sync` (i.e. the case where the user explicitly chains `sync`) - just rely on progress output, don't show the id
https://github.com/dagger/dagger/issues/6359
https://github.com/dagger/dagger/pull/6482
2999573c5a34e85b8baac8c0150881d9c08a86b8
d91ac42c196873830c2e0876b251f3bf4d62ea49
2024-01-03T20:19:06Z
go
2024-01-26T18:48:04Z
core/integration/module_test.go
t.Parallel() c, ctx := connect(t) modGen := c.Container().From(golangImage). WithMountedFile(testCLIBinPath, daggerCliFile(t, c)). WithWorkdir("/work"). With(daggerExec("mod", "init", "--name=minimal", "--sdk=go")). WithNewFile("main.go", dagger.ContainerWithNewFileOpts{ Contents: `package main import "context" type Minimal struct {}
closed
dagger/dagger
https://github.com/dagger/dagger
6,359
CLI: update handling of various core types
As described in [this comment](https://github.com/dagger/dagger/issues/6229#issuecomment-1863649336) (and that issue generally), we need to make some adjustments to the CLIs behavior when `dagger call` ends in various core types. There's a handful of related adjustments needed here. Creating as a checklist for now to save issue spam; can break down into more issues if useful though. I'm including my initial suggestions on how to handle these, but to be clear these are not finalized decisions and the final call can be made as part of implementing this - [ ] Handle arbitrary user objects - Print fields (as in `TypeDef` fields, so just trivially resolvable values) as a json object - [x] Handle container - call `sync` only, rely on progress output for anything else - [x] Handle directory - call `sync` only, rely on progress output for anything else - [x] Handle file - call `sync` only, rely on progress output for anything else - [ ] Handle IDs returned by `sync` (i.e. the case where the user explicitly chains `sync`) - just rely on progress output, don't show the id
https://github.com/dagger/dagger/issues/6359
https://github.com/dagger/dagger/pull/6482
2999573c5a34e85b8baac8c0150881d9c08a86b8
d91ac42c196873830c2e0876b251f3bf4d62ea49
2024-01-03T20:19:06Z
go
2024-01-26T18:48:04Z
core/integration/module_test.go
func (m *Minimal) Read(ctx context.Context, dir Directory) (string, error) { return dir.File("foo").Contents(ctx) } func (m *Minimal) ReadPointer(ctx context.Context, dir *Directory) (string, error) { return dir.File("foo").Contents(ctx) } func (m *Minimal) ReadSlice(ctx context.Context, dir []Directory) (string, error) { return dir[0].File("foo").Contents(ctx) } func (m *Minimal) ReadVariadic(ctx context.Context, dir ...Directory) (string, error) { return dir[0].File("foo").Contents(ctx) } func (m *Minimal) ReadOptional(ctx context.Context, dir Optional[Directory]) (string, error) { d, ok := dir.Get() if ok { return d.File("foo").Contents(ctx) } return "", nil } `, }) logGen(ctx, t, modGen.Directory(".")) out, err := modGen.With(daggerQuery(`{directory{withNewFile(path: "foo", contents: "bar"){id}}}`)).Stdout(ctx) require.NoError(t, err) dirID := gjson.Get(out, "directory.withNewFile.id").String() t.Run("func Read(ctx, Directory) (string, error)", func(t *testing.T) { t.Parallel() out, err := modGen.With(daggerQuery(fmt.Sprintf(`{minimal{read(dir: "%s")}}`, dirID))).Stdout(ctx) require.NoError(t, err) require.JSONEq(t, `{"minimal":{"read":"bar"}}`, out)
closed
dagger/dagger
https://github.com/dagger/dagger
6,359
CLI: update handling of various core types
As described in [this comment](https://github.com/dagger/dagger/issues/6229#issuecomment-1863649336) (and that issue generally), we need to make some adjustments to the CLIs behavior when `dagger call` ends in various core types. There's a handful of related adjustments needed here. Creating as a checklist for now to save issue spam; can break down into more issues if useful though. I'm including my initial suggestions on how to handle these, but to be clear these are not finalized decisions and the final call can be made as part of implementing this - [ ] Handle arbitrary user objects - Print fields (as in `TypeDef` fields, so just trivially resolvable values) as a json object - [x] Handle container - call `sync` only, rely on progress output for anything else - [x] Handle directory - call `sync` only, rely on progress output for anything else - [x] Handle file - call `sync` only, rely on progress output for anything else - [ ] Handle IDs returned by `sync` (i.e. the case where the user explicitly chains `sync`) - just rely on progress output, don't show the id
https://github.com/dagger/dagger/issues/6359
https://github.com/dagger/dagger/pull/6482
2999573c5a34e85b8baac8c0150881d9c08a86b8
d91ac42c196873830c2e0876b251f3bf4d62ea49
2024-01-03T20:19:06Z
go
2024-01-26T18:48:04Z
core/integration/module_test.go
}) t.Run("func ReadPointer(ctx, *Directory) (string, error)", func(t *testing.T) { t.Parallel() out, err := modGen.With(daggerQuery(fmt.Sprintf(`{minimal{readPointer(dir: "%s")}}`, dirID))).Stdout(ctx) require.NoError(t, err) require.JSONEq(t, `{"minimal":{"readPointer":"bar"}}`, out) }) t.Run("func ReadSlice(ctx, []Directory) (string, error)", func(t *testing.T) { t.Parallel() out, err := modGen.With(daggerQuery(fmt.Sprintf(`{minimal{readSlice(dir: ["%s"])}}`, dirID))).Stdout(ctx) require.NoError(t, err) require.JSONEq(t, `{"minimal":{"readSlice":"bar"}}`, out) }) t.Run("func ReadVariadic(ctx, ...Directory) (string, error)", func(t *testing.T) { t.Parallel() out, err := modGen.With(daggerQuery(fmt.Sprintf(`{minimal{readVariadic(dir: ["%s"])}}`, dirID))).Stdout(ctx) require.NoError(t, err) require.JSONEq(t, `{"minimal":{"readVariadic":"bar"}}`, out) }) t.Run("func ReadOptional(ctx, Optional[Directory]) (string, error)", func(t *testing.T) { t.Parallel() out, err := modGen.With(daggerQuery(fmt.Sprintf(`{minimal{readOptional(dir: "%s")}}`, dirID))).Stdout(ctx) require.NoError(t, err) require.JSONEq(t, `{"minimal":{"readOptional":"bar"}}`, out) out, err = modGen.With(daggerQuery(`{minimal{readOptional}}`)).Stdout(ctx) require.NoError(t, err) require.JSONEq(t, `{"minimal":{"readOptional":""}}`, out) }) } func TestModuleGoSignaturesUnexported(t *testing.T) {
closed
dagger/dagger
https://github.com/dagger/dagger
6,359
CLI: update handling of various core types
As described in [this comment](https://github.com/dagger/dagger/issues/6229#issuecomment-1863649336) (and that issue generally), we need to make some adjustments to the CLIs behavior when `dagger call` ends in various core types. There's a handful of related adjustments needed here. Creating as a checklist for now to save issue spam; can break down into more issues if useful though. I'm including my initial suggestions on how to handle these, but to be clear these are not finalized decisions and the final call can be made as part of implementing this - [ ] Handle arbitrary user objects - Print fields (as in `TypeDef` fields, so just trivially resolvable values) as a json object - [x] Handle container - call `sync` only, rely on progress output for anything else - [x] Handle directory - call `sync` only, rely on progress output for anything else - [x] Handle file - call `sync` only, rely on progress output for anything else - [ ] Handle IDs returned by `sync` (i.e. the case where the user explicitly chains `sync`) - just rely on progress output, don't show the id
https://github.com/dagger/dagger/issues/6359
https://github.com/dagger/dagger/pull/6482
2999573c5a34e85b8baac8c0150881d9c08a86b8
d91ac42c196873830c2e0876b251f3bf4d62ea49
2024-01-03T20:19:06Z
go
2024-01-26T18:48:04Z
core/integration/module_test.go
t.Parallel() var logs safeBuffer c, ctx := connect(t, dagger.WithLogOutput(&logs)) modGen := c.Container().From(golangImage). WithMountedFile(testCLIBinPath, daggerCliFile(t, c)). WithWorkdir("/work"). With(daggerExec("mod", "init", "--name=minimal", "--sdk=go")). WithNewFile("main.go", dagger.ContainerWithNewFileOpts{ Contents: `package main type Minimal struct {} type Foo struct {} type bar struct {} func (m *Minimal) Hello(name string) string { return name } func (f *Foo) Hello(name string) string { return name } func (b *bar) Hello(name string) string { return name } `, }) logGen(ctx, t, modGen.Directory(".")) out, err := modGen.With(inspectModule).Stdout(ctx) require.NoError(t, err) objs := gjson.Get(out, "host.directory.asModule.objects") require.Equal(t, 1, len(objs.Array()))
closed
dagger/dagger
https://github.com/dagger/dagger
6,359
CLI: update handling of various core types
As described in [this comment](https://github.com/dagger/dagger/issues/6229#issuecomment-1863649336) (and that issue generally), we need to make some adjustments to the CLIs behavior when `dagger call` ends in various core types. There's a handful of related adjustments needed here. Creating as a checklist for now to save issue spam; can break down into more issues if useful though. I'm including my initial suggestions on how to handle these, but to be clear these are not finalized decisions and the final call can be made as part of implementing this - [ ] Handle arbitrary user objects - Print fields (as in `TypeDef` fields, so just trivially resolvable values) as a json object - [x] Handle container - call `sync` only, rely on progress output for anything else - [x] Handle directory - call `sync` only, rely on progress output for anything else - [x] Handle file - call `sync` only, rely on progress output for anything else - [ ] Handle IDs returned by `sync` (i.e. the case where the user explicitly chains `sync`) - just rely on progress output, don't show the id
https://github.com/dagger/dagger/issues/6359
https://github.com/dagger/dagger/pull/6482
2999573c5a34e85b8baac8c0150881d9c08a86b8
d91ac42c196873830c2e0876b251f3bf4d62ea49
2024-01-03T20:19:06Z
go
2024-01-26T18:48:04Z
core/integration/module_test.go
minimal := objs.Get(`0.asObject`) require.Equal(t, "Minimal", minimal.Get("name").String()) modGen = c.Container().From(golangImage). WithMountedFile(testCLIBinPath, daggerCliFile(t, c)). WithWorkdir("/work"). With(daggerExec("mod", "init", "--name=minimal", "--sdk=go")). WithNewFile("main.go", dagger.ContainerWithNewFileOpts{ Contents: `package main type Minimal struct {} type Foo struct {} type bar struct {} func (m *Minimal) Hello(name string) Foo { return Foo{} } func (f *Foo) Hello(name string) string { return name } func (b *bar) Hello(name string) string { return name } `, }) logGen(ctx, t, modGen.Directory(".")) out, err = modGen.With(inspectModule).Stdout(ctx) require.NoError(t, err) objs = gjson.Get(out, "host.directory.asModule.objects") require.Equal(t, 2, len(objs.Array())) minimal = objs.Get(`0.asObject`) require.Equal(t, "Minimal", minimal.Get("name").String()) foo := objs.Get(`1.asObject`)
closed
dagger/dagger
https://github.com/dagger/dagger
6,359
CLI: update handling of various core types
As described in [this comment](https://github.com/dagger/dagger/issues/6229#issuecomment-1863649336) (and that issue generally), we need to make some adjustments to the CLIs behavior when `dagger call` ends in various core types. There's a handful of related adjustments needed here. Creating as a checklist for now to save issue spam; can break down into more issues if useful though. I'm including my initial suggestions on how to handle these, but to be clear these are not finalized decisions and the final call can be made as part of implementing this - [ ] Handle arbitrary user objects - Print fields (as in `TypeDef` fields, so just trivially resolvable values) as a json object - [x] Handle container - call `sync` only, rely on progress output for anything else - [x] Handle directory - call `sync` only, rely on progress output for anything else - [x] Handle file - call `sync` only, rely on progress output for anything else - [ ] Handle IDs returned by `sync` (i.e. the case where the user explicitly chains `sync`) - just rely on progress output, don't show the id
https://github.com/dagger/dagger/issues/6359
https://github.com/dagger/dagger/pull/6482
2999573c5a34e85b8baac8c0150881d9c08a86b8
d91ac42c196873830c2e0876b251f3bf4d62ea49
2024-01-03T20:19:06Z
go
2024-01-26T18:48:04Z
core/integration/module_test.go
require.Equal(t, "MinimalFoo", foo.Get("name").String()) modGen = c.Container().From(golangImage). WithMountedFile(testCLIBinPath, daggerCliFile(t, c)). WithWorkdir("/work"). With(daggerExec("mod", "init", "--name=minimal", "--sdk=go")). WithNewFile("main.go", dagger.ContainerWithNewFileOpts{ Contents: `package main type Minimal struct {} type Foo struct { Bar bar } type bar struct {} func (m *Minimal) Hello(name string) Foo { return Foo{} } func (f *Foo) Hello(name string) string { return name } func (b *bar) Hello(name string) string { return name } `, }) logGen(ctx, t, modGen.Directory(".")) _, err = modGen.With(inspectModule).Stderr(ctx) require.Error(t, err) require.NoError(t, c.Close()) require.Contains(t, logs.String(), "cannot code-generate unexported type bar") } func TestModuleGoSignaturesMixMatch(t *testing.T) {
closed
dagger/dagger
https://github.com/dagger/dagger
6,359
CLI: update handling of various core types
As described in [this comment](https://github.com/dagger/dagger/issues/6229#issuecomment-1863649336) (and that issue generally), we need to make some adjustments to the CLIs behavior when `dagger call` ends in various core types. There's a handful of related adjustments needed here. Creating as a checklist for now to save issue spam; can break down into more issues if useful though. I'm including my initial suggestions on how to handle these, but to be clear these are not finalized decisions and the final call can be made as part of implementing this - [ ] Handle arbitrary user objects - Print fields (as in `TypeDef` fields, so just trivially resolvable values) as a json object - [x] Handle container - call `sync` only, rely on progress output for anything else - [x] Handle directory - call `sync` only, rely on progress output for anything else - [x] Handle file - call `sync` only, rely on progress output for anything else - [ ] Handle IDs returned by `sync` (i.e. the case where the user explicitly chains `sync`) - just rely on progress output, don't show the id
https://github.com/dagger/dagger/issues/6359
https://github.com/dagger/dagger/pull/6482
2999573c5a34e85b8baac8c0150881d9c08a86b8
d91ac42c196873830c2e0876b251f3bf4d62ea49
2024-01-03T20:19:06Z
go
2024-01-26T18:48:04Z
core/integration/module_test.go
t.Parallel() var logs safeBuffer c, ctx := connect(t, dagger.WithLogOutput(&logs)) modGen := c.Container().From(golangImage). WithMountedFile(testCLIBinPath, daggerCliFile(t, c)). WithWorkdir("/work"). With(daggerExec("mod", "init", "--name=minimal", "--sdk=go")). WithNewFile("main.go", dagger.ContainerWithNewFileOpts{ Contents: `package main type Minimal struct {} func (m *Minimal) Hello(name string, opts struct{}, opts2 struct{}) string { return name } `, }) logGen(ctx, t, modGen.Directory(".")) _, err := modGen.With(daggerQuery(`{minimal{hello}}`)).Stdout(ctx) require.Error(t, err) require.NoError(t, c.Close()) require.Contains(t, logs.String(), "nested structs are not supported") } func TestModuleGoSignaturesNameConflict(t *testing.T) {
closed
dagger/dagger
https://github.com/dagger/dagger
6,359
CLI: update handling of various core types
As described in [this comment](https://github.com/dagger/dagger/issues/6229#issuecomment-1863649336) (and that issue generally), we need to make some adjustments to the CLIs behavior when `dagger call` ends in various core types. There's a handful of related adjustments needed here. Creating as a checklist for now to save issue spam; can break down into more issues if useful though. I'm including my initial suggestions on how to handle these, but to be clear these are not finalized decisions and the final call can be made as part of implementing this - [ ] Handle arbitrary user objects - Print fields (as in `TypeDef` fields, so just trivially resolvable values) as a json object - [x] Handle container - call `sync` only, rely on progress output for anything else - [x] Handle directory - call `sync` only, rely on progress output for anything else - [x] Handle file - call `sync` only, rely on progress output for anything else - [ ] Handle IDs returned by `sync` (i.e. the case where the user explicitly chains `sync`) - just rely on progress output, don't show the id
https://github.com/dagger/dagger/issues/6359
https://github.com/dagger/dagger/pull/6482
2999573c5a34e85b8baac8c0150881d9c08a86b8
d91ac42c196873830c2e0876b251f3bf4d62ea49
2024-01-03T20:19:06Z
go
2024-01-26T18:48:04Z
core/integration/module_test.go
t.Parallel() var logs safeBuffer c, ctx := connect(t, dagger.WithLogOutput(&logs)) modGen := c.Container().From(golangImage). WithMountedFile(testCLIBinPath, daggerCliFile(t, c)). WithWorkdir("/work"). With(daggerExec("mod", "init", "--name=minimal", "--sdk=go")). WithNewFile("main.go", dagger.ContainerWithNewFileOpts{ Contents: `package main type Minimal struct { Foo Foo Bar Bar Baz Baz
closed
dagger/dagger
https://github.com/dagger/dagger
6,359
CLI: update handling of various core types
As described in [this comment](https://github.com/dagger/dagger/issues/6229#issuecomment-1863649336) (and that issue generally), we need to make some adjustments to the CLIs behavior when `dagger call` ends in various core types. There's a handful of related adjustments needed here. Creating as a checklist for now to save issue spam; can break down into more issues if useful though. I'm including my initial suggestions on how to handle these, but to be clear these are not finalized decisions and the final call can be made as part of implementing this - [ ] Handle arbitrary user objects - Print fields (as in `TypeDef` fields, so just trivially resolvable values) as a json object - [x] Handle container - call `sync` only, rely on progress output for anything else - [x] Handle directory - call `sync` only, rely on progress output for anything else - [x] Handle file - call `sync` only, rely on progress output for anything else - [ ] Handle IDs returned by `sync` (i.e. the case where the user explicitly chains `sync`) - just rely on progress output, don't show the id
https://github.com/dagger/dagger/issues/6359
https://github.com/dagger/dagger/pull/6482
2999573c5a34e85b8baac8c0150881d9c08a86b8
d91ac42c196873830c2e0876b251f3bf4d62ea49
2024-01-03T20:19:06Z
go
2024-01-26T18:48:04Z
core/integration/module_test.go
} type Foo struct {} type Bar struct {} type Baz struct {} func (m *Foo) Hello(name string) string { return name } func (f *Bar) Hello(name string, name2 string) string { return name + name2 } func (b *Baz) Hello() (string, error) { return "", nil } `, }) logGen(ctx, t, modGen.Directory(".")) out, err := modGen.With(inspectModule).Stdout(ctx) require.NoError(t, err) objs := gjson.Get(out, "host.directory.asModule.objects") require.Equal(t, 4, len(objs.Array())) obj := objs.Get(`0.asObject`) require.Equal(t, "Minimal", obj.Get("name").String()) obj = objs.Get(`1.asObject`) require.Equal(t, "MinimalFoo", obj.Get("name").String()) obj = objs.Get(`2.asObject`) require.Equal(t, "MinimalBar", obj.Get("name").String()) obj = objs.Get(`3.asObject`) require.Equal(t, "MinimalBaz", obj.Get("name").String()) } var inspectModule = daggerQuery(`
closed
dagger/dagger
https://github.com/dagger/dagger
6,359
CLI: update handling of various core types
As described in [this comment](https://github.com/dagger/dagger/issues/6229#issuecomment-1863649336) (and that issue generally), we need to make some adjustments to the CLIs behavior when `dagger call` ends in various core types. There's a handful of related adjustments needed here. Creating as a checklist for now to save issue spam; can break down into more issues if useful though. I'm including my initial suggestions on how to handle these, but to be clear these are not finalized decisions and the final call can be made as part of implementing this - [ ] Handle arbitrary user objects - Print fields (as in `TypeDef` fields, so just trivially resolvable values) as a json object - [x] Handle container - call `sync` only, rely on progress output for anything else - [x] Handle directory - call `sync` only, rely on progress output for anything else - [x] Handle file - call `sync` only, rely on progress output for anything else - [ ] Handle IDs returned by `sync` (i.e. the case where the user explicitly chains `sync`) - just rely on progress output, don't show the id
https://github.com/dagger/dagger/issues/6359
https://github.com/dagger/dagger/pull/6482
2999573c5a34e85b8baac8c0150881d9c08a86b8
d91ac42c196873830c2e0876b251f3bf4d62ea49
2024-01-03T20:19:06Z
go
2024-01-26T18:48:04Z
core/integration/module_test.go
query { host { directory(path: ".") { asModule { description objects { asObject { name description functions { name description args { name description defaultValue } } fields { name description } } } } } } } `) func TestModuleGoDocs(t *testing.T) {
closed
dagger/dagger
https://github.com/dagger/dagger
6,359
CLI: update handling of various core types
As described in [this comment](https://github.com/dagger/dagger/issues/6229#issuecomment-1863649336) (and that issue generally), we need to make some adjustments to the CLIs behavior when `dagger call` ends in various core types. There's a handful of related adjustments needed here. Creating as a checklist for now to save issue spam; can break down into more issues if useful though. I'm including my initial suggestions on how to handle these, but to be clear these are not finalized decisions and the final call can be made as part of implementing this - [ ] Handle arbitrary user objects - Print fields (as in `TypeDef` fields, so just trivially resolvable values) as a json object - [x] Handle container - call `sync` only, rely on progress output for anything else - [x] Handle directory - call `sync` only, rely on progress output for anything else - [x] Handle file - call `sync` only, rely on progress output for anything else - [ ] Handle IDs returned by `sync` (i.e. the case where the user explicitly chains `sync`) - just rely on progress output, don't show the id
https://github.com/dagger/dagger/issues/6359
https://github.com/dagger/dagger/pull/6482
2999573c5a34e85b8baac8c0150881d9c08a86b8
d91ac42c196873830c2e0876b251f3bf4d62ea49
2024-01-03T20:19:06Z
go
2024-01-26T18:48:04Z
core/integration/module_test.go
t.Parallel() c, ctx := connect(t) modGen := c.Container().From(golangImage). WithMountedFile(testCLIBinPath, daggerCliFile(t, c)). WithWorkdir("/work"). With(daggerExec("mod", "init", "--name=minimal", "--sdk=go")). WithNewFile("main.go", dagger.ContainerWithNewFileOpts{ Contents: goSignatures, }) logGen(ctx, t, modGen.Directory(".")) out, err := modGen.With(inspectModule).Stdout(ctx) require.NoError(t, err) obj := gjson.Get(out, "host.directory.asModule.objects.0.asObject") require.Equal(t, "Minimal", obj.Get("name").String()) hello := obj.Get(`functions.#(name="hello")`) require.Equal(t, "hello", hello.Get("name").String()) require.Empty(t, hello.Get("description").String()) require.Empty(t, hello.Get("args").Array()) echoOpts := obj.Get(`functions.#(name="echoOpts")`) require.Equal(t, "echoOpts", echoOpts.Get("name").String()) require.Equal(t, "EchoOpts does some opts things", echoOpts.Get("description").String()) require.Len(t, echoOpts.Get("args").Array(), 3) require.Equal(t, "msg", echoOpts.Get("args.0.name").String())
closed
dagger/dagger
https://github.com/dagger/dagger
6,359
CLI: update handling of various core types
As described in [this comment](https://github.com/dagger/dagger/issues/6229#issuecomment-1863649336) (and that issue generally), we need to make some adjustments to the CLIs behavior when `dagger call` ends in various core types. There's a handful of related adjustments needed here. Creating as a checklist for now to save issue spam; can break down into more issues if useful though. I'm including my initial suggestions on how to handle these, but to be clear these are not finalized decisions and the final call can be made as part of implementing this - [ ] Handle arbitrary user objects - Print fields (as in `TypeDef` fields, so just trivially resolvable values) as a json object - [x] Handle container - call `sync` only, rely on progress output for anything else - [x] Handle directory - call `sync` only, rely on progress output for anything else - [x] Handle file - call `sync` only, rely on progress output for anything else - [ ] Handle IDs returned by `sync` (i.e. the case where the user explicitly chains `sync`) - just rely on progress output, don't show the id
https://github.com/dagger/dagger/issues/6359
https://github.com/dagger/dagger/pull/6482
2999573c5a34e85b8baac8c0150881d9c08a86b8
d91ac42c196873830c2e0876b251f3bf4d62ea49
2024-01-03T20:19:06Z
go
2024-01-26T18:48:04Z
core/integration/module_test.go
require.Equal(t, "the message to echo", echoOpts.Get("args.0.description").String()) require.Equal(t, "suffix", echoOpts.Get("args.1.name").String()) require.Equal(t, "String to append to the echoed message", echoOpts.Get("args.1.description").String()) require.Equal(t, "times", echoOpts.Get("args.2.name").String()) require.Equal(t, "Number of times to repeat the message", echoOpts.Get("args.2.description").String()) echoOpts = obj.Get(`functions.#(name="echoOptsInline")`) require.Equal(t, "echoOptsInline", echoOpts.Get("name").String()) require.Equal(t, "EchoOptsInline does some opts things", echoOpts.Get("description").String()) require.Len(t, echoOpts.Get("args").Array(), 3) require.Equal(t, "msg", echoOpts.Get("args.0.name").String()) require.Equal(t, "the message to echo", echoOpts.Get("args.0.description").String()) require.Equal(t, "suffix", echoOpts.Get("args.1.name").String()) require.Equal(t, "String to append to the echoed message", echoOpts.Get("args.1.description").String()) require.Equal(t, "times", echoOpts.Get("args.2.name").String()) require.Equal(t, "Number of times to repeat the message", echoOpts.Get("args.2.description").String()) echoOpts = obj.Get(`functions.#(name="echoOptsPragmas")`) require.Equal(t, "echoOptsPragmas", echoOpts.Get("name").String()) require.Len(t, echoOpts.Get("args").Array(), 3) require.Equal(t, "msg", echoOpts.Get("args.0.name").String()) require.Equal(t, "", echoOpts.Get("args.0.defaultValue").String()) require.Equal(t, "suffix", echoOpts.Get("args.1.name").String()) require.Equal(t, "String to append to the echoed message", echoOpts.Get("args.1.description").String()) require.Equal(t, "\"...\"", echoOpts.Get("args.1.defaultValue").String()) require.Equal(t, "times", echoOpts.Get("args.2.name").String()) require.Equal(t, "3", echoOpts.Get("args.2.defaultValue").String()) require.Equal(t, "Number of times to repeat the message", echoOpts.Get("args.2.description").String()) } func TestModuleGoDocsEdgeCases(t *testing.T) {
closed
dagger/dagger
https://github.com/dagger/dagger
6,359
CLI: update handling of various core types
As described in [this comment](https://github.com/dagger/dagger/issues/6229#issuecomment-1863649336) (and that issue generally), we need to make some adjustments to the CLIs behavior when `dagger call` ends in various core types. There's a handful of related adjustments needed here. Creating as a checklist for now to save issue spam; can break down into more issues if useful though. I'm including my initial suggestions on how to handle these, but to be clear these are not finalized decisions and the final call can be made as part of implementing this - [ ] Handle arbitrary user objects - Print fields (as in `TypeDef` fields, so just trivially resolvable values) as a json object - [x] Handle container - call `sync` only, rely on progress output for anything else - [x] Handle directory - call `sync` only, rely on progress output for anything else - [x] Handle file - call `sync` only, rely on progress output for anything else - [ ] Handle IDs returned by `sync` (i.e. the case where the user explicitly chains `sync`) - just rely on progress output, don't show the id
https://github.com/dagger/dagger/issues/6359
https://github.com/dagger/dagger/pull/6482
2999573c5a34e85b8baac8c0150881d9c08a86b8
d91ac42c196873830c2e0876b251f3bf4d62ea49
2024-01-03T20:19:06Z
go
2024-01-26T18:48:04Z
core/integration/module_test.go
t.Parallel() c, ctx := connect(t) modGen := c.Container().From(golangImage). WithMountedFile(testCLIBinPath, daggerCliFile(t, c)). WithWorkdir("/work"). With(daggerExec("mod", "init", "--name=minimal", "--sdk=go")). WithNewFile("main.go", dagger.ContainerWithNewFileOpts{ Contents: `package main // Minimal is a thing type Minimal struct { // X is this X, Y string // Y is not this // +private Z string }
closed
dagger/dagger
https://github.com/dagger/dagger
6,359
CLI: update handling of various core types
As described in [this comment](https://github.com/dagger/dagger/issues/6229#issuecomment-1863649336) (and that issue generally), we need to make some adjustments to the CLIs behavior when `dagger call` ends in various core types. There's a handful of related adjustments needed here. Creating as a checklist for now to save issue spam; can break down into more issues if useful though. I'm including my initial suggestions on how to handle these, but to be clear these are not finalized decisions and the final call can be made as part of implementing this - [ ] Handle arbitrary user objects - Print fields (as in `TypeDef` fields, so just trivially resolvable values) as a json object - [x] Handle container - call `sync` only, rely on progress output for anything else - [x] Handle directory - call `sync` only, rely on progress output for anything else - [x] Handle file - call `sync` only, rely on progress output for anything else - [ ] Handle IDs returned by `sync` (i.e. the case where the user explicitly chains `sync`) - just rely on progress output, don't show the id
https://github.com/dagger/dagger/issues/6359
https://github.com/dagger/dagger/pull/6482
2999573c5a34e85b8baac8c0150881d9c08a86b8
d91ac42c196873830c2e0876b251f3bf4d62ea49
2024-01-03T20:19:06Z
go
2024-01-26T18:48:04Z
core/integration/module_test.go
// some docs func (m *Minimal) Hello(foo string, bar string, // hello baz string, qux string, x string, // lol ) string { return foo + bar } func (m *Minimal) HelloMore( // foo here foo, // bar here bar string, ) string { return foo + bar } func (m *Minimal) HelloMoreInline(opts struct{ // foo here foo, bar string }) string { return opts.foo + opts.bar } func (m *Minimal) HelloAgain( // docs for helloagain foo string, bar string, // docs for bar baz string, ) string { return foo + bar } func (m *Minimal) HelloFinal( foo string) string { // woops
closed
dagger/dagger
https://github.com/dagger/dagger
6,359
CLI: update handling of various core types
As described in [this comment](https://github.com/dagger/dagger/issues/6229#issuecomment-1863649336) (and that issue generally), we need to make some adjustments to the CLIs behavior when `dagger call` ends in various core types. There's a handful of related adjustments needed here. Creating as a checklist for now to save issue spam; can break down into more issues if useful though. I'm including my initial suggestions on how to handle these, but to be clear these are not finalized decisions and the final call can be made as part of implementing this - [ ] Handle arbitrary user objects - Print fields (as in `TypeDef` fields, so just trivially resolvable values) as a json object - [x] Handle container - call `sync` only, rely on progress output for anything else - [x] Handle directory - call `sync` only, rely on progress output for anything else - [x] Handle file - call `sync` only, rely on progress output for anything else - [ ] Handle IDs returned by `sync` (i.e. the case where the user explicitly chains `sync`) - just rely on progress output, don't show the id
https://github.com/dagger/dagger/issues/6359
https://github.com/dagger/dagger/pull/6482
2999573c5a34e85b8baac8c0150881d9c08a86b8
d91ac42c196873830c2e0876b251f3bf4d62ea49
2024-01-03T20:19:06Z
go
2024-01-26T18:48:04Z
core/integration/module_test.go
return foo } `, }) logGen(ctx, t, modGen.Directory(".")) out, err := modGen.With(inspectModule).Stdout(ctx) require.NoError(t, err) obj := gjson.Get(out, "host.directory.asModule.objects.0.asObject") require.Equal(t, "Minimal", obj.Get("name").String()) require.Equal(t, "Minimal is a thing", obj.Get("description").String()) hello := obj.Get(`functions.#(name="hello")`) require.Equal(t, "hello", hello.Get("name").String()) require.Len(t, hello.Get("args").Array(), 5) require.Equal(t, "foo", hello.Get("args.0.name").String()) require.Equal(t, "", hello.Get("args.0.description").String()) require.Equal(t, "bar", hello.Get("args.1.name").String()) require.Equal(t, "", hello.Get("args.1.description").String()) require.Equal(t, "baz", hello.Get("args.2.name").String()) require.Equal(t, "hello", hello.Get("args.2.description").String()) require.Equal(t, "qux", hello.Get("args.3.name").String()) require.Equal(t, "", hello.Get("args.3.description").String()) require.Equal(t, "x", hello.Get("args.4.name").String()) require.Equal(t, "lol", hello.Get("args.4.description").String()) hello = obj.Get(`functions.#(name="helloMore")`) require.Equal(t, "helloMore", hello.Get("name").String()) require.Len(t, hello.Get("args").Array(), 2) require.Equal(t, "foo", hello.Get("args.0.name").String()) require.Equal(t, "foo here", hello.Get("args.0.description").String()) require.Equal(t, "bar", hello.Get("args.1.name").String()) require.Equal(t, "bar here", hello.Get("args.1.description").String())
closed
dagger/dagger
https://github.com/dagger/dagger
6,359
CLI: update handling of various core types
As described in [this comment](https://github.com/dagger/dagger/issues/6229#issuecomment-1863649336) (and that issue generally), we need to make some adjustments to the CLIs behavior when `dagger call` ends in various core types. There's a handful of related adjustments needed here. Creating as a checklist for now to save issue spam; can break down into more issues if useful though. I'm including my initial suggestions on how to handle these, but to be clear these are not finalized decisions and the final call can be made as part of implementing this - [ ] Handle arbitrary user objects - Print fields (as in `TypeDef` fields, so just trivially resolvable values) as a json object - [x] Handle container - call `sync` only, rely on progress output for anything else - [x] Handle directory - call `sync` only, rely on progress output for anything else - [x] Handle file - call `sync` only, rely on progress output for anything else - [ ] Handle IDs returned by `sync` (i.e. the case where the user explicitly chains `sync`) - just rely on progress output, don't show the id
https://github.com/dagger/dagger/issues/6359
https://github.com/dagger/dagger/pull/6482
2999573c5a34e85b8baac8c0150881d9c08a86b8
d91ac42c196873830c2e0876b251f3bf4d62ea49
2024-01-03T20:19:06Z
go
2024-01-26T18:48:04Z
core/integration/module_test.go
hello = obj.Get(`functions.#(name="helloMoreInline")`) require.Equal(t, "helloMoreInline", hello.Get("name").String()) require.Len(t, hello.Get("args").Array(), 2) require.Equal(t, "foo", hello.Get("args.0.name").String()) require.Equal(t, "foo here", hello.Get("args.0.description").String()) require.Equal(t, "bar", hello.Get("args.1.name").String()) require.Equal(t, "", hello.Get("args.1.description").String()) hello = obj.Get(`functions.#(name="helloAgain")`) require.Equal(t, "helloAgain", hello.Get("name").String()) require.Len(t, hello.Get("args").Array(), 3) require.Equal(t, "foo", hello.Get("args.0.name").String()) require.Equal(t, "", hello.Get("args.0.description").String()) require.Equal(t, "bar", hello.Get("args.1.name").String()) require.Equal(t, "docs for bar", hello.Get("args.1.description").String()) require.Equal(t, "baz", hello.Get("args.2.name").String()) require.Equal(t, "", hello.Get("args.2.description").String()) hello = obj.Get(`functions.#(name="helloFinal")`) require.Equal(t, "helloFinal", hello.Get("name").String()) require.Len(t, hello.Get("args").Array(), 1) require.Equal(t, "foo", hello.Get("args.0.name").String()) require.Equal(t, "", hello.Get("args.0.description").String()) require.Len(t, obj.Get(`fields`).Array(), 2) prop := obj.Get(`fields.#(name="x")`) require.Equal(t, "x", prop.Get("name").String()) require.Equal(t, "X is this", prop.Get("description").String()) prop = obj.Get(`fields.#(name="y")`) require.Equal(t, "y", prop.Get("name").String()) require.Equal(t, "", prop.Get("description").String()) } func TestModuleGoWeirdFields(t *testing.T) {
closed
dagger/dagger
https://github.com/dagger/dagger
6,359
CLI: update handling of various core types
As described in [this comment](https://github.com/dagger/dagger/issues/6229#issuecomment-1863649336) (and that issue generally), we need to make some adjustments to the CLIs behavior when `dagger call` ends in various core types. There's a handful of related adjustments needed here. Creating as a checklist for now to save issue spam; can break down into more issues if useful though. I'm including my initial suggestions on how to handle these, but to be clear these are not finalized decisions and the final call can be made as part of implementing this - [ ] Handle arbitrary user objects - Print fields (as in `TypeDef` fields, so just trivially resolvable values) as a json object - [x] Handle container - call `sync` only, rely on progress output for anything else - [x] Handle directory - call `sync` only, rely on progress output for anything else - [x] Handle file - call `sync` only, rely on progress output for anything else - [ ] Handle IDs returned by `sync` (i.e. the case where the user explicitly chains `sync`) - just rely on progress output, don't show the id
https://github.com/dagger/dagger/issues/6359
https://github.com/dagger/dagger/pull/6482
2999573c5a34e85b8baac8c0150881d9c08a86b8
d91ac42c196873830c2e0876b251f3bf4d62ea49
2024-01-03T20:19:06Z
go
2024-01-26T18:48:04Z
core/integration/module_test.go
t.Parallel() c, ctx := connect(t) modGen := c.Container().From(golangImage). WithMountedFile(testCLIBinPath, daggerCliFile(t, c)). WithWorkdir("/work"). With(daggerExec("mod", "init", "--name=minimal", "--sdk=go")). WithNewFile("main.go", dagger.ContainerWithNewFileOpts{ Contents: `package main type Z string type Minimal struct { // field with single (normal) name W string // field with multiple names X, Y string // field with no names Z }
closed
dagger/dagger
https://github.com/dagger/dagger
6,359
CLI: update handling of various core types
As described in [this comment](https://github.com/dagger/dagger/issues/6229#issuecomment-1863649336) (and that issue generally), we need to make some adjustments to the CLIs behavior when `dagger call` ends in various core types. There's a handful of related adjustments needed here. Creating as a checklist for now to save issue spam; can break down into more issues if useful though. I'm including my initial suggestions on how to handle these, but to be clear these are not finalized decisions and the final call can be made as part of implementing this - [ ] Handle arbitrary user objects - Print fields (as in `TypeDef` fields, so just trivially resolvable values) as a json object - [x] Handle container - call `sync` only, rely on progress output for anything else - [x] Handle directory - call `sync` only, rely on progress output for anything else - [x] Handle file - call `sync` only, rely on progress output for anything else - [ ] Handle IDs returned by `sync` (i.e. the case where the user explicitly chains `sync`) - just rely on progress output, don't show the id
https://github.com/dagger/dagger/issues/6359
https://github.com/dagger/dagger/pull/6482
2999573c5a34e85b8baac8c0150881d9c08a86b8
d91ac42c196873830c2e0876b251f3bf4d62ea49
2024-01-03T20:19:06Z
go
2024-01-26T18:48:04Z
core/integration/module_test.go
func New() Minimal { return Minimal{ W: "-", X: "-", Y: "-", Z: Z("-"), } } // struct with no fields type Bar struct{} func (m *Minimal) Say( // field with single (normal) name a string, // field with multiple names b, c string, // field with no names (not included, mixed names not allowed) // string ) string { return a + " " + b + " " + c } func (m *Minimal) Hello( // field with no names string, ) string { return "hello" } func (m *Minimal) SayOpts(opts struct{ // field with single (normal) name A string // field with multiple names
closed
dagger/dagger
https://github.com/dagger/dagger
6,359
CLI: update handling of various core types
As described in [this comment](https://github.com/dagger/dagger/issues/6229#issuecomment-1863649336) (and that issue generally), we need to make some adjustments to the CLIs behavior when `dagger call` ends in various core types. There's a handful of related adjustments needed here. Creating as a checklist for now to save issue spam; can break down into more issues if useful though. I'm including my initial suggestions on how to handle these, but to be clear these are not finalized decisions and the final call can be made as part of implementing this - [ ] Handle arbitrary user objects - Print fields (as in `TypeDef` fields, so just trivially resolvable values) as a json object - [x] Handle container - call `sync` only, rely on progress output for anything else - [x] Handle directory - call `sync` only, rely on progress output for anything else - [x] Handle file - call `sync` only, rely on progress output for anything else - [ ] Handle IDs returned by `sync` (i.e. the case where the user explicitly chains `sync`) - just rely on progress output, don't show the id
https://github.com/dagger/dagger/issues/6359
https://github.com/dagger/dagger/pull/6482
2999573c5a34e85b8baac8c0150881d9c08a86b8
d91ac42c196873830c2e0876b251f3bf4d62ea49
2024-01-03T20:19:06Z
go
2024-01-26T18:48:04Z
core/integration/module_test.go
B, C string // field with no names (not included because of above) // string }) string { return opts.A + " " + opts.B + " " + opts.C } func (m *Minimal) HelloOpts(opts struct{ // field with no names string }) string { return "hello" } `, }) logGen(ctx, t, modGen.Directory(".")) out, err := modGen.With(daggerQuery(`{minimal{w, x, y, z}}`)).Stdout(ctx) require.NoError(t, err) require.JSONEq(t, `{"minimal": {"w": "-", "x": "-", "y": "-", "z": "-"}}`, out) for _, name := range []string{"say", "sayOpts"} { out, err := modGen.With(daggerQuery(`{minimal{%s(a: "hello", b: "world", c: "!")}}`, name)).Stdout(ctx) require.NoError(t, err) require.JSONEq(t, fmt.Sprintf(`{"minimal": {"%s": "hello world !"}}`, name), out) } for _, name := range []string{"hello", "helloOpts"} { out, err := modGen.With(daggerQuery(`{minimal{%s(string: "")}}`, name)).Stdout(ctx) require.NoError(t, err) require.JSONEq(t, fmt.Sprintf(`{"minimal": {"%s": "hello"}}`, name), out) } } func TestModuleGoOptionalMustBeNil(t *testing.T) {
closed
dagger/dagger
https://github.com/dagger/dagger
6,359
CLI: update handling of various core types
As described in [this comment](https://github.com/dagger/dagger/issues/6229#issuecomment-1863649336) (and that issue generally), we need to make some adjustments to the CLIs behavior when `dagger call` ends in various core types. There's a handful of related adjustments needed here. Creating as a checklist for now to save issue spam; can break down into more issues if useful though. I'm including my initial suggestions on how to handle these, but to be clear these are not finalized decisions and the final call can be made as part of implementing this - [ ] Handle arbitrary user objects - Print fields (as in `TypeDef` fields, so just trivially resolvable values) as a json object - [x] Handle container - call `sync` only, rely on progress output for anything else - [x] Handle directory - call `sync` only, rely on progress output for anything else - [x] Handle file - call `sync` only, rely on progress output for anything else - [ ] Handle IDs returned by `sync` (i.e. the case where the user explicitly chains `sync`) - just rely on progress output, don't show the id
https://github.com/dagger/dagger/issues/6359
https://github.com/dagger/dagger/pull/6482
2999573c5a34e85b8baac8c0150881d9c08a86b8
d91ac42c196873830c2e0876b251f3bf4d62ea49
2024-01-03T20:19:06Z
go
2024-01-26T18:48:04Z
core/integration/module_test.go
t.Parallel() c, ctx := connect(t) modGen := c.Container().From(golangImage). WithMountedFile(testCLIBinPath, daggerCliFile(t, c)). WithWorkdir("/work"). With(daggerExec("mod", "init", "--name=minimal", "--sdk=go")). WithNewFile("main.go", dagger.ContainerWithNewFileOpts{ Contents: `package main type Minimal struct {} func (m *Minimal) Foo(x *Optional[*string]) string { if v, _ := x.Get(); v != nil { panic("uh oh") } return "" } func (m *Minimal) Bar(opts struct { x *Optional[*string] }) string { if v, _ := opts.x.Get(); v != nil { panic("uh oh") } return "" } func (m *Minimal) Baz( // +optional x *string,
closed
dagger/dagger
https://github.com/dagger/dagger
6,359
CLI: update handling of various core types
As described in [this comment](https://github.com/dagger/dagger/issues/6229#issuecomment-1863649336) (and that issue generally), we need to make some adjustments to the CLIs behavior when `dagger call` ends in various core types. There's a handful of related adjustments needed here. Creating as a checklist for now to save issue spam; can break down into more issues if useful though. I'm including my initial suggestions on how to handle these, but to be clear these are not finalized decisions and the final call can be made as part of implementing this - [ ] Handle arbitrary user objects - Print fields (as in `TypeDef` fields, so just trivially resolvable values) as a json object - [x] Handle container - call `sync` only, rely on progress output for anything else - [x] Handle directory - call `sync` only, rely on progress output for anything else - [x] Handle file - call `sync` only, rely on progress output for anything else - [ ] Handle IDs returned by `sync` (i.e. the case where the user explicitly chains `sync`) - just rely on progress output, don't show the id
https://github.com/dagger/dagger/issues/6359
https://github.com/dagger/dagger/pull/6482
2999573c5a34e85b8baac8c0150881d9c08a86b8
d91ac42c196873830c2e0876b251f3bf4d62ea49
2024-01-03T20:19:06Z
go
2024-01-26T18:48:04Z
core/integration/module_test.go
) string { if x != nil { panic("uh oh") } return "" } func (m *Minimal) Qux(opts struct { // +optional x *string }) string { if opts.x != nil { panic("uh oh") } return "" } `, }) logGen(ctx, t, modGen.Directory(".")) for _, name := range []string{"foo", "bar", "baz", "qux"} { out, err := modGen.With(daggerQuery(`{minimal{%s}}`, name)).Stdout(ctx) require.NoError(t, err) require.JSONEq(t, fmt.Sprintf(`{"minimal": {"%s": ""}}`, name), out) } } func TestModuleGoFieldMustBeNil(t *testing.T) { t.Parallel() c, ctx := connect(t) modGen := c.Container().From(golangImage). WithMountedFile(testCLIBinPath, daggerCliFile(t, c)). WithWorkdir("/work").
closed
dagger/dagger
https://github.com/dagger/dagger
6,359
CLI: update handling of various core types
As described in [this comment](https://github.com/dagger/dagger/issues/6229#issuecomment-1863649336) (and that issue generally), we need to make some adjustments to the CLIs behavior when `dagger call` ends in various core types. There's a handful of related adjustments needed here. Creating as a checklist for now to save issue spam; can break down into more issues if useful though. I'm including my initial suggestions on how to handle these, but to be clear these are not finalized decisions and the final call can be made as part of implementing this - [ ] Handle arbitrary user objects - Print fields (as in `TypeDef` fields, so just trivially resolvable values) as a json object - [x] Handle container - call `sync` only, rely on progress output for anything else - [x] Handle directory - call `sync` only, rely on progress output for anything else - [x] Handle file - call `sync` only, rely on progress output for anything else - [ ] Handle IDs returned by `sync` (i.e. the case where the user explicitly chains `sync`) - just rely on progress output, don't show the id
https://github.com/dagger/dagger/issues/6359
https://github.com/dagger/dagger/pull/6482
2999573c5a34e85b8baac8c0150881d9c08a86b8
d91ac42c196873830c2e0876b251f3bf4d62ea49
2024-01-03T20:19:06Z
go
2024-01-26T18:48:04Z
core/integration/module_test.go
With(daggerExec("mod", "init", "--name=minimal", "--sdk=go")). WithNewFile("main.go", dagger.ContainerWithNewFileOpts{ Contents: `package main import "fmt" type Minimal struct { Src *Directory Name *string } func New() *Minimal { return &Minimal{} } func (m *Minimal) IsEmpty() bool { if m.Name != nil { panic(fmt.Sprintf("name should be nil but is %v", m.Name)) } if m.Src != nil { panic(fmt.Sprintf("src should be nil but is %v", m.Src)) } return true } `, }) out, err := modGen.With(daggerQuery(`{minimal{isEmpty}}`)).Stdout(ctx) require.NoError(t, err) require.JSONEq(t, `{"minimal": {"isEmpty": true}}`, out) } func TestModuleDescription(t *testing.T) { t.Parallel() c, ctx := connect(t) for _, tc := range []struct {
closed
dagger/dagger
https://github.com/dagger/dagger
6,359
CLI: update handling of various core types
As described in [this comment](https://github.com/dagger/dagger/issues/6229#issuecomment-1863649336) (and that issue generally), we need to make some adjustments to the CLIs behavior when `dagger call` ends in various core types. There's a handful of related adjustments needed here. Creating as a checklist for now to save issue spam; can break down into more issues if useful though. I'm including my initial suggestions on how to handle these, but to be clear these are not finalized decisions and the final call can be made as part of implementing this - [ ] Handle arbitrary user objects - Print fields (as in `TypeDef` fields, so just trivially resolvable values) as a json object - [x] Handle container - call `sync` only, rely on progress output for anything else - [x] Handle directory - call `sync` only, rely on progress output for anything else - [x] Handle file - call `sync` only, rely on progress output for anything else - [ ] Handle IDs returned by `sync` (i.e. the case where the user explicitly chains `sync`) - just rely on progress output, don't show the id
https://github.com/dagger/dagger/issues/6359
https://github.com/dagger/dagger/pull/6482
2999573c5a34e85b8baac8c0150881d9c08a86b8
d91ac42c196873830c2e0876b251f3bf4d62ea49
2024-01-03T20:19:06Z
go
2024-01-26T18:48:04Z
core/integration/module_test.go
sdk string source string }{ { sdk: "python", source: `"""Minimal module, short description Long description, with full sentences. """ from dagger import field, function, object_type @object_type class Minimal: """Minimal object, short description""" foo: str = field(default="foo") `, },
closed
dagger/dagger
https://github.com/dagger/dagger
6,359
CLI: update handling of various core types
As described in [this comment](https://github.com/dagger/dagger/issues/6229#issuecomment-1863649336) (and that issue generally), we need to make some adjustments to the CLIs behavior when `dagger call` ends in various core types. There's a handful of related adjustments needed here. Creating as a checklist for now to save issue spam; can break down into more issues if useful though. I'm including my initial suggestions on how to handle these, but to be clear these are not finalized decisions and the final call can be made as part of implementing this - [ ] Handle arbitrary user objects - Print fields (as in `TypeDef` fields, so just trivially resolvable values) as a json object - [x] Handle container - call `sync` only, rely on progress output for anything else - [x] Handle directory - call `sync` only, rely on progress output for anything else - [x] Handle file - call `sync` only, rely on progress output for anything else - [ ] Handle IDs returned by `sync` (i.e. the case where the user explicitly chains `sync`) - just rely on progress output, don't show the id
https://github.com/dagger/dagger/issues/6359
https://github.com/dagger/dagger/pull/6482
2999573c5a34e85b8baac8c0150881d9c08a86b8
d91ac42c196873830c2e0876b251f3bf4d62ea49
2024-01-03T20:19:06Z
go
2024-01-26T18:48:04Z
core/integration/module_test.go
} { tc := tc t.Run(tc.sdk, func(t *testing.T) { t.Parallel() modGen := c.Container().From(golangImage). WithMountedFile(testCLIBinPath, daggerCliFile(t, c)). WithWorkdir("/work"). With(daggerExec("mod", "init", "--name=minimal", "--sdk="+tc.sdk)). With(sdkSource(tc.sdk, tc.source)) if tc.sdk == "go" { logGen(ctx, t, modGen.Directory(".")) } out, err := modGen.With(inspectModule).Stdout(ctx) require.NoError(t, err) mod := gjson.Get(out, "host.directory.asModule") require.Equal(t, "Minimal module, short description\n\nLong description, with full sentences.", mod.Get("description").String(), ) require.Equal(t, "Minimal object, short description", mod.Get("objects.0.asObject.description").String(), ) }) } } func TestModulePrivateField(t *testing.T) { t.Parallel() c, ctx := connect(t) for _, tc := range []struct {
closed
dagger/dagger
https://github.com/dagger/dagger
6,359
CLI: update handling of various core types
As described in [this comment](https://github.com/dagger/dagger/issues/6229#issuecomment-1863649336) (and that issue generally), we need to make some adjustments to the CLIs behavior when `dagger call` ends in various core types. There's a handful of related adjustments needed here. Creating as a checklist for now to save issue spam; can break down into more issues if useful though. I'm including my initial suggestions on how to handle these, but to be clear these are not finalized decisions and the final call can be made as part of implementing this - [ ] Handle arbitrary user objects - Print fields (as in `TypeDef` fields, so just trivially resolvable values) as a json object - [x] Handle container - call `sync` only, rely on progress output for anything else - [x] Handle directory - call `sync` only, rely on progress output for anything else - [x] Handle file - call `sync` only, rely on progress output for anything else - [ ] Handle IDs returned by `sync` (i.e. the case where the user explicitly chains `sync`) - just rely on progress output, don't show the id
https://github.com/dagger/dagger/issues/6359
https://github.com/dagger/dagger/pull/6482
2999573c5a34e85b8baac8c0150881d9c08a86b8
d91ac42c196873830c2e0876b251f3bf4d62ea49
2024-01-03T20:19:06Z
go
2024-01-26T18:48:04Z
core/integration/module_test.go
sdk string source string }{ { sdk: "go", source: `package main type Minimal struct { Foo string Bar string // +private } func (m *Minimal) Set(foo string, bar string) *Minimal { m.Foo = foo m.Bar = bar return m } func (m *Minimal) Hello() string { return m.Foo + m.Bar } `, }, { sdk: "python", source: `from dagger import field, function, object_type @object_type class Minimal: foo: str = field(default="") bar: str = "" @function def set(self, foo: str, bar: str) -> "Minimal": self.foo = foo
closed
dagger/dagger
https://github.com/dagger/dagger
6,359
CLI: update handling of various core types
As described in [this comment](https://github.com/dagger/dagger/issues/6229#issuecomment-1863649336) (and that issue generally), we need to make some adjustments to the CLIs behavior when `dagger call` ends in various core types. There's a handful of related adjustments needed here. Creating as a checklist for now to save issue spam; can break down into more issues if useful though. I'm including my initial suggestions on how to handle these, but to be clear these are not finalized decisions and the final call can be made as part of implementing this - [ ] Handle arbitrary user objects - Print fields (as in `TypeDef` fields, so just trivially resolvable values) as a json object - [x] Handle container - call `sync` only, rely on progress output for anything else - [x] Handle directory - call `sync` only, rely on progress output for anything else - [x] Handle file - call `sync` only, rely on progress output for anything else - [ ] Handle IDs returned by `sync` (i.e. the case where the user explicitly chains `sync`) - just rely on progress output, don't show the id
https://github.com/dagger/dagger/issues/6359
https://github.com/dagger/dagger/pull/6482
2999573c5a34e85b8baac8c0150881d9c08a86b8
d91ac42c196873830c2e0876b251f3bf4d62ea49
2024-01-03T20:19:06Z
go
2024-01-26T18:48:04Z
core/integration/module_test.go
self.bar = bar return self @function def hello(self) -> str: return self.foo + self.bar `, }, { sdk: "typescript", source: ` import { object, func, field } from "@dagger.io/dagger" @object class Minimal { @field foo: string bar?: string constructor(foo?: string, bar?: string) { this.foo = foo this.bar = bar } @func set(foo: string, bar: string): Minimal { this.foo = foo this.bar = bar return this } @func hello(): string { return this.foo + this.bar }
closed
dagger/dagger
https://github.com/dagger/dagger
6,359
CLI: update handling of various core types
As described in [this comment](https://github.com/dagger/dagger/issues/6229#issuecomment-1863649336) (and that issue generally), we need to make some adjustments to the CLIs behavior when `dagger call` ends in various core types. There's a handful of related adjustments needed here. Creating as a checklist for now to save issue spam; can break down into more issues if useful though. I'm including my initial suggestions on how to handle these, but to be clear these are not finalized decisions and the final call can be made as part of implementing this - [ ] Handle arbitrary user objects - Print fields (as in `TypeDef` fields, so just trivially resolvable values) as a json object - [x] Handle container - call `sync` only, rely on progress output for anything else - [x] Handle directory - call `sync` only, rely on progress output for anything else - [x] Handle file - call `sync` only, rely on progress output for anything else - [ ] Handle IDs returned by `sync` (i.e. the case where the user explicitly chains `sync`) - just rely on progress output, don't show the id
https://github.com/dagger/dagger/issues/6359
https://github.com/dagger/dagger/pull/6482
2999573c5a34e85b8baac8c0150881d9c08a86b8
d91ac42c196873830c2e0876b251f3bf4d62ea49
2024-01-03T20:19:06Z
go
2024-01-26T18:48:04Z
core/integration/module_test.go
} `, }, } { tc := tc t.Run(tc.sdk, func(t *testing.T) { t.Parallel() modGen := c.Container().From(golangImage). WithMountedFile(testCLIBinPath, daggerCliFile(t, c)). WithWorkdir("/work"). With(daggerExec("mod", "init", "--name=minimal", "--sdk="+tc.sdk)). With(sdkSource(tc.sdk, tc.source)) if tc.sdk == "go" { logGen(ctx, t, modGen.Directory(".")) } out, err := modGen.With(inspectModule).Stdout(ctx) require.NoError(t, err) obj := gjson.Get(out, "host.directory.asModule.objects.0.asObject") require.Equal(t, "Minimal", obj.Get("name").String()) require.Len(t, obj.Get(`fields`).Array(), 1) prop := obj.Get(`fields.#(name="foo")`) require.Equal(t, "foo", prop.Get("name").String()) out, err = modGen.With(daggerQuery(`{minimal{set(foo: "abc", bar: "xyz"){hello}}}`)).Stdout(ctx) require.NoError(t, err) require.JSONEq(t, `{"minimal":{"set":{"hello": "abcxyz"}}}`, out) out, err = modGen.With(daggerQuery(`{minimal{set(foo: "abc", bar: "xyz"){foo}}}`)).Stdout(ctx) require.NoError(t, err) require.JSONEq(t, `{"minimal":{"set":{"foo": "abc"}}}`, out) _, err = modGen.With(daggerQuery(`{minimal{set(foo: "abc", bar: "xyz"){bar}}}`)).Stdout(ctx) require.ErrorContains(t, err, `Minimal has no such field: "bar"`)
closed
dagger/dagger
https://github.com/dagger/dagger
6,359
CLI: update handling of various core types
As described in [this comment](https://github.com/dagger/dagger/issues/6229#issuecomment-1863649336) (and that issue generally), we need to make some adjustments to the CLIs behavior when `dagger call` ends in various core types. There's a handful of related adjustments needed here. Creating as a checklist for now to save issue spam; can break down into more issues if useful though. I'm including my initial suggestions on how to handle these, but to be clear these are not finalized decisions and the final call can be made as part of implementing this - [ ] Handle arbitrary user objects - Print fields (as in `TypeDef` fields, so just trivially resolvable values) as a json object - [x] Handle container - call `sync` only, rely on progress output for anything else - [x] Handle directory - call `sync` only, rely on progress output for anything else - [x] Handle file - call `sync` only, rely on progress output for anything else - [ ] Handle IDs returned by `sync` (i.e. the case where the user explicitly chains `sync`) - just rely on progress output, don't show the id
https://github.com/dagger/dagger/issues/6359
https://github.com/dagger/dagger/pull/6482
2999573c5a34e85b8baac8c0150881d9c08a86b8
d91ac42c196873830c2e0876b251f3bf4d62ea49
2024-01-03T20:19:06Z
go
2024-01-26T18:48:04Z
core/integration/module_test.go
}) } } func TestModuleGoExtendCore(t *testing.T) { t.Parallel() var logs safeBuffer c, ctx := connect(t, dagger.WithLogOutput(&logs)) _, err := c.Container().From(golangImage). WithMountedFile(testCLIBinPath, daggerCliFile(t, c)). WithWorkdir("/work"). With(daggerExec("mod", "init", "--name=container", "--sdk=go")). WithNewFile("main.go", dagger.ContainerWithNewFileOpts{ Contents: `package main import "context" func (c *Container) Echo(ctx context.Context, msg string) (string, error) { return c.WithExec([]string{"echo", msg}).Stdout(ctx) } `, }). With(daggerQuery(`{container{from(address:"` + alpineImage + `"){echo(msg:"echo!"){stdout}}}}`)). Sync(ctx) require.Error(t, err) require.NoError(t, c.Close()) t.Log(logs.String()) require.Contains(t, logs.String(), "cannot define methods on objects from outside this module") } func TestModuleCustomTypes(t *testing.T) { t.Parallel() c, ctx := connect(t) type testCase struct {
closed
dagger/dagger
https://github.com/dagger/dagger
6,359
CLI: update handling of various core types
As described in [this comment](https://github.com/dagger/dagger/issues/6229#issuecomment-1863649336) (and that issue generally), we need to make some adjustments to the CLIs behavior when `dagger call` ends in various core types. There's a handful of related adjustments needed here. Creating as a checklist for now to save issue spam; can break down into more issues if useful though. I'm including my initial suggestions on how to handle these, but to be clear these are not finalized decisions and the final call can be made as part of implementing this - [ ] Handle arbitrary user objects - Print fields (as in `TypeDef` fields, so just trivially resolvable values) as a json object - [x] Handle container - call `sync` only, rely on progress output for anything else - [x] Handle directory - call `sync` only, rely on progress output for anything else - [x] Handle file - call `sync` only, rely on progress output for anything else - [ ] Handle IDs returned by `sync` (i.e. the case where the user explicitly chains `sync`) - just rely on progress output, don't show the id
https://github.com/dagger/dagger/issues/6359
https://github.com/dagger/dagger/pull/6482
2999573c5a34e85b8baac8c0150881d9c08a86b8
d91ac42c196873830c2e0876b251f3bf4d62ea49
2024-01-03T20:19:06Z
go
2024-01-26T18:48:04Z
core/integration/module_test.go
sdk string source string } for _, tc := range []testCase{ { sdk: "go", source: `package main import "strings" type Test struct{} func (m *Test) Repeater(msg string, times int) *Repeater { return &Repeater{ Message: msg, Times: times, } } type Repeater struct { Message string Times int } func (t *Repeater) Render() string { return strings.Repeat(t.Message, t.Times) } `, }, { sdk: "python", source: `from dagger import field, function, object_type @object_type class Repeater:
closed
dagger/dagger
https://github.com/dagger/dagger
6,359
CLI: update handling of various core types
As described in [this comment](https://github.com/dagger/dagger/issues/6229#issuecomment-1863649336) (and that issue generally), we need to make some adjustments to the CLIs behavior when `dagger call` ends in various core types. There's a handful of related adjustments needed here. Creating as a checklist for now to save issue spam; can break down into more issues if useful though. I'm including my initial suggestions on how to handle these, but to be clear these are not finalized decisions and the final call can be made as part of implementing this - [ ] Handle arbitrary user objects - Print fields (as in `TypeDef` fields, so just trivially resolvable values) as a json object - [x] Handle container - call `sync` only, rely on progress output for anything else - [x] Handle directory - call `sync` only, rely on progress output for anything else - [x] Handle file - call `sync` only, rely on progress output for anything else - [ ] Handle IDs returned by `sync` (i.e. the case where the user explicitly chains `sync`) - just rely on progress output, don't show the id
https://github.com/dagger/dagger/issues/6359
https://github.com/dagger/dagger/pull/6482
2999573c5a34e85b8baac8c0150881d9c08a86b8
d91ac42c196873830c2e0876b251f3bf4d62ea49
2024-01-03T20:19:06Z
go
2024-01-26T18:48:04Z
core/integration/module_test.go
message: str = field(default="") times: int = field(default=0) @function def render(self) -> str: return self.message * self.times @function def repeater(msg: str, times: int) -> Repeater: return Repeater(message=msg, times=times) `, }, { sdk: "typescript", source: ` import { object, func, field } from "@dagger.io/dagger" @object class Repeater { @field message: string @field times: number constructor(message: string, times: number) { this.message = message this.times = times } @func render(): string { return this.message.repeat(this.times) } } @object
closed
dagger/dagger
https://github.com/dagger/dagger
6,359
CLI: update handling of various core types
As described in [this comment](https://github.com/dagger/dagger/issues/6229#issuecomment-1863649336) (and that issue generally), we need to make some adjustments to the CLIs behavior when `dagger call` ends in various core types. There's a handful of related adjustments needed here. Creating as a checklist for now to save issue spam; can break down into more issues if useful though. I'm including my initial suggestions on how to handle these, but to be clear these are not finalized decisions and the final call can be made as part of implementing this - [ ] Handle arbitrary user objects - Print fields (as in `TypeDef` fields, so just trivially resolvable values) as a json object - [x] Handle container - call `sync` only, rely on progress output for anything else - [x] Handle directory - call `sync` only, rely on progress output for anything else - [x] Handle file - call `sync` only, rely on progress output for anything else - [ ] Handle IDs returned by `sync` (i.e. the case where the user explicitly chains `sync`) - just rely on progress output, don't show the id
https://github.com/dagger/dagger/issues/6359
https://github.com/dagger/dagger/pull/6482
2999573c5a34e85b8baac8c0150881d9c08a86b8
d91ac42c196873830c2e0876b251f3bf4d62ea49
2024-01-03T20:19:06Z
go
2024-01-26T18:48:04Z
core/integration/module_test.go
class Test { @func repeater(msg: string, times: number): Repeater { return new Repeater(msg, times) } } `, }, } { tc := tc t.Run(fmt.Sprintf("custom %s types", tc.sdk), func(t *testing.T) { t.Parallel() modGen := c.Container().From(golangImage). WithMountedFile(testCLIBinPath, daggerCliFile(t, c)). WithWorkdir("/work"). With(daggerExec("mod", "init", "--name=test", "--sdk="+tc.sdk)). With(sdkSource(tc.sdk, tc.source)) if tc.sdk == "go" { logGen(ctx, t, modGen.Directory(".")) } out, err := modGen.With(daggerQuery(`{test{repeater(msg:"echo!", times: 3){render}}}`)).Stdout(ctx) require.NoError(t, err) require.JSONEq(t, `{"test":{"repeater":{"render":"echo!echo!echo!"}}}`, out) }) } } func TestModuleReturnTypeDetection(t *testing.T) { t.Parallel() c, ctx := connect(t) type testCase struct {
closed
dagger/dagger
https://github.com/dagger/dagger
6,359
CLI: update handling of various core types
As described in [this comment](https://github.com/dagger/dagger/issues/6229#issuecomment-1863649336) (and that issue generally), we need to make some adjustments to the CLIs behavior when `dagger call` ends in various core types. There's a handful of related adjustments needed here. Creating as a checklist for now to save issue spam; can break down into more issues if useful though. I'm including my initial suggestions on how to handle these, but to be clear these are not finalized decisions and the final call can be made as part of implementing this - [ ] Handle arbitrary user objects - Print fields (as in `TypeDef` fields, so just trivially resolvable values) as a json object - [x] Handle container - call `sync` only, rely on progress output for anything else - [x] Handle directory - call `sync` only, rely on progress output for anything else - [x] Handle file - call `sync` only, rely on progress output for anything else - [ ] Handle IDs returned by `sync` (i.e. the case where the user explicitly chains `sync`) - just rely on progress output, don't show the id
https://github.com/dagger/dagger/issues/6359
https://github.com/dagger/dagger/pull/6482
2999573c5a34e85b8baac8c0150881d9c08a86b8
d91ac42c196873830c2e0876b251f3bf4d62ea49
2024-01-03T20:19:06Z
go
2024-01-26T18:48:04Z
core/integration/module_test.go
sdk string source string } for _, tc := range []testCase{ { sdk: "go", source: `package main type Foo struct {} type X struct { Message string ` + "`json:\"message\"`" + `
closed
dagger/dagger
https://github.com/dagger/dagger
6,359
CLI: update handling of various core types
As described in [this comment](https://github.com/dagger/dagger/issues/6229#issuecomment-1863649336) (and that issue generally), we need to make some adjustments to the CLIs behavior when `dagger call` ends in various core types. There's a handful of related adjustments needed here. Creating as a checklist for now to save issue spam; can break down into more issues if useful though. I'm including my initial suggestions on how to handle these, but to be clear these are not finalized decisions and the final call can be made as part of implementing this - [ ] Handle arbitrary user objects - Print fields (as in `TypeDef` fields, so just trivially resolvable values) as a json object - [x] Handle container - call `sync` only, rely on progress output for anything else - [x] Handle directory - call `sync` only, rely on progress output for anything else - [x] Handle file - call `sync` only, rely on progress output for anything else - [ ] Handle IDs returned by `sync` (i.e. the case where the user explicitly chains `sync`) - just rely on progress output, don't show the id
https://github.com/dagger/dagger/issues/6359
https://github.com/dagger/dagger/pull/6482
2999573c5a34e85b8baac8c0150881d9c08a86b8
d91ac42c196873830c2e0876b251f3bf4d62ea49
2024-01-03T20:19:06Z
go
2024-01-26T18:48:04Z
core/integration/module_test.go
} func (m *Foo) MyFunction() X { return X{Message: "foo"} } `, }, { sdk: "python", source: `from dagger import field, function, object_type @object_type class X: message: str = field(default="") @function def my_function() -> X: return X(message="foo") `, }, { sdk: "typescript", source: ` import { object, func, field } from "@dagger.io/dagger" @object class X { @field message: string constructor(message: string) { this.message = message; } } @object
closed
dagger/dagger
https://github.com/dagger/dagger
6,359
CLI: update handling of various core types
As described in [this comment](https://github.com/dagger/dagger/issues/6229#issuecomment-1863649336) (and that issue generally), we need to make some adjustments to the CLIs behavior when `dagger call` ends in various core types. There's a handful of related adjustments needed here. Creating as a checklist for now to save issue spam; can break down into more issues if useful though. I'm including my initial suggestions on how to handle these, but to be clear these are not finalized decisions and the final call can be made as part of implementing this - [ ] Handle arbitrary user objects - Print fields (as in `TypeDef` fields, so just trivially resolvable values) as a json object - [x] Handle container - call `sync` only, rely on progress output for anything else - [x] Handle directory - call `sync` only, rely on progress output for anything else - [x] Handle file - call `sync` only, rely on progress output for anything else - [ ] Handle IDs returned by `sync` (i.e. the case where the user explicitly chains `sync`) - just rely on progress output, don't show the id
https://github.com/dagger/dagger/issues/6359
https://github.com/dagger/dagger/pull/6482
2999573c5a34e85b8baac8c0150881d9c08a86b8
d91ac42c196873830c2e0876b251f3bf4d62ea49
2024-01-03T20:19:06Z
go
2024-01-26T18:48:04Z
core/integration/module_test.go
class Foo { @func myFunction(): X { return new X("foo"); } } `, }, } { tc := tc t.Run(tc.sdk, func(t *testing.T) { t.Parallel() modGen := c.Container().From(golangImage). WithMountedFile(testCLIBinPath, daggerCliFile(t, c)). WithWorkdir("/work"). With(daggerExec("mod", "init", "--name=foo", "--sdk="+tc.sdk)). With(sdkSource(tc.sdk, tc.source)) if tc.sdk == "go" { logGen(ctx, t, modGen.Directory(".")) } out, err := modGen.With(daggerQuery(`{foo{myFunction{message}}}`)).Stdout(ctx) require.NoError(t, err) require.JSONEq(t, `{"foo":{"myFunction":{"message":"foo"}}}`, out) }) } } func TestModuleReturnObject(t *testing.T) { t.Parallel() c, ctx := connect(t) type testCase struct {
closed
dagger/dagger
https://github.com/dagger/dagger
6,359
CLI: update handling of various core types
As described in [this comment](https://github.com/dagger/dagger/issues/6229#issuecomment-1863649336) (and that issue generally), we need to make some adjustments to the CLIs behavior when `dagger call` ends in various core types. There's a handful of related adjustments needed here. Creating as a checklist for now to save issue spam; can break down into more issues if useful though. I'm including my initial suggestions on how to handle these, but to be clear these are not finalized decisions and the final call can be made as part of implementing this - [ ] Handle arbitrary user objects - Print fields (as in `TypeDef` fields, so just trivially resolvable values) as a json object - [x] Handle container - call `sync` only, rely on progress output for anything else - [x] Handle directory - call `sync` only, rely on progress output for anything else - [x] Handle file - call `sync` only, rely on progress output for anything else - [ ] Handle IDs returned by `sync` (i.e. the case where the user explicitly chains `sync`) - just rely on progress output, don't show the id
https://github.com/dagger/dagger/issues/6359
https://github.com/dagger/dagger/pull/6482
2999573c5a34e85b8baac8c0150881d9c08a86b8
d91ac42c196873830c2e0876b251f3bf4d62ea49
2024-01-03T20:19:06Z
go
2024-01-26T18:48:04Z
core/integration/module_test.go
sdk string source string } for _, tc := range []testCase{ { sdk: "go", source: `package main type Foo struct {} type X struct { Message string ` + "`json:\"message\"`" + ` When string ` + "`json:\"Timestamp\"`" + ` To string ` + "`json:\"recipient\"`" + ` From string } func (m *Foo) MyFunction() X { return X{Message: "foo", When: "now", To: "user", From: "admin"} } `, }, { sdk: "python", source: `from dagger import field, function, object_type @object_type class X: message: str = field(default="") when: str = field(default="", name="Timestamp") to: str = field(default="", name="recipient")
closed
dagger/dagger
https://github.com/dagger/dagger
6,359
CLI: update handling of various core types
As described in [this comment](https://github.com/dagger/dagger/issues/6229#issuecomment-1863649336) (and that issue generally), we need to make some adjustments to the CLIs behavior when `dagger call` ends in various core types. There's a handful of related adjustments needed here. Creating as a checklist for now to save issue spam; can break down into more issues if useful though. I'm including my initial suggestions on how to handle these, but to be clear these are not finalized decisions and the final call can be made as part of implementing this - [ ] Handle arbitrary user objects - Print fields (as in `TypeDef` fields, so just trivially resolvable values) as a json object - [x] Handle container - call `sync` only, rely on progress output for anything else - [x] Handle directory - call `sync` only, rely on progress output for anything else - [x] Handle file - call `sync` only, rely on progress output for anything else - [ ] Handle IDs returned by `sync` (i.e. the case where the user explicitly chains `sync`) - just rely on progress output, don't show the id
https://github.com/dagger/dagger/issues/6359
https://github.com/dagger/dagger/pull/6482
2999573c5a34e85b8baac8c0150881d9c08a86b8
d91ac42c196873830c2e0876b251f3bf4d62ea49
2024-01-03T20:19:06Z
go
2024-01-26T18:48:04Z
core/integration/module_test.go
from_: str = field(default="", name="from") @object_type class Foo: @function def my_function(self) -> X: return X(message="foo", when="now", to="user", from_="admin") `, }, { sdk: "typescript", source: ` import { object, func, field } from "@dagger.io/dagger" @object class X { @field message: string @field timestamp: string @field recipient: string @field from: string constructor(message: string, timestamp: string, recipient: string, from: string) { this.message = message; this.timestamp = timestamp; this.recipient = recipient; this.from = from; } } @object