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
5,575
🐞 Node.js SDK - Enum wrongly interpreted
### What is the issue? There appears to be an issue with the interpretation of the Enum in the Node.js SDK. In the example bellow ImageMediaTypes.Dockermediatypes should return `DockerMediaTypes` but instead it returns 0. ```ts await client .container() .publish(gitLabImageRepo, { platformVariants: seededPlatformVariants, mediaTypes: ImageMediaTypes.Dockermediatypes, }); ``` ### Log output ```shell GraphQLRequestError: Argument "mediaTypes" has invalid value 0. Expected type "ImageMediaTypes", found 0. at file:///Users/doe0003p/Projects/it-service/qa/teamscale/base-images/tflint/node_modules/@dagger.io/dagger/dist/api/utils.js:155:23 at Generator.throw (<anonymous>) at rejected (file:///Users/doe0003p/Projects/it-service/qa/teamscale/base-images/tflint/node_modules/@dagger.io/dagger/dist/api/utils.js:5:65) at processTicksAndRejections (node:internal/process/task_queues:95:5) { cause: ClientError: Argument "mediaTypes" has invalid value 0. ``` ### Steps to reproduce _No response_ ### SDK version Node.js SDK v0.8.0 ### OS version macOs 13.4.1
https://github.com/dagger/dagger/issues/5575
https://github.com/dagger/dagger/pull/5594
2ce7f970373569b476956b8a0d5c37b3a384ff49
6e4ba34afd975beef1e8cadb7b17003f810b1207
2023-08-04T13:28:35Z
go
2023-08-09T18:42:54Z
codegen/generator/nodejs/templates/functions.go
s = strings.ToLower(s) return strcase.ToCamel(s) } func isArgOptional(values introspection.InputValues) bool { for _, v := range values { if v.TypeRef != nil && !v.TypeRef.IsOptional() { return false } } return true } func splitRequiredOptionalArgs(values introspection.InputValues) (required introspection.InputValues, optionals introspection.InputValues) { for i, v := range values { if v.TypeRef != nil && !v.TypeRef.IsOptional() { continue } return values[:i], values[i:] } return values, nil } func getRequiredArgs(values introspection.InputValues) introspection.InputValues { required, _ := splitRequiredOptionalArgs(values) return required } func getOptionalArgs(values introspection.InputValues) introspection.InputValues {
closed
dagger/dagger
https://github.com/dagger/dagger
5,575
🐞 Node.js SDK - Enum wrongly interpreted
### What is the issue? There appears to be an issue with the interpretation of the Enum in the Node.js SDK. In the example bellow ImageMediaTypes.Dockermediatypes should return `DockerMediaTypes` but instead it returns 0. ```ts await client .container() .publish(gitLabImageRepo, { platformVariants: seededPlatformVariants, mediaTypes: ImageMediaTypes.Dockermediatypes, }); ``` ### Log output ```shell GraphQLRequestError: Argument "mediaTypes" has invalid value 0. Expected type "ImageMediaTypes", found 0. at file:///Users/doe0003p/Projects/it-service/qa/teamscale/base-images/tflint/node_modules/@dagger.io/dagger/dist/api/utils.js:155:23 at Generator.throw (<anonymous>) at rejected (file:///Users/doe0003p/Projects/it-service/qa/teamscale/base-images/tflint/node_modules/@dagger.io/dagger/dist/api/utils.js:5:65) at processTicksAndRejections (node:internal/process/task_queues:95:5) { cause: ClientError: Argument "mediaTypes" has invalid value 0. ``` ### Steps to reproduce _No response_ ### SDK version Node.js SDK v0.8.0 ### OS version macOs 13.4.1
https://github.com/dagger/dagger/issues/5575
https://github.com/dagger/dagger/pull/5594
2ce7f970373569b476956b8a0d5c37b3a384ff49
6e4ba34afd975beef1e8cadb7b17003f810b1207
2023-08-04T13:28:35Z
go
2023-08-09T18:42:54Z
codegen/generator/nodejs/templates/functions.go
_, optional := splitRequiredOptionalArgs(values) return optional } func sortInputFields(s []introspection.InputValue) []introspection.InputValue { sort.SliceStable(s, func(i, j int) bool { return s[i].Name < s[j].Name }) return s } func sortEnumFields(s []introspection.EnumValue) []introspection.EnumValue { sort.SliceStable(s, func(i, j int) bool { return s[i].Name < s[j].Name }) return s } func argsHaveDescription(values introspection.InputValues) bool { for _, o := range values { if strings.TrimSpace(o.Description) != "" { return true } } return false } func toSingleType(value string) string { return value[:len(value)-2] }
closed
dagger/dagger
https://github.com/dagger/dagger
5,084
TUI: show directory export target
## Problem In the new (and awesome) TUI: * directory imports (reading from host filesystem) are shown with the source path βœ… * but directory exports (writing from host filesystem) don't 😒 Example: ![image](https://user-images.githubusercontent.com/29565/236122949-033beb18-59aa-4d59-8724-311411c64bb2.png) ## Solution Change how directory exports are displayed in the TUI, so that the target path is visible.
https://github.com/dagger/dagger/issues/5084
https://github.com/dagger/dagger/pull/5632
ece3f3691ac5d241a2e8d3bf047c2ea8cf952547
badf974d4e5d4592602c4ed876a0da50c9d74e5c
2023-05-04T05:59:34Z
go
2023-08-15T16:22:20Z
core/directory.go
package core import ( "context" "fmt" "io/fs" "path" "path/filepath" "reflect" "strings" "time" "github.com/dagger/dagger/core/pipeline" "github.com/dagger/dagger/core/resourceid" "github.com/dagger/dagger/engine/buildkit" "github.com/moby/buildkit/client/llb" bkgw "github.com/moby/buildkit/frontend/gateway/client" "github.com/moby/buildkit/solver/pb" "github.com/opencontainers/go-digest" specs "github.com/opencontainers/image-spec/specs-go/v1" "github.com/pkg/errors" fstypes "github.com/tonistiigi/fsutil/types" ) type Directory struct {
closed
dagger/dagger
https://github.com/dagger/dagger
5,084
TUI: show directory export target
## Problem In the new (and awesome) TUI: * directory imports (reading from host filesystem) are shown with the source path βœ… * but directory exports (writing from host filesystem) don't 😒 Example: ![image](https://user-images.githubusercontent.com/29565/236122949-033beb18-59aa-4d59-8724-311411c64bb2.png) ## Solution Change how directory exports are displayed in the TUI, so that the target path is visible.
https://github.com/dagger/dagger/issues/5084
https://github.com/dagger/dagger/pull/5632
ece3f3691ac5d241a2e8d3bf047c2ea8cf952547
badf974d4e5d4592602c4ed876a0da50c9d74e5c
2023-05-04T05:59:34Z
go
2023-08-15T16:22:20Z
core/directory.go
LLB *pb.Definition `json:"llb"` Dir string `json:"dir"` Platform specs.Platform `json:"platform"` Pipeline pipeline.Path `json:"pipeline"` Services ServiceBindings `json:"services,omitempty"` } func NewDirectory(ctx context.Context, def *pb.Definition, dir string, pipeline pipeline.Path, platform specs.Platform, services ServiceBindings) *Directory { return &Directory{ LLB: def, Dir: dir, Platform: platform, Pipeline: pipeline.Copy(), Services: services, } } func NewScratchDirectory(pipeline pipeline.Path, platform specs.Platform) *Directory { return &Directory{ Dir: "/", Platform: platform, Pipeline: pipeline.Copy(), } } func NewDirectorySt(ctx context.Context, st llb.State, dir string, pipeline pipeline.Path, platform specs.Platform, services ServiceBindings) (*Directory, error) { def, err := st.Marshal(ctx, llb.Platform(platform)) if err != nil { return nil, err
closed
dagger/dagger
https://github.com/dagger/dagger
5,084
TUI: show directory export target
## Problem In the new (and awesome) TUI: * directory imports (reading from host filesystem) are shown with the source path βœ… * but directory exports (writing from host filesystem) don't 😒 Example: ![image](https://user-images.githubusercontent.com/29565/236122949-033beb18-59aa-4d59-8724-311411c64bb2.png) ## Solution Change how directory exports are displayed in the TUI, so that the target path is visible.
https://github.com/dagger/dagger/issues/5084
https://github.com/dagger/dagger/pull/5632
ece3f3691ac5d241a2e8d3bf047c2ea8cf952547
badf974d4e5d4592602c4ed876a0da50c9d74e5c
2023-05-04T05:59:34Z
go
2023-08-15T16:22:20Z
core/directory.go
} return NewDirectory(ctx, def.ToPB(), dir, pipeline, platform, services), nil } func (dir *Directory) Clone() *Directory { cp := *dir cp.Pipeline = cloneSlice(cp.Pipeline) cp.Services = cloneMap(cp.Services) return &cp } type DirectoryID string func (id DirectoryID) String() string { return string(id) } var _ Digestible = DirectoryID("") func (id DirectoryID) Digest() (digest.Digest, error) { dir, err := id.ToDirectory() if err != nil { return "", err } return dir.Digest() } func (id DirectoryID) ToDirectory() (*Directory, error) { var dir Directory if id == "" { return &dir, nil } if err := resourceid.Decode(&dir, id); err != nil { return nil, err } return &dir, nil
closed
dagger/dagger
https://github.com/dagger/dagger
5,084
TUI: show directory export target
## Problem In the new (and awesome) TUI: * directory imports (reading from host filesystem) are shown with the source path βœ… * but directory exports (writing from host filesystem) don't 😒 Example: ![image](https://user-images.githubusercontent.com/29565/236122949-033beb18-59aa-4d59-8724-311411c64bb2.png) ## Solution Change how directory exports are displayed in the TUI, so that the target path is visible.
https://github.com/dagger/dagger/issues/5084
https://github.com/dagger/dagger/pull/5632
ece3f3691ac5d241a2e8d3bf047c2ea8cf952547
badf974d4e5d4592602c4ed876a0da50c9d74e5c
2023-05-04T05:59:34Z
go
2023-08-15T16:22:20Z
core/directory.go
} func (dir *Directory) ID() (DirectoryID, error) { return resourceid.Encode[DirectoryID](dir) } var _ pipeline.Pipelineable = (*Directory)(nil) func (dir *Directory) PipelinePath() pipeline.Path { return dir.Pipeline } var _ Digestible = (*Directory)(nil) func (dir *Directory) Digest() (digest.Digest, error) { return stableDigest(dir) } func (dir *Directory) State() (llb.State, error) { if dir.LLB == nil { return llb.Scratch(), nil } return defToState(dir.LLB) } func (dir *Directory) StateWithSourcePath() (llb.State, error) { dirSt, err := dir.State() if err != nil { return llb.State{}, err } if dir.Dir == "/" { return dirSt, nil } return llb.Scratch().File( llb.Copy(dirSt, dir.Dir, ".", &llb.CopyInfo{ CopyDirContentsOnly: true,
closed
dagger/dagger
https://github.com/dagger/dagger
5,084
TUI: show directory export target
## Problem In the new (and awesome) TUI: * directory imports (reading from host filesystem) are shown with the source path βœ… * but directory exports (writing from host filesystem) don't 😒 Example: ![image](https://user-images.githubusercontent.com/29565/236122949-033beb18-59aa-4d59-8724-311411c64bb2.png) ## Solution Change how directory exports are displayed in the TUI, so that the target path is visible.
https://github.com/dagger/dagger/issues/5084
https://github.com/dagger/dagger/pull/5632
ece3f3691ac5d241a2e8d3bf047c2ea8cf952547
badf974d4e5d4592602c4ed876a0da50c9d74e5c
2023-05-04T05:59:34Z
go
2023-08-15T16:22:20Z
core/directory.go
}), ), nil } func (dir *Directory) SetState(ctx context.Context, st llb.State) error { def, err := st.Marshal(ctx, llb.Platform(dir.Platform)) if err != nil { return nil } dir.LLB = def.ToPB() return nil } func (dir *Directory) WithPipeline(ctx context.Context, name, description string, labels []pipeline.Label) (*Directory, error) { dir = dir.Clone() dir.Pipeline = dir.Pipeline.Add(pipeline.Pipeline{ Name: name, Description: description, Labels: labels, }) return dir, nil } func (dir *Directory) Evaluate(ctx context.Context, bk *buildkit.Client) error { if dir.LLB == nil { return nil } _, err := WithServices(ctx, bk, dir.Services, func() (*buildkit.Result, error) { return bk.Solve(ctx, bkgw.SolveRequest{ Evaluate: true, Definition: dir.LLB, }) })
closed
dagger/dagger
https://github.com/dagger/dagger
5,084
TUI: show directory export target
## Problem In the new (and awesome) TUI: * directory imports (reading from host filesystem) are shown with the source path βœ… * but directory exports (writing from host filesystem) don't 😒 Example: ![image](https://user-images.githubusercontent.com/29565/236122949-033beb18-59aa-4d59-8724-311411c64bb2.png) ## Solution Change how directory exports are displayed in the TUI, so that the target path is visible.
https://github.com/dagger/dagger/issues/5084
https://github.com/dagger/dagger/pull/5632
ece3f3691ac5d241a2e8d3bf047c2ea8cf952547
badf974d4e5d4592602c4ed876a0da50c9d74e5c
2023-05-04T05:59:34Z
go
2023-08-15T16:22:20Z
core/directory.go
return err } func (dir *Directory) Stat(ctx context.Context, bk *buildkit.Client, src string) (*fstypes.Stat, error) { src = path.Join(dir.Dir, src) return WithServices(ctx, bk, dir.Services, func() (*fstypes.Stat, error) { res, err := bk.Solve(ctx, bkgw.SolveRequest{ Definition: dir.LLB, }) if err != nil { return nil, err } ref, err := res.SingleRef() if err != nil { return nil, err } if ref == nil { if clean := path.Clean(src); clean == "." || clean == "/" { return &fstypes.Stat{ Path: src, Mode: uint32(fs.ModeDir), }, nil } return nil, fmt.Errorf("%s: no such file or directory", src) } return ref.StatFile(ctx, bkgw.StatRequest{ Path: src, }) })
closed
dagger/dagger
https://github.com/dagger/dagger
5,084
TUI: show directory export target
## Problem In the new (and awesome) TUI: * directory imports (reading from host filesystem) are shown with the source path βœ… * but directory exports (writing from host filesystem) don't 😒 Example: ![image](https://user-images.githubusercontent.com/29565/236122949-033beb18-59aa-4d59-8724-311411c64bb2.png) ## Solution Change how directory exports are displayed in the TUI, so that the target path is visible.
https://github.com/dagger/dagger/issues/5084
https://github.com/dagger/dagger/pull/5632
ece3f3691ac5d241a2e8d3bf047c2ea8cf952547
badf974d4e5d4592602c4ed876a0da50c9d74e5c
2023-05-04T05:59:34Z
go
2023-08-15T16:22:20Z
core/directory.go
} func (dir *Directory) Entries(ctx context.Context, bk *buildkit.Client, src string) ([]string, error) { src = path.Join(dir.Dir, src) return WithServices(ctx, bk, dir.Services, func() ([]string, error) { res, err := bk.Solve(ctx, bkgw.SolveRequest{ Definition: dir.LLB, }) if err != nil { return nil, err } ref, err := res.SingleRef() if err != nil { return nil, err } if ref == nil { if clean := path.Clean(src); clean == "." || clean == "/" { return []string{}, nil } return nil, fmt.Errorf("%s: no such file or directory", src) } entries, err := ref.ReadDir(ctx, bkgw.ReadDirRequest{ Path: src, }) if err != nil { return nil, err } paths := []string{} for _, entry := range entries { paths = append(paths, entry.GetPath())
closed
dagger/dagger
https://github.com/dagger/dagger
5,084
TUI: show directory export target
## Problem In the new (and awesome) TUI: * directory imports (reading from host filesystem) are shown with the source path βœ… * but directory exports (writing from host filesystem) don't 😒 Example: ![image](https://user-images.githubusercontent.com/29565/236122949-033beb18-59aa-4d59-8724-311411c64bb2.png) ## Solution Change how directory exports are displayed in the TUI, so that the target path is visible.
https://github.com/dagger/dagger/issues/5084
https://github.com/dagger/dagger/pull/5632
ece3f3691ac5d241a2e8d3bf047c2ea8cf952547
badf974d4e5d4592602c4ed876a0da50c9d74e5c
2023-05-04T05:59:34Z
go
2023-08-15T16:22:20Z
core/directory.go
} return paths, nil }) } func (dir *Directory) WithNewFile(ctx context.Context, dest string, content []byte, permissions fs.FileMode, ownership *Ownership) (*Directory, error) { dir = dir.Clone() err := validateFileName(dest) if err != nil { return nil, err } if permissions == 0 { permissions = 0o644 } dest = path.Join(dir.Dir, dest) st, err := dir.State() if err != nil { return nil, err } parent, _ := path.Split(dest) if parent != "" { st = st.File(llb.Mkdir(parent, 0755, llb.WithParents(true))) } opts := []llb.MkfileOption{} if ownership != nil { opts = append(opts, ownership.Opt()) } st = st.File(llb.Mkfile(dest, permissions, content, opts...)) err = dir.SetState(ctx, st) if err != nil {
closed
dagger/dagger
https://github.com/dagger/dagger
5,084
TUI: show directory export target
## Problem In the new (and awesome) TUI: * directory imports (reading from host filesystem) are shown with the source path βœ… * but directory exports (writing from host filesystem) don't 😒 Example: ![image](https://user-images.githubusercontent.com/29565/236122949-033beb18-59aa-4d59-8724-311411c64bb2.png) ## Solution Change how directory exports are displayed in the TUI, so that the target path is visible.
https://github.com/dagger/dagger/issues/5084
https://github.com/dagger/dagger/pull/5632
ece3f3691ac5d241a2e8d3bf047c2ea8cf952547
badf974d4e5d4592602c4ed876a0da50c9d74e5c
2023-05-04T05:59:34Z
go
2023-08-15T16:22:20Z
core/directory.go
return nil, err } return dir, nil } func (dir *Directory) Directory(ctx context.Context, bk *buildkit.Client, subdir string) (*Directory, error) { dir = dir.Clone() dir.Dir = path.Join(dir.Dir, subdir) info, err := dir.Stat(ctx, bk, ".") if err != nil { return nil, err } if !info.IsDir() { return nil, fmt.Errorf("path %s is a file, not a directory", subdir) } return dir, nil } func (dir *Directory) File(ctx context.Context, bk *buildkit.Client, file string) (*File, error) { err := validateFileName(file) if err != nil { return nil, err } info, err := dir.Stat(ctx, bk, file) if err != nil { return nil, err } if info.IsDir() {
closed
dagger/dagger
https://github.com/dagger/dagger
5,084
TUI: show directory export target
## Problem In the new (and awesome) TUI: * directory imports (reading from host filesystem) are shown with the source path βœ… * but directory exports (writing from host filesystem) don't 😒 Example: ![image](https://user-images.githubusercontent.com/29565/236122949-033beb18-59aa-4d59-8724-311411c64bb2.png) ## Solution Change how directory exports are displayed in the TUI, so that the target path is visible.
https://github.com/dagger/dagger/issues/5084
https://github.com/dagger/dagger/pull/5632
ece3f3691ac5d241a2e8d3bf047c2ea8cf952547
badf974d4e5d4592602c4ed876a0da50c9d74e5c
2023-05-04T05:59:34Z
go
2023-08-15T16:22:20Z
core/directory.go
return nil, fmt.Errorf("path %s is a directory, not a file", file) } return &File{ LLB: dir.LLB, File: path.Join(dir.Dir, file), Pipeline: dir.Pipeline, Platform: dir.Platform, Services: dir.Services, }, nil } func (dir *Directory) WithDirectory(ctx context.Context, destDir string, src *Directory, filter CopyFilter, owner *Ownership) (*Directory, error) { dir = dir.Clone() destSt, err := dir.State() if err != nil { return nil, err } srcSt, err := src.State() if err != nil { return nil, err } if err := dir.SetState(ctx, mergeStates(mergeStateInput{ Dest: destSt, DestDir: path.Join(dir.Dir, destDir), Src: srcSt, SrcDir: src.Dir, IncludePatterns: filter.Include, ExcludePatterns: filter.Exclude, Owner: owner, })); err != nil { return nil, err
closed
dagger/dagger
https://github.com/dagger/dagger
5,084
TUI: show directory export target
## Problem In the new (and awesome) TUI: * directory imports (reading from host filesystem) are shown with the source path βœ… * but directory exports (writing from host filesystem) don't 😒 Example: ![image](https://user-images.githubusercontent.com/29565/236122949-033beb18-59aa-4d59-8724-311411c64bb2.png) ## Solution Change how directory exports are displayed in the TUI, so that the target path is visible.
https://github.com/dagger/dagger/issues/5084
https://github.com/dagger/dagger/pull/5632
ece3f3691ac5d241a2e8d3bf047c2ea8cf952547
badf974d4e5d4592602c4ed876a0da50c9d74e5c
2023-05-04T05:59:34Z
go
2023-08-15T16:22:20Z
core/directory.go
} dir.Services.Merge(src.Services) return dir, nil } func (dir *Directory) WithFile(ctx context.Context, destPath string, src *File, permissions fs.FileMode, owner *Ownership) (*Directory, error) { dir = dir.Clone() destSt, err := dir.State() if err != nil { return nil, err } srcSt, err := src.State() if err != nil { return nil, err } if err := dir.SetState(ctx, mergeStates(mergeStateInput{ Dest: destSt, DestDir: path.Join(dir.Dir, path.Dir(destPath)), DestFileName: path.Base(destPath), Src: srcSt, SrcDir: path.Dir(src.File), SrcFileName: path.Base(src.File), Permissions: permissions, Owner: owner, })); err != nil { return nil, err } dir.Services.Merge(src.Services) return dir, nil } type mergeStateInput struct {
closed
dagger/dagger
https://github.com/dagger/dagger
5,084
TUI: show directory export target
## Problem In the new (and awesome) TUI: * directory imports (reading from host filesystem) are shown with the source path βœ… * but directory exports (writing from host filesystem) don't 😒 Example: ![image](https://user-images.githubusercontent.com/29565/236122949-033beb18-59aa-4d59-8724-311411c64bb2.png) ## Solution Change how directory exports are displayed in the TUI, so that the target path is visible.
https://github.com/dagger/dagger/issues/5084
https://github.com/dagger/dagger/pull/5632
ece3f3691ac5d241a2e8d3bf047c2ea8cf952547
badf974d4e5d4592602c4ed876a0da50c9d74e5c
2023-05-04T05:59:34Z
go
2023-08-15T16:22:20Z
core/directory.go
Dest llb.State DestDir string DestFileName string Src llb.State SrcDir string SrcFileName string IncludePatterns []string ExcludePatterns []string Permissions fs.FileMode Owner *Ownership } func mergeStates(input mergeStateInput) llb.State { input.DestDir = path.Join("/", input.DestDir) input.SrcDir = path.Join("/", input.SrcDir) copyInfo := &llb.CopyInfo{ CreateDestPath: true, CopyDirContentsOnly: true, IncludePatterns: input.IncludePatterns, ExcludePatterns: input.ExcludePatterns, } if input.DestFileName == "" && input.SrcFileName != "" { input.DestFileName = input.SrcFileName } if input.Permissions != 0 { copyInfo.Mode = &input.Permissions } if input.Owner != nil { input.Owner.Opt().SetCopyOption(copyInfo)
closed
dagger/dagger
https://github.com/dagger/dagger
5,084
TUI: show directory export target
## Problem In the new (and awesome) TUI: * directory imports (reading from host filesystem) are shown with the source path βœ… * but directory exports (writing from host filesystem) don't 😒 Example: ![image](https://user-images.githubusercontent.com/29565/236122949-033beb18-59aa-4d59-8724-311411c64bb2.png) ## Solution Change how directory exports are displayed in the TUI, so that the target path is visible.
https://github.com/dagger/dagger/issues/5084
https://github.com/dagger/dagger/pull/5632
ece3f3691ac5d241a2e8d3bf047c2ea8cf952547
badf974d4e5d4592602c4ed876a0da50c9d74e5c
2023-05-04T05:59:34Z
go
2023-08-15T16:22:20Z
core/directory.go
} canDoDirectMerge := copyInfo.Mode == nil && copyInfo.ChownOpt == nil && len(copyInfo.ExcludePatterns) == 0 && len(copyInfo.IncludePatterns) == 0 && input.DestDir == "/" && input.SrcDir == "/" && input.DestFileName == "" && input.SrcFileName == "" mergeStates := []llb.State{input.Dest} if canDoDirectMerge { mergeStates = append(mergeStates, input.Src) } else { mergeStates = append(mergeStates, llb.Scratch().File(llb.Copy( input.Src, path.Join(input.SrcDir, input.SrcFileName), path.Join(input.DestDir, input.DestFileName), copyInfo, ))) } return llb.Merge(mergeStates, llb.WithCustomName(buildkit.InternalPrefix+"merge"))
closed
dagger/dagger
https://github.com/dagger/dagger
5,084
TUI: show directory export target
## Problem In the new (and awesome) TUI: * directory imports (reading from host filesystem) are shown with the source path βœ… * but directory exports (writing from host filesystem) don't 😒 Example: ![image](https://user-images.githubusercontent.com/29565/236122949-033beb18-59aa-4d59-8724-311411c64bb2.png) ## Solution Change how directory exports are displayed in the TUI, so that the target path is visible.
https://github.com/dagger/dagger/issues/5084
https://github.com/dagger/dagger/pull/5632
ece3f3691ac5d241a2e8d3bf047c2ea8cf952547
badf974d4e5d4592602c4ed876a0da50c9d74e5c
2023-05-04T05:59:34Z
go
2023-08-15T16:22:20Z
core/directory.go
} func (dir *Directory) WithTimestamps(ctx context.Context, unix int) (*Directory, error) { dir = dir.Clone() st, err := dir.State() if err != nil { return nil, err } t := time.Unix(int64(unix), 0) st = llb.Scratch().File( llb.Copy(st, dir.Dir, ".", &llb.CopyInfo{ CopyDirContentsOnly: true, CreatedTime: &t, }), ) err = dir.SetState(ctx, st) if err != nil { return nil, err } dir.Dir = "" return dir, nil } func (dir *Directory) WithNewDirectory(ctx context.Context, dest string, permissions fs.FileMode) (*Directory, error) { dir = dir.Clone() dest = path.Clean(dest) if strings.HasPrefix(dest, "../") { return nil, fmt.Errorf("cannot create directory outside parent: %s", dest) } dest = path.Join(dir.Dir, dest) st, err := dir.State()
closed
dagger/dagger
https://github.com/dagger/dagger
5,084
TUI: show directory export target
## Problem In the new (and awesome) TUI: * directory imports (reading from host filesystem) are shown with the source path βœ… * but directory exports (writing from host filesystem) don't 😒 Example: ![image](https://user-images.githubusercontent.com/29565/236122949-033beb18-59aa-4d59-8724-311411c64bb2.png) ## Solution Change how directory exports are displayed in the TUI, so that the target path is visible.
https://github.com/dagger/dagger/issues/5084
https://github.com/dagger/dagger/pull/5632
ece3f3691ac5d241a2e8d3bf047c2ea8cf952547
badf974d4e5d4592602c4ed876a0da50c9d74e5c
2023-05-04T05:59:34Z
go
2023-08-15T16:22:20Z
core/directory.go
if err != nil { return nil, err } if permissions == 0 { permissions = 0755 } st = st.File(llb.Mkdir(dest, permissions, llb.WithParents(true))) err = dir.SetState(ctx, st) if err != nil { return nil, err } return dir, nil } func (dir *Directory) Diff(ctx context.Context, other *Directory) (*Directory, error) { dir = dir.Clone() if dir.Dir != other.Dir { return nil, fmt.Errorf("TODO: cannot diff with different relative paths: %q != %q", dir.Dir, other.Dir) } if !reflect.DeepEqual(dir.Platform, other.Platform) { return nil, fmt.Errorf("TODO: cannot diff across platforms: %+v != %+v", dir.Platform, other.Platform) } lowerSt, err := dir.State() if err != nil { return nil, err } upperSt, err := other.State() if err != nil { return nil, err
closed
dagger/dagger
https://github.com/dagger/dagger
5,084
TUI: show directory export target
## Problem In the new (and awesome) TUI: * directory imports (reading from host filesystem) are shown with the source path βœ… * but directory exports (writing from host filesystem) don't 😒 Example: ![image](https://user-images.githubusercontent.com/29565/236122949-033beb18-59aa-4d59-8724-311411c64bb2.png) ## Solution Change how directory exports are displayed in the TUI, so that the target path is visible.
https://github.com/dagger/dagger/issues/5084
https://github.com/dagger/dagger/pull/5632
ece3f3691ac5d241a2e8d3bf047c2ea8cf952547
badf974d4e5d4592602c4ed876a0da50c9d74e5c
2023-05-04T05:59:34Z
go
2023-08-15T16:22:20Z
core/directory.go
} err = dir.SetState(ctx, llb.Diff(lowerSt, upperSt)) if err != nil { return nil, err } return dir, nil } func (dir *Directory) Without(ctx context.Context, path string) (*Directory, error) { dir = dir.Clone() st, err := dir.State() if err != nil { return nil, err } err = dir.SetState(ctx, st.File(llb.Rm(path, llb.WithAllowWildcard(true)))) if err != nil { return nil, err } return dir, nil } func (dir *Directory) Export( ctx context.Context, bk *buildkit.Client, host *Host, destPath string, ) (rerr error) { var defPB *pb.Definition if dir.Dir != "" { src, err := dir.State() if err != nil { return err
closed
dagger/dagger
https://github.com/dagger/dagger
5,084
TUI: show directory export target
## Problem In the new (and awesome) TUI: * directory imports (reading from host filesystem) are shown with the source path βœ… * but directory exports (writing from host filesystem) don't 😒 Example: ![image](https://user-images.githubusercontent.com/29565/236122949-033beb18-59aa-4d59-8724-311411c64bb2.png) ## Solution Change how directory exports are displayed in the TUI, so that the target path is visible.
https://github.com/dagger/dagger/issues/5084
https://github.com/dagger/dagger/pull/5632
ece3f3691ac5d241a2e8d3bf047c2ea8cf952547
badf974d4e5d4592602c4ed876a0da50c9d74e5c
2023-05-04T05:59:34Z
go
2023-08-15T16:22:20Z
core/directory.go
} src = llb.Scratch().File(llb.Copy(src, dir.Dir, ".", &llb.CopyInfo{ CopyDirContentsOnly: true, })) def, err := src.Marshal(ctx, llb.Platform(dir.Platform)) if err != nil { return err } defPB = def.ToPB() } else { defPB = dir.LLB } _, err := WithServices(ctx, bk, dir.Services, func() (any, error) { return nil, bk.LocalDirExport(ctx, defPB, destPath) }) return err } func (dir *Directory) Root() (*Directory, error) { dir = dir.Clone() dir.Dir = "/" return dir, nil } func validateFileName(file string) error { baseFileName := filepath.Base(file) if len(baseFileName) > 255 { return errors.Errorf("File name length exceeds the maximum supported 255 characters") } return nil }
closed
dagger/dagger
https://github.com/dagger/dagger
5,084
TUI: show directory export target
## Problem In the new (and awesome) TUI: * directory imports (reading from host filesystem) are shown with the source path βœ… * but directory exports (writing from host filesystem) don't 😒 Example: ![image](https://user-images.githubusercontent.com/29565/236122949-033beb18-59aa-4d59-8724-311411c64bb2.png) ## Solution Change how directory exports are displayed in the TUI, so that the target path is visible.
https://github.com/dagger/dagger/issues/5084
https://github.com/dagger/dagger/pull/5632
ece3f3691ac5d241a2e8d3bf047c2ea8cf952547
badf974d4e5d4592602c4ed876a0da50c9d74e5c
2023-05-04T05:59:34Z
go
2023-08-15T16:22:20Z
core/file.go
package core import ( "context" "fmt" "io" "path" "time" "github.com/dagger/dagger/core/pipeline" "github.com/dagger/dagger/core/reffs" "github.com/dagger/dagger/core/resourceid" "github.com/dagger/dagger/engine/buildkit" "github.com/moby/buildkit/client/llb" bkgw "github.com/moby/buildkit/frontend/gateway/client" "github.com/moby/buildkit/solver/pb" "github.com/opencontainers/go-digest" specs "github.com/opencontainers/image-spec/specs-go/v1" fstypes "github.com/tonistiigi/fsutil/types" ) type File struct { LLB *pb.Definition `json:"llb"` File string `json:"file"` Pipeline pipeline.Path `json:"pipeline"` Platform specs.Platform `json:"platform"` Services ServiceBindings `json:"services,omitempty"` } func NewFile(ctx context.Context, def *pb.Definition, file string, pipeline pipeline.Path, platform specs.Platform, services ServiceBindings) *File {
closed
dagger/dagger
https://github.com/dagger/dagger
5,084
TUI: show directory export target
## Problem In the new (and awesome) TUI: * directory imports (reading from host filesystem) are shown with the source path βœ… * but directory exports (writing from host filesystem) don't 😒 Example: ![image](https://user-images.githubusercontent.com/29565/236122949-033beb18-59aa-4d59-8724-311411c64bb2.png) ## Solution Change how directory exports are displayed in the TUI, so that the target path is visible.
https://github.com/dagger/dagger/issues/5084
https://github.com/dagger/dagger/pull/5632
ece3f3691ac5d241a2e8d3bf047c2ea8cf952547
badf974d4e5d4592602c4ed876a0da50c9d74e5c
2023-05-04T05:59:34Z
go
2023-08-15T16:22:20Z
core/file.go
return &File{ LLB: def, File: file, Pipeline: pipeline, Platform: platform, Services: services, } } func NewFileSt(ctx context.Context, st llb.State, dir string, pipeline pipeline.Path, platform specs.Platform, services ServiceBindings) (*File, error) { def, err := st.Marshal(ctx, llb.Platform(platform)) if err != nil { return nil, err } return NewFile(ctx, def.ToPB(), dir, pipeline, platform, services), nil } func (file *File) Clone() *File { cp := *file cp.Pipeline = cloneSlice(cp.Pipeline) cp.Services = cloneMap(cp.Services) return &cp } type FileID string func (id FileID) String() string { return string(id) } var _ Digestible = FileID("") func (id FileID) Digest() (digest.Digest, error) { file, err := id.ToFile() if err != nil {
closed
dagger/dagger
https://github.com/dagger/dagger
5,084
TUI: show directory export target
## Problem In the new (and awesome) TUI: * directory imports (reading from host filesystem) are shown with the source path βœ… * but directory exports (writing from host filesystem) don't 😒 Example: ![image](https://user-images.githubusercontent.com/29565/236122949-033beb18-59aa-4d59-8724-311411c64bb2.png) ## Solution Change how directory exports are displayed in the TUI, so that the target path is visible.
https://github.com/dagger/dagger/issues/5084
https://github.com/dagger/dagger/pull/5632
ece3f3691ac5d241a2e8d3bf047c2ea8cf952547
badf974d4e5d4592602c4ed876a0da50c9d74e5c
2023-05-04T05:59:34Z
go
2023-08-15T16:22:20Z
core/file.go
return "", err } return file.Digest() } func (id FileID) ToFile() (*File, error) { var file File if err := resourceid.Decode(&file, id); err != nil { return nil, err } return &file, nil } func (file *File) ID() (FileID, error) { return resourceid.Encode[FileID](file) } var _ pipeline.Pipelineable = (*File)(nil) func (file *File) PipelinePath() pipeline.Path { return file.Pipeline } var _ Digestible = (*File)(nil) func (file *File) Digest() (digest.Digest, error) { return stableDigest(file) } func (file *File) State() (llb.State, error) { return defToState(file.LLB) } func (file *File) Evaluate(ctx context.Context, bk *buildkit.Client) error { _, err := WithServices(ctx, bk, file.Services, func() (*buildkit.Result, error) { return bk.Solve(ctx, bkgw.SolveRequest{ Evaluate: true,
closed
dagger/dagger
https://github.com/dagger/dagger
5,084
TUI: show directory export target
## Problem In the new (and awesome) TUI: * directory imports (reading from host filesystem) are shown with the source path βœ… * but directory exports (writing from host filesystem) don't 😒 Example: ![image](https://user-images.githubusercontent.com/29565/236122949-033beb18-59aa-4d59-8724-311411c64bb2.png) ## Solution Change how directory exports are displayed in the TUI, so that the target path is visible.
https://github.com/dagger/dagger/issues/5084
https://github.com/dagger/dagger/pull/5632
ece3f3691ac5d241a2e8d3bf047c2ea8cf952547
badf974d4e5d4592602c4ed876a0da50c9d74e5c
2023-05-04T05:59:34Z
go
2023-08-15T16:22:20Z
core/file.go
Definition: file.LLB, }) }) return err } func (file *File) Contents(ctx context.Context, bk *buildkit.Client) ([]byte, error) { return WithServices(ctx, bk, file.Services, func() ([]byte, error) { ref, err := bkRef(ctx, bk, file.LLB) if err != nil { return nil, err } st, err := file.Stat(ctx, bk) if err != nil { return nil, err } fileSize := int(st.GetSize_()) if fileSize > buildkit.MaxFileContentsSize { return nil, fmt.Errorf("file size %d exceeds limit %d", fileSize, buildkit.MaxFileContentsSize) } contents := make([]byte, fileSize) var offset int for offset < fileSize { chunk, err := ref.ReadFile(ctx, bkgw.ReadRequest{ Filename: file.File,
closed
dagger/dagger
https://github.com/dagger/dagger
5,084
TUI: show directory export target
## Problem In the new (and awesome) TUI: * directory imports (reading from host filesystem) are shown with the source path βœ… * but directory exports (writing from host filesystem) don't 😒 Example: ![image](https://user-images.githubusercontent.com/29565/236122949-033beb18-59aa-4d59-8724-311411c64bb2.png) ## Solution Change how directory exports are displayed in the TUI, so that the target path is visible.
https://github.com/dagger/dagger/issues/5084
https://github.com/dagger/dagger/pull/5632
ece3f3691ac5d241a2e8d3bf047c2ea8cf952547
badf974d4e5d4592602c4ed876a0da50c9d74e5c
2023-05-04T05:59:34Z
go
2023-08-15T16:22:20Z
core/file.go
Range: &bkgw.FileRange{ Offset: offset, Length: buildkit.MaxFileContentsChunkSize, }, }) if err != nil { return nil, err } copy(contents[offset:], chunk) offset += len(chunk) } return contents, nil }) } func (file *File) Stat(ctx context.Context, bk *buildkit.Client) (*fstypes.Stat, error) { return WithServices(ctx, bk, file.Services, func() (*fstypes.Stat, error) { ref, err := bkRef(ctx, bk, file.LLB) if err != nil { return nil, err } return ref.StatFile(ctx, bkgw.StatRequest{ Path: file.File, }) }) } func (file *File) WithTimestamps(ctx context.Context, unix int) (*File, error) { file = file.Clone() st, err := file.State() if err != nil {
closed
dagger/dagger
https://github.com/dagger/dagger
5,084
TUI: show directory export target
## Problem In the new (and awesome) TUI: * directory imports (reading from host filesystem) are shown with the source path βœ… * but directory exports (writing from host filesystem) don't 😒 Example: ![image](https://user-images.githubusercontent.com/29565/236122949-033beb18-59aa-4d59-8724-311411c64bb2.png) ## Solution Change how directory exports are displayed in the TUI, so that the target path is visible.
https://github.com/dagger/dagger/issues/5084
https://github.com/dagger/dagger/pull/5632
ece3f3691ac5d241a2e8d3bf047c2ea8cf952547
badf974d4e5d4592602c4ed876a0da50c9d74e5c
2023-05-04T05:59:34Z
go
2023-08-15T16:22:20Z
core/file.go
return nil, err } t := time.Unix(int64(unix), 0) stamped := llb.Scratch().File(llb.Copy(st, file.File, ".", llb.WithCreatedTime(t))) def, err := stamped.Marshal(ctx, llb.Platform(file.Platform)) if err != nil { return nil, err } file.LLB = def.ToPB() file.File = path.Base(file.File) return file, nil } func (file *File) Open(ctx context.Context, host *Host, bk *buildkit.Client) (io.ReadCloser, error) { return WithServices(ctx, bk, file.Services, func() (io.ReadCloser, error) { fs, err := reffs.OpenDef(ctx, bk, file.LLB) if err != nil { return nil, err } return fs.Open(file.File) }) } func (file *File) Export( ctx context.Context, bk *buildkit.Client, host *Host, dest string, allowParentDirPath bool, ) error { src, err := file.State() if err != nil {
closed
dagger/dagger
https://github.com/dagger/dagger
5,084
TUI: show directory export target
## Problem In the new (and awesome) TUI: * directory imports (reading from host filesystem) are shown with the source path βœ… * but directory exports (writing from host filesystem) don't 😒 Example: ![image](https://user-images.githubusercontent.com/29565/236122949-033beb18-59aa-4d59-8724-311411c64bb2.png) ## Solution Change how directory exports are displayed in the TUI, so that the target path is visible.
https://github.com/dagger/dagger/issues/5084
https://github.com/dagger/dagger/pull/5632
ece3f3691ac5d241a2e8d3bf047c2ea8cf952547
badf974d4e5d4592602c4ed876a0da50c9d74e5c
2023-05-04T05:59:34Z
go
2023-08-15T16:22:20Z
core/file.go
return err } def, err := src.Marshal(ctx, llb.Platform(file.Platform)) if err != nil { return err } _, err = WithServices(ctx, bk, file.Services, func() (any, error) { err = bk.LocalFileExport(ctx, def.ToPB(), dest, file.File, allowParentDirPath) return nil, err }) return err } func bkRef(ctx context.Context, bk *buildkit.Client, def *pb.Definition) (bkgw.Reference, error) { res, err := bk.Solve(ctx, bkgw.SolveRequest{ Definition: def, }) if err != nil { return nil, err } ref, err := res.SingleRef() if err != nil { return nil, err } if ref == nil { return nil, fmt.Errorf("empty reference") } return ref, nil }
closed
dagger/dagger
https://github.com/dagger/dagger
5,638
🐞 Node SDK string value conflict with enum
### What is the issue? If a string has the same value as a Dagger enum, this will be converted to an enumeration by our query builder. This bug is introduced by #5594 and can be fix using a new internal metadata field see https://github.com/dagger/dagger/issues/5609#issuecomment-1679275740 Unfortunately, the usage of a query builder library cannot fix the issue since our client actually build a query tree composed of primitive types that are converted to an actual gql query during the execution. ```ts it("Check conflict with enum", async function () { this.timeout(60000) await connect(async (client) => { const env = await client .container() .from("alpine:3.16.2") .withEnvVariable("FOO", "TCP") .envVariable("FOO") assert.strictEqual(env, "TCP") }) }) ``` ### Log output ``` 1) NodeJS SDK api Check conflict with enum: GraphQLRequestError: Argument "value" has invalid value TCP. Expected type "String", found TCP. at file:///Users/tomchauveau/Documents/DAGGER/dagger/sdk/nodejs/api/utils.ts:163:23 at Generator.throw (<anonymous>) at rejected (file:///Users/tomchauveau/Documents/DAGGER/dagger/sdk/nodejs/api/utils.ts:5:65) at process.processTicksAndRejections (node:internal/process/task_queues:95:5) ``` ### Steps to reproduce _No response_ ### SDK version Node SDK 0.8.2 ### OS version All OS
https://github.com/dagger/dagger/issues/5638
https://github.com/dagger/dagger/pull/5645
f3dc810f2e730c982bf1cb7192c4d9b56c944199
ffef493a58cf617cba6eea6e7f60f27ceb9e1783
2023-08-15T21:09:35Z
go
2023-08-16T17:57:01Z
codegen/generator/nodejs/templates/functions.go
package templates import ( "regexp" "sort" "strings" "text/template" "github.com/iancoleman/strcase" "github.com/dagger/dagger/codegen/generator" "github.com/dagger/dagger/codegen/introspection" ) var ( commonFunc = generator.NewCommonFunctions(&FormatTypeFunc{}) funcMap = template.FuncMap{
closed
dagger/dagger
https://github.com/dagger/dagger
5,638
🐞 Node SDK string value conflict with enum
### What is the issue? If a string has the same value as a Dagger enum, this will be converted to an enumeration by our query builder. This bug is introduced by #5594 and can be fix using a new internal metadata field see https://github.com/dagger/dagger/issues/5609#issuecomment-1679275740 Unfortunately, the usage of a query builder library cannot fix the issue since our client actually build a query tree composed of primitive types that are converted to an actual gql query during the execution. ```ts it("Check conflict with enum", async function () { this.timeout(60000) await connect(async (client) => { const env = await client .container() .from("alpine:3.16.2") .withEnvVariable("FOO", "TCP") .envVariable("FOO") assert.strictEqual(env, "TCP") }) }) ``` ### Log output ``` 1) NodeJS SDK api Check conflict with enum: GraphQLRequestError: Argument "value" has invalid value TCP. Expected type "String", found TCP. at file:///Users/tomchauveau/Documents/DAGGER/dagger/sdk/nodejs/api/utils.ts:163:23 at Generator.throw (<anonymous>) at rejected (file:///Users/tomchauveau/Documents/DAGGER/dagger/sdk/nodejs/api/utils.ts:5:65) at process.processTicksAndRejections (node:internal/process/task_queues:95:5) ``` ### Steps to reproduce _No response_ ### SDK version Node SDK 0.8.2 ### OS version All OS
https://github.com/dagger/dagger/issues/5638
https://github.com/dagger/dagger/pull/5645
f3dc810f2e730c982bf1cb7192c4d9b56c944199
ffef493a58cf617cba6eea6e7f60f27ceb9e1783
2023-08-15T21:09:35Z
go
2023-08-16T17:57:01Z
codegen/generator/nodejs/templates/functions.go
"CommentToLines": commentToLines, "FormatDeprecation": formatDeprecation, "FormatReturnType": commonFunc.FormatReturnType, "FormatInputType": commonFunc.FormatInputType, "FormatOutputType": commonFunc.FormatOutputType, "FormatEnum": formatEnum, "FormatName": formatName, "GetOptionalArgs": getOptionalArgs, "GetRequiredArgs": getRequiredArgs, "HasPrefix": strings.HasPrefix, "PascalCase": pascalCase, "IsArgOptional": isArgOptional, "IsCustomScalar": isCustomScalar, "IsEnum": isEnum, "ArgsHaveDescription": argsHaveDescription, "SortInputFields": sortInputFields, "SortEnumFields": sortEnumFields, "Solve": solve, "Subtract": subtract, "ConvertID": commonFunc.ConvertID, "IsSelfChainable": commonFunc.IsSelfChainable, "IsListOfObject": commonFunc.IsListOfObject, "GetArrayField": commonFunc.GetArrayField, "ToLowerCase": commonFunc.ToLowerCase, "ToUpperCase": commonFunc.ToUpperCase, "ToSingleType": toSingleType, "ListOfEnum": listOfEnum, } ) func listOfEnum() string {
closed
dagger/dagger
https://github.com/dagger/dagger
5,638
🐞 Node SDK string value conflict with enum
### What is the issue? If a string has the same value as a Dagger enum, this will be converted to an enumeration by our query builder. This bug is introduced by #5594 and can be fix using a new internal metadata field see https://github.com/dagger/dagger/issues/5609#issuecomment-1679275740 Unfortunately, the usage of a query builder library cannot fix the issue since our client actually build a query tree composed of primitive types that are converted to an actual gql query during the execution. ```ts it("Check conflict with enum", async function () { this.timeout(60000) await connect(async (client) => { const env = await client .container() .from("alpine:3.16.2") .withEnvVariable("FOO", "TCP") .envVariable("FOO") assert.strictEqual(env, "TCP") }) }) ``` ### Log output ``` 1) NodeJS SDK api Check conflict with enum: GraphQLRequestError: Argument "value" has invalid value TCP. Expected type "String", found TCP. at file:///Users/tomchauveau/Documents/DAGGER/dagger/sdk/nodejs/api/utils.ts:163:23 at Generator.throw (<anonymous>) at rejected (file:///Users/tomchauveau/Documents/DAGGER/dagger/sdk/nodejs/api/utils.ts:5:65) at process.processTicksAndRejections (node:internal/process/task_queues:95:5) ``` ### Steps to reproduce _No response_ ### SDK version Node SDK 0.8.2 ### OS version All OS
https://github.com/dagger/dagger/issues/5638
https://github.com/dagger/dagger/pull/5645
f3dc810f2e730c982bf1cb7192c4d9b56c944199
ffef493a58cf617cba6eea6e7f60f27ceb9e1783
2023-08-15T21:09:35Z
go
2023-08-16T17:57:01Z
codegen/generator/nodejs/templates/functions.go
schema := generator.GetSchema() var result []string for _, t := range schema.Types { if t.Kind == introspection.TypeKindEnum && !strings.HasPrefix(t.Name, "__") { result = append(result, t.Name) } } return strings.Join(result, ", ") } func pascalCase(name string) string { return strcase.ToCamel(name) } func solve(field introspection.Field) bool { if field.TypeRef == nil { return false } return field.TypeRef.IsScalar() || field.TypeRef.IsList() } func subtract(a, b int) int { return a - b } func commentToLines(s string) []string { s = strings.TrimSpace(s) if s == "" { return []string{} } split := strings.Split(s, "\n") return split } func formatDeprecation(s string) []string {
closed
dagger/dagger
https://github.com/dagger/dagger
5,638
🐞 Node SDK string value conflict with enum
### What is the issue? If a string has the same value as a Dagger enum, this will be converted to an enumeration by our query builder. This bug is introduced by #5594 and can be fix using a new internal metadata field see https://github.com/dagger/dagger/issues/5609#issuecomment-1679275740 Unfortunately, the usage of a query builder library cannot fix the issue since our client actually build a query tree composed of primitive types that are converted to an actual gql query during the execution. ```ts it("Check conflict with enum", async function () { this.timeout(60000) await connect(async (client) => { const env = await client .container() .from("alpine:3.16.2") .withEnvVariable("FOO", "TCP") .envVariable("FOO") assert.strictEqual(env, "TCP") }) }) ``` ### Log output ``` 1) NodeJS SDK api Check conflict with enum: GraphQLRequestError: Argument "value" has invalid value TCP. Expected type "String", found TCP. at file:///Users/tomchauveau/Documents/DAGGER/dagger/sdk/nodejs/api/utils.ts:163:23 at Generator.throw (<anonymous>) at rejected (file:///Users/tomchauveau/Documents/DAGGER/dagger/sdk/nodejs/api/utils.ts:5:65) at process.processTicksAndRejections (node:internal/process/task_queues:95:5) ``` ### Steps to reproduce _No response_ ### SDK version Node SDK 0.8.2 ### OS version All OS
https://github.com/dagger/dagger/issues/5638
https://github.com/dagger/dagger/pull/5645
f3dc810f2e730c982bf1cb7192c4d9b56c944199
ffef493a58cf617cba6eea6e7f60f27ceb9e1783
2023-08-15T21:09:35Z
go
2023-08-16T17:57:01Z
codegen/generator/nodejs/templates/functions.go
r := regexp.MustCompile("`[a-zA-Z0-9_]+`") matches := r.FindAllString(s, -1) for _, match := range matches { replacement := strings.TrimPrefix(match, "`") replacement = strings.TrimSuffix(replacement, "`") replacement = formatName(replacement) s = strings.ReplaceAll(s, match, replacement) } return commentToLines("@deprecated " + s) } func isCustomScalar(t *introspection.Type) bool { switch introspection.Scalar(t.Name) { case introspection.ScalarString, introspection.ScalarInt, introspection.ScalarFloat, introspection.ScalarBoolean: return false default: return t.Kind == introspection.TypeKindScalar } } func isEnum(t *introspection.Type) bool { return t.Kind == introspection.TypeKindEnum && !strings.HasPrefix(t.Name, "__") } func formatName(s string) string { if s == generator.QueryStructName { return generator.QueryStructClientName } return s } func formatEnum(s string) string {
closed
dagger/dagger
https://github.com/dagger/dagger
5,638
🐞 Node SDK string value conflict with enum
### What is the issue? If a string has the same value as a Dagger enum, this will be converted to an enumeration by our query builder. This bug is introduced by #5594 and can be fix using a new internal metadata field see https://github.com/dagger/dagger/issues/5609#issuecomment-1679275740 Unfortunately, the usage of a query builder library cannot fix the issue since our client actually build a query tree composed of primitive types that are converted to an actual gql query during the execution. ```ts it("Check conflict with enum", async function () { this.timeout(60000) await connect(async (client) => { const env = await client .container() .from("alpine:3.16.2") .withEnvVariable("FOO", "TCP") .envVariable("FOO") assert.strictEqual(env, "TCP") }) }) ``` ### Log output ``` 1) NodeJS SDK api Check conflict with enum: GraphQLRequestError: Argument "value" has invalid value TCP. Expected type "String", found TCP. at file:///Users/tomchauveau/Documents/DAGGER/dagger/sdk/nodejs/api/utils.ts:163:23 at Generator.throw (<anonymous>) at rejected (file:///Users/tomchauveau/Documents/DAGGER/dagger/sdk/nodejs/api/utils.ts:5:65) at process.processTicksAndRejections (node:internal/process/task_queues:95:5) ``` ### Steps to reproduce _No response_ ### SDK version Node SDK 0.8.2 ### OS version All OS
https://github.com/dagger/dagger/issues/5638
https://github.com/dagger/dagger/pull/5645
f3dc810f2e730c982bf1cb7192c4d9b56c944199
ffef493a58cf617cba6eea6e7f60f27ceb9e1783
2023-08-15T21:09:35Z
go
2023-08-16T17:57:01Z
codegen/generator/nodejs/templates/functions.go
s = strings.ToLower(s) return strcase.ToCamel(s) } func isArgOptional(values introspection.InputValues) bool { for _, v := range values { if v.TypeRef != nil && !v.TypeRef.IsOptional() { return false } } return true } func splitRequiredOptionalArgs(values introspection.InputValues) (required introspection.InputValues, optionals introspection.InputValues) { for i, v := range values { if v.TypeRef != nil && !v.TypeRef.IsOptional() { continue } return values[:i], values[i:] } return values, nil } func getRequiredArgs(values introspection.InputValues) introspection.InputValues { required, _ := splitRequiredOptionalArgs(values) return required } func getOptionalArgs(values introspection.InputValues) introspection.InputValues {
closed
dagger/dagger
https://github.com/dagger/dagger
5,638
🐞 Node SDK string value conflict with enum
### What is the issue? If a string has the same value as a Dagger enum, this will be converted to an enumeration by our query builder. This bug is introduced by #5594 and can be fix using a new internal metadata field see https://github.com/dagger/dagger/issues/5609#issuecomment-1679275740 Unfortunately, the usage of a query builder library cannot fix the issue since our client actually build a query tree composed of primitive types that are converted to an actual gql query during the execution. ```ts it("Check conflict with enum", async function () { this.timeout(60000) await connect(async (client) => { const env = await client .container() .from("alpine:3.16.2") .withEnvVariable("FOO", "TCP") .envVariable("FOO") assert.strictEqual(env, "TCP") }) }) ``` ### Log output ``` 1) NodeJS SDK api Check conflict with enum: GraphQLRequestError: Argument "value" has invalid value TCP. Expected type "String", found TCP. at file:///Users/tomchauveau/Documents/DAGGER/dagger/sdk/nodejs/api/utils.ts:163:23 at Generator.throw (<anonymous>) at rejected (file:///Users/tomchauveau/Documents/DAGGER/dagger/sdk/nodejs/api/utils.ts:5:65) at process.processTicksAndRejections (node:internal/process/task_queues:95:5) ``` ### Steps to reproduce _No response_ ### SDK version Node SDK 0.8.2 ### OS version All OS
https://github.com/dagger/dagger/issues/5638
https://github.com/dagger/dagger/pull/5645
f3dc810f2e730c982bf1cb7192c4d9b56c944199
ffef493a58cf617cba6eea6e7f60f27ceb9e1783
2023-08-15T21:09:35Z
go
2023-08-16T17:57:01Z
codegen/generator/nodejs/templates/functions.go
_, optional := splitRequiredOptionalArgs(values) return optional } func sortInputFields(s []introspection.InputValue) []introspection.InputValue { sort.SliceStable(s, func(i, j int) bool { return s[i].Name < s[j].Name }) return s } func sortEnumFields(s []introspection.EnumValue) []introspection.EnumValue { sort.SliceStable(s, func(i, j int) bool { return s[i].Name < s[j].Name }) return s } func argsHaveDescription(values introspection.InputValues) bool { for _, o := range values { if strings.TrimSpace(o.Description) != "" { return true } } return false } func toSingleType(value string) string { return value[:len(value)-2] }
closed
dagger/dagger
https://github.com/dagger/dagger
3,323
Support configuring additional options for secrets
Buildkit's full `SecretInfo` struct is as follows: ```go type SecretInfo struct { ID string Target string Mode int UID int GID int Optional bool IsEnv bool } ``` We already support `ID`, `Target`, and `IsEnv` but maybe folks will have a use for `Mode`, `UID`, `GUID`, and/or `Optional`.
https://github.com/dagger/dagger/issues/3323
https://github.com/dagger/dagger/pull/5707
e5feaea7f1d6eb01d834e83b180fc3daed3463ea
1ddf4ea46492a1aad850906c0c78c58e43d873c4
2022-10-11T23:15:04Z
go
2023-09-12T06:56:33Z
core/container.go
package core import ( "context" "encoding/json" "fmt" "io/fs" "os"
closed
dagger/dagger
https://github.com/dagger/dagger
3,323
Support configuring additional options for secrets
Buildkit's full `SecretInfo` struct is as follows: ```go type SecretInfo struct { ID string Target string Mode int UID int GID int Optional bool IsEnv bool } ``` We already support `ID`, `Target`, and `IsEnv` but maybe folks will have a use for `Mode`, `UID`, `GUID`, and/or `Optional`.
https://github.com/dagger/dagger/issues/3323
https://github.com/dagger/dagger/pull/5707
e5feaea7f1d6eb01d834e83b180fc3daed3463ea
1ddf4ea46492a1aad850906c0c78c58e43d873c4
2022-10-11T23:15:04Z
go
2023-09-12T06:56:33Z
core/container.go
"path" "path/filepath" "sort" "strconv" "strings" "github.com/containerd/containerd/content" "github.com/containerd/containerd/images" "github.com/containerd/containerd/pkg/transfer/archive" "github.com/containerd/containerd/platforms" "github.com/docker/distribution/reference" "github.com/moby/buildkit/client/llb" "github.com/moby/buildkit/exporter/containerimage/exptypes" "github.com/moby/buildkit/frontend/dockerui" bkgw "github.com/moby/buildkit/frontend/gateway/client" "github.com/moby/buildkit/solver/pb" "github.com/moby/buildkit/util/leaseutil" "github.com/opencontainers/go-digest" specs "github.com/opencontainers/image-spec/specs-go/v1" "github.com/pkg/errors" "github.com/vito/progrock" "github.com/dagger/dagger/core/pipeline" "github.com/dagger/dagger/core/resourceid" "github.com/dagger/dagger/core/socket" "github.com/dagger/dagger/engine" "github.com/dagger/dagger/engine/buildkit" "github.com/dagger/dagger/network" ) var ErrContainerNoExec = errors.New("no command has been executed") const OCIStoreName = "dagger-oci" type Container struct {
closed
dagger/dagger
https://github.com/dagger/dagger
3,323
Support configuring additional options for secrets
Buildkit's full `SecretInfo` struct is as follows: ```go type SecretInfo struct { ID string Target string Mode int UID int GID int Optional bool IsEnv bool } ``` We already support `ID`, `Target`, and `IsEnv` but maybe folks will have a use for `Mode`, `UID`, `GUID`, and/or `Optional`.
https://github.com/dagger/dagger/issues/3323
https://github.com/dagger/dagger/pull/5707
e5feaea7f1d6eb01d834e83b180fc3daed3463ea
1ddf4ea46492a1aad850906c0c78c58e43d873c4
2022-10-11T23:15:04Z
go
2023-09-12T06:56:33Z
core/container.go
FS *pb.Definition `json:"fs"` Config specs.ImageConfig `json:"cfg"` Pipeline pipeline.Path `json:"pipeline"` Mounts ContainerMounts `json:"mounts,omitempty"` Meta *pb.Definition `json:"meta,omitempty"` Platform specs.Platform `json:"platform,omitempty"` Secrets []ContainerSecret `json:"secret_env,omitempty"` Sockets []ContainerSocket `json:"sockets,omitempty"` ImageRef string `json:"image_ref,omitempty"` Ports []ContainerPort `json:"ports,omitempty"` Services ServiceBindings `json:"services,omitempty"` HostAliases []HostAlias `json:"host_aliases,omitempty"` Focused bool `json:"focused"` } func NewContainer(id ContainerID, pipeline pipeline.Path, platform specs.Platform) (*Container, error) {
closed
dagger/dagger
https://github.com/dagger/dagger
3,323
Support configuring additional options for secrets
Buildkit's full `SecretInfo` struct is as follows: ```go type SecretInfo struct { ID string Target string Mode int UID int GID int Optional bool IsEnv bool } ``` We already support `ID`, `Target`, and `IsEnv` but maybe folks will have a use for `Mode`, `UID`, `GUID`, and/or `Optional`.
https://github.com/dagger/dagger/issues/3323
https://github.com/dagger/dagger/pull/5707
e5feaea7f1d6eb01d834e83b180fc3daed3463ea
1ddf4ea46492a1aad850906c0c78c58e43d873c4
2022-10-11T23:15:04Z
go
2023-09-12T06:56:33Z
core/container.go
container, err := id.ToContainer() if err != nil { return nil, err } container.Pipeline = pipeline.Copy() container.Platform = platform return container, nil } func (container *Container) Clone() *Container { cp := *container cp.Config.ExposedPorts = cloneMap(cp.Config.ExposedPorts) cp.Config.Env = cloneSlice(cp.Config.Env) cp.Config.Entrypoint = cloneSlice(cp.Config.Entrypoint) cp.Config.Cmd = cloneSlice(cp.Config.Cmd) cp.Config.Volumes = cloneMap(cp.Config.Volumes) cp.Config.Labels = cloneMap(cp.Config.Labels) cp.Mounts = cloneSlice(cp.Mounts) cp.Secrets = cloneSlice(cp.Secrets) cp.Sockets = cloneSlice(cp.Sockets) cp.Ports = cloneSlice(cp.Ports) cp.Services = cloneMap(cp.Services) cp.HostAliases = cloneSlice(cp.HostAliases) cp.Pipeline = cloneSlice(cp.Pipeline) return &cp } type ContainerID string func (id ContainerID) String() string { return string(id) } var _ Digestible = ContainerID("")
closed
dagger/dagger
https://github.com/dagger/dagger
3,323
Support configuring additional options for secrets
Buildkit's full `SecretInfo` struct is as follows: ```go type SecretInfo struct { ID string Target string Mode int UID int GID int Optional bool IsEnv bool } ``` We already support `ID`, `Target`, and `IsEnv` but maybe folks will have a use for `Mode`, `UID`, `GUID`, and/or `Optional`.
https://github.com/dagger/dagger/issues/3323
https://github.com/dagger/dagger/pull/5707
e5feaea7f1d6eb01d834e83b180fc3daed3463ea
1ddf4ea46492a1aad850906c0c78c58e43d873c4
2022-10-11T23:15:04Z
go
2023-09-12T06:56:33Z
core/container.go
func (id ContainerID) Digest() (digest.Digest, error) { ctr, err := id.ToContainer() if err != nil { return "", err } return ctr.Digest() } func (id ContainerID) ToContainer() (*Container, error) { var container Container if id == "" { return &container, nil } if err := resourceid.Decode(&container, id); err != nil { return nil, err } return &container, nil } func (container *Container) ID() (ContainerID, error) { return resourceid.Encode[ContainerID](container) } var _ pipeline.Pipelineable = (*Container)(nil) func (container *Container) PipelinePath() pipeline.Path { return container.Pipeline } var _ Digestible = (*Container)(nil) func (container *Container) Digest() (digest.Digest, error) { return stableDigest(container) } type HostAlias struct {
closed
dagger/dagger
https://github.com/dagger/dagger
3,323
Support configuring additional options for secrets
Buildkit's full `SecretInfo` struct is as follows: ```go type SecretInfo struct { ID string Target string Mode int UID int GID int Optional bool IsEnv bool } ``` We already support `ID`, `Target`, and `IsEnv` but maybe folks will have a use for `Mode`, `UID`, `GUID`, and/or `Optional`.
https://github.com/dagger/dagger/issues/3323
https://github.com/dagger/dagger/pull/5707
e5feaea7f1d6eb01d834e83b180fc3daed3463ea
1ddf4ea46492a1aad850906c0c78c58e43d873c4
2022-10-11T23:15:04Z
go
2023-09-12T06:56:33Z
core/container.go
Alias string `json:"alias"` Target string `json:"target"` } type Ownership struct { UID int `json:"uid"` GID int `json:"gid"` } func (owner Ownership) Opt() llb.ChownOption { return llb.WithUIDGID(owner.UID, owner.GID) } type ContainerSecret struct { Secret SecretID `json:"secret"` EnvName string `json:"env,omitempty"` MountPath string `json:"path,omitempty"` Owner *Ownership `json:"owner,omitempty"` } type ContainerSocket struct {
closed
dagger/dagger
https://github.com/dagger/dagger
3,323
Support configuring additional options for secrets
Buildkit's full `SecretInfo` struct is as follows: ```go type SecretInfo struct { ID string Target string Mode int UID int GID int Optional bool IsEnv bool } ``` We already support `ID`, `Target`, and `IsEnv` but maybe folks will have a use for `Mode`, `UID`, `GUID`, and/or `Optional`.
https://github.com/dagger/dagger/issues/3323
https://github.com/dagger/dagger/pull/5707
e5feaea7f1d6eb01d834e83b180fc3daed3463ea
1ddf4ea46492a1aad850906c0c78c58e43d873c4
2022-10-11T23:15:04Z
go
2023-09-12T06:56:33Z
core/container.go
SocketID socket.ID `json:"socket"` UnixPath string `json:"unix_path,omitempty"` Owner *Ownership `json:"owner,omitempty"` } type ContainerPort struct { Port int `json:"port"` Protocol NetworkProtocol `json:"protocol"` Description *string `json:"description,omitempty"` } func (container *Container) FSState() (llb.State, error) { if container.FS == nil { return llb.Scratch(), nil } return defToState(container.FS) } const metaSourcePath = "meta" func (container *Container) MetaState() (*llb.State, error) { if container.Meta == nil { return nil, nil } metaSt, err := defToState(container.Meta) if err != nil { return nil, err } return &metaSt, nil } type ContainerMount struct {
closed
dagger/dagger
https://github.com/dagger/dagger
3,323
Support configuring additional options for secrets
Buildkit's full `SecretInfo` struct is as follows: ```go type SecretInfo struct { ID string Target string Mode int UID int GID int Optional bool IsEnv bool } ``` We already support `ID`, `Target`, and `IsEnv` but maybe folks will have a use for `Mode`, `UID`, `GUID`, and/or `Optional`.
https://github.com/dagger/dagger/issues/3323
https://github.com/dagger/dagger/pull/5707
e5feaea7f1d6eb01d834e83b180fc3daed3463ea
1ddf4ea46492a1aad850906c0c78c58e43d873c4
2022-10-11T23:15:04Z
go
2023-09-12T06:56:33Z
core/container.go
Source *pb.Definition `json:"source,omitempty"` SourcePath string `json:"source_path,omitempty"` Target string `json:"target"` CacheID string `json:"cache_id,omitempty"` CacheSharingMode string `json:"cache_sharing,omitempty"` Tmpfs bool `json:"tmpfs,omitempty"` } func (mnt ContainerMount) SourceState() (llb.State, error) { if mnt.Source == nil { return llb.Scratch(), nil } return defToState(mnt.Source) } type ContainerMounts []ContainerMount func (mnts ContainerMounts) With(newMnt ContainerMount) ContainerMounts { mntsCp := make(ContainerMounts, 0, len(mnts)) parent := newMnt.Target + "/" for _, mnt := range mnts { if mnt.Target == newMnt.Target || strings.HasPrefix(mnt.Target, parent) { continue
closed
dagger/dagger
https://github.com/dagger/dagger
3,323
Support configuring additional options for secrets
Buildkit's full `SecretInfo` struct is as follows: ```go type SecretInfo struct { ID string Target string Mode int UID int GID int Optional bool IsEnv bool } ``` We already support `ID`, `Target`, and `IsEnv` but maybe folks will have a use for `Mode`, `UID`, `GUID`, and/or `Optional`.
https://github.com/dagger/dagger/issues/3323
https://github.com/dagger/dagger/pull/5707
e5feaea7f1d6eb01d834e83b180fc3daed3463ea
1ddf4ea46492a1aad850906c0c78c58e43d873c4
2022-10-11T23:15:04Z
go
2023-09-12T06:56:33Z
core/container.go
} mntsCp = append(mntsCp, mnt) } mntsCp = append(mntsCp, newMnt) return mntsCp } func (container *Container) From(ctx context.Context, bk *buildkit.Client, addr string) (*Container, error) { container = container.Clone() platform := container.Platform ctx, subRecorder := progrock.WithGroup(ctx, fmt.Sprintf("from %s", addr), progrock.Weak()) refName, err := reference.ParseNormalizedNamed(addr) if err != nil { return nil, err } ref := reference.TagNameOnly(refName).String() digest, cfgBytes, err := bk.ResolveImageConfig(ctx, ref, llb.ResolveImageConfigOpt{ Platform: &platform, ResolveMode: llb.ResolveModeDefault.String(), }) if err != nil { return nil, err } digested, err := reference.WithDigest(refName, digest) if err != nil { return nil, err } var imgSpec specs.Image if err := json.Unmarshal(cfgBytes, &imgSpec); err != nil {
closed
dagger/dagger
https://github.com/dagger/dagger
3,323
Support configuring additional options for secrets
Buildkit's full `SecretInfo` struct is as follows: ```go type SecretInfo struct { ID string Target string Mode int UID int GID int Optional bool IsEnv bool } ``` We already support `ID`, `Target`, and `IsEnv` but maybe folks will have a use for `Mode`, `UID`, `GUID`, and/or `Optional`.
https://github.com/dagger/dagger/issues/3323
https://github.com/dagger/dagger/pull/5707
e5feaea7f1d6eb01d834e83b180fc3daed3463ea
1ddf4ea46492a1aad850906c0c78c58e43d873c4
2022-10-11T23:15:04Z
go
2023-09-12T06:56:33Z
core/container.go
return nil, err } fsSt := llb.Image( digested.String(), llb.WithCustomNamef("pull %s", ref), ) def, err := fsSt.Marshal(ctx, llb.Platform(container.Platform)) if err != nil { return nil, err } container.FS = def.ToPB() buildkit.RecordVertexes(subRecorder, container.FS) container.Config = mergeImageConfig(container.Config, imgSpec.Config) container.ImageRef = digested.String() return container, nil } const defaultDockerfileName = "Dockerfile" func (container *Container) Build( ctx context.Context, context *Directory, dockerfile string, buildArgs []BuildArg, target string, secrets []SecretID, bk *buildkit.Client, buildCache *CacheMap[uint64, *Container], ) (*Container, error) { clientMetadata, err := engine.ClientMetadataFromContext(ctx) if err != nil {
closed
dagger/dagger
https://github.com/dagger/dagger
3,323
Support configuring additional options for secrets
Buildkit's full `SecretInfo` struct is as follows: ```go type SecretInfo struct { ID string Target string Mode int UID int GID int Optional bool IsEnv bool } ``` We already support `ID`, `Target`, and `IsEnv` but maybe folks will have a use for `Mode`, `UID`, `GUID`, and/or `Optional`.
https://github.com/dagger/dagger/issues/3323
https://github.com/dagger/dagger/pull/5707
e5feaea7f1d6eb01d834e83b180fc3daed3463ea
1ddf4ea46492a1aad850906c0c78c58e43d873c4
2022-10-11T23:15:04Z
go
2023-09-12T06:56:33Z
core/container.go
return nil, err } return buildCache.GetOrInitialize( cacheKey( container, context, dockerfile, buildArgs, target, secrets, clientMetadata.ClientID, ), func() (*Container, error) { return container.buildUncached(ctx, bk, context, dockerfile, buildArgs, target, secrets) }, ) } func (container *Container) buildUncached( ctx context.Context, bk *buildkit.Client, context *Directory, dockerfile string, buildArgs []BuildArg, target string, secrets []SecretID, ) (*Container, error) { container = container.Clone()
closed
dagger/dagger
https://github.com/dagger/dagger
3,323
Support configuring additional options for secrets
Buildkit's full `SecretInfo` struct is as follows: ```go type SecretInfo struct { ID string Target string Mode int UID int GID int Optional bool IsEnv bool } ``` We already support `ID`, `Target`, and `IsEnv` but maybe folks will have a use for `Mode`, `UID`, `GUID`, and/or `Optional`.
https://github.com/dagger/dagger/issues/3323
https://github.com/dagger/dagger/pull/5707
e5feaea7f1d6eb01d834e83b180fc3daed3463ea
1ddf4ea46492a1aad850906c0c78c58e43d873c4
2022-10-11T23:15:04Z
go
2023-09-12T06:56:33Z
core/container.go
container.Services.Merge(context.Services) for _, secretID := range secrets { secret, err := secretID.ToSecret() if err != nil { return nil, err } container.Secrets = append(container.Secrets, ContainerSecret{ Secret: secretID, MountPath: fmt.Sprintf("/run/secrets/%s", secret.Name), }) } container.ImageRef = "" ctx, subRecorder := progrock.WithGroup(ctx, "docker build", progrock.Weak()) return WithServices(ctx, bk, container.Services, func() (*Container, error) { platform := container.Platform opts := map[string]string{ "platform": platforms.Format(platform), "contextsubdir": context.Dir, } if dockerfile != "" { opts["filename"] = path.Join(context.Dir, dockerfile) } else { opts["filename"] = path.Join(context.Dir, defaultDockerfileName) } if target != "" { opts["target"] = target } for _, buildArg := range buildArgs {
closed
dagger/dagger
https://github.com/dagger/dagger
3,323
Support configuring additional options for secrets
Buildkit's full `SecretInfo` struct is as follows: ```go type SecretInfo struct { ID string Target string Mode int UID int GID int Optional bool IsEnv bool } ``` We already support `ID`, `Target`, and `IsEnv` but maybe folks will have a use for `Mode`, `UID`, `GUID`, and/or `Optional`.
https://github.com/dagger/dagger/issues/3323
https://github.com/dagger/dagger/pull/5707
e5feaea7f1d6eb01d834e83b180fc3daed3463ea
1ddf4ea46492a1aad850906c0c78c58e43d873c4
2022-10-11T23:15:04Z
go
2023-09-12T06:56:33Z
core/container.go
opts["build-arg:"+buildArg.Name] = buildArg.Value } inputs := map[string]*pb.Definition{ dockerui.DefaultLocalNameContext: context.LLB, dockerui.DefaultLocalNameDockerfile: context.LLB, } res, err := bk.Solve(ctx, bkgw.SolveRequest{ Frontend: "dockerfile.v0", FrontendOpt: opts, FrontendInputs: inputs, }) if err != nil { return nil, err } bkref, err := res.SingleRef() if err != nil { return nil, err } var st llb.State if bkref == nil { st = llb.Scratch() } else { st, err = bkref.ToState() if err != nil { return nil, err } } def, err := st.Marshal(ctx, llb.Platform(platform)) if err != nil { return nil, err
closed
dagger/dagger
https://github.com/dagger/dagger
3,323
Support configuring additional options for secrets
Buildkit's full `SecretInfo` struct is as follows: ```go type SecretInfo struct { ID string Target string Mode int UID int GID int Optional bool IsEnv bool } ``` We already support `ID`, `Target`, and `IsEnv` but maybe folks will have a use for `Mode`, `UID`, `GUID`, and/or `Optional`.
https://github.com/dagger/dagger/issues/3323
https://github.com/dagger/dagger/pull/5707
e5feaea7f1d6eb01d834e83b180fc3daed3463ea
1ddf4ea46492a1aad850906c0c78c58e43d873c4
2022-10-11T23:15:04Z
go
2023-09-12T06:56:33Z
core/container.go
} buildkit.RecordVertexes(subRecorder, def.ToPB()) container.FS = def.ToPB() container.FS.Source = nil cfgBytes, found := res.Metadata[exptypes.ExporterImageConfigKey] if found { var imgSpec specs.Image if err := json.Unmarshal(cfgBytes, &imgSpec); err != nil { return nil, err } container.Config = mergeImageConfig(container.Config, imgSpec.Config) } return container, nil }) } func (container *Container) RootFS(ctx context.Context) (*Directory, error) { return &Directory{ LLB: container.FS, Dir: "/", Platform: container.Platform, Pipeline: container.Pipeline, Services: container.Services, }, nil } func (container *Container) WithRootFS(ctx context.Context, dir *Directory) (*Container, error) { container = container.Clone() dirSt, err := dir.StateWithSourcePath() if err != nil { return nil, err
closed
dagger/dagger
https://github.com/dagger/dagger
3,323
Support configuring additional options for secrets
Buildkit's full `SecretInfo` struct is as follows: ```go type SecretInfo struct { ID string Target string Mode int UID int GID int Optional bool IsEnv bool } ``` We already support `ID`, `Target`, and `IsEnv` but maybe folks will have a use for `Mode`, `UID`, `GUID`, and/or `Optional`.
https://github.com/dagger/dagger/issues/3323
https://github.com/dagger/dagger/pull/5707
e5feaea7f1d6eb01d834e83b180fc3daed3463ea
1ddf4ea46492a1aad850906c0c78c58e43d873c4
2022-10-11T23:15:04Z
go
2023-09-12T06:56:33Z
core/container.go
} def, err := dirSt.Marshal(ctx, llb.Platform(dir.Platform)) if err != nil { return nil, err } container.FS = def.ToPB() container.Services.Merge(dir.Services) container.ImageRef = "" return container, nil } func (container *Container) WithDirectory(ctx context.Context, bk *buildkit.Client, subdir string, src *Directory, filter CopyFilter, owner string) (*Container, error) { container = container.Clone() return container.writeToPath(ctx, bk, subdir, func(dir *Directory) (*Directory, error) { ownership, err := container.ownership(ctx, bk, owner) if err != nil { return nil, err } return dir.WithDirectory(ctx, ".", src, filter, ownership) }) } func (container *Container) WithFile(ctx context.Context, bk *buildkit.Client, destPath string, src *File, permissions fs.FileMode, owner string) (*Container, error) { container = container.Clone() return container.writeToPath(ctx, bk, path.Dir(destPath), func(dir *Directory) (*Directory, error) { ownership, err := container.ownership(ctx, bk, owner) if err != nil { return nil, err } return dir.WithFile(ctx, path.Base(destPath), src, permissions, ownership) })
closed
dagger/dagger
https://github.com/dagger/dagger
3,323
Support configuring additional options for secrets
Buildkit's full `SecretInfo` struct is as follows: ```go type SecretInfo struct { ID string Target string Mode int UID int GID int Optional bool IsEnv bool } ``` We already support `ID`, `Target`, and `IsEnv` but maybe folks will have a use for `Mode`, `UID`, `GUID`, and/or `Optional`.
https://github.com/dagger/dagger/issues/3323
https://github.com/dagger/dagger/pull/5707
e5feaea7f1d6eb01d834e83b180fc3daed3463ea
1ddf4ea46492a1aad850906c0c78c58e43d873c4
2022-10-11T23:15:04Z
go
2023-09-12T06:56:33Z
core/container.go
} func (container *Container) WithNewFile(ctx context.Context, bk *buildkit.Client, dest string, content []byte, permissions fs.FileMode, owner string) (*Container, error) { container = container.Clone() dir, file := filepath.Split(dest) return container.writeToPath(ctx, bk, dir, func(dir *Directory) (*Directory, error) { ownership, err := container.ownership(ctx, bk, owner) if err != nil { return nil, err } return dir.WithNewFile(ctx, file, content, permissions, ownership) }) } func (container *Container) WithMountedDirectory(ctx context.Context, bk *buildkit.Client, target string, dir *Directory, owner string) (*Container, error) { container = container.Clone() return container.withMounted(ctx, bk, target, dir.LLB, dir.Dir, dir.Services, owner) } func (container *Container) WithMountedFile(ctx context.Context, bk *buildkit.Client, target string, file *File, owner string) (*Container, error) { container = container.Clone() return container.withMounted(ctx, bk, target, file.LLB, file.File, file.Services, owner) } func (container *Container) WithMountedCache(ctx context.Context, bk *buildkit.Client, target string, cache *CacheVolume, source *Directory, concurrency CacheSharingMode, owner string) (*Container, error) { container = container.Clone() target = absPath(container.Config.WorkingDir, target) cacheSharingMode := "" switch concurrency { case CacheSharingModePrivate: cacheSharingMode = "private" case CacheSharingModeLocked: cacheSharingMode = "locked" default:
closed
dagger/dagger
https://github.com/dagger/dagger
3,323
Support configuring additional options for secrets
Buildkit's full `SecretInfo` struct is as follows: ```go type SecretInfo struct { ID string Target string Mode int UID int GID int Optional bool IsEnv bool } ``` We already support `ID`, `Target`, and `IsEnv` but maybe folks will have a use for `Mode`, `UID`, `GUID`, and/or `Optional`.
https://github.com/dagger/dagger/issues/3323
https://github.com/dagger/dagger/pull/5707
e5feaea7f1d6eb01d834e83b180fc3daed3463ea
1ddf4ea46492a1aad850906c0c78c58e43d873c4
2022-10-11T23:15:04Z
go
2023-09-12T06:56:33Z
core/container.go
cacheSharingMode = "shared" } mount := ContainerMount{ Target: target, CacheID: cache.Sum(), CacheSharingMode: cacheSharingMode, } if source != nil { mount.Source = source.LLB mount.SourcePath = source.Dir } if owner != "" { var err error mount.Source, mount.SourcePath, err = container.chown( ctx, bk, mount.Source, mount.SourcePath, owner, llb.Platform(container.Platform), ) if err != nil { return nil, err } } container.Mounts = container.Mounts.With(mount) container.ImageRef = "" return container, nil }
closed
dagger/dagger
https://github.com/dagger/dagger
3,323
Support configuring additional options for secrets
Buildkit's full `SecretInfo` struct is as follows: ```go type SecretInfo struct { ID string Target string Mode int UID int GID int Optional bool IsEnv bool } ``` We already support `ID`, `Target`, and `IsEnv` but maybe folks will have a use for `Mode`, `UID`, `GUID`, and/or `Optional`.
https://github.com/dagger/dagger/issues/3323
https://github.com/dagger/dagger/pull/5707
e5feaea7f1d6eb01d834e83b180fc3daed3463ea
1ddf4ea46492a1aad850906c0c78c58e43d873c4
2022-10-11T23:15:04Z
go
2023-09-12T06:56:33Z
core/container.go
func (container *Container) WithMountedTemp(ctx context.Context, target string) (*Container, error) { container = container.Clone() target = absPath(container.Config.WorkingDir, target) container.Mounts = container.Mounts.With(ContainerMount{ Target: target, Tmpfs: true, }) container.ImageRef = "" return container, nil } func (container *Container) WithMountedSecret(ctx context.Context, bk *buildkit.Client, target string, source *Secret, owner string) (*Container, error) { container = container.Clone() target = absPath(container.Config.WorkingDir, target) ownership, err := container.ownership(ctx, bk, owner) if err != nil { return nil, err } secretID, err := source.ID() if err != nil { return nil, err } container.Secrets = append(container.Secrets, ContainerSecret{ Secret: secretID, MountPath: target, Owner: ownership, }) container.ImageRef = "" return container, nil
closed
dagger/dagger
https://github.com/dagger/dagger
3,323
Support configuring additional options for secrets
Buildkit's full `SecretInfo` struct is as follows: ```go type SecretInfo struct { ID string Target string Mode int UID int GID int Optional bool IsEnv bool } ``` We already support `ID`, `Target`, and `IsEnv` but maybe folks will have a use for `Mode`, `UID`, `GUID`, and/or `Optional`.
https://github.com/dagger/dagger/issues/3323
https://github.com/dagger/dagger/pull/5707
e5feaea7f1d6eb01d834e83b180fc3daed3463ea
1ddf4ea46492a1aad850906c0c78c58e43d873c4
2022-10-11T23:15:04Z
go
2023-09-12T06:56:33Z
core/container.go
} func (container *Container) WithoutMount(ctx context.Context, target string) (*Container, error) { container = container.Clone() target = absPath(container.Config.WorkingDir, target) var found bool var foundIdx int for i := len(container.Mounts) - 1; i >= 0; i-- { if container.Mounts[i].Target == target { found = true foundIdx = i break } } if found { container.Mounts = append(container.Mounts[:foundIdx], container.Mounts[foundIdx+1:]...) } container.ImageRef = "" return container, nil } func (container *Container) MountTargets(ctx context.Context) ([]string, error) { mounts := []string{} for _, mnt := range container.Mounts { mounts = append(mounts, mnt.Target) } return mounts, nil } func (container *Container) WithUnixSocket(ctx context.Context, bk *buildkit.Client, target string, source *socket.Socket, owner string) (*Container, error) { container = container.Clone() target = absPath(container.Config.WorkingDir, target)
closed
dagger/dagger
https://github.com/dagger/dagger
3,323
Support configuring additional options for secrets
Buildkit's full `SecretInfo` struct is as follows: ```go type SecretInfo struct { ID string Target string Mode int UID int GID int Optional bool IsEnv bool } ``` We already support `ID`, `Target`, and `IsEnv` but maybe folks will have a use for `Mode`, `UID`, `GUID`, and/or `Optional`.
https://github.com/dagger/dagger/issues/3323
https://github.com/dagger/dagger/pull/5707
e5feaea7f1d6eb01d834e83b180fc3daed3463ea
1ddf4ea46492a1aad850906c0c78c58e43d873c4
2022-10-11T23:15:04Z
go
2023-09-12T06:56:33Z
core/container.go
ownership, err := container.ownership(ctx, bk, owner) if err != nil { return nil, err } socketID, err := source.ID() if err != nil { return nil, err } newSocket := ContainerSocket{ SocketID: socketID, UnixPath: target, Owner: ownership, } var replaced bool for i, sock := range container.Sockets { if sock.UnixPath == target { container.Sockets[i] = newSocket replaced = true break } } if !replaced { container.Sockets = append(container.Sockets, newSocket) } container.ImageRef = "" return container, nil } func (container *Container) WithoutUnixSocket(ctx context.Context, target string) (*Container, error) { container = container.Clone()
closed
dagger/dagger
https://github.com/dagger/dagger
3,323
Support configuring additional options for secrets
Buildkit's full `SecretInfo` struct is as follows: ```go type SecretInfo struct { ID string Target string Mode int UID int GID int Optional bool IsEnv bool } ``` We already support `ID`, `Target`, and `IsEnv` but maybe folks will have a use for `Mode`, `UID`, `GUID`, and/or `Optional`.
https://github.com/dagger/dagger/issues/3323
https://github.com/dagger/dagger/pull/5707
e5feaea7f1d6eb01d834e83b180fc3daed3463ea
1ddf4ea46492a1aad850906c0c78c58e43d873c4
2022-10-11T23:15:04Z
go
2023-09-12T06:56:33Z
core/container.go
target = absPath(container.Config.WorkingDir, target) for i, sock := range container.Sockets { if sock.UnixPath == target { container.Sockets = append(container.Sockets[:i], container.Sockets[i+1:]...) break } } container.ImageRef = "" return container, nil } func (container *Container) WithSecretVariable(ctx context.Context, name string, secret *Secret) (*Container, error) { container = container.Clone() secretID, err := secret.ID() if err != nil { return nil, err } container.Secrets = append(container.Secrets, ContainerSecret{ Secret: secretID, EnvName: name, }) container.ImageRef = "" return container, nil } func (container *Container) Directory(ctx context.Context, bk *buildkit.Client, dirPath string) (*Directory, error) { dir, _, err := locatePath(ctx, container, dirPath, NewDirectory) if err != nil { return nil, err }
closed
dagger/dagger
https://github.com/dagger/dagger
3,323
Support configuring additional options for secrets
Buildkit's full `SecretInfo` struct is as follows: ```go type SecretInfo struct { ID string Target string Mode int UID int GID int Optional bool IsEnv bool } ``` We already support `ID`, `Target`, and `IsEnv` but maybe folks will have a use for `Mode`, `UID`, `GUID`, and/or `Optional`.
https://github.com/dagger/dagger/issues/3323
https://github.com/dagger/dagger/pull/5707
e5feaea7f1d6eb01d834e83b180fc3daed3463ea
1ddf4ea46492a1aad850906c0c78c58e43d873c4
2022-10-11T23:15:04Z
go
2023-09-12T06:56:33Z
core/container.go
info, err := dir.Stat(ctx, bk, ".") if err != nil { return nil, err } if !info.IsDir() { return nil, fmt.Errorf("path %s is a file, not a directory", dirPath) } return dir, nil } func (container *Container) File(ctx context.Context, bk *buildkit.Client, filePath string) (*File, error) { file, _, err := locatePath(ctx, container, filePath, NewFile) if err != nil { return nil, err } info, err := file.Stat(ctx, bk) if err != nil { return nil, err } if info.IsDir() { return nil, fmt.Errorf("path %s is a directory, not a file", filePath) } return file, nil } func locatePath[T *File | *Directory]( ctx context.Context, container *Container,
closed
dagger/dagger
https://github.com/dagger/dagger
3,323
Support configuring additional options for secrets
Buildkit's full `SecretInfo` struct is as follows: ```go type SecretInfo struct { ID string Target string Mode int UID int GID int Optional bool IsEnv bool } ``` We already support `ID`, `Target`, and `IsEnv` but maybe folks will have a use for `Mode`, `UID`, `GUID`, and/or `Optional`.
https://github.com/dagger/dagger/issues/3323
https://github.com/dagger/dagger/pull/5707
e5feaea7f1d6eb01d834e83b180fc3daed3463ea
1ddf4ea46492a1aad850906c0c78c58e43d873c4
2022-10-11T23:15:04Z
go
2023-09-12T06:56:33Z
core/container.go
containerPath string, init func(context.Context, *pb.Definition, string, pipeline.Path, specs.Platform, ServiceBindings) T, ) (T, *ContainerMount, error) { containerPath = absPath(container.Config.WorkingDir, containerPath) for i := len(container.Mounts) - 1; i >= 0; i-- { mnt := container.Mounts[i] if containerPath == mnt.Target || strings.HasPrefix(containerPath, mnt.Target+"/") { if mnt.Tmpfs { return nil, nil, fmt.Errorf("%s: cannot retrieve path from tmpfs", containerPath) } if mnt.CacheID != "" { return nil, nil, fmt.Errorf("%s: cannot retrieve path from cache", containerPath) } sub := mnt.SourcePath if containerPath != mnt.Target { dirSub := strings.TrimPrefix(containerPath, mnt.Target+"/") if dirSub != "" { sub = path.Join(sub, dirSub) } } return init( ctx, mnt.Source, sub, container.Pipeline, container.Platform, container.Services, ), &mnt, nil
closed
dagger/dagger
https://github.com/dagger/dagger
3,323
Support configuring additional options for secrets
Buildkit's full `SecretInfo` struct is as follows: ```go type SecretInfo struct { ID string Target string Mode int UID int GID int Optional bool IsEnv bool } ``` We already support `ID`, `Target`, and `IsEnv` but maybe folks will have a use for `Mode`, `UID`, `GUID`, and/or `Optional`.
https://github.com/dagger/dagger/issues/3323
https://github.com/dagger/dagger/pull/5707
e5feaea7f1d6eb01d834e83b180fc3daed3463ea
1ddf4ea46492a1aad850906c0c78c58e43d873c4
2022-10-11T23:15:04Z
go
2023-09-12T06:56:33Z
core/container.go
} } return init( ctx, container.FS, containerPath, container.Pipeline, container.Platform, container.Services, ), nil, nil } func (container *Container) withMounted( ctx context.Context, bk *buildkit.Client, target string, srcDef *pb.Definition, srcPath string, svcs ServiceBindings, owner string, ) (*Container, error) { target = absPath(container.Config.WorkingDir, target) var err error if owner != "" { srcDef, srcPath, err = container.chown(ctx, bk, srcDef, srcPath, owner, llb.Platform(container.Platform)) if err != nil { return nil, err } } container.Mounts = container.Mounts.With(ContainerMount{
closed
dagger/dagger
https://github.com/dagger/dagger
3,323
Support configuring additional options for secrets
Buildkit's full `SecretInfo` struct is as follows: ```go type SecretInfo struct { ID string Target string Mode int UID int GID int Optional bool IsEnv bool } ``` We already support `ID`, `Target`, and `IsEnv` but maybe folks will have a use for `Mode`, `UID`, `GUID`, and/or `Optional`.
https://github.com/dagger/dagger/issues/3323
https://github.com/dagger/dagger/pull/5707
e5feaea7f1d6eb01d834e83b180fc3daed3463ea
1ddf4ea46492a1aad850906c0c78c58e43d873c4
2022-10-11T23:15:04Z
go
2023-09-12T06:56:33Z
core/container.go
Source: srcDef, SourcePath: srcPath, Target: target, }) container.Services.Merge(svcs) container.ImageRef = "" return container, nil } func (container *Container) chown( ctx context.Context, bk *buildkit.Client, srcDef *pb.Definition, srcPath string, owner string, opts ...llb.ConstraintsOpt, ) (*pb.Definition, string, error) { ownership, err := container.ownership(ctx, bk, owner) if err != nil { return nil, "", err } if ownership == nil { return srcDef, srcPath, nil } var srcSt llb.State if srcDef == nil { srcSt = llb.Scratch().File( llb.Mkdir("/chown", 0o755, ownership.Opt()), )
closed
dagger/dagger
https://github.com/dagger/dagger
3,323
Support configuring additional options for secrets
Buildkit's full `SecretInfo` struct is as follows: ```go type SecretInfo struct { ID string Target string Mode int UID int GID int Optional bool IsEnv bool } ``` We already support `ID`, `Target`, and `IsEnv` but maybe folks will have a use for `Mode`, `UID`, `GUID`, and/or `Optional`.
https://github.com/dagger/dagger/issues/3323
https://github.com/dagger/dagger/pull/5707
e5feaea7f1d6eb01d834e83b180fc3daed3463ea
1ddf4ea46492a1aad850906c0c78c58e43d873c4
2022-10-11T23:15:04Z
go
2023-09-12T06:56:33Z
core/container.go
srcPath = "/chown" } else { srcSt, err = defToState(srcDef) if err != nil { return nil, "", err } def, err := srcSt.Marshal(ctx, opts...) if err != nil { return nil, "", err } ref, err := bkRef(ctx, bk, def.ToPB()) if err != nil { return nil, "", err } stat, err := ref.StatFile(ctx, bkgw.StatRequest{ Path: srcPath, }) if err != nil { return nil, "", err } if stat.IsDir() { chowned := "/chown" srcSt = llb.Scratch().File( llb.Mkdir(chowned, os.FileMode(stat.Mode), ownership.Opt()). Copy(srcSt, srcPath, chowned, &llb.CopyInfo{ CopyDirContentsOnly: true, }, ownership.Opt()),
closed
dagger/dagger
https://github.com/dagger/dagger
3,323
Support configuring additional options for secrets
Buildkit's full `SecretInfo` struct is as follows: ```go type SecretInfo struct { ID string Target string Mode int UID int GID int Optional bool IsEnv bool } ``` We already support `ID`, `Target`, and `IsEnv` but maybe folks will have a use for `Mode`, `UID`, `GUID`, and/or `Optional`.
https://github.com/dagger/dagger/issues/3323
https://github.com/dagger/dagger/pull/5707
e5feaea7f1d6eb01d834e83b180fc3daed3463ea
1ddf4ea46492a1aad850906c0c78c58e43d873c4
2022-10-11T23:15:04Z
go
2023-09-12T06:56:33Z
core/container.go
) srcPath = chowned } else { srcSt = llb.Scratch().File( llb.Copy(srcSt, srcPath, ".", ownership.Opt()), ) srcPath = filepath.Base(srcPath) } } def, err := srcSt.Marshal(ctx, opts...) if err != nil { return nil, "", err } return def.ToPB(), srcPath, nil } func (container *Container) writeToPath(ctx context.Context, bk *buildkit.Client, subdir string, fn func(dir *Directory) (*Directory, error)) (*Container, error) { dir, mount, err := locatePath(ctx, container, subdir, NewDirectory) if err != nil { return nil, err } dir.Pipeline = container.Pipeline dir, err = fn(dir) if err != nil { return nil, err } if mount == nil { root, err := dir.Root() if err != nil { return nil, err
closed
dagger/dagger
https://github.com/dagger/dagger
3,323
Support configuring additional options for secrets
Buildkit's full `SecretInfo` struct is as follows: ```go type SecretInfo struct { ID string Target string Mode int UID int GID int Optional bool IsEnv bool } ``` We already support `ID`, `Target`, and `IsEnv` but maybe folks will have a use for `Mode`, `UID`, `GUID`, and/or `Optional`.
https://github.com/dagger/dagger/issues/3323
https://github.com/dagger/dagger/pull/5707
e5feaea7f1d6eb01d834e83b180fc3daed3463ea
1ddf4ea46492a1aad850906c0c78c58e43d873c4
2022-10-11T23:15:04Z
go
2023-09-12T06:56:33Z
core/container.go
} return container.WithRootFS(ctx, root) } return container.withMounted(ctx, bk, mount.Target, dir.LLB, mount.SourcePath, nil, "") } func (container *Container) ImageConfig(ctx context.Context) (specs.ImageConfig, error) { return container.Config, nil } func (container *Container) UpdateImageConfig(ctx context.Context, updateFn func(specs.ImageConfig) specs.ImageConfig) (*Container, error) { container = container.Clone() container.Config = updateFn(container.Config) return container, nil } func (container *Container) WithPipeline(ctx context.Context, name, description string, labels []pipeline.Label) (*Container, error) { container = container.Clone() container.Pipeline = container.Pipeline.Add(pipeline.Pipeline{ Name: name, Description: description, Labels: labels, }) return container, nil } func (container *Container) WithExec(ctx context.Context, bk *buildkit.Client, progSock string, defaultPlatform specs.Platform, opts ContainerExecOpts) (*Container, error) { container = container.Clone() cfg := container.Config mounts := container.Mounts platform := container.Platform if platform.OS == "" { platform = defaultPlatform }
closed
dagger/dagger
https://github.com/dagger/dagger
3,323
Support configuring additional options for secrets
Buildkit's full `SecretInfo` struct is as follows: ```go type SecretInfo struct { ID string Target string Mode int UID int GID int Optional bool IsEnv bool } ``` We already support `ID`, `Target`, and `IsEnv` but maybe folks will have a use for `Mode`, `UID`, `GUID`, and/or `Optional`.
https://github.com/dagger/dagger/issues/3323
https://github.com/dagger/dagger/pull/5707
e5feaea7f1d6eb01d834e83b180fc3daed3463ea
1ddf4ea46492a1aad850906c0c78c58e43d873c4
2022-10-11T23:15:04Z
go
2023-09-12T06:56:33Z
core/container.go
args := opts.Args if len(args) == 0 { args = cfg.Cmd } if len(cfg.Entrypoint) > 0 && !opts.SkipEntrypoint { args = append(cfg.Entrypoint, args...) } if len(args) == 0 { return nil, errors.New("no command has been set") } var namef string if container.Focused { namef = buildkit.FocusPrefix + "exec %s" } else { namef = "exec %s" } runOpts := []llb.RunOption{ llb.Args(args), llb.WithCustomNamef(namef, strings.Join(args, " ")), } clientMetadata, err := engine.ClientMetadataFromContext(ctx) if err != nil { return nil, err } uncachedExecMetadataOpt, err := ContainerExecUncachedMetadata{ ParentClientIDs: clientMetadata.ClientIDs(), ServerID: clientMetadata.ServerID, ProgSockPath: progSock, }.ToLLBRunOpt()
closed
dagger/dagger
https://github.com/dagger/dagger
3,323
Support configuring additional options for secrets
Buildkit's full `SecretInfo` struct is as follows: ```go type SecretInfo struct { ID string Target string Mode int UID int GID int Optional bool IsEnv bool } ``` We already support `ID`, `Target`, and `IsEnv` but maybe folks will have a use for `Mode`, `UID`, `GUID`, and/or `Optional`.
https://github.com/dagger/dagger/issues/3323
https://github.com/dagger/dagger/pull/5707
e5feaea7f1d6eb01d834e83b180fc3daed3463ea
1ddf4ea46492a1aad850906c0c78c58e43d873c4
2022-10-11T23:15:04Z
go
2023-09-12T06:56:33Z
core/container.go
if err != nil { return nil, err } runOpts = append(runOpts, uncachedExecMetadataOpt) if opts.ExperimentalPrivilegedNesting { runOpts = append(runOpts, llb.AddEnv("_DAGGER_ENABLE_NESTING", "")) } meta := llb.Mkdir(buildkit.MetaSourcePath, 0o777) if opts.Stdin != "" { meta = meta.Mkfile(path.Join(buildkit.MetaSourcePath, "stdin"), 0o600, []byte(opts.Stdin)) } runOpts = append(runOpts, llb.AddMount(buildkit.MetaMountDestPath, llb.Scratch().File(meta, llb.WithCustomName(buildkit.InternalPrefix+"creating dagger metadata")), llb.SourcePath(buildkit.MetaSourcePath))) if opts.RedirectStdout != "" { runOpts = append(runOpts, llb.AddEnv("_DAGGER_REDIRECT_STDOUT", opts.RedirectStdout)) } if opts.RedirectStderr != "" { runOpts = append(runOpts, llb.AddEnv("_DAGGER_REDIRECT_STDERR", opts.RedirectStderr)) } for _, alias := range container.HostAliases { runOpts = append(runOpts, llb.AddEnv("_DAGGER_HOSTNAME_ALIAS_"+alias.Alias, alias.Target)) }
closed
dagger/dagger
https://github.com/dagger/dagger
3,323
Support configuring additional options for secrets
Buildkit's full `SecretInfo` struct is as follows: ```go type SecretInfo struct { ID string Target string Mode int UID int GID int Optional bool IsEnv bool } ``` We already support `ID`, `Target`, and `IsEnv` but maybe folks will have a use for `Mode`, `UID`, `GUID`, and/or `Optional`.
https://github.com/dagger/dagger/issues/3323
https://github.com/dagger/dagger/pull/5707
e5feaea7f1d6eb01d834e83b180fc3daed3463ea
1ddf4ea46492a1aad850906c0c78c58e43d873c4
2022-10-11T23:15:04Z
go
2023-09-12T06:56:33Z
core/container.go
if cfg.User != "" { runOpts = append(runOpts, llb.User(cfg.User)) } if cfg.WorkingDir != "" { runOpts = append(runOpts, llb.Dir(cfg.WorkingDir)) } for _, env := range cfg.Env { name, val, ok := strings.Cut(env, "=") if !ok { _ = ok } if name == "_DAGGER_ENABLE_NESTING" && !opts.ExperimentalPrivilegedNesting { continue } runOpts = append(runOpts, llb.AddEnv(name, val)) } secretsToScrub := SecretToScrubInfo{} for i, secret := range container.Secrets { secretOpts := []llb.SecretOption{llb.SecretID(secret.Secret.String())} var secretDest string switch { case secret.EnvName != "": secretDest = secret.EnvName secretOpts = append(secretOpts, llb.SecretAsEnv(true)) secretsToScrub.Envs = append(secretsToScrub.Envs, secret.EnvName) case secret.MountPath != "": secretDest = secret.MountPath
closed
dagger/dagger
https://github.com/dagger/dagger
3,323
Support configuring additional options for secrets
Buildkit's full `SecretInfo` struct is as follows: ```go type SecretInfo struct { ID string Target string Mode int UID int GID int Optional bool IsEnv bool } ``` We already support `ID`, `Target`, and `IsEnv` but maybe folks will have a use for `Mode`, `UID`, `GUID`, and/or `Optional`.
https://github.com/dagger/dagger/issues/3323
https://github.com/dagger/dagger/pull/5707
e5feaea7f1d6eb01d834e83b180fc3daed3463ea
1ddf4ea46492a1aad850906c0c78c58e43d873c4
2022-10-11T23:15:04Z
go
2023-09-12T06:56:33Z
core/container.go
secretsToScrub.Files = append(secretsToScrub.Files, secret.MountPath) if secret.Owner != nil { secretOpts = append(secretOpts, llb.SecretFileOpt( secret.Owner.UID, secret.Owner.GID, 0o400, )) } default: return nil, fmt.Errorf("malformed secret config at index %d", i) } runOpts = append(runOpts, llb.AddSecret(secretDest, secretOpts...)) } if len(secretsToScrub.Envs) != 0 || len(secretsToScrub.Files) != 0 { sort.Strings(secretsToScrub.Envs) sort.Strings(secretsToScrub.Files) secretsToScrubJSON, err := json.Marshal(secretsToScrub) if err != nil { return nil, fmt.Errorf("scrub secrets json: %w", err) } runOpts = append(runOpts, llb.AddEnv("_DAGGER_SCRUB_SECRETS", string(secretsToScrubJSON))) } for _, ctrSocket := range container.Sockets { if ctrSocket.UnixPath == "" { return nil, fmt.Errorf("unsupported socket: only unix paths are implemented") } socketOpts := []llb.SSHOption{ llb.SSHID(string(ctrSocket.SocketID)), llb.SSHSocketTarget(ctrSocket.UnixPath),
closed
dagger/dagger
https://github.com/dagger/dagger
3,323
Support configuring additional options for secrets
Buildkit's full `SecretInfo` struct is as follows: ```go type SecretInfo struct { ID string Target string Mode int UID int GID int Optional bool IsEnv bool } ``` We already support `ID`, `Target`, and `IsEnv` but maybe folks will have a use for `Mode`, `UID`, `GUID`, and/or `Optional`.
https://github.com/dagger/dagger/issues/3323
https://github.com/dagger/dagger/pull/5707
e5feaea7f1d6eb01d834e83b180fc3daed3463ea
1ddf4ea46492a1aad850906c0c78c58e43d873c4
2022-10-11T23:15:04Z
go
2023-09-12T06:56:33Z
core/container.go
} if ctrSocket.Owner != nil { socketOpts = append(socketOpts, llb.SSHSocketOpt( ctrSocket.UnixPath, ctrSocket.Owner.UID, ctrSocket.Owner.GID, 0o600, )) } runOpts = append(runOpts, llb.AddSSHSocket(socketOpts...)) } for _, mnt := range mounts { srcSt, err := mnt.SourceState() if err != nil { return nil, fmt.Errorf("mount %s: %w", mnt.Target, err) } mountOpts := []llb.MountOption{} if mnt.SourcePath != "" { mountOpts = append(mountOpts, llb.SourcePath(mnt.SourcePath)) } if mnt.CacheID != "" { var sharingMode llb.CacheMountSharingMode switch mnt.CacheSharingMode { case "shared": sharingMode = llb.CacheMountShared case "private": sharingMode = llb.CacheMountPrivate case "locked": sharingMode = llb.CacheMountLocked
closed
dagger/dagger
https://github.com/dagger/dagger
3,323
Support configuring additional options for secrets
Buildkit's full `SecretInfo` struct is as follows: ```go type SecretInfo struct { ID string Target string Mode int UID int GID int Optional bool IsEnv bool } ``` We already support `ID`, `Target`, and `IsEnv` but maybe folks will have a use for `Mode`, `UID`, `GUID`, and/or `Optional`.
https://github.com/dagger/dagger/issues/3323
https://github.com/dagger/dagger/pull/5707
e5feaea7f1d6eb01d834e83b180fc3daed3463ea
1ddf4ea46492a1aad850906c0c78c58e43d873c4
2022-10-11T23:15:04Z
go
2023-09-12T06:56:33Z
core/container.go
default: return nil, errors.Errorf("invalid cache mount sharing mode %q", mnt.CacheSharingMode) } mountOpts = append(mountOpts, llb.AsPersistentCacheDir(mnt.CacheID, sharingMode)) } if mnt.Tmpfs { mountOpts = append(mountOpts, llb.Tmpfs()) } runOpts = append(runOpts, llb.AddMount(mnt.Target, srcSt, mountOpts...)) } if opts.InsecureRootCapabilities { runOpts = append(runOpts, llb.Security(llb.SecurityModeInsecure)) } fsSt, err := container.FSState() if err != nil { return nil, fmt.Errorf("fs state: %w", err) } execSt := fsSt.Run(runOpts...) execDef, err := execSt.Root().Marshal(ctx, llb.Platform(platform)) if err != nil { return nil, fmt.Errorf("marshal root: %w", err) } container.FS = execDef.ToPB() metaDef, err := execSt.GetMount(buildkit.MetaMountDestPath).Marshal(ctx, llb.Platform(platform)) if err != nil { return nil, fmt.Errorf("get meta mount: %w", err) } container.Meta = metaDef.ToPB() for i, mnt := range mounts { if mnt.Tmpfs || mnt.CacheID != "" {
closed
dagger/dagger
https://github.com/dagger/dagger
3,323
Support configuring additional options for secrets
Buildkit's full `SecretInfo` struct is as follows: ```go type SecretInfo struct { ID string Target string Mode int UID int GID int Optional bool IsEnv bool } ``` We already support `ID`, `Target`, and `IsEnv` but maybe folks will have a use for `Mode`, `UID`, `GUID`, and/or `Optional`.
https://github.com/dagger/dagger/issues/3323
https://github.com/dagger/dagger/pull/5707
e5feaea7f1d6eb01d834e83b180fc3daed3463ea
1ddf4ea46492a1aad850906c0c78c58e43d873c4
2022-10-11T23:15:04Z
go
2023-09-12T06:56:33Z
core/container.go
continue } mountSt := execSt.GetMount(mnt.Target) execMountDef, err := mountSt.Marshal(ctx, llb.Platform(platform)) if err != nil { return nil, fmt.Errorf("propagate %s: %w", mnt.Target, err) } mounts[i].Source = execMountDef.ToPB() } container.Mounts = mounts container.ImageRef = "" return container, nil } func (container *Container) Evaluate(ctx context.Context, bk *buildkit.Client) error { if container.FS == nil { return nil } _, err := WithServices(ctx, bk, container.Services, func() (*buildkit.Result, error) { st, err := container.FSState() if err != nil { return nil, err } def, err := st.Marshal(ctx, llb.Platform(container.Platform)) if err != nil { return nil, err } return bk.Solve(ctx, bkgw.SolveRequest{ Evaluate: true,
closed
dagger/dagger
https://github.com/dagger/dagger
3,323
Support configuring additional options for secrets
Buildkit's full `SecretInfo` struct is as follows: ```go type SecretInfo struct { ID string Target string Mode int UID int GID int Optional bool IsEnv bool } ``` We already support `ID`, `Target`, and `IsEnv` but maybe folks will have a use for `Mode`, `UID`, `GUID`, and/or `Optional`.
https://github.com/dagger/dagger/issues/3323
https://github.com/dagger/dagger/pull/5707
e5feaea7f1d6eb01d834e83b180fc3daed3463ea
1ddf4ea46492a1aad850906c0c78c58e43d873c4
2022-10-11T23:15:04Z
go
2023-09-12T06:56:33Z
core/container.go
Definition: def.ToPB(), }) }) return err } func (container *Container) Start(ctx context.Context, bk *buildkit.Client) (*Service, error) { container = container.Clone() hostname, err := container.HostnameOrErr() if err != nil { return nil, err } clientMetadata, err := engine.ClientMetadataFromContext(ctx) if err != nil { return nil, err } hostname += "." + network.ClientDomain(clientMetadata.ClientID) dag, err := defToDAG(container.FS) if err != nil { return nil, fmt.Errorf("failed to convert container def to dag: %w", err) } if len(dag.inputs) == 0 { return nil, fmt.Errorf("service container must be result of withExec") } execOp, ok := dag.inputs[0].AsExec() if !ok { return nil, fmt.Errorf("service container must be result of withExec")
closed
dagger/dagger
https://github.com/dagger/dagger
3,323
Support configuring additional options for secrets
Buildkit's full `SecretInfo` struct is as follows: ```go type SecretInfo struct { ID string Target string Mode int UID int GID int Optional bool IsEnv bool } ``` We already support `ID`, `Target`, and `IsEnv` but maybe folks will have a use for `Mode`, `UID`, `GUID`, and/or `Optional`.
https://github.com/dagger/dagger/issues/3323
https://github.com/dagger/dagger/pull/5707
e5feaea7f1d6eb01d834e83b180fc3daed3463ea
1ddf4ea46492a1aad850906c0c78c58e43d873c4
2022-10-11T23:15:04Z
go
2023-09-12T06:56:33Z
core/container.go
} execOp.Meta.Hostname = hostname container.FS, err = dag.Marshal() if err != nil { return nil, fmt.Errorf("failed to marshal dag: %w", err) } health := newHealth(bk, hostname, container.Ports) rec := progrock.FromContext(ctx). WithGroup( fmt.Sprintf("service %s", hostname), progrock.Weak(), ) svcCtx, stop := context.WithCancel(context.Background()) svcCtx = progrock.ToContext(svcCtx, rec) svcCtx = engine.ContextWithClientMetadata(svcCtx, clientMetadata) checked := make(chan error, 1) go func() { checked <- health.Check(svcCtx) }() exited := make(chan error, 1) go func() { exited <- container.Evaluate(svcCtx, bk) }() select { case err := <-checked: if err != nil { stop() return nil, fmt.Errorf("health check errored: %w", err)
closed
dagger/dagger
https://github.com/dagger/dagger
3,323
Support configuring additional options for secrets
Buildkit's full `SecretInfo` struct is as follows: ```go type SecretInfo struct { ID string Target string Mode int UID int GID int Optional bool IsEnv bool } ``` We already support `ID`, `Target`, and `IsEnv` but maybe folks will have a use for `Mode`, `UID`, `GUID`, and/or `Optional`.
https://github.com/dagger/dagger/issues/3323
https://github.com/dagger/dagger/pull/5707
e5feaea7f1d6eb01d834e83b180fc3daed3463ea
1ddf4ea46492a1aad850906c0c78c58e43d873c4
2022-10-11T23:15:04Z
go
2023-09-12T06:56:33Z
core/container.go
} _ = stop return &Service{ Container: container, Detach: stop, }, nil case err := <-exited: stop() if err != nil { return nil, fmt.Errorf("exited: %w", err) } return nil, fmt.Errorf("service exited before healthcheck") } } func (container *Container) MetaFileContents(ctx context.Context, bk *buildkit.Client, progSock string, filePath string) (string, error) { if container.Meta == nil { ctr, err := container.WithExec(ctx, bk, progSock, container.Platform, ContainerExecOpts{}) if err != nil { return "", err } return ctr.MetaFileContents(ctx, bk, progSock, filePath) } file := NewFile( ctx, container.Meta, path.Join(metaSourcePath, filePath), container.Pipeline, container.Platform, container.Services, )
closed
dagger/dagger
https://github.com/dagger/dagger
3,323
Support configuring additional options for secrets
Buildkit's full `SecretInfo` struct is as follows: ```go type SecretInfo struct { ID string Target string Mode int UID int GID int Optional bool IsEnv bool } ``` We already support `ID`, `Target`, and `IsEnv` but maybe folks will have a use for `Mode`, `UID`, `GUID`, and/or `Optional`.
https://github.com/dagger/dagger/issues/3323
https://github.com/dagger/dagger/pull/5707
e5feaea7f1d6eb01d834e83b180fc3daed3463ea
1ddf4ea46492a1aad850906c0c78c58e43d873c4
2022-10-11T23:15:04Z
go
2023-09-12T06:56:33Z
core/container.go
content, err := file.Contents(ctx, bk) if err != nil { return "", err } return string(content), nil } func (container *Container) Publish( ctx context.Context, bk *buildkit.Client, ref string, platformVariants []ContainerID, forcedCompression ImageLayerCompression, mediaTypes ImageMediaTypes, ) (string, error) { if mediaTypes == "" { mediaTypes = OCIMediaTypes } inputByPlatform := map[string]buildkit.ContainerExport{} id, err := container.ID() if err != nil { return "", err } services := ServiceBindings{} for _, variantID := range append([]ContainerID{id}, platformVariants...) { variant, err := variantID.ToContainer() if err != nil {
closed
dagger/dagger
https://github.com/dagger/dagger
3,323
Support configuring additional options for secrets
Buildkit's full `SecretInfo` struct is as follows: ```go type SecretInfo struct { ID string Target string Mode int UID int GID int Optional bool IsEnv bool } ``` We already support `ID`, `Target`, and `IsEnv` but maybe folks will have a use for `Mode`, `UID`, `GUID`, and/or `Optional`.
https://github.com/dagger/dagger/issues/3323
https://github.com/dagger/dagger/pull/5707
e5feaea7f1d6eb01d834e83b180fc3daed3463ea
1ddf4ea46492a1aad850906c0c78c58e43d873c4
2022-10-11T23:15:04Z
go
2023-09-12T06:56:33Z
core/container.go
return "", err } if variant.FS == nil { continue } st, err := variant.FSState() if err != nil { return "", err } def, err := st.Marshal(ctx, llb.Platform(variant.Platform)) if err != nil { return "", err } platformString := platforms.Format(variant.Platform) if _, ok := inputByPlatform[platformString]; ok { return "", fmt.Errorf("duplicate platform %q", platformString) } inputByPlatform[platforms.Format(variant.Platform)] = buildkit.ContainerExport{ Definition: def.ToPB(), Config: variant.Config, } services.Merge(variant.Services) } if len(inputByPlatform) == 0 { return "", errors.New("no containers to export") } opts := map[string]string{ string(exptypes.OptKeyName): ref, string(exptypes.OptKeyPush): strconv.FormatBool(true),
closed
dagger/dagger
https://github.com/dagger/dagger
3,323
Support configuring additional options for secrets
Buildkit's full `SecretInfo` struct is as follows: ```go type SecretInfo struct { ID string Target string Mode int UID int GID int Optional bool IsEnv bool } ``` We already support `ID`, `Target`, and `IsEnv` but maybe folks will have a use for `Mode`, `UID`, `GUID`, and/or `Optional`.
https://github.com/dagger/dagger/issues/3323
https://github.com/dagger/dagger/pull/5707
e5feaea7f1d6eb01d834e83b180fc3daed3463ea
1ddf4ea46492a1aad850906c0c78c58e43d873c4
2022-10-11T23:15:04Z
go
2023-09-12T06:56:33Z
core/container.go
string(exptypes.OptKeyOCITypes): strconv.FormatBool(mediaTypes == OCIMediaTypes), } if forcedCompression != "" { opts[string(exptypes.OptKeyLayerCompression)] = strings.ToLower(string(forcedCompression)) opts[string(exptypes.OptKeyForceCompression)] = strconv.FormatBool(true) } resp, err := WithServices(ctx, bk, services, func() (map[string]string, error) { return bk.PublishContainerImage(ctx, inputByPlatform, opts) }) if err != nil { return "", err } refName, err := reference.ParseNormalizedNamed(ref) if err != nil { return "", err } imageDigest, found := resp[exptypes.ExporterImageDigestKey] if found { dig, err := digest.Parse(imageDigest) if err != nil { return "", fmt.Errorf("parse digest: %w", err) } withDig, err := reference.WithDigest(refName, dig) if err != nil { return "", fmt.Errorf("with digest: %w", err) } return withDig.String(), nil } return ref, nil }
closed
dagger/dagger
https://github.com/dagger/dagger
3,323
Support configuring additional options for secrets
Buildkit's full `SecretInfo` struct is as follows: ```go type SecretInfo struct { ID string Target string Mode int UID int GID int Optional bool IsEnv bool } ``` We already support `ID`, `Target`, and `IsEnv` but maybe folks will have a use for `Mode`, `UID`, `GUID`, and/or `Optional`.
https://github.com/dagger/dagger/issues/3323
https://github.com/dagger/dagger/pull/5707
e5feaea7f1d6eb01d834e83b180fc3daed3463ea
1ddf4ea46492a1aad850906c0c78c58e43d873c4
2022-10-11T23:15:04Z
go
2023-09-12T06:56:33Z
core/container.go
func (container *Container) Export( ctx context.Context, bk *buildkit.Client, dest string, platformVariants []ContainerID, forcedCompression ImageLayerCompression, mediaTypes ImageMediaTypes, ) error { if mediaTypes == "" { mediaTypes = OCIMediaTypes } inputByPlatform := map[string]buildkit.ContainerExport{} id, err := container.ID() if err != nil { return err } services := ServiceBindings{} for _, variantID := range append([]ContainerID{id}, platformVariants...) { variant, err := variantID.ToContainer() if err != nil { return err } if variant.FS == nil { continue } st, err := variant.FSState()
closed
dagger/dagger
https://github.com/dagger/dagger
3,323
Support configuring additional options for secrets
Buildkit's full `SecretInfo` struct is as follows: ```go type SecretInfo struct { ID string Target string Mode int UID int GID int Optional bool IsEnv bool } ``` We already support `ID`, `Target`, and `IsEnv` but maybe folks will have a use for `Mode`, `UID`, `GUID`, and/or `Optional`.
https://github.com/dagger/dagger/issues/3323
https://github.com/dagger/dagger/pull/5707
e5feaea7f1d6eb01d834e83b180fc3daed3463ea
1ddf4ea46492a1aad850906c0c78c58e43d873c4
2022-10-11T23:15:04Z
go
2023-09-12T06:56:33Z
core/container.go
if err != nil { return err } def, err := st.Marshal(ctx, llb.Platform(variant.Platform)) if err != nil { return err } platformString := platforms.Format(variant.Platform) if _, ok := inputByPlatform[platformString]; ok { return fmt.Errorf("duplicate platform %q", platformString) } inputByPlatform[platforms.Format(variant.Platform)] = buildkit.ContainerExport{ Definition: def.ToPB(), Config: variant.Config, } services.Merge(variant.Services) } if len(inputByPlatform) == 0 { return errors.New("no containers to export") } opts := map[string]string{ "tar": strconv.FormatBool(true), string(exptypes.OptKeyOCITypes): strconv.FormatBool(mediaTypes == OCIMediaTypes), } if forcedCompression != "" { opts[string(exptypes.OptKeyLayerCompression)] = strings.ToLower(string(forcedCompression)) opts[string(exptypes.OptKeyForceCompression)] = strconv.FormatBool(true) } _, err = WithServices(ctx, bk, services, func() (map[string]string, error) {
closed
dagger/dagger
https://github.com/dagger/dagger
3,323
Support configuring additional options for secrets
Buildkit's full `SecretInfo` struct is as follows: ```go type SecretInfo struct { ID string Target string Mode int UID int GID int Optional bool IsEnv bool } ``` We already support `ID`, `Target`, and `IsEnv` but maybe folks will have a use for `Mode`, `UID`, `GUID`, and/or `Optional`.
https://github.com/dagger/dagger/issues/3323
https://github.com/dagger/dagger/pull/5707
e5feaea7f1d6eb01d834e83b180fc3daed3463ea
1ddf4ea46492a1aad850906c0c78c58e43d873c4
2022-10-11T23:15:04Z
go
2023-09-12T06:56:33Z
core/container.go
return bk.ExportContainerImage(ctx, inputByPlatform, dest, opts) }) return err } func (container *Container) Import( ctx context.Context, source FileID, tag string, bk *buildkit.Client, host *Host, importCache *CacheMap[uint64, *specs.Descriptor], store content.Store, lm *leaseutil.Manager, ) (*Container, error) { file, err := source.ToFile() if err != nil { return nil, err } clientMetadata, err := engine.ClientMetadataFromContext(ctx) if err != nil { return nil, err } var release func(context.Context) error loadManifest := func() (*specs.Descriptor, error) { src, err := file.Open(ctx, host, bk) if err != nil { return nil, err } defer src.Close() container = container.Clone()
closed
dagger/dagger
https://github.com/dagger/dagger
3,323
Support configuring additional options for secrets
Buildkit's full `SecretInfo` struct is as follows: ```go type SecretInfo struct { ID string Target string Mode int UID int GID int Optional bool IsEnv bool } ``` We already support `ID`, `Target`, and `IsEnv` but maybe folks will have a use for `Mode`, `UID`, `GUID`, and/or `Optional`.
https://github.com/dagger/dagger/issues/3323
https://github.com/dagger/dagger/pull/5707
e5feaea7f1d6eb01d834e83b180fc3daed3463ea
1ddf4ea46492a1aad850906c0c78c58e43d873c4
2022-10-11T23:15:04Z
go
2023-09-12T06:56:33Z
core/container.go
ctx, release, err = leaseutil.WithLease(ctx, lm, leaseutil.MakeTemporary) if err != nil { return nil, err } stream := archive.NewImageImportStream(src, "") desc, err := stream.Import(ctx, store) if err != nil { return nil, fmt.Errorf("image archive import: %w", err) } return resolveIndex(ctx, store, desc, container.Platform, tag) } key := cacheKey( file, tag, container.Platform, clientMetadata.ClientID, ) manifestDesc, err := importCache.GetOrInitialize(key, loadManifest) if err != nil { return nil, err } if _, err := store.Info(ctx, manifestDesc.Digest); err != nil { manifestDesc, err = loadManifest() if err != nil {
closed
dagger/dagger
https://github.com/dagger/dagger
3,323
Support configuring additional options for secrets
Buildkit's full `SecretInfo` struct is as follows: ```go type SecretInfo struct { ID string Target string Mode int UID int GID int Optional bool IsEnv bool } ``` We already support `ID`, `Target`, and `IsEnv` but maybe folks will have a use for `Mode`, `UID`, `GUID`, and/or `Optional`.
https://github.com/dagger/dagger/issues/3323
https://github.com/dagger/dagger/pull/5707
e5feaea7f1d6eb01d834e83b180fc3daed3463ea
1ddf4ea46492a1aad850906c0c78c58e43d873c4
2022-10-11T23:15:04Z
go
2023-09-12T06:56:33Z
core/container.go
return nil, fmt.Errorf("recover: %w", err) } } dummyRepo := "dagger/import" st := llb.OCILayout( fmt.Sprintf("%s@%s", dummyRepo, manifestDesc.Digest), llb.OCIStore("", OCIStoreName), llb.Platform(container.Platform), ) execDef, err := st.Marshal(ctx, llb.Platform(container.Platform)) if err != nil { return nil, fmt.Errorf("marshal root: %w", err) } container.FS = execDef.ToPB() if release != nil { _, err = bk.Solve(ctx, bkgw.SolveRequest{ Definition: container.FS, Evaluate: true, }) if err != nil { return nil, fmt.Errorf("solve: %w", err) } if err := release(ctx); err != nil { return nil, fmt.Errorf("release: %w", err) } } manifestBlob, err := content.ReadBlob(ctx, store, *manifestDesc)
closed
dagger/dagger
https://github.com/dagger/dagger
3,323
Support configuring additional options for secrets
Buildkit's full `SecretInfo` struct is as follows: ```go type SecretInfo struct { ID string Target string Mode int UID int GID int Optional bool IsEnv bool } ``` We already support `ID`, `Target`, and `IsEnv` but maybe folks will have a use for `Mode`, `UID`, `GUID`, and/or `Optional`.
https://github.com/dagger/dagger/issues/3323
https://github.com/dagger/dagger/pull/5707
e5feaea7f1d6eb01d834e83b180fc3daed3463ea
1ddf4ea46492a1aad850906c0c78c58e43d873c4
2022-10-11T23:15:04Z
go
2023-09-12T06:56:33Z
core/container.go
if err != nil { return nil, fmt.Errorf("image archive read manifest blob: %w", err) } var man specs.Manifest err = json.Unmarshal(manifestBlob, &man) if err != nil { return nil, fmt.Errorf("image archive unmarshal manifest: %w", err) } configBlob, err := content.ReadBlob(ctx, store, man.Config) if err != nil { return nil, fmt.Errorf("image archive read image config blob %s: %w", man.Config.Digest, err) } var imgSpec specs.Image err = json.Unmarshal(configBlob, &imgSpec) if err != nil { return nil, fmt.Errorf("load image config: %w", err) } container.Config = imgSpec.Config return container, nil } func (container *Container) HostnameOrErr() (string, error) { dig, err := container.Digest() if err != nil { return "", err } return network.HostHash(dig), nil } func (container *Container) Endpoint(bk *buildkit.Client, port int, scheme string) (string, error) { if port == 0 { if len(container.Ports) == 0 {
closed
dagger/dagger
https://github.com/dagger/dagger
3,323
Support configuring additional options for secrets
Buildkit's full `SecretInfo` struct is as follows: ```go type SecretInfo struct { ID string Target string Mode int UID int GID int Optional bool IsEnv bool } ``` We already support `ID`, `Target`, and `IsEnv` but maybe folks will have a use for `Mode`, `UID`, `GUID`, and/or `Optional`.
https://github.com/dagger/dagger/issues/3323
https://github.com/dagger/dagger/pull/5707
e5feaea7f1d6eb01d834e83b180fc3daed3463ea
1ddf4ea46492a1aad850906c0c78c58e43d873c4
2022-10-11T23:15:04Z
go
2023-09-12T06:56:33Z
core/container.go
return "", fmt.Errorf("no ports exposed") } port = container.Ports[0].Port } host, err := container.HostnameOrErr() if err != nil { return "", err } endpoint := fmt.Sprintf("%s:%d", host, port) if scheme != "" { endpoint = scheme + ":" + endpoint } return endpoint, nil } func (container *Container) WithExposedPort(port ContainerPort) (*Container, error) { container = container.Clone() gotOne := false for i, p := range container.Ports { if p.Port == port.Port && p.Protocol == port.Protocol { container.Ports[i] = port gotOne = true break } } if !gotOne { container.Ports = append(container.Ports, port) } if container.Config.ExposedPorts == nil { container.Config.ExposedPorts = map[string]struct{}{}
closed
dagger/dagger
https://github.com/dagger/dagger
3,323
Support configuring additional options for secrets
Buildkit's full `SecretInfo` struct is as follows: ```go type SecretInfo struct { ID string Target string Mode int UID int GID int Optional bool IsEnv bool } ``` We already support `ID`, `Target`, and `IsEnv` but maybe folks will have a use for `Mode`, `UID`, `GUID`, and/or `Optional`.
https://github.com/dagger/dagger/issues/3323
https://github.com/dagger/dagger/pull/5707
e5feaea7f1d6eb01d834e83b180fc3daed3463ea
1ddf4ea46492a1aad850906c0c78c58e43d873c4
2022-10-11T23:15:04Z
go
2023-09-12T06:56:33Z
core/container.go
} ociPort := fmt.Sprintf("%d/%s", port.Port, port.Protocol.Network()) container.Config.ExposedPorts[ociPort] = struct{}{} return container, nil } func (container *Container) WithoutExposedPort(port int, protocol NetworkProtocol) (*Container, error) { container = container.Clone() filtered := []ContainerPort{} filteredOCI := map[string]struct{}{} for _, p := range container.Ports { if p.Port != port || p.Protocol != protocol { filtered = append(filtered, p) ociPort := fmt.Sprintf("%d/%s", p.Port, p.Protocol.Network()) filteredOCI[ociPort] = struct{}{} } } container.Ports = filtered container.Config.ExposedPorts = filteredOCI return container, nil } func (container *Container) WithServiceBinding(bk *buildkit.Client, svc *Container, alias string) (*Container, error) { container = container.Clone() svcID, err := svc.ID() if err != nil { return nil, err } container.Services.Merge(ServiceBindings{ svcID: AliasSet{alias}, }) if alias != "" {
closed
dagger/dagger
https://github.com/dagger/dagger
3,323
Support configuring additional options for secrets
Buildkit's full `SecretInfo` struct is as follows: ```go type SecretInfo struct { ID string Target string Mode int UID int GID int Optional bool IsEnv bool } ``` We already support `ID`, `Target`, and `IsEnv` but maybe folks will have a use for `Mode`, `UID`, `GUID`, and/or `Optional`.
https://github.com/dagger/dagger/issues/3323
https://github.com/dagger/dagger/pull/5707
e5feaea7f1d6eb01d834e83b180fc3daed3463ea
1ddf4ea46492a1aad850906c0c78c58e43d873c4
2022-10-11T23:15:04Z
go
2023-09-12T06:56:33Z
core/container.go
hn, err := svc.HostnameOrErr() if err != nil { return nil, fmt.Errorf("get hostname: %w", err) } container.HostAliases = append(container.HostAliases, HostAlias{ Alias: alias, Target: hn, }) } return container, nil } func (container *Container) ImageRefOrErr(ctx context.Context, bk *buildkit.Client) (string, error) { imgRef := container.ImageRef if imgRef != "" { return imgRef, nil } return "", errors.Errorf("Image reference can only be retrieved immediately after the 'Container.From' call. Error in fetching imageRef as the container image is changed") } func (container *Container) ownership(ctx context.Context, bk *buildkit.Client, owner string) (*Ownership, error) { if owner == "" { return nil, nil } fsSt, err := container.FSState() if err != nil { return nil, err } return resolveUIDGID(ctx, fsSt, bk, container.Platform, owner) } type ContainerExecOpts struct {
closed
dagger/dagger
https://github.com/dagger/dagger
3,323
Support configuring additional options for secrets
Buildkit's full `SecretInfo` struct is as follows: ```go type SecretInfo struct { ID string Target string Mode int UID int GID int Optional bool IsEnv bool } ``` We already support `ID`, `Target`, and `IsEnv` but maybe folks will have a use for `Mode`, `UID`, `GUID`, and/or `Optional`.
https://github.com/dagger/dagger/issues/3323
https://github.com/dagger/dagger/pull/5707
e5feaea7f1d6eb01d834e83b180fc3daed3463ea
1ddf4ea46492a1aad850906c0c78c58e43d873c4
2022-10-11T23:15:04Z
go
2023-09-12T06:56:33Z
core/container.go
Args []string SkipEntrypoint bool Stdin string RedirectStdout string RedirectStderr string ExperimentalPrivilegedNesting bool InsecureRootCapabilities bool } type BuildArg struct {
closed
dagger/dagger
https://github.com/dagger/dagger
3,323
Support configuring additional options for secrets
Buildkit's full `SecretInfo` struct is as follows: ```go type SecretInfo struct { ID string Target string Mode int UID int GID int Optional bool IsEnv bool } ``` We already support `ID`, `Target`, and `IsEnv` but maybe folks will have a use for `Mode`, `UID`, `GUID`, and/or `Optional`.
https://github.com/dagger/dagger/issues/3323
https://github.com/dagger/dagger/pull/5707
e5feaea7f1d6eb01d834e83b180fc3daed3463ea
1ddf4ea46492a1aad850906c0c78c58e43d873c4
2022-10-11T23:15:04Z
go
2023-09-12T06:56:33Z
core/container.go
Name string `json:"name"` Value string `json:"value"` } const ociTagAnnotation = "org.opencontainers.image.ref.name" func resolveIndex(ctx context.Context, store content.Store, desc specs.Descriptor, platform specs.Platform, tag string) (*specs.Descriptor, error) { if desc.MediaType != specs.MediaTypeImageIndex { return nil, fmt.Errorf("expected index, got %s", desc.MediaType) } indexBlob, err := content.ReadBlob(ctx, store, desc) if err != nil { return nil, fmt.Errorf("read index blob: %w", err) } var idx specs.Index err = json.Unmarshal(indexBlob, &idx) if err != nil { return nil, fmt.Errorf("unmarshal index: %w", err) } matcher := platforms.Only(platform) for _, m := range idx.Manifests { if m.Platform != nil { if !matcher.Match(*m.Platform) { continue } } if tag != "" { if m.Annotations == nil { continue } manifestTag, found := m.Annotations[ociTagAnnotation]
closed
dagger/dagger
https://github.com/dagger/dagger
3,323
Support configuring additional options for secrets
Buildkit's full `SecretInfo` struct is as follows: ```go type SecretInfo struct { ID string Target string Mode int UID int GID int Optional bool IsEnv bool } ``` We already support `ID`, `Target`, and `IsEnv` but maybe folks will have a use for `Mode`, `UID`, `GUID`, and/or `Optional`.
https://github.com/dagger/dagger/issues/3323
https://github.com/dagger/dagger/pull/5707
e5feaea7f1d6eb01d834e83b180fc3daed3463ea
1ddf4ea46492a1aad850906c0c78c58e43d873c4
2022-10-11T23:15:04Z
go
2023-09-12T06:56:33Z
core/container.go
if !found || manifestTag != tag { continue } } switch m.MediaType { case specs.MediaTypeImageManifest, images.MediaTypeDockerSchema2Manifest: return &m, nil case specs.MediaTypeImageIndex, images.MediaTypeDockerSchema2ManifestList: return resolveIndex(ctx, store, m, platform, tag) default: return nil, fmt.Errorf("expected manifest or index, got %s", m.MediaType) } } return nil, fmt.Errorf("no manifest for platform %s and tag %s", platforms.Format(platform), tag) } type ImageLayerCompression string const ( CompressionGzip ImageLayerCompression = "Gzip" CompressionZstd ImageLayerCompression = "Zstd" CompressionEStarGZ ImageLayerCompression = "EStarGZ" CompressionUncompressed ImageLayerCompression = "Uncompressed" ) type ImageMediaTypes string const ( OCIMediaTypes ImageMediaTypes = "OCIMediaTypes" DockerMediaTypes ImageMediaTypes = "DockerMediaTypes" ) type ContainerExecUncachedMetadata struct {
closed
dagger/dagger
https://github.com/dagger/dagger
3,323
Support configuring additional options for secrets
Buildkit's full `SecretInfo` struct is as follows: ```go type SecretInfo struct { ID string Target string Mode int UID int GID int Optional bool IsEnv bool } ``` We already support `ID`, `Target`, and `IsEnv` but maybe folks will have a use for `Mode`, `UID`, `GUID`, and/or `Optional`.
https://github.com/dagger/dagger/issues/3323
https://github.com/dagger/dagger/pull/5707
e5feaea7f1d6eb01d834e83b180fc3daed3463ea
1ddf4ea46492a1aad850906c0c78c58e43d873c4
2022-10-11T23:15:04Z
go
2023-09-12T06:56:33Z
core/container.go
ParentClientIDs []string `json:"parentClientIDs,omitempty"` ServerID string `json:"serverID,omitempty"` ProgSockPath string `json:"progSockPath,omitempty"` } func (md ContainerExecUncachedMetadata) ToLLBRunOpt() (llb.RunOption, error) { b, err := json.Marshal(md) if err != nil { return nil, err } return llb.WithProxy(llb.ProxyEnv{ FTPProxy: string(b), }), nil } func (md *ContainerExecUncachedMetadata) FromEnv(envKV string) (bool, error) { _, val, ok := strings.Cut(envKV, "ftp_proxy=") if !ok { return false, nil } err := json.Unmarshal([]byte(val), md) if err != nil { return false, err } return true, nil }
closed
dagger/dagger
https://github.com/dagger/dagger
3,323
Support configuring additional options for secrets
Buildkit's full `SecretInfo` struct is as follows: ```go type SecretInfo struct { ID string Target string Mode int UID int GID int Optional bool IsEnv bool } ``` We already support `ID`, `Target`, and `IsEnv` but maybe folks will have a use for `Mode`, `UID`, `GUID`, and/or `Optional`.
https://github.com/dagger/dagger/issues/3323
https://github.com/dagger/dagger/pull/5707
e5feaea7f1d6eb01d834e83b180fc3daed3463ea
1ddf4ea46492a1aad850906c0c78c58e43d873c4
2022-10-11T23:15:04Z
go
2023-09-12T06:56:33Z
core/integration/container_test.go
package core import ( "bytes" "context" _ "embed" "encoding/base64" "encoding/json" "errors" "fmt" "io" "net" "net/http" "os" "path" "path/filepath" "strconv" "strings" "testing" "dagger.io/dagger" "github.com/containerd/containerd/platforms" "github.com/dagger/dagger/core" "github.com/dagger/dagger/core/schema" "github.com/dagger/dagger/engine/buildkit" "github.com/dagger/dagger/internal/testutil" "github.com/google/go-containerregistry/pkg/name" "github.com/google/go-containerregistry/pkg/v1/remote"
closed
dagger/dagger
https://github.com/dagger/dagger
3,323
Support configuring additional options for secrets
Buildkit's full `SecretInfo` struct is as follows: ```go type SecretInfo struct { ID string Target string Mode int UID int GID int Optional bool IsEnv bool } ``` We already support `ID`, `Target`, and `IsEnv` but maybe folks will have a use for `Mode`, `UID`, `GUID`, and/or `Optional`.
https://github.com/dagger/dagger/issues/3323
https://github.com/dagger/dagger/pull/5707
e5feaea7f1d6eb01d834e83b180fc3daed3463ea
1ddf4ea46492a1aad850906c0c78c58e43d873c4
2022-10-11T23:15:04Z
go
2023-09-12T06:56:33Z
core/integration/container_test.go
"github.com/moby/buildkit/identity" ocispecs "github.com/opencontainers/image-spec/specs-go/v1" "github.com/stretchr/testify/require" "gopkg.in/yaml.v3" ) func TestContainerScratch(t *testing.T) { t.Parallel() res := struct { Container struct { ID string Rootfs struct { Entries []string } } }{} err := testutil.Query( `{ container { id rootfs { entries } } }`, &res, nil) require.NoError(t, err) require.Empty(t, res.Container.Rootfs.Entries) } func TestContainerFrom(t *testing.T) { t.Parallel() res := struct {
closed
dagger/dagger
https://github.com/dagger/dagger
3,323
Support configuring additional options for secrets
Buildkit's full `SecretInfo` struct is as follows: ```go type SecretInfo struct { ID string Target string Mode int UID int GID int Optional bool IsEnv bool } ``` We already support `ID`, `Target`, and `IsEnv` but maybe folks will have a use for `Mode`, `UID`, `GUID`, and/or `Optional`.
https://github.com/dagger/dagger/issues/3323
https://github.com/dagger/dagger/pull/5707
e5feaea7f1d6eb01d834e83b180fc3daed3463ea
1ddf4ea46492a1aad850906c0c78c58e43d873c4
2022-10-11T23:15:04Z
go
2023-09-12T06:56:33Z
core/integration/container_test.go
Container struct { From struct { File struct { Contents string } } } }{} err := testutil.Query( `{ container { from(address: "`+alpineImage+`") { file(path: "/etc/alpine-release") { contents } } } }`, &res, nil) require.NoError(t, err) require.Equal(t, res.Container.From.File.Contents, "3.18.2\n") } func TestContainerBuild(t *testing.T) {
closed
dagger/dagger
https://github.com/dagger/dagger
3,323
Support configuring additional options for secrets
Buildkit's full `SecretInfo` struct is as follows: ```go type SecretInfo struct { ID string Target string Mode int UID int GID int Optional bool IsEnv bool } ``` We already support `ID`, `Target`, and `IsEnv` but maybe folks will have a use for `Mode`, `UID`, `GUID`, and/or `Optional`.
https://github.com/dagger/dagger/issues/3323
https://github.com/dagger/dagger/pull/5707
e5feaea7f1d6eb01d834e83b180fc3daed3463ea
1ddf4ea46492a1aad850906c0c78c58e43d873c4
2022-10-11T23:15:04Z
go
2023-09-12T06:56:33Z
core/integration/container_test.go
c, ctx := connect(t) contextDir := c.Directory(). WithNewFile("main.go", `package main import "fmt" import "os" func main() { for _, env := range os.Environ() { fmt.Println(env) } }`) t.Run("default Dockerfile location", func(t *testing.T) { src := contextDir. WithNewFile("Dockerfile", `FROM golang:1.18.2-alpine WORKDIR /src COPY main.go . RUN go mod init hello RUN go build -o /usr/bin/goenv main.go ENV FOO=bar CMD goenv `) env, err := c.Container().Build(src).Stdout(ctx) require.NoError(t, err) require.Contains(t, env, "FOO=bar\n") }) t.Run("custom Dockerfile location", func(t *testing.T) {
closed
dagger/dagger
https://github.com/dagger/dagger
3,323
Support configuring additional options for secrets
Buildkit's full `SecretInfo` struct is as follows: ```go type SecretInfo struct { ID string Target string Mode int UID int GID int Optional bool IsEnv bool } ``` We already support `ID`, `Target`, and `IsEnv` but maybe folks will have a use for `Mode`, `UID`, `GUID`, and/or `Optional`.
https://github.com/dagger/dagger/issues/3323
https://github.com/dagger/dagger/pull/5707
e5feaea7f1d6eb01d834e83b180fc3daed3463ea
1ddf4ea46492a1aad850906c0c78c58e43d873c4
2022-10-11T23:15:04Z
go
2023-09-12T06:56:33Z
core/integration/container_test.go
src := contextDir. WithNewFile("subdir/Dockerfile.whee", `FROM golang:1.18.2-alpine WORKDIR /src COPY main.go . RUN go mod init hello RUN go build -o /usr/bin/goenv main.go ENV FOO=bar CMD goenv `) env, err := c.Container().Build(src, dagger.ContainerBuildOpts{ Dockerfile: "subdir/Dockerfile.whee", }).Stdout(ctx) require.NoError(t, err) require.Contains(t, env, "FOO=bar\n") }) t.Run("subdirectory with default Dockerfile location", func(t *testing.T) { src := contextDir. WithNewFile("Dockerfile", `FROM golang:1.18.2-alpine WORKDIR /src COPY main.go . RUN go mod init hello RUN go build -o /usr/bin/goenv main.go ENV FOO=bar CMD goenv `) sub := c.Directory().WithDirectory("subcontext", src).Directory("subcontext") env, err := c.Container().Build(sub).Stdout(ctx) require.NoError(t, err)
closed
dagger/dagger
https://github.com/dagger/dagger
3,323
Support configuring additional options for secrets
Buildkit's full `SecretInfo` struct is as follows: ```go type SecretInfo struct { ID string Target string Mode int UID int GID int Optional bool IsEnv bool } ``` We already support `ID`, `Target`, and `IsEnv` but maybe folks will have a use for `Mode`, `UID`, `GUID`, and/or `Optional`.
https://github.com/dagger/dagger/issues/3323
https://github.com/dagger/dagger/pull/5707
e5feaea7f1d6eb01d834e83b180fc3daed3463ea
1ddf4ea46492a1aad850906c0c78c58e43d873c4
2022-10-11T23:15:04Z
go
2023-09-12T06:56:33Z
core/integration/container_test.go
require.Contains(t, env, "FOO=bar\n") }) t.Run("subdirectory with custom Dockerfile location", func(t *testing.T) { src := contextDir. WithNewFile("subdir/Dockerfile.whee", `FROM golang:1.18.2-alpine WORKDIR /src COPY main.go . RUN go mod init hello RUN go build -o /usr/bin/goenv main.go ENV FOO=bar CMD goenv `) sub := c.Directory().WithDirectory("subcontext", src).Directory("subcontext") env, err := c.Container().Build(sub, dagger.ContainerBuildOpts{ Dockerfile: "subdir/Dockerfile.whee", }).Stdout(ctx) require.NoError(t, err) require.Contains(t, env, "FOO=bar\n") }) t.Run("with build args", func(t *testing.T) { src := contextDir. WithNewFile("Dockerfile", `FROM golang:1.18.2-alpine ARG FOOARG=bar WORKDIR /src COPY main.go . RUN go mod init hello RUN go build -o /usr/bin/goenv main.go ENV FOO=$FOOARG
closed
dagger/dagger
https://github.com/dagger/dagger
3,323
Support configuring additional options for secrets
Buildkit's full `SecretInfo` struct is as follows: ```go type SecretInfo struct { ID string Target string Mode int UID int GID int Optional bool IsEnv bool } ``` We already support `ID`, `Target`, and `IsEnv` but maybe folks will have a use for `Mode`, `UID`, `GUID`, and/or `Optional`.
https://github.com/dagger/dagger/issues/3323
https://github.com/dagger/dagger/pull/5707
e5feaea7f1d6eb01d834e83b180fc3daed3463ea
1ddf4ea46492a1aad850906c0c78c58e43d873c4
2022-10-11T23:15:04Z
go
2023-09-12T06:56:33Z
core/integration/container_test.go
CMD goenv `) env, err := c.Container().Build(src).Stdout(ctx) require.NoError(t, err) require.Contains(t, env, "FOO=bar\n") env, err = c.Container().Build(src, dagger.ContainerBuildOpts{BuildArgs: []dagger.BuildArg{{Name: "FOOARG", Value: "barbar"}}}).Stdout(ctx) require.NoError(t, err) require.Contains(t, env, "FOO=barbar\n") }) t.Run("with target", func(t *testing.T) { src := contextDir. WithNewFile("Dockerfile", `FROM golang:1.18.2-alpine AS base CMD echo "base" FROM base AS stage1 CMD echo "stage1" FROM base AS stage2 CMD echo "stage2" `) output, err := c.Container().Build(src).Stdout(ctx) require.NoError(t, err) require.Contains(t, output, "stage2\n") output, err = c.Container().Build(src, dagger.ContainerBuildOpts{Target: "stage1"}).Stdout(ctx) require.NoError(t, err) require.Contains(t, output, "stage1\n") require.NotContains(t, output, "stage2\n") }) t.Run("with build secrets", func(t *testing.T) { sec := c.SetSecret("my-secret", "barbar") src := contextDir.
closed
dagger/dagger
https://github.com/dagger/dagger
3,323
Support configuring additional options for secrets
Buildkit's full `SecretInfo` struct is as follows: ```go type SecretInfo struct { ID string Target string Mode int UID int GID int Optional bool IsEnv bool } ``` We already support `ID`, `Target`, and `IsEnv` but maybe folks will have a use for `Mode`, `UID`, `GUID`, and/or `Optional`.
https://github.com/dagger/dagger/issues/3323
https://github.com/dagger/dagger/pull/5707
e5feaea7f1d6eb01d834e83b180fc3daed3463ea
1ddf4ea46492a1aad850906c0c78c58e43d873c4
2022-10-11T23:15:04Z
go
2023-09-12T06:56:33Z
core/integration/container_test.go
WithNewFile("Dockerfile", `FROM golang:1.18.2-alpine WORKDIR /src RUN --mount=type=secret,id=my-secret test "$(cat /run/secrets/my-secret)" = "barbar" RUN --mount=type=secret,id=my-secret cp /run/secrets/my-secret /secret CMD cat /secret `) stdout, err := c.Container().Build(src, dagger.ContainerBuildOpts{ Secrets: []*dagger.Secret{sec}, }).Stdout(ctx) require.NoError(t, err) require.Contains(t, stdout, "***") }) t.Run("just build, don't execute", func(t *testing.T) { src := contextDir. WithNewFile("Dockerfile", "FROM "+alpineImage+"\nCMD false") _, err := c.Container().Build(src).Sync(ctx) require.NoError(t, err) _, err = c.Container().Build(src).WithExec(nil).Sync(ctx) require.NotEmpty(t, err) }) t.Run("just build, short-circuit", func(t *testing.T) { src := contextDir. WithNewFile("Dockerfile", "FROM "+alpineImage+"\nRUN false") _, err := c.Container().Build(src).Sync(ctx) require.NotEmpty(t, err) }) } func TestContainerWithRootFS(t *testing.T) {
closed
dagger/dagger
https://github.com/dagger/dagger
3,323
Support configuring additional options for secrets
Buildkit's full `SecretInfo` struct is as follows: ```go type SecretInfo struct { ID string Target string Mode int UID int GID int Optional bool IsEnv bool } ``` We already support `ID`, `Target`, and `IsEnv` but maybe folks will have a use for `Mode`, `UID`, `GUID`, and/or `Optional`.
https://github.com/dagger/dagger/issues/3323
https://github.com/dagger/dagger/pull/5707
e5feaea7f1d6eb01d834e83b180fc3daed3463ea
1ddf4ea46492a1aad850906c0c78c58e43d873c4
2022-10-11T23:15:04Z
go
2023-09-12T06:56:33Z
core/integration/container_test.go
t.Parallel() c, ctx := connect(t) alpine316 := c.Container().From(alpineImage) alpine316ReleaseStr, err := alpine316.File("/etc/alpine-release").Contents(ctx) require.NoError(t, err) alpine316ReleaseStr = strings.TrimSpace(alpine316ReleaseStr) dir := alpine316.Rootfs() _, err = c.Container().WithEnvVariable("ALPINE_RELEASE", alpine316ReleaseStr).WithRootfs(dir).WithExec([]string{ "/bin/sh", "-c", "test -f /etc/alpine-release && test \"$(head -n 1 /etc/alpine-release)\" = \"$ALPINE_RELEASE\"", }).Sync(ctx) require.NoError(t, err) alpine315 := c.Container().From(alpineImage) varVal := "testing123" alpine315WithVar := alpine315.WithEnvVariable("DAGGER_TEST", varVal) varValResp, err := alpine315WithVar.EnvVariable(ctx, "DAGGER_TEST") require.NoError(t, err) require.Equal(t, varVal, varValResp) alpine315ReplacedFS := alpine315WithVar.WithRootfs(dir) varValResp, err = alpine315ReplacedFS.EnvVariable(ctx, "DAGGER_TEST") require.NoError(t, err) require.Equal(t, varVal, varValResp) releaseStr, err := alpine315ReplacedFS.File("/etc/alpine-release").Contents(ctx) require.NoError(t, err) require.Equal(t, "3.18.2\n", releaseStr) } var helloSrc string func TestContainerWithRootFSSubdir(t *testing.T) {
closed
dagger/dagger
https://github.com/dagger/dagger
3,323
Support configuring additional options for secrets
Buildkit's full `SecretInfo` struct is as follows: ```go type SecretInfo struct { ID string Target string Mode int UID int GID int Optional bool IsEnv bool } ``` We already support `ID`, `Target`, and `IsEnv` but maybe folks will have a use for `Mode`, `UID`, `GUID`, and/or `Optional`.
https://github.com/dagger/dagger/issues/3323
https://github.com/dagger/dagger/pull/5707
e5feaea7f1d6eb01d834e83b180fc3daed3463ea
1ddf4ea46492a1aad850906c0c78c58e43d873c4
2022-10-11T23:15:04Z
go
2023-09-12T06:56:33Z
core/integration/container_test.go
t.Parallel() c, ctx := connect(t) hello := c.Directory().WithNewFile("main.go", helloSrc).File("main.go") ctr := c.Container(). From("golang:1.20.0-alpine"). WithMountedFile("/src/main.go", hello). WithEnvVariable("CGO_ENABLED", "0"). WithExec([]string{"go", "build", "-o", "/out/hello", "/src/main.go"}) out, err := c.Container(). WithRootfs(ctr.Directory("/out")). WithExec([]string{"/hello"}). Stdout(ctx) require.NoError(t, err) require.Equal(t, "Hello, world!\n", out) } func TestContainerExecSync(t *testing.T) {
closed
dagger/dagger
https://github.com/dagger/dagger
3,323
Support configuring additional options for secrets
Buildkit's full `SecretInfo` struct is as follows: ```go type SecretInfo struct { ID string Target string Mode int UID int GID int Optional bool IsEnv bool } ``` We already support `ID`, `Target`, and `IsEnv` but maybe folks will have a use for `Mode`, `UID`, `GUID`, and/or `Optional`.
https://github.com/dagger/dagger/issues/3323
https://github.com/dagger/dagger/pull/5707
e5feaea7f1d6eb01d834e83b180fc3daed3463ea
1ddf4ea46492a1aad850906c0c78c58e43d873c4
2022-10-11T23:15:04Z
go
2023-09-12T06:56:33Z
core/integration/container_test.go
t.Parallel() err := testutil.Query( `{ container { from(address: "`+alpineImage+`") { withExec(args: ["false"]) { sync } } } }`, nil, nil) require.Contains(t, err.Error(), `process "false" did not complete successfully`) } func TestContainerExecStdoutStderr(t *testing.T) { t.Parallel() res := struct {
closed
dagger/dagger
https://github.com/dagger/dagger
3,323
Support configuring additional options for secrets
Buildkit's full `SecretInfo` struct is as follows: ```go type SecretInfo struct { ID string Target string Mode int UID int GID int Optional bool IsEnv bool } ``` We already support `ID`, `Target`, and `IsEnv` but maybe folks will have a use for `Mode`, `UID`, `GUID`, and/or `Optional`.
https://github.com/dagger/dagger/issues/3323
https://github.com/dagger/dagger/pull/5707
e5feaea7f1d6eb01d834e83b180fc3daed3463ea
1ddf4ea46492a1aad850906c0c78c58e43d873c4
2022-10-11T23:15:04Z
go
2023-09-12T06:56:33Z
core/integration/container_test.go
Container struct { From struct { WithExec struct { Stdout string Stderr string } } } }{} err := testutil.Query( `{ container { from(address: "`+alpineImage+`") { withExec(args: ["sh", "-c", "echo hello; echo goodbye >/dev/stderr"]) { stdout stderr } } } }`, &res, nil) require.NoError(t, err) require.Equal(t, res.Container.From.WithExec.Stdout, "hello\n") require.Equal(t, res.Container.From.WithExec.Stderr, "goodbye\n") } func TestContainerExecStdin(t *testing.T) { t.Parallel() res := struct {
closed
dagger/dagger
https://github.com/dagger/dagger
3,323
Support configuring additional options for secrets
Buildkit's full `SecretInfo` struct is as follows: ```go type SecretInfo struct { ID string Target string Mode int UID int GID int Optional bool IsEnv bool } ``` We already support `ID`, `Target`, and `IsEnv` but maybe folks will have a use for `Mode`, `UID`, `GUID`, and/or `Optional`.
https://github.com/dagger/dagger/issues/3323
https://github.com/dagger/dagger/pull/5707
e5feaea7f1d6eb01d834e83b180fc3daed3463ea
1ddf4ea46492a1aad850906c0c78c58e43d873c4
2022-10-11T23:15:04Z
go
2023-09-12T06:56:33Z
core/integration/container_test.go
Container struct { From struct { WithExec struct { Stdout string } } } }{} err := testutil.Query( `{ container { from(address: "`+alpineImage+`") { withExec(args: ["cat"], stdin: "hello") { stdout } } } }`, &res, nil) require.NoError(t, err) require.Equal(t, res.Container.From.WithExec.Stdout, "hello") } func TestContainerExecRedirectStdoutStderr(t *testing.T) { t.Parallel() res := struct {
closed
dagger/dagger
https://github.com/dagger/dagger
3,323
Support configuring additional options for secrets
Buildkit's full `SecretInfo` struct is as follows: ```go type SecretInfo struct { ID string Target string Mode int UID int GID int Optional bool IsEnv bool } ``` We already support `ID`, `Target`, and `IsEnv` but maybe folks will have a use for `Mode`, `UID`, `GUID`, and/or `Optional`.
https://github.com/dagger/dagger/issues/3323
https://github.com/dagger/dagger/pull/5707
e5feaea7f1d6eb01d834e83b180fc3daed3463ea
1ddf4ea46492a1aad850906c0c78c58e43d873c4
2022-10-11T23:15:04Z
go
2023-09-12T06:56:33Z
core/integration/container_test.go
Container struct { From struct { WithExec struct { Out, Err struct { Contents string } } } } }{} err := testutil.Query( `{ container { from(address: "`+alpineImage+`") { withExec( args: ["sh", "-c", "echo hello; echo goodbye >/dev/stderr"], redirectStdout: "out", redirectStderr: "err" ) { out: file(path: "out") { contents } err: file(path: "err") { contents } } }