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,140 | Expand environment variables in `withEnvVariable` values | ### Discussed in https://github.com/dagger/dagger/discussions/5001
<div type='discussions-op-text'>
<sup>Originally posted by **wingyplus** April 21, 2023</sup>
I want to install something and append it to `PATH` to make it accessible. So how to prepend the new directory into the env variable as we do with `PATH`?</div>
Solution proposed by @vito :
> I agree; extending $PATH seems like a common use case. it would be nice to have parity with Dockerfile ENV which supports interpolation.
>
> It might be a surprising default, since who knows what values people might try to set in env vars. An expand: true param would be simple enough to implement by using [os.Expand](https://pkg.go.dev/os#Expand) and fetching values from the current image config.
>
> ```
> container {
> withEnvVariable(name: "PATH", value: "/opt/venv/bin:${PATH}", expand: true) {
> withExec(args: []string{"sh", "-c", "echo $PATH"}) {
> stdout
> }
> }
> }
> ```
> (Interpolate might be a more obvious name.) | https://github.com/dagger/dagger/issues/5140 | https://github.com/dagger/dagger/pull/5160 | c2fcf8390801585188042d12ee8190b436cc9c2f | e171dc4252e464031737b51fee4c54531b4b537d | 2023-05-16T15:18:49Z | go | 2023-05-25T09:29:47Z | core/schema/container.go | Name string
}
func (s *containerSchema) withUser(ctx *router.Context, parent *core.Container, args containerWithUserArgs) (*core.Container, error) {
return parent.UpdateImageConfig(ctx, func(cfg specs.ImageConfig) specs.ImageConfig {
cfg.User = args.Name
return cfg
})
}
func (s *containerSchema) user(ctx *router.Context, parent *core.Container, args containerWithVariableArgs) (string, error) {
cfg, err := parent.ImageConfig(ctx)
if err != nil {
return "", err
}
return cfg.User, nil
}
type containerWithWorkdirArgs struct { |
closed | dagger/dagger | https://github.com/dagger/dagger | 5,140 | Expand environment variables in `withEnvVariable` values | ### Discussed in https://github.com/dagger/dagger/discussions/5001
<div type='discussions-op-text'>
<sup>Originally posted by **wingyplus** April 21, 2023</sup>
I want to install something and append it to `PATH` to make it accessible. So how to prepend the new directory into the env variable as we do with `PATH`?</div>
Solution proposed by @vito :
> I agree; extending $PATH seems like a common use case. it would be nice to have parity with Dockerfile ENV which supports interpolation.
>
> It might be a surprising default, since who knows what values people might try to set in env vars. An expand: true param would be simple enough to implement by using [os.Expand](https://pkg.go.dev/os#Expand) and fetching values from the current image config.
>
> ```
> container {
> withEnvVariable(name: "PATH", value: "/opt/venv/bin:${PATH}", expand: true) {
> withExec(args: []string{"sh", "-c", "echo $PATH"}) {
> stdout
> }
> }
> }
> ```
> (Interpolate might be a more obvious name.) | https://github.com/dagger/dagger/issues/5140 | https://github.com/dagger/dagger/pull/5160 | c2fcf8390801585188042d12ee8190b436cc9c2f | e171dc4252e464031737b51fee4c54531b4b537d | 2023-05-16T15:18:49Z | go | 2023-05-25T09:29:47Z | core/schema/container.go | Path string
}
func (s *containerSchema) withWorkdir(ctx *router.Context, parent *core.Container, args containerWithWorkdirArgs) (*core.Container, error) {
return parent.UpdateImageConfig(ctx, func(cfg specs.ImageConfig) specs.ImageConfig {
cfg.WorkingDir = absPath(cfg.WorkingDir, args.Path)
return cfg
})
}
func (s *containerSchema) workdir(ctx *router.Context, parent *core.Container, args containerWithVariableArgs) (string, error) {
cfg, err := parent.ImageConfig(ctx)
if err != nil {
return "", err
}
return cfg.WorkingDir, nil
}
type containerWithVariableArgs struct { |
closed | dagger/dagger | https://github.com/dagger/dagger | 5,140 | Expand environment variables in `withEnvVariable` values | ### Discussed in https://github.com/dagger/dagger/discussions/5001
<div type='discussions-op-text'>
<sup>Originally posted by **wingyplus** April 21, 2023</sup>
I want to install something and append it to `PATH` to make it accessible. So how to prepend the new directory into the env variable as we do with `PATH`?</div>
Solution proposed by @vito :
> I agree; extending $PATH seems like a common use case. it would be nice to have parity with Dockerfile ENV which supports interpolation.
>
> It might be a surprising default, since who knows what values people might try to set in env vars. An expand: true param would be simple enough to implement by using [os.Expand](https://pkg.go.dev/os#Expand) and fetching values from the current image config.
>
> ```
> container {
> withEnvVariable(name: "PATH", value: "/opt/venv/bin:${PATH}", expand: true) {
> withExec(args: []string{"sh", "-c", "echo $PATH"}) {
> stdout
> }
> }
> }
> ```
> (Interpolate might be a more obvious name.) | https://github.com/dagger/dagger/issues/5140 | https://github.com/dagger/dagger/pull/5160 | c2fcf8390801585188042d12ee8190b436cc9c2f | e171dc4252e464031737b51fee4c54531b4b537d | 2023-05-16T15:18:49Z | go | 2023-05-25T09:29:47Z | core/schema/container.go | Name string
Value string
}
func (s *containerSchema) withEnvVariable(ctx *router.Context, parent *core.Container, args containerWithVariableArgs) (*core.Container, error) {
return parent.UpdateImageConfig(ctx, func(cfg specs.ImageConfig) specs.ImageConfig {
newEnv := []string{}
prefix := args.Name + "="
for _, env := range cfg.Env {
if !strings.HasPrefix(env, prefix) {
newEnv = append(newEnv, env)
}
}
newEnv = append(newEnv, fmt.Sprintf("%s=%s", args.Name, args.Value))
cfg.Env = newEnv
return cfg
})
}
type containerWithoutVariableArgs struct { |
closed | dagger/dagger | https://github.com/dagger/dagger | 5,140 | Expand environment variables in `withEnvVariable` values | ### Discussed in https://github.com/dagger/dagger/discussions/5001
<div type='discussions-op-text'>
<sup>Originally posted by **wingyplus** April 21, 2023</sup>
I want to install something and append it to `PATH` to make it accessible. So how to prepend the new directory into the env variable as we do with `PATH`?</div>
Solution proposed by @vito :
> I agree; extending $PATH seems like a common use case. it would be nice to have parity with Dockerfile ENV which supports interpolation.
>
> It might be a surprising default, since who knows what values people might try to set in env vars. An expand: true param would be simple enough to implement by using [os.Expand](https://pkg.go.dev/os#Expand) and fetching values from the current image config.
>
> ```
> container {
> withEnvVariable(name: "PATH", value: "/opt/venv/bin:${PATH}", expand: true) {
> withExec(args: []string{"sh", "-c", "echo $PATH"}) {
> stdout
> }
> }
> }
> ```
> (Interpolate might be a more obvious name.) | https://github.com/dagger/dagger/issues/5140 | https://github.com/dagger/dagger/pull/5160 | c2fcf8390801585188042d12ee8190b436cc9c2f | e171dc4252e464031737b51fee4c54531b4b537d | 2023-05-16T15:18:49Z | go | 2023-05-25T09:29:47Z | core/schema/container.go | Name string
}
func (s *containerSchema) withoutEnvVariable(ctx *router.Context, parent *core.Container, args containerWithoutVariableArgs) (*core.Container, error) {
return parent.UpdateImageConfig(ctx, func(cfg specs.ImageConfig) specs.ImageConfig {
removedEnv := []string{}
prefix := args.Name + "="
for _, env := range cfg.Env {
if !strings.HasPrefix(env, prefix) {
removedEnv = append(removedEnv, env)
}
}
cfg.Env = removedEnv
return cfg
})
}
type EnvVariable struct { |
closed | dagger/dagger | https://github.com/dagger/dagger | 5,140 | Expand environment variables in `withEnvVariable` values | ### Discussed in https://github.com/dagger/dagger/discussions/5001
<div type='discussions-op-text'>
<sup>Originally posted by **wingyplus** April 21, 2023</sup>
I want to install something and append it to `PATH` to make it accessible. So how to prepend the new directory into the env variable as we do with `PATH`?</div>
Solution proposed by @vito :
> I agree; extending $PATH seems like a common use case. it would be nice to have parity with Dockerfile ENV which supports interpolation.
>
> It might be a surprising default, since who knows what values people might try to set in env vars. An expand: true param would be simple enough to implement by using [os.Expand](https://pkg.go.dev/os#Expand) and fetching values from the current image config.
>
> ```
> container {
> withEnvVariable(name: "PATH", value: "/opt/venv/bin:${PATH}", expand: true) {
> withExec(args: []string{"sh", "-c", "echo $PATH"}) {
> stdout
> }
> }
> }
> ```
> (Interpolate might be a more obvious name.) | https://github.com/dagger/dagger/issues/5140 | https://github.com/dagger/dagger/pull/5160 | c2fcf8390801585188042d12ee8190b436cc9c2f | e171dc4252e464031737b51fee4c54531b4b537d | 2023-05-16T15:18:49Z | go | 2023-05-25T09:29:47Z | core/schema/container.go | Name string `json:"name"`
Value string `json:"value"`
}
func (s *containerSchema) envVariables(ctx *router.Context, parent *core.Container, args any) ([]EnvVariable, error) {
cfg, err := parent.ImageConfig(ctx)
if err != nil {
return nil, err
}
vars := make([]EnvVariable, 0, len(cfg.Env))
for _, v := range cfg.Env {
name, value, _ := strings.Cut(v, "=")
e := EnvVariable{
Name: name,
Value: value,
}
vars = append(vars, e)
}
return vars, nil
}
type containerVariableArgs struct { |
closed | dagger/dagger | https://github.com/dagger/dagger | 5,140 | Expand environment variables in `withEnvVariable` values | ### Discussed in https://github.com/dagger/dagger/discussions/5001
<div type='discussions-op-text'>
<sup>Originally posted by **wingyplus** April 21, 2023</sup>
I want to install something and append it to `PATH` to make it accessible. So how to prepend the new directory into the env variable as we do with `PATH`?</div>
Solution proposed by @vito :
> I agree; extending $PATH seems like a common use case. it would be nice to have parity with Dockerfile ENV which supports interpolation.
>
> It might be a surprising default, since who knows what values people might try to set in env vars. An expand: true param would be simple enough to implement by using [os.Expand](https://pkg.go.dev/os#Expand) and fetching values from the current image config.
>
> ```
> container {
> withEnvVariable(name: "PATH", value: "/opt/venv/bin:${PATH}", expand: true) {
> withExec(args: []string{"sh", "-c", "echo $PATH"}) {
> stdout
> }
> }
> }
> ```
> (Interpolate might be a more obvious name.) | https://github.com/dagger/dagger/issues/5140 | https://github.com/dagger/dagger/pull/5160 | c2fcf8390801585188042d12ee8190b436cc9c2f | e171dc4252e464031737b51fee4c54531b4b537d | 2023-05-16T15:18:49Z | go | 2023-05-25T09:29:47Z | core/schema/container.go | Name string
}
func (s *containerSchema) envVariable(ctx *router.Context, parent *core.Container, args containerVariableArgs) (*string, error) {
cfg, err := parent.ImageConfig(ctx)
if err != nil {
return nil, err
}
for _, env := range cfg.Env {
name, val, ok := strings.Cut(env, "=")
if ok && name == args.Name {
return &val, nil
}
}
return nil, nil
}
type Label struct { |
closed | dagger/dagger | https://github.com/dagger/dagger | 5,140 | Expand environment variables in `withEnvVariable` values | ### Discussed in https://github.com/dagger/dagger/discussions/5001
<div type='discussions-op-text'>
<sup>Originally posted by **wingyplus** April 21, 2023</sup>
I want to install something and append it to `PATH` to make it accessible. So how to prepend the new directory into the env variable as we do with `PATH`?</div>
Solution proposed by @vito :
> I agree; extending $PATH seems like a common use case. it would be nice to have parity with Dockerfile ENV which supports interpolation.
>
> It might be a surprising default, since who knows what values people might try to set in env vars. An expand: true param would be simple enough to implement by using [os.Expand](https://pkg.go.dev/os#Expand) and fetching values from the current image config.
>
> ```
> container {
> withEnvVariable(name: "PATH", value: "/opt/venv/bin:${PATH}", expand: true) {
> withExec(args: []string{"sh", "-c", "echo $PATH"}) {
> stdout
> }
> }
> }
> ```
> (Interpolate might be a more obvious name.) | https://github.com/dagger/dagger/issues/5140 | https://github.com/dagger/dagger/pull/5160 | c2fcf8390801585188042d12ee8190b436cc9c2f | e171dc4252e464031737b51fee4c54531b4b537d | 2023-05-16T15:18:49Z | go | 2023-05-25T09:29:47Z | core/schema/container.go | Name string `json:"name"`
Value string `json:"value"`
}
func (s *containerSchema) labels(ctx *router.Context, parent *core.Container, args any) ([]Label, error) {
cfg, err := parent.ImageConfig(ctx)
if err != nil {
return nil, err
}
labels := make([]Label, 0, len(cfg.Labels))
for name, value := range cfg.Labels {
label := Label{
Name: name,
Value: value,
}
labels = append(labels, label)
}
return labels, nil
}
type containerLabelArgs struct { |
closed | dagger/dagger | https://github.com/dagger/dagger | 5,140 | Expand environment variables in `withEnvVariable` values | ### Discussed in https://github.com/dagger/dagger/discussions/5001
<div type='discussions-op-text'>
<sup>Originally posted by **wingyplus** April 21, 2023</sup>
I want to install something and append it to `PATH` to make it accessible. So how to prepend the new directory into the env variable as we do with `PATH`?</div>
Solution proposed by @vito :
> I agree; extending $PATH seems like a common use case. it would be nice to have parity with Dockerfile ENV which supports interpolation.
>
> It might be a surprising default, since who knows what values people might try to set in env vars. An expand: true param would be simple enough to implement by using [os.Expand](https://pkg.go.dev/os#Expand) and fetching values from the current image config.
>
> ```
> container {
> withEnvVariable(name: "PATH", value: "/opt/venv/bin:${PATH}", expand: true) {
> withExec(args: []string{"sh", "-c", "echo $PATH"}) {
> stdout
> }
> }
> }
> ```
> (Interpolate might be a more obvious name.) | https://github.com/dagger/dagger/issues/5140 | https://github.com/dagger/dagger/pull/5160 | c2fcf8390801585188042d12ee8190b436cc9c2f | e171dc4252e464031737b51fee4c54531b4b537d | 2023-05-16T15:18:49Z | go | 2023-05-25T09:29:47Z | core/schema/container.go | Name string
}
func (s *containerSchema) label(ctx *router.Context, parent *core.Container, args containerLabelArgs) (*string, error) {
cfg, err := parent.ImageConfig(ctx)
if err != nil {
return nil, err
}
if val, ok := cfg.Labels[args.Name]; ok {
return &val, nil
}
return nil, nil
}
type containerWithMountedDirectoryArgs struct {
Path string
Source core.DirectoryID
Owner string
}
func (s *containerSchema) withMountedDirectory(ctx *router.Context, parent *core.Container, args containerWithMountedDirectoryArgs) (*core.Container, error) {
dir, err := args.Source.ToDirectory()
if err != nil {
return nil, err
}
return parent.WithMountedDirectory(ctx, s.gw, args.Path, dir, args.Owner)
}
type containerPublishArgs struct { |
closed | dagger/dagger | https://github.com/dagger/dagger | 5,140 | Expand environment variables in `withEnvVariable` values | ### Discussed in https://github.com/dagger/dagger/discussions/5001
<div type='discussions-op-text'>
<sup>Originally posted by **wingyplus** April 21, 2023</sup>
I want to install something and append it to `PATH` to make it accessible. So how to prepend the new directory into the env variable as we do with `PATH`?</div>
Solution proposed by @vito :
> I agree; extending $PATH seems like a common use case. it would be nice to have parity with Dockerfile ENV which supports interpolation.
>
> It might be a surprising default, since who knows what values people might try to set in env vars. An expand: true param would be simple enough to implement by using [os.Expand](https://pkg.go.dev/os#Expand) and fetching values from the current image config.
>
> ```
> container {
> withEnvVariable(name: "PATH", value: "/opt/venv/bin:${PATH}", expand: true) {
> withExec(args: []string{"sh", "-c", "echo $PATH"}) {
> stdout
> }
> }
> }
> ```
> (Interpolate might be a more obvious name.) | https://github.com/dagger/dagger/issues/5140 | https://github.com/dagger/dagger/pull/5160 | c2fcf8390801585188042d12ee8190b436cc9c2f | e171dc4252e464031737b51fee4c54531b4b537d | 2023-05-16T15:18:49Z | go | 2023-05-25T09:29:47Z | core/schema/container.go | Address string
PlatformVariants []core.ContainerID
ForcedCompression core.ImageLayerCompression
}
func (s *containerSchema) publish(ctx *router.Context, parent *core.Container, args containerPublishArgs) (string, error) {
return parent.Publish(ctx, args.Address, args.PlatformVariants, args.ForcedCompression, s.bkClient, s.solveOpts, s.solveCh)
}
type containerWithMountedFileArgs struct {
Path string
Source core.FileID
Owner string
}
func (s *containerSchema) withMountedFile(ctx *router.Context, parent *core.Container, args containerWithMountedFileArgs) (*core.Container, error) {
file, err := args.Source.ToFile()
if err != nil {
return nil, err
}
return parent.WithMountedFile(ctx, s.gw, args.Path, file, args.Owner)
}
type containerWithMountedCacheArgs struct { |
closed | dagger/dagger | https://github.com/dagger/dagger | 5,140 | Expand environment variables in `withEnvVariable` values | ### Discussed in https://github.com/dagger/dagger/discussions/5001
<div type='discussions-op-text'>
<sup>Originally posted by **wingyplus** April 21, 2023</sup>
I want to install something and append it to `PATH` to make it accessible. So how to prepend the new directory into the env variable as we do with `PATH`?</div>
Solution proposed by @vito :
> I agree; extending $PATH seems like a common use case. it would be nice to have parity with Dockerfile ENV which supports interpolation.
>
> It might be a surprising default, since who knows what values people might try to set in env vars. An expand: true param would be simple enough to implement by using [os.Expand](https://pkg.go.dev/os#Expand) and fetching values from the current image config.
>
> ```
> container {
> withEnvVariable(name: "PATH", value: "/opt/venv/bin:${PATH}", expand: true) {
> withExec(args: []string{"sh", "-c", "echo $PATH"}) {
> stdout
> }
> }
> }
> ```
> (Interpolate might be a more obvious name.) | https://github.com/dagger/dagger/issues/5140 | https://github.com/dagger/dagger/pull/5160 | c2fcf8390801585188042d12ee8190b436cc9c2f | e171dc4252e464031737b51fee4c54531b4b537d | 2023-05-16T15:18:49Z | go | 2023-05-25T09:29:47Z | core/schema/container.go | Path string
Cache core.CacheID
Source core.DirectoryID
Concurrency core.CacheSharingMode
Owner string
}
func (s *containerSchema) withMountedCache(ctx *router.Context, parent *core.Container, args containerWithMountedCacheArgs) (*core.Container, error) {
var dir *core.Directory
if args.Source != "" {
var err error
dir, err = args.Source.ToDirectory()
if err != nil {
return nil, err
}
}
cache, err := args.Cache.ToCacheVolume()
if err != nil {
return nil, err
}
return parent.WithMountedCache(ctx, s.gw, args.Path, cache, dir, args.Concurrency, args.Owner)
}
type containerWithMountedTempArgs struct { |
closed | dagger/dagger | https://github.com/dagger/dagger | 5,140 | Expand environment variables in `withEnvVariable` values | ### Discussed in https://github.com/dagger/dagger/discussions/5001
<div type='discussions-op-text'>
<sup>Originally posted by **wingyplus** April 21, 2023</sup>
I want to install something and append it to `PATH` to make it accessible. So how to prepend the new directory into the env variable as we do with `PATH`?</div>
Solution proposed by @vito :
> I agree; extending $PATH seems like a common use case. it would be nice to have parity with Dockerfile ENV which supports interpolation.
>
> It might be a surprising default, since who knows what values people might try to set in env vars. An expand: true param would be simple enough to implement by using [os.Expand](https://pkg.go.dev/os#Expand) and fetching values from the current image config.
>
> ```
> container {
> withEnvVariable(name: "PATH", value: "/opt/venv/bin:${PATH}", expand: true) {
> withExec(args: []string{"sh", "-c", "echo $PATH"}) {
> stdout
> }
> }
> }
> ```
> (Interpolate might be a more obvious name.) | https://github.com/dagger/dagger/issues/5140 | https://github.com/dagger/dagger/pull/5160 | c2fcf8390801585188042d12ee8190b436cc9c2f | e171dc4252e464031737b51fee4c54531b4b537d | 2023-05-16T15:18:49Z | go | 2023-05-25T09:29:47Z | core/schema/container.go | Path string
}
func (s *containerSchema) withMountedTemp(ctx *router.Context, parent *core.Container, args containerWithMountedTempArgs) (*core.Container, error) {
return parent.WithMountedTemp(ctx, args.Path)
}
type containerWithoutMountArgs struct {
Path string
}
func (s *containerSchema) withoutMount(ctx *router.Context, parent *core.Container, args containerWithoutMountArgs) (*core.Container, error) {
return parent.WithoutMount(ctx, args.Path)
}
func (s *containerSchema) mounts(ctx *router.Context, parent *core.Container, _ any) ([]string, error) {
return parent.MountTargets(ctx)
}
type containerWithLabelArgs struct { |
closed | dagger/dagger | https://github.com/dagger/dagger | 5,140 | Expand environment variables in `withEnvVariable` values | ### Discussed in https://github.com/dagger/dagger/discussions/5001
<div type='discussions-op-text'>
<sup>Originally posted by **wingyplus** April 21, 2023</sup>
I want to install something and append it to `PATH` to make it accessible. So how to prepend the new directory into the env variable as we do with `PATH`?</div>
Solution proposed by @vito :
> I agree; extending $PATH seems like a common use case. it would be nice to have parity with Dockerfile ENV which supports interpolation.
>
> It might be a surprising default, since who knows what values people might try to set in env vars. An expand: true param would be simple enough to implement by using [os.Expand](https://pkg.go.dev/os#Expand) and fetching values from the current image config.
>
> ```
> container {
> withEnvVariable(name: "PATH", value: "/opt/venv/bin:${PATH}", expand: true) {
> withExec(args: []string{"sh", "-c", "echo $PATH"}) {
> stdout
> }
> }
> }
> ```
> (Interpolate might be a more obvious name.) | https://github.com/dagger/dagger/issues/5140 | https://github.com/dagger/dagger/pull/5160 | c2fcf8390801585188042d12ee8190b436cc9c2f | e171dc4252e464031737b51fee4c54531b4b537d | 2023-05-16T15:18:49Z | go | 2023-05-25T09:29:47Z | core/schema/container.go | Name string
Value string
}
func (s *containerSchema) withLabel(ctx *router.Context, parent *core.Container, args containerWithLabelArgs) (*core.Container, error) {
return parent.UpdateImageConfig(ctx, func(cfg specs.ImageConfig) specs.ImageConfig {
if cfg.Labels == nil {
cfg.Labels = make(map[string]string)
}
cfg.Labels[args.Name] = args.Value
return cfg
})
}
type containerWithoutLabelArgs struct {
Name string
}
func (s *containerSchema) withoutLabel(ctx *router.Context, parent *core.Container, args containerWithoutLabelArgs) (*core.Container, error) {
return parent.UpdateImageConfig(ctx, func(cfg specs.ImageConfig) specs.ImageConfig {
delete(cfg.Labels, args.Name)
return cfg
})
}
type containerDirectoryArgs struct {
Path string
}
func (s *containerSchema) directory(ctx *router.Context, parent *core.Container, args containerDirectoryArgs) (*core.Directory, error) {
return parent.Directory(ctx, s.gw, args.Path)
}
type containerFileArgs struct { |
closed | dagger/dagger | https://github.com/dagger/dagger | 5,140 | Expand environment variables in `withEnvVariable` values | ### Discussed in https://github.com/dagger/dagger/discussions/5001
<div type='discussions-op-text'>
<sup>Originally posted by **wingyplus** April 21, 2023</sup>
I want to install something and append it to `PATH` to make it accessible. So how to prepend the new directory into the env variable as we do with `PATH`?</div>
Solution proposed by @vito :
> I agree; extending $PATH seems like a common use case. it would be nice to have parity with Dockerfile ENV which supports interpolation.
>
> It might be a surprising default, since who knows what values people might try to set in env vars. An expand: true param would be simple enough to implement by using [os.Expand](https://pkg.go.dev/os#Expand) and fetching values from the current image config.
>
> ```
> container {
> withEnvVariable(name: "PATH", value: "/opt/venv/bin:${PATH}", expand: true) {
> withExec(args: []string{"sh", "-c", "echo $PATH"}) {
> stdout
> }
> }
> }
> ```
> (Interpolate might be a more obvious name.) | https://github.com/dagger/dagger/issues/5140 | https://github.com/dagger/dagger/pull/5160 | c2fcf8390801585188042d12ee8190b436cc9c2f | e171dc4252e464031737b51fee4c54531b4b537d | 2023-05-16T15:18:49Z | go | 2023-05-25T09:29:47Z | core/schema/container.go | Path string
}
func (s *containerSchema) file(ctx *router.Context, parent *core.Container, args containerFileArgs) (*core.File, error) {
return parent.File(ctx, s.gw, args.Path)
}
func absPath(workDir string, containerPath string) string {
if path.IsAbs(containerPath) {
return containerPath
}
if workDir == "" {
workDir = "/"
}
return path.Join(workDir, containerPath)
}
type containerWithSecretVariableArgs struct {
Name string
Secret core.SecretID
}
func (s *containerSchema) withSecretVariable(ctx *router.Context, parent *core.Container, args containerWithSecretVariableArgs) (*core.Container, error) {
secret, err := args.Secret.ToSecret()
if err != nil {
return nil, err
}
return parent.WithSecretVariable(ctx, args.Name, secret)
}
type containerWithMountedSecretArgs struct { |
closed | dagger/dagger | https://github.com/dagger/dagger | 5,140 | Expand environment variables in `withEnvVariable` values | ### Discussed in https://github.com/dagger/dagger/discussions/5001
<div type='discussions-op-text'>
<sup>Originally posted by **wingyplus** April 21, 2023</sup>
I want to install something and append it to `PATH` to make it accessible. So how to prepend the new directory into the env variable as we do with `PATH`?</div>
Solution proposed by @vito :
> I agree; extending $PATH seems like a common use case. it would be nice to have parity with Dockerfile ENV which supports interpolation.
>
> It might be a surprising default, since who knows what values people might try to set in env vars. An expand: true param would be simple enough to implement by using [os.Expand](https://pkg.go.dev/os#Expand) and fetching values from the current image config.
>
> ```
> container {
> withEnvVariable(name: "PATH", value: "/opt/venv/bin:${PATH}", expand: true) {
> withExec(args: []string{"sh", "-c", "echo $PATH"}) {
> stdout
> }
> }
> }
> ```
> (Interpolate might be a more obvious name.) | https://github.com/dagger/dagger/issues/5140 | https://github.com/dagger/dagger/pull/5160 | c2fcf8390801585188042d12ee8190b436cc9c2f | e171dc4252e464031737b51fee4c54531b4b537d | 2023-05-16T15:18:49Z | go | 2023-05-25T09:29:47Z | core/schema/container.go | Path string
Source core.SecretID
Owner string
}
func (s *containerSchema) withMountedSecret(ctx *router.Context, parent *core.Container, args containerWithMountedSecretArgs) (*core.Container, error) {
secret, err := args.Source.ToSecret()
if err != nil {
return nil, err
}
return parent.WithMountedSecret(ctx, s.gw, args.Path, secret, args.Owner)
}
type containerWithDirectoryArgs struct {
withDirectoryArgs
Owner string
}
func (s *containerSchema) withDirectory(ctx *router.Context, parent *core.Container, args containerWithDirectoryArgs) (*core.Container, error) {
dir, err := args.Directory.ToDirectory()
if err != nil {
return nil, err
}
return parent.WithDirectory(ctx, s.gw, args.Path, dir, args.CopyFilter, args.Owner)
}
type containerWithFileArgs struct { |
closed | dagger/dagger | https://github.com/dagger/dagger | 5,140 | Expand environment variables in `withEnvVariable` values | ### Discussed in https://github.com/dagger/dagger/discussions/5001
<div type='discussions-op-text'>
<sup>Originally posted by **wingyplus** April 21, 2023</sup>
I want to install something and append it to `PATH` to make it accessible. So how to prepend the new directory into the env variable as we do with `PATH`?</div>
Solution proposed by @vito :
> I agree; extending $PATH seems like a common use case. it would be nice to have parity with Dockerfile ENV which supports interpolation.
>
> It might be a surprising default, since who knows what values people might try to set in env vars. An expand: true param would be simple enough to implement by using [os.Expand](https://pkg.go.dev/os#Expand) and fetching values from the current image config.
>
> ```
> container {
> withEnvVariable(name: "PATH", value: "/opt/venv/bin:${PATH}", expand: true) {
> withExec(args: []string{"sh", "-c", "echo $PATH"}) {
> stdout
> }
> }
> }
> ```
> (Interpolate might be a more obvious name.) | https://github.com/dagger/dagger/issues/5140 | https://github.com/dagger/dagger/pull/5160 | c2fcf8390801585188042d12ee8190b436cc9c2f | e171dc4252e464031737b51fee4c54531b4b537d | 2023-05-16T15:18:49Z | go | 2023-05-25T09:29:47Z | core/schema/container.go | withFileArgs
Owner string
}
func (s *containerSchema) withFile(ctx *router.Context, parent *core.Container, args containerWithFileArgs) (*core.Container, error) {
file, err := args.Source.ToFile()
if err != nil {
return nil, err
}
return parent.WithFile(ctx, s.gw, args.Path, file, args.Permissions, args.Owner)
}
type containerWithNewFileArgs struct {
withNewFileArgs
Owner string
}
func (s *containerSchema) withNewFile(ctx *router.Context, parent *core.Container, args containerWithNewFileArgs) (*core.Container, error) {
return parent.WithNewFile(ctx, s.gw, args.Path, []byte(args.Contents), args.Permissions, args.Owner)
}
type containerWithUnixSocketArgs struct {
Path string
Source core.SocketID
Owner string
}
func (s *containerSchema) withUnixSocket(ctx *router.Context, parent *core.Container, args containerWithUnixSocketArgs) (*core.Container, error) {
socket, err := args.Source.ToSocket()
if err != nil {
return nil, err
}
return parent.WithUnixSocket(ctx, s.gw, args.Path, socket, args.Owner)
}
type containerWithoutUnixSocketArgs struct { |
closed | dagger/dagger | https://github.com/dagger/dagger | 5,140 | Expand environment variables in `withEnvVariable` values | ### Discussed in https://github.com/dagger/dagger/discussions/5001
<div type='discussions-op-text'>
<sup>Originally posted by **wingyplus** April 21, 2023</sup>
I want to install something and append it to `PATH` to make it accessible. So how to prepend the new directory into the env variable as we do with `PATH`?</div>
Solution proposed by @vito :
> I agree; extending $PATH seems like a common use case. it would be nice to have parity with Dockerfile ENV which supports interpolation.
>
> It might be a surprising default, since who knows what values people might try to set in env vars. An expand: true param would be simple enough to implement by using [os.Expand](https://pkg.go.dev/os#Expand) and fetching values from the current image config.
>
> ```
> container {
> withEnvVariable(name: "PATH", value: "/opt/venv/bin:${PATH}", expand: true) {
> withExec(args: []string{"sh", "-c", "echo $PATH"}) {
> stdout
> }
> }
> }
> ```
> (Interpolate might be a more obvious name.) | https://github.com/dagger/dagger/issues/5140 | https://github.com/dagger/dagger/pull/5160 | c2fcf8390801585188042d12ee8190b436cc9c2f | e171dc4252e464031737b51fee4c54531b4b537d | 2023-05-16T15:18:49Z | go | 2023-05-25T09:29:47Z | core/schema/container.go | Path string
}
func (s *containerSchema) withoutUnixSocket(ctx *router.Context, parent *core.Container, args containerWithoutUnixSocketArgs) (*core.Container, error) {
return parent.WithoutUnixSocket(ctx, args.Path)
}
func (s *containerSchema) platform(ctx *router.Context, parent *core.Container, args any) (specs.Platform, error) {
return parent.Platform, nil
}
type containerExportArgs struct {
Path string
PlatformVariants []core.ContainerID
ForcedCompression core.ImageLayerCompression
}
func (s *containerSchema) export(ctx *router.Context, parent *core.Container, args containerExportArgs) (bool, error) {
if err := parent.Export(ctx, s.host, args.Path, args.PlatformVariants, args.ForcedCompression, s.bkClient, s.solveOpts, s.solveCh); err != nil {
return false, err
}
return true, nil
}
type containerImportArgs struct { |
closed | dagger/dagger | https://github.com/dagger/dagger | 5,140 | Expand environment variables in `withEnvVariable` values | ### Discussed in https://github.com/dagger/dagger/discussions/5001
<div type='discussions-op-text'>
<sup>Originally posted by **wingyplus** April 21, 2023</sup>
I want to install something and append it to `PATH` to make it accessible. So how to prepend the new directory into the env variable as we do with `PATH`?</div>
Solution proposed by @vito :
> I agree; extending $PATH seems like a common use case. it would be nice to have parity with Dockerfile ENV which supports interpolation.
>
> It might be a surprising default, since who knows what values people might try to set in env vars. An expand: true param would be simple enough to implement by using [os.Expand](https://pkg.go.dev/os#Expand) and fetching values from the current image config.
>
> ```
> container {
> withEnvVariable(name: "PATH", value: "/opt/venv/bin:${PATH}", expand: true) {
> withExec(args: []string{"sh", "-c", "echo $PATH"}) {
> stdout
> }
> }
> }
> ```
> (Interpolate might be a more obvious name.) | https://github.com/dagger/dagger/issues/5140 | https://github.com/dagger/dagger/pull/5160 | c2fcf8390801585188042d12ee8190b436cc9c2f | e171dc4252e464031737b51fee4c54531b4b537d | 2023-05-16T15:18:49Z | go | 2023-05-25T09:29:47Z | core/schema/container.go | Source core.FileID
Tag string
}
func (s *containerSchema) import_(ctx *router.Context, parent *core.Container, args containerImportArgs) (*core.Container, error) {
return parent.Import(ctx, s.gw, s.host, args.Source, args.Tag, s.ociStore)
}
type containerWithRegistryAuthArgs struct {
Address string `json:"address"`
Username string `json:"username"`
Secret core.SecretID `json:"secret"`
}
func (s *containerSchema) withRegistryAuth(ctx *router.Context, parents *core.Container, args containerWithRegistryAuthArgs) (*core.Container, error) {
secretBytes, err := s.secrets.GetSecret(ctx, args.Secret.String())
if err != nil {
return nil, err
}
if err := s.auth.AddCredential(args.Address, args.Username, string(secretBytes)); err != nil {
return nil, err
}
return parents, nil
}
type containerWithoutRegistryAuthArgs struct { |
closed | dagger/dagger | https://github.com/dagger/dagger | 5,140 | Expand environment variables in `withEnvVariable` values | ### Discussed in https://github.com/dagger/dagger/discussions/5001
<div type='discussions-op-text'>
<sup>Originally posted by **wingyplus** April 21, 2023</sup>
I want to install something and append it to `PATH` to make it accessible. So how to prepend the new directory into the env variable as we do with `PATH`?</div>
Solution proposed by @vito :
> I agree; extending $PATH seems like a common use case. it would be nice to have parity with Dockerfile ENV which supports interpolation.
>
> It might be a surprising default, since who knows what values people might try to set in env vars. An expand: true param would be simple enough to implement by using [os.Expand](https://pkg.go.dev/os#Expand) and fetching values from the current image config.
>
> ```
> container {
> withEnvVariable(name: "PATH", value: "/opt/venv/bin:${PATH}", expand: true) {
> withExec(args: []string{"sh", "-c", "echo $PATH"}) {
> stdout
> }
> }
> }
> ```
> (Interpolate might be a more obvious name.) | https://github.com/dagger/dagger/issues/5140 | https://github.com/dagger/dagger/pull/5160 | c2fcf8390801585188042d12ee8190b436cc9c2f | e171dc4252e464031737b51fee4c54531b4b537d | 2023-05-16T15:18:49Z | go | 2023-05-25T09:29:47Z | core/schema/container.go | Address string
}
func (s *containerSchema) withoutRegistryAuth(_ *router.Context, parents *core.Container, args containerWithoutRegistryAuthArgs) (*core.Container, error) {
if err := s.auth.RemoveCredential(args.Address); err != nil {
return nil, err
}
return parents, nil
}
func (s *containerSchema) imageRef(ctx *router.Context, parent *core.Container, args containerWithVariableArgs) (string, error) {
return parent.ImageRefOrErr(ctx, s.gw)
}
func (s *containerSchema) hostname(ctx *router.Context, parent *core.Container, args any) (string, error) {
if !s.servicesEnabled {
return "", ErrServicesDisabled
}
parent, err := s.withDefaultExec(ctx, parent)
if err != nil {
return "", err
}
return parent.HostnameOrErr()
}
type containerEndpointArgs struct { |
closed | dagger/dagger | https://github.com/dagger/dagger | 5,140 | Expand environment variables in `withEnvVariable` values | ### Discussed in https://github.com/dagger/dagger/discussions/5001
<div type='discussions-op-text'>
<sup>Originally posted by **wingyplus** April 21, 2023</sup>
I want to install something and append it to `PATH` to make it accessible. So how to prepend the new directory into the env variable as we do with `PATH`?</div>
Solution proposed by @vito :
> I agree; extending $PATH seems like a common use case. it would be nice to have parity with Dockerfile ENV which supports interpolation.
>
> It might be a surprising default, since who knows what values people might try to set in env vars. An expand: true param would be simple enough to implement by using [os.Expand](https://pkg.go.dev/os#Expand) and fetching values from the current image config.
>
> ```
> container {
> withEnvVariable(name: "PATH", value: "/opt/venv/bin:${PATH}", expand: true) {
> withExec(args: []string{"sh", "-c", "echo $PATH"}) {
> stdout
> }
> }
> }
> ```
> (Interpolate might be a more obvious name.) | https://github.com/dagger/dagger/issues/5140 | https://github.com/dagger/dagger/pull/5160 | c2fcf8390801585188042d12ee8190b436cc9c2f | e171dc4252e464031737b51fee4c54531b4b537d | 2023-05-16T15:18:49Z | go | 2023-05-25T09:29:47Z | core/schema/container.go | Port int
Scheme string
}
func (s *containerSchema) endpoint(ctx *router.Context, parent *core.Container, args containerEndpointArgs) (string, error) {
if !s.servicesEnabled {
return "", ErrServicesDisabled
}
parent, err := s.withDefaultExec(ctx, parent)
if err != nil {
return "", err
}
return parent.Endpoint(args.Port, args.Scheme)
}
type containerWithServiceDependencyArgs struct { |
closed | dagger/dagger | https://github.com/dagger/dagger | 5,140 | Expand environment variables in `withEnvVariable` values | ### Discussed in https://github.com/dagger/dagger/discussions/5001
<div type='discussions-op-text'>
<sup>Originally posted by **wingyplus** April 21, 2023</sup>
I want to install something and append it to `PATH` to make it accessible. So how to prepend the new directory into the env variable as we do with `PATH`?</div>
Solution proposed by @vito :
> I agree; extending $PATH seems like a common use case. it would be nice to have parity with Dockerfile ENV which supports interpolation.
>
> It might be a surprising default, since who knows what values people might try to set in env vars. An expand: true param would be simple enough to implement by using [os.Expand](https://pkg.go.dev/os#Expand) and fetching values from the current image config.
>
> ```
> container {
> withEnvVariable(name: "PATH", value: "/opt/venv/bin:${PATH}", expand: true) {
> withExec(args: []string{"sh", "-c", "echo $PATH"}) {
> stdout
> }
> }
> }
> ```
> (Interpolate might be a more obvious name.) | https://github.com/dagger/dagger/issues/5140 | https://github.com/dagger/dagger/pull/5160 | c2fcf8390801585188042d12ee8190b436cc9c2f | e171dc4252e464031737b51fee4c54531b4b537d | 2023-05-16T15:18:49Z | go | 2023-05-25T09:29:47Z | core/schema/container.go | Service core.ContainerID
Alias string
}
func (s *containerSchema) withServiceBinding(ctx *router.Context, parent *core.Container, args containerWithServiceDependencyArgs) (*core.Container, error) {
if !s.servicesEnabled {
return nil, ErrServicesDisabled
}
svc, err := args.Service.ToContainer()
if err != nil {
return nil, err
}
svc, err = s.withDefaultExec(ctx, svc)
if err != nil {
return nil, err
}
return parent.WithServiceBinding(svc, args.Alias)
}
type containerWithExposedPortArgs struct { |
closed | dagger/dagger | https://github.com/dagger/dagger | 5,140 | Expand environment variables in `withEnvVariable` values | ### Discussed in https://github.com/dagger/dagger/discussions/5001
<div type='discussions-op-text'>
<sup>Originally posted by **wingyplus** April 21, 2023</sup>
I want to install something and append it to `PATH` to make it accessible. So how to prepend the new directory into the env variable as we do with `PATH`?</div>
Solution proposed by @vito :
> I agree; extending $PATH seems like a common use case. it would be nice to have parity with Dockerfile ENV which supports interpolation.
>
> It might be a surprising default, since who knows what values people might try to set in env vars. An expand: true param would be simple enough to implement by using [os.Expand](https://pkg.go.dev/os#Expand) and fetching values from the current image config.
>
> ```
> container {
> withEnvVariable(name: "PATH", value: "/opt/venv/bin:${PATH}", expand: true) {
> withExec(args: []string{"sh", "-c", "echo $PATH"}) {
> stdout
> }
> }
> }
> ```
> (Interpolate might be a more obvious name.) | https://github.com/dagger/dagger/issues/5140 | https://github.com/dagger/dagger/pull/5160 | c2fcf8390801585188042d12ee8190b436cc9c2f | e171dc4252e464031737b51fee4c54531b4b537d | 2023-05-16T15:18:49Z | go | 2023-05-25T09:29:47Z | core/schema/container.go | Protocol core.NetworkProtocol
Port int
Description *string
}
func (s *containerSchema) withExposedPort(ctx *router.Context, parent *core.Container, args containerWithExposedPortArgs) (*core.Container, error) {
if !s.servicesEnabled {
return nil, ErrServicesDisabled
}
return parent.WithExposedPort(core.ContainerPort{
Protocol: args.Protocol,
Port: args.Port,
Description: args.Description,
})
}
type containerWithoutExposedPortArgs struct { |
closed | dagger/dagger | https://github.com/dagger/dagger | 5,140 | Expand environment variables in `withEnvVariable` values | ### Discussed in https://github.com/dagger/dagger/discussions/5001
<div type='discussions-op-text'>
<sup>Originally posted by **wingyplus** April 21, 2023</sup>
I want to install something and append it to `PATH` to make it accessible. So how to prepend the new directory into the env variable as we do with `PATH`?</div>
Solution proposed by @vito :
> I agree; extending $PATH seems like a common use case. it would be nice to have parity with Dockerfile ENV which supports interpolation.
>
> It might be a surprising default, since who knows what values people might try to set in env vars. An expand: true param would be simple enough to implement by using [os.Expand](https://pkg.go.dev/os#Expand) and fetching values from the current image config.
>
> ```
> container {
> withEnvVariable(name: "PATH", value: "/opt/venv/bin:${PATH}", expand: true) {
> withExec(args: []string{"sh", "-c", "echo $PATH"}) {
> stdout
> }
> }
> }
> ```
> (Interpolate might be a more obvious name.) | https://github.com/dagger/dagger/issues/5140 | https://github.com/dagger/dagger/pull/5160 | c2fcf8390801585188042d12ee8190b436cc9c2f | e171dc4252e464031737b51fee4c54531b4b537d | 2023-05-16T15:18:49Z | go | 2023-05-25T09:29:47Z | core/schema/container.go | Protocol core.NetworkProtocol
Port int
}
func (s *containerSchema) withoutExposedPort(ctx *router.Context, parent *core.Container, args containerWithoutExposedPortArgs) (*core.Container, error) {
if !s.servicesEnabled {
return nil, ErrServicesDisabled
}
return parent.WithoutExposedPort(args.Port, args.Protocol)
}
type ExposedPort struct {
Port int `json:"port"`
Protocol string `json:"protocol"`
Description *string `json:"description,omitempty"`
}
func (s *containerSchema) exposedPorts(ctx *router.Context, parent *core.Container, args any) ([]ExposedPort, error) {
if !s.servicesEnabled {
return nil, ErrServicesDisabled
}
exposedPorts := []ExposedPort{}
for _, p := range parent.Ports {
exposedPorts = append(exposedPorts, ExposedPort{
Port: p.Port,
Protocol: string(p.Protocol),
Description: p.Description,
})
}
return exposedPorts, nil
} |
closed | dagger/dagger | https://github.com/dagger/dagger | 5,140 | Expand environment variables in `withEnvVariable` values | ### Discussed in https://github.com/dagger/dagger/discussions/5001
<div type='discussions-op-text'>
<sup>Originally posted by **wingyplus** April 21, 2023</sup>
I want to install something and append it to `PATH` to make it accessible. So how to prepend the new directory into the env variable as we do with `PATH`?</div>
Solution proposed by @vito :
> I agree; extending $PATH seems like a common use case. it would be nice to have parity with Dockerfile ENV which supports interpolation.
>
> It might be a surprising default, since who knows what values people might try to set in env vars. An expand: true param would be simple enough to implement by using [os.Expand](https://pkg.go.dev/os#Expand) and fetching values from the current image config.
>
> ```
> container {
> withEnvVariable(name: "PATH", value: "/opt/venv/bin:${PATH}", expand: true) {
> withExec(args: []string{"sh", "-c", "echo $PATH"}) {
> stdout
> }
> }
> }
> ```
> (Interpolate might be a more obvious name.) | https://github.com/dagger/dagger/issues/5140 | https://github.com/dagger/dagger/pull/5160 | c2fcf8390801585188042d12ee8190b436cc9c2f | e171dc4252e464031737b51fee4c54531b4b537d | 2023-05-16T15:18:49Z | go | 2023-05-25T09:29:47Z | core/util.go | package core
import (
"context"
"encoding/base64"
"encoding/json"
"fmt"
"io/fs"
"path"
"strconv"
"strings"
"sync"
"github.com/dagger/dagger/core/reffs"
"github.com/moby/buildkit/client/llb"
"github.com/moby/buildkit/frontend/dockerfile/shell"
bkgw "github.com/moby/buildkit/frontend/gateway/client"
"github.com/moby/buildkit/solver/pb"
specs "github.com/opencontainers/image-spec/specs-go/v1"
"github.com/opencontainers/runc/libcontainer/user"
)
func encodeID[T ~string](payload any) (T, error) { |
closed | dagger/dagger | https://github.com/dagger/dagger | 5,140 | Expand environment variables in `withEnvVariable` values | ### Discussed in https://github.com/dagger/dagger/discussions/5001
<div type='discussions-op-text'>
<sup>Originally posted by **wingyplus** April 21, 2023</sup>
I want to install something and append it to `PATH` to make it accessible. So how to prepend the new directory into the env variable as we do with `PATH`?</div>
Solution proposed by @vito :
> I agree; extending $PATH seems like a common use case. it would be nice to have parity with Dockerfile ENV which supports interpolation.
>
> It might be a surprising default, since who knows what values people might try to set in env vars. An expand: true param would be simple enough to implement by using [os.Expand](https://pkg.go.dev/os#Expand) and fetching values from the current image config.
>
> ```
> container {
> withEnvVariable(name: "PATH", value: "/opt/venv/bin:${PATH}", expand: true) {
> withExec(args: []string{"sh", "-c", "echo $PATH"}) {
> stdout
> }
> }
> }
> ```
> (Interpolate might be a more obvious name.) | https://github.com/dagger/dagger/issues/5140 | https://github.com/dagger/dagger/pull/5160 | c2fcf8390801585188042d12ee8190b436cc9c2f | e171dc4252e464031737b51fee4c54531b4b537d | 2023-05-16T15:18:49Z | go | 2023-05-25T09:29:47Z | core/util.go | jsonBytes, err := json.Marshal(payload)
if err != nil {
return "", err
}
b64Bytes := make([]byte, base64.StdEncoding.EncodedLen(len(jsonBytes)))
base64.StdEncoding.Encode(b64Bytes, jsonBytes)
return T(b64Bytes), nil
}
func decodeID[T ~string](payload any, id T) error {
jsonBytes := make([]byte, base64.StdEncoding.DecodedLen(len(id)))
n, err := base64.StdEncoding.Decode(jsonBytes, []byte(id))
if err != nil {
return fmt.Errorf("failed to decode %T bytes: %v: %w", payload, id, err)
}
jsonBytes = jsonBytes[:n]
return json.Unmarshal(jsonBytes, payload)
}
func absPath(workDir string, containerPath string) string {
if path.IsAbs(containerPath) {
return containerPath
}
if workDir == "" {
workDir = "/"
}
return path.Join(workDir, containerPath)
}
func defToState(def *pb.Definition) (llb.State, error) { |
closed | dagger/dagger | https://github.com/dagger/dagger | 5,140 | Expand environment variables in `withEnvVariable` values | ### Discussed in https://github.com/dagger/dagger/discussions/5001
<div type='discussions-op-text'>
<sup>Originally posted by **wingyplus** April 21, 2023</sup>
I want to install something and append it to `PATH` to make it accessible. So how to prepend the new directory into the env variable as we do with `PATH`?</div>
Solution proposed by @vito :
> I agree; extending $PATH seems like a common use case. it would be nice to have parity with Dockerfile ENV which supports interpolation.
>
> It might be a surprising default, since who knows what values people might try to set in env vars. An expand: true param would be simple enough to implement by using [os.Expand](https://pkg.go.dev/os#Expand) and fetching values from the current image config.
>
> ```
> container {
> withEnvVariable(name: "PATH", value: "/opt/venv/bin:${PATH}", expand: true) {
> withExec(args: []string{"sh", "-c", "echo $PATH"}) {
> stdout
> }
> }
> }
> ```
> (Interpolate might be a more obvious name.) | https://github.com/dagger/dagger/issues/5140 | https://github.com/dagger/dagger/pull/5160 | c2fcf8390801585188042d12ee8190b436cc9c2f | e171dc4252e464031737b51fee4c54531b4b537d | 2023-05-16T15:18:49Z | go | 2023-05-25T09:29:47Z | core/util.go | if def.Def == nil {
return llb.Scratch(), nil
}
defop, err := llb.NewDefinitionOp(def)
if err != nil {
return llb.State{}, err
}
return llb.NewState(defop), nil
}
func mirrorCh[T any](dest chan<- T) (chan T, *sync.WaitGroup) {
wg := new(sync.WaitGroup)
if dest == nil {
return nil, wg
}
mirrorCh := make(chan T)
wg.Add(1)
go func() {
defer wg.Done()
for event := range mirrorCh {
dest <- event
}
}()
return mirrorCh, wg
}
func resolveUIDGID(ctx context.Context, fsSt llb.State, gw bkgw.Client, platform specs.Platform, owner string) (*Ownership, error) { |
closed | dagger/dagger | https://github.com/dagger/dagger | 5,140 | Expand environment variables in `withEnvVariable` values | ### Discussed in https://github.com/dagger/dagger/discussions/5001
<div type='discussions-op-text'>
<sup>Originally posted by **wingyplus** April 21, 2023</sup>
I want to install something and append it to `PATH` to make it accessible. So how to prepend the new directory into the env variable as we do with `PATH`?</div>
Solution proposed by @vito :
> I agree; extending $PATH seems like a common use case. it would be nice to have parity with Dockerfile ENV which supports interpolation.
>
> It might be a surprising default, since who knows what values people might try to set in env vars. An expand: true param would be simple enough to implement by using [os.Expand](https://pkg.go.dev/os#Expand) and fetching values from the current image config.
>
> ```
> container {
> withEnvVariable(name: "PATH", value: "/opt/venv/bin:${PATH}", expand: true) {
> withExec(args: []string{"sh", "-c", "echo $PATH"}) {
> stdout
> }
> }
> }
> ```
> (Interpolate might be a more obvious name.) | https://github.com/dagger/dagger/issues/5140 | https://github.com/dagger/dagger/pull/5160 | c2fcf8390801585188042d12ee8190b436cc9c2f | e171dc4252e464031737b51fee4c54531b4b537d | 2023-05-16T15:18:49Z | go | 2023-05-25T09:29:47Z | core/util.go | uidOrName, gidOrName, hasGroup := strings.Cut(owner, ":")
var uid, gid int
var uname, gname string
uid, err := parseUID(uidOrName)
if err != nil {
uname = uidOrName
}
if hasGroup {
gid, err = parseUID(gidOrName)
if err != nil {
gname = gidOrName
}
}
var fs fs.FS
if uname != "" || gname != "" {
fs, err = reffs.OpenState(ctx, gw, fsSt, llb.Platform(platform))
if err != nil {
return nil, fmt.Errorf("open fs state for name->id: %w", err)
}
}
if uname != "" {
uid, err = findUID(fs, uname)
if err != nil {
return nil, fmt.Errorf("find uid: %w", err) |
closed | dagger/dagger | https://github.com/dagger/dagger | 5,140 | Expand environment variables in `withEnvVariable` values | ### Discussed in https://github.com/dagger/dagger/discussions/5001
<div type='discussions-op-text'>
<sup>Originally posted by **wingyplus** April 21, 2023</sup>
I want to install something and append it to `PATH` to make it accessible. So how to prepend the new directory into the env variable as we do with `PATH`?</div>
Solution proposed by @vito :
> I agree; extending $PATH seems like a common use case. it would be nice to have parity with Dockerfile ENV which supports interpolation.
>
> It might be a surprising default, since who knows what values people might try to set in env vars. An expand: true param would be simple enough to implement by using [os.Expand](https://pkg.go.dev/os#Expand) and fetching values from the current image config.
>
> ```
> container {
> withEnvVariable(name: "PATH", value: "/opt/venv/bin:${PATH}", expand: true) {
> withExec(args: []string{"sh", "-c", "echo $PATH"}) {
> stdout
> }
> }
> }
> ```
> (Interpolate might be a more obvious name.) | https://github.com/dagger/dagger/issues/5140 | https://github.com/dagger/dagger/pull/5160 | c2fcf8390801585188042d12ee8190b436cc9c2f | e171dc4252e464031737b51fee4c54531b4b537d | 2023-05-16T15:18:49Z | go | 2023-05-25T09:29:47Z | core/util.go | }
}
if gname != "" {
gid, err = findGID(fs, gname)
if err != nil {
return nil, fmt.Errorf("find gid: %w", err)
}
}
if !hasGroup {
gid = uid
}
return &Ownership{uid, gid}, nil
}
func findUID(fs fs.FS, uname string) (int, error) {
f, err := fs.Open("/etc/passwd")
if err != nil {
return -1, fmt.Errorf("open /etc/passwd: %w", err)
}
users, err := user.ParsePasswdFilter(f, func(u user.User) bool {
return u.Name == uname
})
if err != nil {
return -1, fmt.Errorf("parse /etc/passwd: %w", err)
}
if len(users) == 0 {
return -1, fmt.Errorf("no such user: %s", uname)
}
return users[0].Uid, nil
}
func findGID(fs fs.FS, gname string) (int, error) { |
closed | dagger/dagger | https://github.com/dagger/dagger | 5,140 | Expand environment variables in `withEnvVariable` values | ### Discussed in https://github.com/dagger/dagger/discussions/5001
<div type='discussions-op-text'>
<sup>Originally posted by **wingyplus** April 21, 2023</sup>
I want to install something and append it to `PATH` to make it accessible. So how to prepend the new directory into the env variable as we do with `PATH`?</div>
Solution proposed by @vito :
> I agree; extending $PATH seems like a common use case. it would be nice to have parity with Dockerfile ENV which supports interpolation.
>
> It might be a surprising default, since who knows what values people might try to set in env vars. An expand: true param would be simple enough to implement by using [os.Expand](https://pkg.go.dev/os#Expand) and fetching values from the current image config.
>
> ```
> container {
> withEnvVariable(name: "PATH", value: "/opt/venv/bin:${PATH}", expand: true) {
> withExec(args: []string{"sh", "-c", "echo $PATH"}) {
> stdout
> }
> }
> }
> ```
> (Interpolate might be a more obvious name.) | https://github.com/dagger/dagger/issues/5140 | https://github.com/dagger/dagger/pull/5160 | c2fcf8390801585188042d12ee8190b436cc9c2f | e171dc4252e464031737b51fee4c54531b4b537d | 2023-05-16T15:18:49Z | go | 2023-05-25T09:29:47Z | core/util.go | f, err := fs.Open("/etc/group")
if err != nil {
return -1, fmt.Errorf("open /etc/passwd: %w", err)
}
groups, err := user.ParseGroupFilter(f, func(g user.Group) bool {
return g.Name == gname
})
if err != nil {
return -1, fmt.Errorf("parse /etc/group: %w", err)
}
if len(groups) == 0 {
return -1, fmt.Errorf("no such group: %s", gname)
}
return groups[0].Gid, nil
}
func parseUID(str string) (int, error) { |
closed | dagger/dagger | https://github.com/dagger/dagger | 5,140 | Expand environment variables in `withEnvVariable` values | ### Discussed in https://github.com/dagger/dagger/discussions/5001
<div type='discussions-op-text'>
<sup>Originally posted by **wingyplus** April 21, 2023</sup>
I want to install something and append it to `PATH` to make it accessible. So how to prepend the new directory into the env variable as we do with `PATH`?</div>
Solution proposed by @vito :
> I agree; extending $PATH seems like a common use case. it would be nice to have parity with Dockerfile ENV which supports interpolation.
>
> It might be a surprising default, since who knows what values people might try to set in env vars. An expand: true param would be simple enough to implement by using [os.Expand](https://pkg.go.dev/os#Expand) and fetching values from the current image config.
>
> ```
> container {
> withEnvVariable(name: "PATH", value: "/opt/venv/bin:${PATH}", expand: true) {
> withExec(args: []string{"sh", "-c", "echo $PATH"}) {
> stdout
> }
> }
> }
> ```
> (Interpolate might be a more obvious name.) | https://github.com/dagger/dagger/issues/5140 | https://github.com/dagger/dagger/pull/5160 | c2fcf8390801585188042d12ee8190b436cc9c2f | e171dc4252e464031737b51fee4c54531b4b537d | 2023-05-16T15:18:49Z | go | 2023-05-25T09:29:47Z | core/util.go | if str == "root" {
return 0, nil
}
uid, err := strconv.ParseInt(str, 10, 32)
if err != nil {
return 0, err
}
return int(uid), nil
}
func clone[T any](src []T) []T {
dst := make([]T, len(src))
copy(dst, src)
return dst
}
func cloneMap[K comparable, T any](src map[K]T) map[K]T {
dst := make(map[K]T, len(src))
for k, v := range src {
dst[k] = v
}
return dst
}
func parseKeyValue(env string) (string, string) { |
closed | dagger/dagger | https://github.com/dagger/dagger | 5,140 | Expand environment variables in `withEnvVariable` values | ### Discussed in https://github.com/dagger/dagger/discussions/5001
<div type='discussions-op-text'>
<sup>Originally posted by **wingyplus** April 21, 2023</sup>
I want to install something and append it to `PATH` to make it accessible. So how to prepend the new directory into the env variable as we do with `PATH`?</div>
Solution proposed by @vito :
> I agree; extending $PATH seems like a common use case. it would be nice to have parity with Dockerfile ENV which supports interpolation.
>
> It might be a surprising default, since who knows what values people might try to set in env vars. An expand: true param would be simple enough to implement by using [os.Expand](https://pkg.go.dev/os#Expand) and fetching values from the current image config.
>
> ```
> container {
> withEnvVariable(name: "PATH", value: "/opt/venv/bin:${PATH}", expand: true) {
> withExec(args: []string{"sh", "-c", "echo $PATH"}) {
> stdout
> }
> }
> }
> ```
> (Interpolate might be a more obvious name.) | https://github.com/dagger/dagger/issues/5140 | https://github.com/dagger/dagger/pull/5160 | c2fcf8390801585188042d12ee8190b436cc9c2f | e171dc4252e464031737b51fee4c54531b4b537d | 2023-05-16T15:18:49Z | go | 2023-05-25T09:29:47Z | core/util.go | parts := strings.SplitN(env, "=", 2)
v := ""
if len(parts) > 1 {
v = parts[1]
}
return parts[0], v
}
func addEnv(env []string, k, v string) []string {
gotOne := false
for i, envVar := range env {
key, _ := parseKeyValue(envVar)
if shell.EqualEnvKeys(key, k) {
env[i] = fmt.Sprintf("%s=%s", k, v)
gotOne = true
break
}
}
if !gotOne {
env = append(env, fmt.Sprintf("%s=%s", k, v))
}
return env
}
func mergeEnv(dst, src []string) []string { |
closed | dagger/dagger | https://github.com/dagger/dagger | 5,140 | Expand environment variables in `withEnvVariable` values | ### Discussed in https://github.com/dagger/dagger/discussions/5001
<div type='discussions-op-text'>
<sup>Originally posted by **wingyplus** April 21, 2023</sup>
I want to install something and append it to `PATH` to make it accessible. So how to prepend the new directory into the env variable as we do with `PATH`?</div>
Solution proposed by @vito :
> I agree; extending $PATH seems like a common use case. it would be nice to have parity with Dockerfile ENV which supports interpolation.
>
> It might be a surprising default, since who knows what values people might try to set in env vars. An expand: true param would be simple enough to implement by using [os.Expand](https://pkg.go.dev/os#Expand) and fetching values from the current image config.
>
> ```
> container {
> withEnvVariable(name: "PATH", value: "/opt/venv/bin:${PATH}", expand: true) {
> withExec(args: []string{"sh", "-c", "echo $PATH"}) {
> stdout
> }
> }
> }
> ```
> (Interpolate might be a more obvious name.) | https://github.com/dagger/dagger/issues/5140 | https://github.com/dagger/dagger/pull/5160 | c2fcf8390801585188042d12ee8190b436cc9c2f | e171dc4252e464031737b51fee4c54531b4b537d | 2023-05-16T15:18:49Z | go | 2023-05-25T09:29:47Z | core/util.go | for _, e := range src {
k, v := parseKeyValue(e)
dst = addEnv(dst, k, v)
}
return dst
}
func mergeMap(dst, src map[string]string) map[string]string {
if src == nil {
return dst
}
if dst == nil {
return src
}
for k, v := range src {
dst[k] = v
}
return dst
}
func mergeImageConfig(dst, src specs.ImageConfig) specs.ImageConfig {
res := src
res.Env = mergeEnv(dst.Env, src.Env)
res.Labels = mergeMap(dst.Labels, src.Labels)
return res
} |
closed | dagger/dagger | https://github.com/dagger/dagger | 5,140 | Expand environment variables in `withEnvVariable` values | ### Discussed in https://github.com/dagger/dagger/discussions/5001
<div type='discussions-op-text'>
<sup>Originally posted by **wingyplus** April 21, 2023</sup>
I want to install something and append it to `PATH` to make it accessible. So how to prepend the new directory into the env variable as we do with `PATH`?</div>
Solution proposed by @vito :
> I agree; extending $PATH seems like a common use case. it would be nice to have parity with Dockerfile ENV which supports interpolation.
>
> It might be a surprising default, since who knows what values people might try to set in env vars. An expand: true param would be simple enough to implement by using [os.Expand](https://pkg.go.dev/os#Expand) and fetching values from the current image config.
>
> ```
> container {
> withEnvVariable(name: "PATH", value: "/opt/venv/bin:${PATH}", expand: true) {
> withExec(args: []string{"sh", "-c", "echo $PATH"}) {
> stdout
> }
> }
> }
> ```
> (Interpolate might be a more obvious name.) | https://github.com/dagger/dagger/issues/5140 | https://github.com/dagger/dagger/pull/5160 | c2fcf8390801585188042d12ee8190b436cc9c2f | e171dc4252e464031737b51fee4c54531b4b537d | 2023-05-16T15:18:49Z | go | 2023-05-25T09:29:47Z | sdk/go/api.gen.go | package dagger
import (
"context"
"dagger.io/dagger/internal/querybuilder"
"github.com/Khan/genqlient/graphql"
)
type CacheID string
type ContainerID string
type DirectoryID string
type FileID string
type Platform string
type ProjectCommandID string
type ProjectID string
type SecretID string
type SocketID string
type BuildArg struct {
Name string `json:"name"`
Value string `json:"value"`
}
type PipelineLabel struct { |
closed | dagger/dagger | https://github.com/dagger/dagger | 5,140 | Expand environment variables in `withEnvVariable` values | ### Discussed in https://github.com/dagger/dagger/discussions/5001
<div type='discussions-op-text'>
<sup>Originally posted by **wingyplus** April 21, 2023</sup>
I want to install something and append it to `PATH` to make it accessible. So how to prepend the new directory into the env variable as we do with `PATH`?</div>
Solution proposed by @vito :
> I agree; extending $PATH seems like a common use case. it would be nice to have parity with Dockerfile ENV which supports interpolation.
>
> It might be a surprising default, since who knows what values people might try to set in env vars. An expand: true param would be simple enough to implement by using [os.Expand](https://pkg.go.dev/os#Expand) and fetching values from the current image config.
>
> ```
> container {
> withEnvVariable(name: "PATH", value: "/opt/venv/bin:${PATH}", expand: true) {
> withExec(args: []string{"sh", "-c", "echo $PATH"}) {
> stdout
> }
> }
> }
> ```
> (Interpolate might be a more obvious name.) | https://github.com/dagger/dagger/issues/5140 | https://github.com/dagger/dagger/pull/5160 | c2fcf8390801585188042d12ee8190b436cc9c2f | e171dc4252e464031737b51fee4c54531b4b537d | 2023-05-16T15:18:49Z | go | 2023-05-25T09:29:47Z | sdk/go/api.gen.go | Name string `json:"name"`
Value string `json:"value"`
}
type CacheVolume struct {
q *querybuilder.Selection
c graphql.Client
id *CacheID
}
func (r *CacheVolume) ID(ctx context.Context) (CacheID, error) {
if r.id != nil {
return *r.id, nil
}
q := r.q.Select("id")
var response CacheID
q = q.Bind(&response)
return response, q.Execute(ctx, r.c)
}
func (r *CacheVolume) XXX_GraphQLType() string {
return "CacheVolume"
}
func (r *CacheVolume) XXX_GraphQLID(ctx context.Context) (string, error) {
id, err := r.ID(ctx)
if err != nil {
return "", err
}
return string(id), nil
}
type Container struct { |
closed | dagger/dagger | https://github.com/dagger/dagger | 5,140 | Expand environment variables in `withEnvVariable` values | ### Discussed in https://github.com/dagger/dagger/discussions/5001
<div type='discussions-op-text'>
<sup>Originally posted by **wingyplus** April 21, 2023</sup>
I want to install something and append it to `PATH` to make it accessible. So how to prepend the new directory into the env variable as we do with `PATH`?</div>
Solution proposed by @vito :
> I agree; extending $PATH seems like a common use case. it would be nice to have parity with Dockerfile ENV which supports interpolation.
>
> It might be a surprising default, since who knows what values people might try to set in env vars. An expand: true param would be simple enough to implement by using [os.Expand](https://pkg.go.dev/os#Expand) and fetching values from the current image config.
>
> ```
> container {
> withEnvVariable(name: "PATH", value: "/opt/venv/bin:${PATH}", expand: true) {
> withExec(args: []string{"sh", "-c", "echo $PATH"}) {
> stdout
> }
> }
> }
> ```
> (Interpolate might be a more obvious name.) | https://github.com/dagger/dagger/issues/5140 | https://github.com/dagger/dagger/pull/5160 | c2fcf8390801585188042d12ee8190b436cc9c2f | e171dc4252e464031737b51fee4c54531b4b537d | 2023-05-16T15:18:49Z | go | 2023-05-25T09:29:47Z | sdk/go/api.gen.go | q *querybuilder.Selection
c graphql.Client
endpoint *string
envVariable *string
exitCode *int
export *bool
hostname *string
id *ContainerID
imageRef *string
label *string
platform *Platform
publish *string
stderr *string
stdout *string
sync *ContainerID
user *string
workdir *string
}
type WithContainerFunc func(r *Container) *Container
func (r *Container) With(f WithContainerFunc) *Container {
return f(r)
}
type ContainerBuildOpts struct { |
closed | dagger/dagger | https://github.com/dagger/dagger | 5,140 | Expand environment variables in `withEnvVariable` values | ### Discussed in https://github.com/dagger/dagger/discussions/5001
<div type='discussions-op-text'>
<sup>Originally posted by **wingyplus** April 21, 2023</sup>
I want to install something and append it to `PATH` to make it accessible. So how to prepend the new directory into the env variable as we do with `PATH`?</div>
Solution proposed by @vito :
> I agree; extending $PATH seems like a common use case. it would be nice to have parity with Dockerfile ENV which supports interpolation.
>
> It might be a surprising default, since who knows what values people might try to set in env vars. An expand: true param would be simple enough to implement by using [os.Expand](https://pkg.go.dev/os#Expand) and fetching values from the current image config.
>
> ```
> container {
> withEnvVariable(name: "PATH", value: "/opt/venv/bin:${PATH}", expand: true) {
> withExec(args: []string{"sh", "-c", "echo $PATH"}) {
> stdout
> }
> }
> }
> ```
> (Interpolate might be a more obvious name.) | https://github.com/dagger/dagger/issues/5140 | https://github.com/dagger/dagger/pull/5160 | c2fcf8390801585188042d12ee8190b436cc9c2f | e171dc4252e464031737b51fee4c54531b4b537d | 2023-05-16T15:18:49Z | go | 2023-05-25T09:29:47Z | sdk/go/api.gen.go | Dockerfile string
BuildArgs []BuildArg
Target string
Secrets []*Secret
}
func (r *Container) Build(context *Directory, opts ...ContainerBuildOpts) *Container {
q := r.q.Select("build")
q = q.Arg("context", context)
for i := len(opts) - 1; i >= 0; i-- {
if !querybuilder.IsZeroValue(opts[i].Dockerfile) {
q = q.Arg("dockerfile", opts[i].Dockerfile)
break
} |
closed | dagger/dagger | https://github.com/dagger/dagger | 5,140 | Expand environment variables in `withEnvVariable` values | ### Discussed in https://github.com/dagger/dagger/discussions/5001
<div type='discussions-op-text'>
<sup>Originally posted by **wingyplus** April 21, 2023</sup>
I want to install something and append it to `PATH` to make it accessible. So how to prepend the new directory into the env variable as we do with `PATH`?</div>
Solution proposed by @vito :
> I agree; extending $PATH seems like a common use case. it would be nice to have parity with Dockerfile ENV which supports interpolation.
>
> It might be a surprising default, since who knows what values people might try to set in env vars. An expand: true param would be simple enough to implement by using [os.Expand](https://pkg.go.dev/os#Expand) and fetching values from the current image config.
>
> ```
> container {
> withEnvVariable(name: "PATH", value: "/opt/venv/bin:${PATH}", expand: true) {
> withExec(args: []string{"sh", "-c", "echo $PATH"}) {
> stdout
> }
> }
> }
> ```
> (Interpolate might be a more obvious name.) | https://github.com/dagger/dagger/issues/5140 | https://github.com/dagger/dagger/pull/5160 | c2fcf8390801585188042d12ee8190b436cc9c2f | e171dc4252e464031737b51fee4c54531b4b537d | 2023-05-16T15:18:49Z | go | 2023-05-25T09:29:47Z | sdk/go/api.gen.go | }
for i := len(opts) - 1; i >= 0; i-- {
if !querybuilder.IsZeroValue(opts[i].BuildArgs) {
q = q.Arg("buildArgs", opts[i].BuildArgs)
break
}
}
for i := len(opts) - 1; i >= 0; i-- {
if !querybuilder.IsZeroValue(opts[i].Target) {
q = q.Arg("target", opts[i].Target)
break
}
}
for i := len(opts) - 1; i >= 0; i-- {
if !querybuilder.IsZeroValue(opts[i].Secrets) {
q = q.Arg("secrets", opts[i].Secrets)
break
}
}
return &Container{
q: q,
c: r.c,
}
}
func (r *Container) DefaultArgs(ctx context.Context) ([]string, error) {
q := r.q.Select("defaultArgs")
var response []string |
closed | dagger/dagger | https://github.com/dagger/dagger | 5,140 | Expand environment variables in `withEnvVariable` values | ### Discussed in https://github.com/dagger/dagger/discussions/5001
<div type='discussions-op-text'>
<sup>Originally posted by **wingyplus** April 21, 2023</sup>
I want to install something and append it to `PATH` to make it accessible. So how to prepend the new directory into the env variable as we do with `PATH`?</div>
Solution proposed by @vito :
> I agree; extending $PATH seems like a common use case. it would be nice to have parity with Dockerfile ENV which supports interpolation.
>
> It might be a surprising default, since who knows what values people might try to set in env vars. An expand: true param would be simple enough to implement by using [os.Expand](https://pkg.go.dev/os#Expand) and fetching values from the current image config.
>
> ```
> container {
> withEnvVariable(name: "PATH", value: "/opt/venv/bin:${PATH}", expand: true) {
> withExec(args: []string{"sh", "-c", "echo $PATH"}) {
> stdout
> }
> }
> }
> ```
> (Interpolate might be a more obvious name.) | https://github.com/dagger/dagger/issues/5140 | https://github.com/dagger/dagger/pull/5160 | c2fcf8390801585188042d12ee8190b436cc9c2f | e171dc4252e464031737b51fee4c54531b4b537d | 2023-05-16T15:18:49Z | go | 2023-05-25T09:29:47Z | sdk/go/api.gen.go | q = q.Bind(&response)
return response, q.Execute(ctx, r.c)
}
func (r *Container) Directory(path string) *Directory {
q := r.q.Select("directory")
q = q.Arg("path", path)
return &Directory{
q: q,
c: r.c,
}
}
type ContainerEndpointOpts struct {
Port int
Scheme string
}
func (r *Container) Endpoint(ctx context.Context, opts ...ContainerEndpointOpts) (string, error) {
if r.endpoint != nil {
return *r.endpoint, nil
}
q := r.q.Select("endpoint")
for i := len(opts) - 1; i >= 0; i-- {
if !querybuilder.IsZeroValue(opts[i].Port) {
q = q.Arg("port", opts[i].Port)
break
}
} |
closed | dagger/dagger | https://github.com/dagger/dagger | 5,140 | Expand environment variables in `withEnvVariable` values | ### Discussed in https://github.com/dagger/dagger/discussions/5001
<div type='discussions-op-text'>
<sup>Originally posted by **wingyplus** April 21, 2023</sup>
I want to install something and append it to `PATH` to make it accessible. So how to prepend the new directory into the env variable as we do with `PATH`?</div>
Solution proposed by @vito :
> I agree; extending $PATH seems like a common use case. it would be nice to have parity with Dockerfile ENV which supports interpolation.
>
> It might be a surprising default, since who knows what values people might try to set in env vars. An expand: true param would be simple enough to implement by using [os.Expand](https://pkg.go.dev/os#Expand) and fetching values from the current image config.
>
> ```
> container {
> withEnvVariable(name: "PATH", value: "/opt/venv/bin:${PATH}", expand: true) {
> withExec(args: []string{"sh", "-c", "echo $PATH"}) {
> stdout
> }
> }
> }
> ```
> (Interpolate might be a more obvious name.) | https://github.com/dagger/dagger/issues/5140 | https://github.com/dagger/dagger/pull/5160 | c2fcf8390801585188042d12ee8190b436cc9c2f | e171dc4252e464031737b51fee4c54531b4b537d | 2023-05-16T15:18:49Z | go | 2023-05-25T09:29:47Z | sdk/go/api.gen.go | for i := len(opts) - 1; i >= 0; i-- {
if !querybuilder.IsZeroValue(opts[i].Scheme) {
q = q.Arg("scheme", opts[i].Scheme)
break
}
}
var response string
q = q.Bind(&response)
return response, q.Execute(ctx, r.c)
}
func (r *Container) Entrypoint(ctx context.Context) ([]string, error) {
q := r.q.Select("entrypoint")
var response []string
q = q.Bind(&response)
return response, q.Execute(ctx, r.c)
}
func (r *Container) EnvVariable(ctx context.Context, name string) (string, error) {
if r.envVariable != nil {
return *r.envVariable, nil
}
q := r.q.Select("envVariable")
q = q.Arg("name", name)
var response string
q = q.Bind(&response)
return response, q.Execute(ctx, r.c)
}
func (r *Container) EnvVariables(ctx context.Context) ([]EnvVariable, error) {
q := r.q.Select("envVariables")
q = q.Select("name value")
type envVariables struct { |
closed | dagger/dagger | https://github.com/dagger/dagger | 5,140 | Expand environment variables in `withEnvVariable` values | ### Discussed in https://github.com/dagger/dagger/discussions/5001
<div type='discussions-op-text'>
<sup>Originally posted by **wingyplus** April 21, 2023</sup>
I want to install something and append it to `PATH` to make it accessible. So how to prepend the new directory into the env variable as we do with `PATH`?</div>
Solution proposed by @vito :
> I agree; extending $PATH seems like a common use case. it would be nice to have parity with Dockerfile ENV which supports interpolation.
>
> It might be a surprising default, since who knows what values people might try to set in env vars. An expand: true param would be simple enough to implement by using [os.Expand](https://pkg.go.dev/os#Expand) and fetching values from the current image config.
>
> ```
> container {
> withEnvVariable(name: "PATH", value: "/opt/venv/bin:${PATH}", expand: true) {
> withExec(args: []string{"sh", "-c", "echo $PATH"}) {
> stdout
> }
> }
> }
> ```
> (Interpolate might be a more obvious name.) | https://github.com/dagger/dagger/issues/5140 | https://github.com/dagger/dagger/pull/5160 | c2fcf8390801585188042d12ee8190b436cc9c2f | e171dc4252e464031737b51fee4c54531b4b537d | 2023-05-16T15:18:49Z | go | 2023-05-25T09:29:47Z | sdk/go/api.gen.go | Name string
Value string
}
convert := func(fields []envVariables) []EnvVariable {
out := []EnvVariable{}
for i := range fields {
out = append(out, EnvVariable{name: &fields[i].Name, value: &fields[i].Value})
}
return out
}
var response []envVariables
q = q.Bind(&response)
err := q.Execute(ctx, r.c)
if err != nil {
return nil, err
}
return convert(response), nil
}
type ContainerExecOpts struct {
Args []string
Stdin string |
closed | dagger/dagger | https://github.com/dagger/dagger | 5,140 | Expand environment variables in `withEnvVariable` values | ### Discussed in https://github.com/dagger/dagger/discussions/5001
<div type='discussions-op-text'>
<sup>Originally posted by **wingyplus** April 21, 2023</sup>
I want to install something and append it to `PATH` to make it accessible. So how to prepend the new directory into the env variable as we do with `PATH`?</div>
Solution proposed by @vito :
> I agree; extending $PATH seems like a common use case. it would be nice to have parity with Dockerfile ENV which supports interpolation.
>
> It might be a surprising default, since who knows what values people might try to set in env vars. An expand: true param would be simple enough to implement by using [os.Expand](https://pkg.go.dev/os#Expand) and fetching values from the current image config.
>
> ```
> container {
> withEnvVariable(name: "PATH", value: "/opt/venv/bin:${PATH}", expand: true) {
> withExec(args: []string{"sh", "-c", "echo $PATH"}) {
> stdout
> }
> }
> }
> ```
> (Interpolate might be a more obvious name.) | https://github.com/dagger/dagger/issues/5140 | https://github.com/dagger/dagger/pull/5160 | c2fcf8390801585188042d12ee8190b436cc9c2f | e171dc4252e464031737b51fee4c54531b4b537d | 2023-05-16T15:18:49Z | go | 2023-05-25T09:29:47Z | sdk/go/api.gen.go | RedirectStdout string
RedirectStderr string
ExperimentalPrivilegedNesting bool
}
func (r *Container) Exec(opts ...ContainerExecOpts) *Container {
q := r.q.Select("exec")
for i := len(opts) - 1; i >= 0; i-- {
if !querybuilder.IsZeroValue(opts[i].Args) {
q = q.Arg("args", opts[i].Args)
break
}
}
for i := len(opts) - 1; i >= 0; i-- {
if !querybuilder.IsZeroValue(opts[i].Stdin) {
q = q.Arg("stdin", opts[i].Stdin)
break
}
}
for i := len(opts) - 1; i >= 0; i-- {
if !querybuilder.IsZeroValue(opts[i].RedirectStdout) {
q = q.Arg("redirectStdout", opts[i].RedirectStdout)
break
} |
closed | dagger/dagger | https://github.com/dagger/dagger | 5,140 | Expand environment variables in `withEnvVariable` values | ### Discussed in https://github.com/dagger/dagger/discussions/5001
<div type='discussions-op-text'>
<sup>Originally posted by **wingyplus** April 21, 2023</sup>
I want to install something and append it to `PATH` to make it accessible. So how to prepend the new directory into the env variable as we do with `PATH`?</div>
Solution proposed by @vito :
> I agree; extending $PATH seems like a common use case. it would be nice to have parity with Dockerfile ENV which supports interpolation.
>
> It might be a surprising default, since who knows what values people might try to set in env vars. An expand: true param would be simple enough to implement by using [os.Expand](https://pkg.go.dev/os#Expand) and fetching values from the current image config.
>
> ```
> container {
> withEnvVariable(name: "PATH", value: "/opt/venv/bin:${PATH}", expand: true) {
> withExec(args: []string{"sh", "-c", "echo $PATH"}) {
> stdout
> }
> }
> }
> ```
> (Interpolate might be a more obvious name.) | https://github.com/dagger/dagger/issues/5140 | https://github.com/dagger/dagger/pull/5160 | c2fcf8390801585188042d12ee8190b436cc9c2f | e171dc4252e464031737b51fee4c54531b4b537d | 2023-05-16T15:18:49Z | go | 2023-05-25T09:29:47Z | sdk/go/api.gen.go | }
for i := len(opts) - 1; i >= 0; i-- {
if !querybuilder.IsZeroValue(opts[i].RedirectStderr) {
q = q.Arg("redirectStderr", opts[i].RedirectStderr)
break
}
}
for i := len(opts) - 1; i >= 0; i-- {
if !querybuilder.IsZeroValue(opts[i].ExperimentalPrivilegedNesting) {
q = q.Arg("experimentalPrivilegedNesting", opts[i].ExperimentalPrivilegedNesting)
break
}
}
return &Container{
q: q,
c: r.c,
}
}
func (r *Container) ExitCode(ctx context.Context) (int, error) {
if r.exitCode != nil {
return *r.exitCode, nil
}
q := r.q.Select("exitCode")
var response int
q = q.Bind(&response)
return response, q.Execute(ctx, r.c)
}
type ContainerExportOpts struct { |
closed | dagger/dagger | https://github.com/dagger/dagger | 5,140 | Expand environment variables in `withEnvVariable` values | ### Discussed in https://github.com/dagger/dagger/discussions/5001
<div type='discussions-op-text'>
<sup>Originally posted by **wingyplus** April 21, 2023</sup>
I want to install something and append it to `PATH` to make it accessible. So how to prepend the new directory into the env variable as we do with `PATH`?</div>
Solution proposed by @vito :
> I agree; extending $PATH seems like a common use case. it would be nice to have parity with Dockerfile ENV which supports interpolation.
>
> It might be a surprising default, since who knows what values people might try to set in env vars. An expand: true param would be simple enough to implement by using [os.Expand](https://pkg.go.dev/os#Expand) and fetching values from the current image config.
>
> ```
> container {
> withEnvVariable(name: "PATH", value: "/opt/venv/bin:${PATH}", expand: true) {
> withExec(args: []string{"sh", "-c", "echo $PATH"}) {
> stdout
> }
> }
> }
> ```
> (Interpolate might be a more obvious name.) | https://github.com/dagger/dagger/issues/5140 | https://github.com/dagger/dagger/pull/5160 | c2fcf8390801585188042d12ee8190b436cc9c2f | e171dc4252e464031737b51fee4c54531b4b537d | 2023-05-16T15:18:49Z | go | 2023-05-25T09:29:47Z | sdk/go/api.gen.go | PlatformVariants []*Container
ForcedCompression ImageLayerCompression
}
func (r *Container) Export(ctx context.Context, path string, opts ...ContainerExportOpts) (bool, error) {
if r.export != nil {
return *r.export, nil
}
q := r.q.Select("export")
q = q.Arg("path", path)
for i := len(opts) - 1; i >= 0; i-- {
if !querybuilder.IsZeroValue(opts[i].PlatformVariants) {
q = q.Arg("platformVariants", opts[i].PlatformVariants)
break
}
}
for i := len(opts) - 1; i >= 0; i-- {
if !querybuilder.IsZeroValue(opts[i].ForcedCompression) {
q = q.Arg("forcedCompression", opts[i].ForcedCompression)
break |
closed | dagger/dagger | https://github.com/dagger/dagger | 5,140 | Expand environment variables in `withEnvVariable` values | ### Discussed in https://github.com/dagger/dagger/discussions/5001
<div type='discussions-op-text'>
<sup>Originally posted by **wingyplus** April 21, 2023</sup>
I want to install something and append it to `PATH` to make it accessible. So how to prepend the new directory into the env variable as we do with `PATH`?</div>
Solution proposed by @vito :
> I agree; extending $PATH seems like a common use case. it would be nice to have parity with Dockerfile ENV which supports interpolation.
>
> It might be a surprising default, since who knows what values people might try to set in env vars. An expand: true param would be simple enough to implement by using [os.Expand](https://pkg.go.dev/os#Expand) and fetching values from the current image config.
>
> ```
> container {
> withEnvVariable(name: "PATH", value: "/opt/venv/bin:${PATH}", expand: true) {
> withExec(args: []string{"sh", "-c", "echo $PATH"}) {
> stdout
> }
> }
> }
> ```
> (Interpolate might be a more obvious name.) | https://github.com/dagger/dagger/issues/5140 | https://github.com/dagger/dagger/pull/5160 | c2fcf8390801585188042d12ee8190b436cc9c2f | e171dc4252e464031737b51fee4c54531b4b537d | 2023-05-16T15:18:49Z | go | 2023-05-25T09:29:47Z | sdk/go/api.gen.go | }
}
var response bool
q = q.Bind(&response)
return response, q.Execute(ctx, r.c)
}
func (r *Container) ExposedPorts(ctx context.Context) ([]Port, error) {
q := r.q.Select("exposedPorts")
q = q.Select("description port protocol")
type exposedPorts struct {
Description string
Port int
Protocol NetworkProtocol
}
convert := func(fields []exposedPorts) []Port {
out := []Port{}
for i := range fields {
out = append(out, Port{description: &fields[i].Description, port: &fields[i].Port, protocol: &fields[i].Protocol})
}
return out
}
var response []exposedPorts
q = q.Bind(&response)
err := q.Execute(ctx, r.c)
if err != nil {
return nil, err
}
return convert(response), nil
}
func (r *Container) File(path string) *File { |
closed | dagger/dagger | https://github.com/dagger/dagger | 5,140 | Expand environment variables in `withEnvVariable` values | ### Discussed in https://github.com/dagger/dagger/discussions/5001
<div type='discussions-op-text'>
<sup>Originally posted by **wingyplus** April 21, 2023</sup>
I want to install something and append it to `PATH` to make it accessible. So how to prepend the new directory into the env variable as we do with `PATH`?</div>
Solution proposed by @vito :
> I agree; extending $PATH seems like a common use case. it would be nice to have parity with Dockerfile ENV which supports interpolation.
>
> It might be a surprising default, since who knows what values people might try to set in env vars. An expand: true param would be simple enough to implement by using [os.Expand](https://pkg.go.dev/os#Expand) and fetching values from the current image config.
>
> ```
> container {
> withEnvVariable(name: "PATH", value: "/opt/venv/bin:${PATH}", expand: true) {
> withExec(args: []string{"sh", "-c", "echo $PATH"}) {
> stdout
> }
> }
> }
> ```
> (Interpolate might be a more obvious name.) | https://github.com/dagger/dagger/issues/5140 | https://github.com/dagger/dagger/pull/5160 | c2fcf8390801585188042d12ee8190b436cc9c2f | e171dc4252e464031737b51fee4c54531b4b537d | 2023-05-16T15:18:49Z | go | 2023-05-25T09:29:47Z | sdk/go/api.gen.go | q := r.q.Select("file")
q = q.Arg("path", path)
return &File{
q: q,
c: r.c,
}
}
func (r *Container) From(address string) *Container {
q := r.q.Select("from")
q = q.Arg("address", address)
return &Container{
q: q,
c: r.c,
}
}
func (r *Container) FS() *Directory {
q := r.q.Select("fs")
return &Directory{
q: q,
c: r.c,
}
}
func (r *Container) Hostname(ctx context.Context) (string, error) {
if r.hostname != nil {
return *r.hostname, nil
}
q := r.q.Select("hostname")
var response string
q = q.Bind(&response)
return response, q.Execute(ctx, r.c) |
closed | dagger/dagger | https://github.com/dagger/dagger | 5,140 | Expand environment variables in `withEnvVariable` values | ### Discussed in https://github.com/dagger/dagger/discussions/5001
<div type='discussions-op-text'>
<sup>Originally posted by **wingyplus** April 21, 2023</sup>
I want to install something and append it to `PATH` to make it accessible. So how to prepend the new directory into the env variable as we do with `PATH`?</div>
Solution proposed by @vito :
> I agree; extending $PATH seems like a common use case. it would be nice to have parity with Dockerfile ENV which supports interpolation.
>
> It might be a surprising default, since who knows what values people might try to set in env vars. An expand: true param would be simple enough to implement by using [os.Expand](https://pkg.go.dev/os#Expand) and fetching values from the current image config.
>
> ```
> container {
> withEnvVariable(name: "PATH", value: "/opt/venv/bin:${PATH}", expand: true) {
> withExec(args: []string{"sh", "-c", "echo $PATH"}) {
> stdout
> }
> }
> }
> ```
> (Interpolate might be a more obvious name.) | https://github.com/dagger/dagger/issues/5140 | https://github.com/dagger/dagger/pull/5160 | c2fcf8390801585188042d12ee8190b436cc9c2f | e171dc4252e464031737b51fee4c54531b4b537d | 2023-05-16T15:18:49Z | go | 2023-05-25T09:29:47Z | sdk/go/api.gen.go | }
func (r *Container) ID(ctx context.Context) (ContainerID, error) {
if r.id != nil {
return *r.id, nil
}
q := r.q.Select("id")
var response ContainerID
q = q.Bind(&response)
return response, q.Execute(ctx, r.c)
}
func (r *Container) XXX_GraphQLType() string {
return "Container"
}
func (r *Container) XXX_GraphQLID(ctx context.Context) (string, error) {
id, err := r.ID(ctx)
if err != nil {
return "", err
}
return string(id), nil
}
func (r *Container) ImageRef(ctx context.Context) (string, error) {
if r.imageRef != nil {
return *r.imageRef, nil
}
q := r.q.Select("imageRef")
var response string
q = q.Bind(&response)
return response, q.Execute(ctx, r.c)
}
type ContainerImportOpts struct { |
closed | dagger/dagger | https://github.com/dagger/dagger | 5,140 | Expand environment variables in `withEnvVariable` values | ### Discussed in https://github.com/dagger/dagger/discussions/5001
<div type='discussions-op-text'>
<sup>Originally posted by **wingyplus** April 21, 2023</sup>
I want to install something and append it to `PATH` to make it accessible. So how to prepend the new directory into the env variable as we do with `PATH`?</div>
Solution proposed by @vito :
> I agree; extending $PATH seems like a common use case. it would be nice to have parity with Dockerfile ENV which supports interpolation.
>
> It might be a surprising default, since who knows what values people might try to set in env vars. An expand: true param would be simple enough to implement by using [os.Expand](https://pkg.go.dev/os#Expand) and fetching values from the current image config.
>
> ```
> container {
> withEnvVariable(name: "PATH", value: "/opt/venv/bin:${PATH}", expand: true) {
> withExec(args: []string{"sh", "-c", "echo $PATH"}) {
> stdout
> }
> }
> }
> ```
> (Interpolate might be a more obvious name.) | https://github.com/dagger/dagger/issues/5140 | https://github.com/dagger/dagger/pull/5160 | c2fcf8390801585188042d12ee8190b436cc9c2f | e171dc4252e464031737b51fee4c54531b4b537d | 2023-05-16T15:18:49Z | go | 2023-05-25T09:29:47Z | sdk/go/api.gen.go | Tag string
}
func (r *Container) Import(source *File, opts ...ContainerImportOpts) *Container {
q := r.q.Select("import")
q = q.Arg("source", source)
for i := len(opts) - 1; i >= 0; i-- {
if !querybuilder.IsZeroValue(opts[i].Tag) {
q = q.Arg("tag", opts[i].Tag)
break
}
}
return &Container{
q: q,
c: r.c,
}
}
func (r *Container) Label(ctx context.Context, name string) (string, error) {
if r.label != nil {
return *r.label, nil
}
q := r.q.Select("label")
q = q.Arg("name", name)
var response string
q = q.Bind(&response)
return response, q.Execute(ctx, r.c) |
closed | dagger/dagger | https://github.com/dagger/dagger | 5,140 | Expand environment variables in `withEnvVariable` values | ### Discussed in https://github.com/dagger/dagger/discussions/5001
<div type='discussions-op-text'>
<sup>Originally posted by **wingyplus** April 21, 2023</sup>
I want to install something and append it to `PATH` to make it accessible. So how to prepend the new directory into the env variable as we do with `PATH`?</div>
Solution proposed by @vito :
> I agree; extending $PATH seems like a common use case. it would be nice to have parity with Dockerfile ENV which supports interpolation.
>
> It might be a surprising default, since who knows what values people might try to set in env vars. An expand: true param would be simple enough to implement by using [os.Expand](https://pkg.go.dev/os#Expand) and fetching values from the current image config.
>
> ```
> container {
> withEnvVariable(name: "PATH", value: "/opt/venv/bin:${PATH}", expand: true) {
> withExec(args: []string{"sh", "-c", "echo $PATH"}) {
> stdout
> }
> }
> }
> ```
> (Interpolate might be a more obvious name.) | https://github.com/dagger/dagger/issues/5140 | https://github.com/dagger/dagger/pull/5160 | c2fcf8390801585188042d12ee8190b436cc9c2f | e171dc4252e464031737b51fee4c54531b4b537d | 2023-05-16T15:18:49Z | go | 2023-05-25T09:29:47Z | sdk/go/api.gen.go | }
func (r *Container) Labels(ctx context.Context) ([]Label, error) {
q := r.q.Select("labels")
q = q.Select("name value")
type labels struct {
Name string
Value string
}
convert := func(fields []labels) []Label {
out := []Label{}
for i := range fields {
out = append(out, Label{name: &fields[i].Name, value: &fields[i].Value})
}
return out
}
var response []labels
q = q.Bind(&response)
err := q.Execute(ctx, r.c)
if err != nil {
return nil, err
}
return convert(response), nil
}
func (r *Container) Mounts(ctx context.Context) ([]string, error) {
q := r.q.Select("mounts")
var response []string
q = q.Bind(&response)
return response, q.Execute(ctx, r.c)
}
type ContainerPipelineOpts struct { |
closed | dagger/dagger | https://github.com/dagger/dagger | 5,140 | Expand environment variables in `withEnvVariable` values | ### Discussed in https://github.com/dagger/dagger/discussions/5001
<div type='discussions-op-text'>
<sup>Originally posted by **wingyplus** April 21, 2023</sup>
I want to install something and append it to `PATH` to make it accessible. So how to prepend the new directory into the env variable as we do with `PATH`?</div>
Solution proposed by @vito :
> I agree; extending $PATH seems like a common use case. it would be nice to have parity with Dockerfile ENV which supports interpolation.
>
> It might be a surprising default, since who knows what values people might try to set in env vars. An expand: true param would be simple enough to implement by using [os.Expand](https://pkg.go.dev/os#Expand) and fetching values from the current image config.
>
> ```
> container {
> withEnvVariable(name: "PATH", value: "/opt/venv/bin:${PATH}", expand: true) {
> withExec(args: []string{"sh", "-c", "echo $PATH"}) {
> stdout
> }
> }
> }
> ```
> (Interpolate might be a more obvious name.) | https://github.com/dagger/dagger/issues/5140 | https://github.com/dagger/dagger/pull/5160 | c2fcf8390801585188042d12ee8190b436cc9c2f | e171dc4252e464031737b51fee4c54531b4b537d | 2023-05-16T15:18:49Z | go | 2023-05-25T09:29:47Z | sdk/go/api.gen.go | Description string
Labels []PipelineLabel
}
func (r *Container) Pipeline(name string, opts ...ContainerPipelineOpts) *Container {
q := r.q.Select("pipeline")
q = q.Arg("name", name)
for i := len(opts) - 1; i >= 0; i-- {
if !querybuilder.IsZeroValue(opts[i].Description) {
q = q.Arg("description", opts[i].Description)
break
}
}
for i := len(opts) - 1; i >= 0; i-- {
if !querybuilder.IsZeroValue(opts[i].Labels) {
q = q.Arg("labels", opts[i].Labels)
break |
closed | dagger/dagger | https://github.com/dagger/dagger | 5,140 | Expand environment variables in `withEnvVariable` values | ### Discussed in https://github.com/dagger/dagger/discussions/5001
<div type='discussions-op-text'>
<sup>Originally posted by **wingyplus** April 21, 2023</sup>
I want to install something and append it to `PATH` to make it accessible. So how to prepend the new directory into the env variable as we do with `PATH`?</div>
Solution proposed by @vito :
> I agree; extending $PATH seems like a common use case. it would be nice to have parity with Dockerfile ENV which supports interpolation.
>
> It might be a surprising default, since who knows what values people might try to set in env vars. An expand: true param would be simple enough to implement by using [os.Expand](https://pkg.go.dev/os#Expand) and fetching values from the current image config.
>
> ```
> container {
> withEnvVariable(name: "PATH", value: "/opt/venv/bin:${PATH}", expand: true) {
> withExec(args: []string{"sh", "-c", "echo $PATH"}) {
> stdout
> }
> }
> }
> ```
> (Interpolate might be a more obvious name.) | https://github.com/dagger/dagger/issues/5140 | https://github.com/dagger/dagger/pull/5160 | c2fcf8390801585188042d12ee8190b436cc9c2f | e171dc4252e464031737b51fee4c54531b4b537d | 2023-05-16T15:18:49Z | go | 2023-05-25T09:29:47Z | sdk/go/api.gen.go | }
}
return &Container{
q: q,
c: r.c,
}
}
func (r *Container) Platform(ctx context.Context) (Platform, error) {
if r.platform != nil {
return *r.platform, nil
}
q := r.q.Select("platform")
var response Platform
q = q.Bind(&response)
return response, q.Execute(ctx, r.c)
}
type ContainerPublishOpts struct {
PlatformVariants []*Container
ForcedCompression ImageLayerCompression
}
func (r *Container) Publish(ctx context.Context, address string, opts ...ContainerPublishOpts) (string, error) {
if r.publish != nil {
return *r.publish, nil |
closed | dagger/dagger | https://github.com/dagger/dagger | 5,140 | Expand environment variables in `withEnvVariable` values | ### Discussed in https://github.com/dagger/dagger/discussions/5001
<div type='discussions-op-text'>
<sup>Originally posted by **wingyplus** April 21, 2023</sup>
I want to install something and append it to `PATH` to make it accessible. So how to prepend the new directory into the env variable as we do with `PATH`?</div>
Solution proposed by @vito :
> I agree; extending $PATH seems like a common use case. it would be nice to have parity with Dockerfile ENV which supports interpolation.
>
> It might be a surprising default, since who knows what values people might try to set in env vars. An expand: true param would be simple enough to implement by using [os.Expand](https://pkg.go.dev/os#Expand) and fetching values from the current image config.
>
> ```
> container {
> withEnvVariable(name: "PATH", value: "/opt/venv/bin:${PATH}", expand: true) {
> withExec(args: []string{"sh", "-c", "echo $PATH"}) {
> stdout
> }
> }
> }
> ```
> (Interpolate might be a more obvious name.) | https://github.com/dagger/dagger/issues/5140 | https://github.com/dagger/dagger/pull/5160 | c2fcf8390801585188042d12ee8190b436cc9c2f | e171dc4252e464031737b51fee4c54531b4b537d | 2023-05-16T15:18:49Z | go | 2023-05-25T09:29:47Z | sdk/go/api.gen.go | }
q := r.q.Select("publish")
q = q.Arg("address", address)
for i := len(opts) - 1; i >= 0; i-- {
if !querybuilder.IsZeroValue(opts[i].PlatformVariants) {
q = q.Arg("platformVariants", opts[i].PlatformVariants)
break
}
}
for i := len(opts) - 1; i >= 0; i-- {
if !querybuilder.IsZeroValue(opts[i].ForcedCompression) {
q = q.Arg("forcedCompression", opts[i].ForcedCompression)
break
}
}
var response string
q = q.Bind(&response)
return response, q.Execute(ctx, r.c)
}
func (r *Container) Rootfs() *Directory {
q := r.q.Select("rootfs")
return &Directory{
q: q,
c: r.c,
}
}
func (r *Container) Stderr(ctx context.Context) (string, error) {
if r.stderr != nil { |
closed | dagger/dagger | https://github.com/dagger/dagger | 5,140 | Expand environment variables in `withEnvVariable` values | ### Discussed in https://github.com/dagger/dagger/discussions/5001
<div type='discussions-op-text'>
<sup>Originally posted by **wingyplus** April 21, 2023</sup>
I want to install something and append it to `PATH` to make it accessible. So how to prepend the new directory into the env variable as we do with `PATH`?</div>
Solution proposed by @vito :
> I agree; extending $PATH seems like a common use case. it would be nice to have parity with Dockerfile ENV which supports interpolation.
>
> It might be a surprising default, since who knows what values people might try to set in env vars. An expand: true param would be simple enough to implement by using [os.Expand](https://pkg.go.dev/os#Expand) and fetching values from the current image config.
>
> ```
> container {
> withEnvVariable(name: "PATH", value: "/opt/venv/bin:${PATH}", expand: true) {
> withExec(args: []string{"sh", "-c", "echo $PATH"}) {
> stdout
> }
> }
> }
> ```
> (Interpolate might be a more obvious name.) | https://github.com/dagger/dagger/issues/5140 | https://github.com/dagger/dagger/pull/5160 | c2fcf8390801585188042d12ee8190b436cc9c2f | e171dc4252e464031737b51fee4c54531b4b537d | 2023-05-16T15:18:49Z | go | 2023-05-25T09:29:47Z | sdk/go/api.gen.go | return *r.stderr, nil
}
q := r.q.Select("stderr")
var response string
q = q.Bind(&response)
return response, q.Execute(ctx, r.c)
}
func (r *Container) Stdout(ctx context.Context) (string, error) {
if r.stdout != nil {
return *r.stdout, nil
}
q := r.q.Select("stdout")
var response string
q = q.Bind(&response)
return response, q.Execute(ctx, r.c)
}
func (r *Container) Sync(ctx context.Context) (*Container, error) {
q := r.q.Select("sync")
return r, q.Execute(ctx, r.c)
}
func (r *Container) User(ctx context.Context) (string, error) {
if r.user != nil {
return *r.user, nil
}
q := r.q.Select("user")
var response string
q = q.Bind(&response)
return response, q.Execute(ctx, r.c)
}
type ContainerWithDefaultArgsOpts struct { |
closed | dagger/dagger | https://github.com/dagger/dagger | 5,140 | Expand environment variables in `withEnvVariable` values | ### Discussed in https://github.com/dagger/dagger/discussions/5001
<div type='discussions-op-text'>
<sup>Originally posted by **wingyplus** April 21, 2023</sup>
I want to install something and append it to `PATH` to make it accessible. So how to prepend the new directory into the env variable as we do with `PATH`?</div>
Solution proposed by @vito :
> I agree; extending $PATH seems like a common use case. it would be nice to have parity with Dockerfile ENV which supports interpolation.
>
> It might be a surprising default, since who knows what values people might try to set in env vars. An expand: true param would be simple enough to implement by using [os.Expand](https://pkg.go.dev/os#Expand) and fetching values from the current image config.
>
> ```
> container {
> withEnvVariable(name: "PATH", value: "/opt/venv/bin:${PATH}", expand: true) {
> withExec(args: []string{"sh", "-c", "echo $PATH"}) {
> stdout
> }
> }
> }
> ```
> (Interpolate might be a more obvious name.) | https://github.com/dagger/dagger/issues/5140 | https://github.com/dagger/dagger/pull/5160 | c2fcf8390801585188042d12ee8190b436cc9c2f | e171dc4252e464031737b51fee4c54531b4b537d | 2023-05-16T15:18:49Z | go | 2023-05-25T09:29:47Z | sdk/go/api.gen.go | Args []string
}
func (r *Container) WithDefaultArgs(opts ...ContainerWithDefaultArgsOpts) *Container {
q := r.q.Select("withDefaultArgs")
for i := len(opts) - 1; i >= 0; i-- {
if !querybuilder.IsZeroValue(opts[i].Args) {
q = q.Arg("args", opts[i].Args)
break
}
}
return &Container{
q: q,
c: r.c,
}
}
type ContainerWithDirectoryOpts struct { |
closed | dagger/dagger | https://github.com/dagger/dagger | 5,140 | Expand environment variables in `withEnvVariable` values | ### Discussed in https://github.com/dagger/dagger/discussions/5001
<div type='discussions-op-text'>
<sup>Originally posted by **wingyplus** April 21, 2023</sup>
I want to install something and append it to `PATH` to make it accessible. So how to prepend the new directory into the env variable as we do with `PATH`?</div>
Solution proposed by @vito :
> I agree; extending $PATH seems like a common use case. it would be nice to have parity with Dockerfile ENV which supports interpolation.
>
> It might be a surprising default, since who knows what values people might try to set in env vars. An expand: true param would be simple enough to implement by using [os.Expand](https://pkg.go.dev/os#Expand) and fetching values from the current image config.
>
> ```
> container {
> withEnvVariable(name: "PATH", value: "/opt/venv/bin:${PATH}", expand: true) {
> withExec(args: []string{"sh", "-c", "echo $PATH"}) {
> stdout
> }
> }
> }
> ```
> (Interpolate might be a more obvious name.) | https://github.com/dagger/dagger/issues/5140 | https://github.com/dagger/dagger/pull/5160 | c2fcf8390801585188042d12ee8190b436cc9c2f | e171dc4252e464031737b51fee4c54531b4b537d | 2023-05-16T15:18:49Z | go | 2023-05-25T09:29:47Z | sdk/go/api.gen.go | Exclude []string
Include []string
Owner string
}
func (r *Container) WithDirectory(path string, directory *Directory, opts ...ContainerWithDirectoryOpts) *Container {
q := r.q.Select("withDirectory")
q = q.Arg("path", path)
q = q.Arg("directory", directory)
for i := len(opts) - 1; i >= 0; i-- {
if !querybuilder.IsZeroValue(opts[i].Exclude) {
q = q.Arg("exclude", opts[i].Exclude)
break
}
}
for i := len(opts) - 1; i >= 0; i-- {
if !querybuilder.IsZeroValue(opts[i].Include) {
q = q.Arg("include", opts[i].Include)
break
}
} |
closed | dagger/dagger | https://github.com/dagger/dagger | 5,140 | Expand environment variables in `withEnvVariable` values | ### Discussed in https://github.com/dagger/dagger/discussions/5001
<div type='discussions-op-text'>
<sup>Originally posted by **wingyplus** April 21, 2023</sup>
I want to install something and append it to `PATH` to make it accessible. So how to prepend the new directory into the env variable as we do with `PATH`?</div>
Solution proposed by @vito :
> I agree; extending $PATH seems like a common use case. it would be nice to have parity with Dockerfile ENV which supports interpolation.
>
> It might be a surprising default, since who knows what values people might try to set in env vars. An expand: true param would be simple enough to implement by using [os.Expand](https://pkg.go.dev/os#Expand) and fetching values from the current image config.
>
> ```
> container {
> withEnvVariable(name: "PATH", value: "/opt/venv/bin:${PATH}", expand: true) {
> withExec(args: []string{"sh", "-c", "echo $PATH"}) {
> stdout
> }
> }
> }
> ```
> (Interpolate might be a more obvious name.) | https://github.com/dagger/dagger/issues/5140 | https://github.com/dagger/dagger/pull/5160 | c2fcf8390801585188042d12ee8190b436cc9c2f | e171dc4252e464031737b51fee4c54531b4b537d | 2023-05-16T15:18:49Z | go | 2023-05-25T09:29:47Z | sdk/go/api.gen.go | for i := len(opts) - 1; i >= 0; i-- {
if !querybuilder.IsZeroValue(opts[i].Owner) {
q = q.Arg("owner", opts[i].Owner)
break
}
}
return &Container{
q: q,
c: r.c,
}
}
func (r *Container) WithEntrypoint(args []string) *Container {
q := r.q.Select("withEntrypoint")
q = q.Arg("args", args)
return &Container{
q: q,
c: r.c,
}
}
func (r *Container) WithEnvVariable(name string, value string) *Container {
q := r.q.Select("withEnvVariable")
q = q.Arg("name", name)
q = q.Arg("value", value)
return &Container{
q: q,
c: r.c,
}
}
type ContainerWithExecOpts struct { |
closed | dagger/dagger | https://github.com/dagger/dagger | 5,140 | Expand environment variables in `withEnvVariable` values | ### Discussed in https://github.com/dagger/dagger/discussions/5001
<div type='discussions-op-text'>
<sup>Originally posted by **wingyplus** April 21, 2023</sup>
I want to install something and append it to `PATH` to make it accessible. So how to prepend the new directory into the env variable as we do with `PATH`?</div>
Solution proposed by @vito :
> I agree; extending $PATH seems like a common use case. it would be nice to have parity with Dockerfile ENV which supports interpolation.
>
> It might be a surprising default, since who knows what values people might try to set in env vars. An expand: true param would be simple enough to implement by using [os.Expand](https://pkg.go.dev/os#Expand) and fetching values from the current image config.
>
> ```
> container {
> withEnvVariable(name: "PATH", value: "/opt/venv/bin:${PATH}", expand: true) {
> withExec(args: []string{"sh", "-c", "echo $PATH"}) {
> stdout
> }
> }
> }
> ```
> (Interpolate might be a more obvious name.) | https://github.com/dagger/dagger/issues/5140 | https://github.com/dagger/dagger/pull/5160 | c2fcf8390801585188042d12ee8190b436cc9c2f | e171dc4252e464031737b51fee4c54531b4b537d | 2023-05-16T15:18:49Z | go | 2023-05-25T09:29:47Z | sdk/go/api.gen.go | SkipEntrypoint bool
Stdin string
RedirectStdout string
RedirectStderr string
ExperimentalPrivilegedNesting bool |
closed | dagger/dagger | https://github.com/dagger/dagger | 5,140 | Expand environment variables in `withEnvVariable` values | ### Discussed in https://github.com/dagger/dagger/discussions/5001
<div type='discussions-op-text'>
<sup>Originally posted by **wingyplus** April 21, 2023</sup>
I want to install something and append it to `PATH` to make it accessible. So how to prepend the new directory into the env variable as we do with `PATH`?</div>
Solution proposed by @vito :
> I agree; extending $PATH seems like a common use case. it would be nice to have parity with Dockerfile ENV which supports interpolation.
>
> It might be a surprising default, since who knows what values people might try to set in env vars. An expand: true param would be simple enough to implement by using [os.Expand](https://pkg.go.dev/os#Expand) and fetching values from the current image config.
>
> ```
> container {
> withEnvVariable(name: "PATH", value: "/opt/venv/bin:${PATH}", expand: true) {
> withExec(args: []string{"sh", "-c", "echo $PATH"}) {
> stdout
> }
> }
> }
> ```
> (Interpolate might be a more obvious name.) | https://github.com/dagger/dagger/issues/5140 | https://github.com/dagger/dagger/pull/5160 | c2fcf8390801585188042d12ee8190b436cc9c2f | e171dc4252e464031737b51fee4c54531b4b537d | 2023-05-16T15:18:49Z | go | 2023-05-25T09:29:47Z | sdk/go/api.gen.go | InsecureRootCapabilities bool
}
func (r *Container) WithExec(args []string, opts ...ContainerWithExecOpts) *Container {
q := r.q.Select("withExec")
q = q.Arg("args", args)
for i := len(opts) - 1; i >= 0; i-- {
if !querybuilder.IsZeroValue(opts[i].SkipEntrypoint) {
q = q.Arg("skipEntrypoint", opts[i].SkipEntrypoint)
break
}
}
for i := len(opts) - 1; i >= 0; i-- {
if !querybuilder.IsZeroValue(opts[i].Stdin) {
q = q.Arg("stdin", opts[i].Stdin)
break
}
}
for i := len(opts) - 1; i >= 0; i-- {
if !querybuilder.IsZeroValue(opts[i].RedirectStdout) {
q = q.Arg("redirectStdout", opts[i].RedirectStdout)
break
}
}
for i := len(opts) - 1; i >= 0; i-- {
if !querybuilder.IsZeroValue(opts[i].RedirectStderr) { |
closed | dagger/dagger | https://github.com/dagger/dagger | 5,140 | Expand environment variables in `withEnvVariable` values | ### Discussed in https://github.com/dagger/dagger/discussions/5001
<div type='discussions-op-text'>
<sup>Originally posted by **wingyplus** April 21, 2023</sup>
I want to install something and append it to `PATH` to make it accessible. So how to prepend the new directory into the env variable as we do with `PATH`?</div>
Solution proposed by @vito :
> I agree; extending $PATH seems like a common use case. it would be nice to have parity with Dockerfile ENV which supports interpolation.
>
> It might be a surprising default, since who knows what values people might try to set in env vars. An expand: true param would be simple enough to implement by using [os.Expand](https://pkg.go.dev/os#Expand) and fetching values from the current image config.
>
> ```
> container {
> withEnvVariable(name: "PATH", value: "/opt/venv/bin:${PATH}", expand: true) {
> withExec(args: []string{"sh", "-c", "echo $PATH"}) {
> stdout
> }
> }
> }
> ```
> (Interpolate might be a more obvious name.) | https://github.com/dagger/dagger/issues/5140 | https://github.com/dagger/dagger/pull/5160 | c2fcf8390801585188042d12ee8190b436cc9c2f | e171dc4252e464031737b51fee4c54531b4b537d | 2023-05-16T15:18:49Z | go | 2023-05-25T09:29:47Z | sdk/go/api.gen.go | q = q.Arg("redirectStderr", opts[i].RedirectStderr)
break
}
}
for i := len(opts) - 1; i >= 0; i-- {
if !querybuilder.IsZeroValue(opts[i].ExperimentalPrivilegedNesting) {
q = q.Arg("experimentalPrivilegedNesting", opts[i].ExperimentalPrivilegedNesting)
break
}
}
for i := len(opts) - 1; i >= 0; i-- {
if !querybuilder.IsZeroValue(opts[i].InsecureRootCapabilities) {
q = q.Arg("insecureRootCapabilities", opts[i].InsecureRootCapabilities)
break
}
}
return &Container{
q: q,
c: r.c,
}
}
type ContainerWithExposedPortOpts struct {
Protocol NetworkProtocol
Description string
}
func (r *Container) WithExposedPort(port int, opts ...ContainerWithExposedPortOpts) *Container { |
closed | dagger/dagger | https://github.com/dagger/dagger | 5,140 | Expand environment variables in `withEnvVariable` values | ### Discussed in https://github.com/dagger/dagger/discussions/5001
<div type='discussions-op-text'>
<sup>Originally posted by **wingyplus** April 21, 2023</sup>
I want to install something and append it to `PATH` to make it accessible. So how to prepend the new directory into the env variable as we do with `PATH`?</div>
Solution proposed by @vito :
> I agree; extending $PATH seems like a common use case. it would be nice to have parity with Dockerfile ENV which supports interpolation.
>
> It might be a surprising default, since who knows what values people might try to set in env vars. An expand: true param would be simple enough to implement by using [os.Expand](https://pkg.go.dev/os#Expand) and fetching values from the current image config.
>
> ```
> container {
> withEnvVariable(name: "PATH", value: "/opt/venv/bin:${PATH}", expand: true) {
> withExec(args: []string{"sh", "-c", "echo $PATH"}) {
> stdout
> }
> }
> }
> ```
> (Interpolate might be a more obvious name.) | https://github.com/dagger/dagger/issues/5140 | https://github.com/dagger/dagger/pull/5160 | c2fcf8390801585188042d12ee8190b436cc9c2f | e171dc4252e464031737b51fee4c54531b4b537d | 2023-05-16T15:18:49Z | go | 2023-05-25T09:29:47Z | sdk/go/api.gen.go | q := r.q.Select("withExposedPort")
q = q.Arg("port", port)
for i := len(opts) - 1; i >= 0; i-- {
if !querybuilder.IsZeroValue(opts[i].Protocol) {
q = q.Arg("protocol", opts[i].Protocol)
break
}
}
for i := len(opts) - 1; i >= 0; i-- {
if !querybuilder.IsZeroValue(opts[i].Description) {
q = q.Arg("description", opts[i].Description)
break
}
}
return &Container{
q: q,
c: r.c,
}
}
func (r *Container) WithFS(id *Directory) *Container {
q := r.q.Select("withFS")
q = q.Arg("id", id)
return &Container{
q: q,
c: r.c,
}
}
type ContainerWithFileOpts struct { |
closed | dagger/dagger | https://github.com/dagger/dagger | 5,140 | Expand environment variables in `withEnvVariable` values | ### Discussed in https://github.com/dagger/dagger/discussions/5001
<div type='discussions-op-text'>
<sup>Originally posted by **wingyplus** April 21, 2023</sup>
I want to install something and append it to `PATH` to make it accessible. So how to prepend the new directory into the env variable as we do with `PATH`?</div>
Solution proposed by @vito :
> I agree; extending $PATH seems like a common use case. it would be nice to have parity with Dockerfile ENV which supports interpolation.
>
> It might be a surprising default, since who knows what values people might try to set in env vars. An expand: true param would be simple enough to implement by using [os.Expand](https://pkg.go.dev/os#Expand) and fetching values from the current image config.
>
> ```
> container {
> withEnvVariable(name: "PATH", value: "/opt/venv/bin:${PATH}", expand: true) {
> withExec(args: []string{"sh", "-c", "echo $PATH"}) {
> stdout
> }
> }
> }
> ```
> (Interpolate might be a more obvious name.) | https://github.com/dagger/dagger/issues/5140 | https://github.com/dagger/dagger/pull/5160 | c2fcf8390801585188042d12ee8190b436cc9c2f | e171dc4252e464031737b51fee4c54531b4b537d | 2023-05-16T15:18:49Z | go | 2023-05-25T09:29:47Z | sdk/go/api.gen.go | Permissions int
Owner string
}
func (r *Container) WithFile(path string, source *File, opts ...ContainerWithFileOpts) *Container {
q := r.q.Select("withFile")
q = q.Arg("path", path)
q = q.Arg("source", source)
for i := len(opts) - 1; i >= 0; i-- {
if !querybuilder.IsZeroValue(opts[i].Permissions) {
q = q.Arg("permissions", opts[i].Permissions)
break
}
}
for i := len(opts) - 1; i >= 0; i-- {
if !querybuilder.IsZeroValue(opts[i].Owner) {
q = q.Arg("owner", opts[i].Owner)
break
}
}
return &Container{ |
closed | dagger/dagger | https://github.com/dagger/dagger | 5,140 | Expand environment variables in `withEnvVariable` values | ### Discussed in https://github.com/dagger/dagger/discussions/5001
<div type='discussions-op-text'>
<sup>Originally posted by **wingyplus** April 21, 2023</sup>
I want to install something and append it to `PATH` to make it accessible. So how to prepend the new directory into the env variable as we do with `PATH`?</div>
Solution proposed by @vito :
> I agree; extending $PATH seems like a common use case. it would be nice to have parity with Dockerfile ENV which supports interpolation.
>
> It might be a surprising default, since who knows what values people might try to set in env vars. An expand: true param would be simple enough to implement by using [os.Expand](https://pkg.go.dev/os#Expand) and fetching values from the current image config.
>
> ```
> container {
> withEnvVariable(name: "PATH", value: "/opt/venv/bin:${PATH}", expand: true) {
> withExec(args: []string{"sh", "-c", "echo $PATH"}) {
> stdout
> }
> }
> }
> ```
> (Interpolate might be a more obvious name.) | https://github.com/dagger/dagger/issues/5140 | https://github.com/dagger/dagger/pull/5160 | c2fcf8390801585188042d12ee8190b436cc9c2f | e171dc4252e464031737b51fee4c54531b4b537d | 2023-05-16T15:18:49Z | go | 2023-05-25T09:29:47Z | sdk/go/api.gen.go | q: q,
c: r.c,
}
}
func (r *Container) WithLabel(name string, value string) *Container {
q := r.q.Select("withLabel")
q = q.Arg("name", name)
q = q.Arg("value", value)
return &Container{
q: q,
c: r.c,
}
}
type ContainerWithMountedCacheOpts struct {
Source *Directory
Sharing CacheSharingMode
Owner string
}
func (r *Container) WithMountedCache(path string, cache *CacheVolume, opts ...ContainerWithMountedCacheOpts) *Container { |
closed | dagger/dagger | https://github.com/dagger/dagger | 5,140 | Expand environment variables in `withEnvVariable` values | ### Discussed in https://github.com/dagger/dagger/discussions/5001
<div type='discussions-op-text'>
<sup>Originally posted by **wingyplus** April 21, 2023</sup>
I want to install something and append it to `PATH` to make it accessible. So how to prepend the new directory into the env variable as we do with `PATH`?</div>
Solution proposed by @vito :
> I agree; extending $PATH seems like a common use case. it would be nice to have parity with Dockerfile ENV which supports interpolation.
>
> It might be a surprising default, since who knows what values people might try to set in env vars. An expand: true param would be simple enough to implement by using [os.Expand](https://pkg.go.dev/os#Expand) and fetching values from the current image config.
>
> ```
> container {
> withEnvVariable(name: "PATH", value: "/opt/venv/bin:${PATH}", expand: true) {
> withExec(args: []string{"sh", "-c", "echo $PATH"}) {
> stdout
> }
> }
> }
> ```
> (Interpolate might be a more obvious name.) | https://github.com/dagger/dagger/issues/5140 | https://github.com/dagger/dagger/pull/5160 | c2fcf8390801585188042d12ee8190b436cc9c2f | e171dc4252e464031737b51fee4c54531b4b537d | 2023-05-16T15:18:49Z | go | 2023-05-25T09:29:47Z | sdk/go/api.gen.go | q := r.q.Select("withMountedCache")
q = q.Arg("path", path)
q = q.Arg("cache", cache)
for i := len(opts) - 1; i >= 0; i-- {
if !querybuilder.IsZeroValue(opts[i].Source) {
q = q.Arg("source", opts[i].Source)
break
}
}
for i := len(opts) - 1; i >= 0; i-- {
if !querybuilder.IsZeroValue(opts[i].Sharing) {
q = q.Arg("sharing", opts[i].Sharing)
break
}
}
for i := len(opts) - 1; i >= 0; i-- {
if !querybuilder.IsZeroValue(opts[i].Owner) {
q = q.Arg("owner", opts[i].Owner)
break
}
}
return &Container{
q: q,
c: r.c,
}
}
type ContainerWithMountedDirectoryOpts struct { |
closed | dagger/dagger | https://github.com/dagger/dagger | 5,140 | Expand environment variables in `withEnvVariable` values | ### Discussed in https://github.com/dagger/dagger/discussions/5001
<div type='discussions-op-text'>
<sup>Originally posted by **wingyplus** April 21, 2023</sup>
I want to install something and append it to `PATH` to make it accessible. So how to prepend the new directory into the env variable as we do with `PATH`?</div>
Solution proposed by @vito :
> I agree; extending $PATH seems like a common use case. it would be nice to have parity with Dockerfile ENV which supports interpolation.
>
> It might be a surprising default, since who knows what values people might try to set in env vars. An expand: true param would be simple enough to implement by using [os.Expand](https://pkg.go.dev/os#Expand) and fetching values from the current image config.
>
> ```
> container {
> withEnvVariable(name: "PATH", value: "/opt/venv/bin:${PATH}", expand: true) {
> withExec(args: []string{"sh", "-c", "echo $PATH"}) {
> stdout
> }
> }
> }
> ```
> (Interpolate might be a more obvious name.) | https://github.com/dagger/dagger/issues/5140 | https://github.com/dagger/dagger/pull/5160 | c2fcf8390801585188042d12ee8190b436cc9c2f | e171dc4252e464031737b51fee4c54531b4b537d | 2023-05-16T15:18:49Z | go | 2023-05-25T09:29:47Z | sdk/go/api.gen.go | Owner string
}
func (r *Container) WithMountedDirectory(path string, source *Directory, opts ...ContainerWithMountedDirectoryOpts) *Container {
q := r.q.Select("withMountedDirectory")
q = q.Arg("path", path)
q = q.Arg("source", source)
for i := len(opts) - 1; i >= 0; i-- {
if !querybuilder.IsZeroValue(opts[i].Owner) {
q = q.Arg("owner", opts[i].Owner)
break
}
}
return &Container{
q: q,
c: r.c,
}
}
type ContainerWithMountedFileOpts struct { |
closed | dagger/dagger | https://github.com/dagger/dagger | 5,140 | Expand environment variables in `withEnvVariable` values | ### Discussed in https://github.com/dagger/dagger/discussions/5001
<div type='discussions-op-text'>
<sup>Originally posted by **wingyplus** April 21, 2023</sup>
I want to install something and append it to `PATH` to make it accessible. So how to prepend the new directory into the env variable as we do with `PATH`?</div>
Solution proposed by @vito :
> I agree; extending $PATH seems like a common use case. it would be nice to have parity with Dockerfile ENV which supports interpolation.
>
> It might be a surprising default, since who knows what values people might try to set in env vars. An expand: true param would be simple enough to implement by using [os.Expand](https://pkg.go.dev/os#Expand) and fetching values from the current image config.
>
> ```
> container {
> withEnvVariable(name: "PATH", value: "/opt/venv/bin:${PATH}", expand: true) {
> withExec(args: []string{"sh", "-c", "echo $PATH"}) {
> stdout
> }
> }
> }
> ```
> (Interpolate might be a more obvious name.) | https://github.com/dagger/dagger/issues/5140 | https://github.com/dagger/dagger/pull/5160 | c2fcf8390801585188042d12ee8190b436cc9c2f | e171dc4252e464031737b51fee4c54531b4b537d | 2023-05-16T15:18:49Z | go | 2023-05-25T09:29:47Z | sdk/go/api.gen.go | Owner string
}
func (r *Container) WithMountedFile(path string, source *File, opts ...ContainerWithMountedFileOpts) *Container {
q := r.q.Select("withMountedFile")
q = q.Arg("path", path)
q = q.Arg("source", source)
for i := len(opts) - 1; i >= 0; i-- {
if !querybuilder.IsZeroValue(opts[i].Owner) {
q = q.Arg("owner", opts[i].Owner)
break
}
}
return &Container{
q: q,
c: r.c,
}
}
type ContainerWithMountedSecretOpts struct { |
closed | dagger/dagger | https://github.com/dagger/dagger | 5,140 | Expand environment variables in `withEnvVariable` values | ### Discussed in https://github.com/dagger/dagger/discussions/5001
<div type='discussions-op-text'>
<sup>Originally posted by **wingyplus** April 21, 2023</sup>
I want to install something and append it to `PATH` to make it accessible. So how to prepend the new directory into the env variable as we do with `PATH`?</div>
Solution proposed by @vito :
> I agree; extending $PATH seems like a common use case. it would be nice to have parity with Dockerfile ENV which supports interpolation.
>
> It might be a surprising default, since who knows what values people might try to set in env vars. An expand: true param would be simple enough to implement by using [os.Expand](https://pkg.go.dev/os#Expand) and fetching values from the current image config.
>
> ```
> container {
> withEnvVariable(name: "PATH", value: "/opt/venv/bin:${PATH}", expand: true) {
> withExec(args: []string{"sh", "-c", "echo $PATH"}) {
> stdout
> }
> }
> }
> ```
> (Interpolate might be a more obvious name.) | https://github.com/dagger/dagger/issues/5140 | https://github.com/dagger/dagger/pull/5160 | c2fcf8390801585188042d12ee8190b436cc9c2f | e171dc4252e464031737b51fee4c54531b4b537d | 2023-05-16T15:18:49Z | go | 2023-05-25T09:29:47Z | sdk/go/api.gen.go | Owner string
}
func (r *Container) WithMountedSecret(path string, source *Secret, opts ...ContainerWithMountedSecretOpts) *Container {
q := r.q.Select("withMountedSecret")
q = q.Arg("path", path)
q = q.Arg("source", source)
for i := len(opts) - 1; i >= 0; i-- {
if !querybuilder.IsZeroValue(opts[i].Owner) {
q = q.Arg("owner", opts[i].Owner)
break
}
}
return &Container{
q: q,
c: r.c, |
closed | dagger/dagger | https://github.com/dagger/dagger | 5,140 | Expand environment variables in `withEnvVariable` values | ### Discussed in https://github.com/dagger/dagger/discussions/5001
<div type='discussions-op-text'>
<sup>Originally posted by **wingyplus** April 21, 2023</sup>
I want to install something and append it to `PATH` to make it accessible. So how to prepend the new directory into the env variable as we do with `PATH`?</div>
Solution proposed by @vito :
> I agree; extending $PATH seems like a common use case. it would be nice to have parity with Dockerfile ENV which supports interpolation.
>
> It might be a surprising default, since who knows what values people might try to set in env vars. An expand: true param would be simple enough to implement by using [os.Expand](https://pkg.go.dev/os#Expand) and fetching values from the current image config.
>
> ```
> container {
> withEnvVariable(name: "PATH", value: "/opt/venv/bin:${PATH}", expand: true) {
> withExec(args: []string{"sh", "-c", "echo $PATH"}) {
> stdout
> }
> }
> }
> ```
> (Interpolate might be a more obvious name.) | https://github.com/dagger/dagger/issues/5140 | https://github.com/dagger/dagger/pull/5160 | c2fcf8390801585188042d12ee8190b436cc9c2f | e171dc4252e464031737b51fee4c54531b4b537d | 2023-05-16T15:18:49Z | go | 2023-05-25T09:29:47Z | sdk/go/api.gen.go | }
}
func (r *Container) WithMountedTemp(path string) *Container {
q := r.q.Select("withMountedTemp")
q = q.Arg("path", path)
return &Container{
q: q,
c: r.c,
}
}
type ContainerWithNewFileOpts struct {
Contents string
Permissions int
Owner string
}
func (r *Container) WithNewFile(path string, opts ...ContainerWithNewFileOpts) *Container {
q := r.q.Select("withNewFile")
q = q.Arg("path", path)
for i := len(opts) - 1; i >= 0; i-- {
if !querybuilder.IsZeroValue(opts[i].Contents) { |
closed | dagger/dagger | https://github.com/dagger/dagger | 5,140 | Expand environment variables in `withEnvVariable` values | ### Discussed in https://github.com/dagger/dagger/discussions/5001
<div type='discussions-op-text'>
<sup>Originally posted by **wingyplus** April 21, 2023</sup>
I want to install something and append it to `PATH` to make it accessible. So how to prepend the new directory into the env variable as we do with `PATH`?</div>
Solution proposed by @vito :
> I agree; extending $PATH seems like a common use case. it would be nice to have parity with Dockerfile ENV which supports interpolation.
>
> It might be a surprising default, since who knows what values people might try to set in env vars. An expand: true param would be simple enough to implement by using [os.Expand](https://pkg.go.dev/os#Expand) and fetching values from the current image config.
>
> ```
> container {
> withEnvVariable(name: "PATH", value: "/opt/venv/bin:${PATH}", expand: true) {
> withExec(args: []string{"sh", "-c", "echo $PATH"}) {
> stdout
> }
> }
> }
> ```
> (Interpolate might be a more obvious name.) | https://github.com/dagger/dagger/issues/5140 | https://github.com/dagger/dagger/pull/5160 | c2fcf8390801585188042d12ee8190b436cc9c2f | e171dc4252e464031737b51fee4c54531b4b537d | 2023-05-16T15:18:49Z | go | 2023-05-25T09:29:47Z | sdk/go/api.gen.go | q = q.Arg("contents", opts[i].Contents)
break
}
}
for i := len(opts) - 1; i >= 0; i-- {
if !querybuilder.IsZeroValue(opts[i].Permissions) {
q = q.Arg("permissions", opts[i].Permissions)
break
}
}
for i := len(opts) - 1; i >= 0; i-- {
if !querybuilder.IsZeroValue(opts[i].Owner) {
q = q.Arg("owner", opts[i].Owner)
break
}
}
return &Container{
q: q,
c: r.c,
}
}
func (r *Container) WithRegistryAuth(address string, username string, secret *Secret) *Container {
q := r.q.Select("withRegistryAuth")
q = q.Arg("address", address)
q = q.Arg("username", username)
q = q.Arg("secret", secret)
return &Container{
q: q, |
closed | dagger/dagger | https://github.com/dagger/dagger | 5,140 | Expand environment variables in `withEnvVariable` values | ### Discussed in https://github.com/dagger/dagger/discussions/5001
<div type='discussions-op-text'>
<sup>Originally posted by **wingyplus** April 21, 2023</sup>
I want to install something and append it to `PATH` to make it accessible. So how to prepend the new directory into the env variable as we do with `PATH`?</div>
Solution proposed by @vito :
> I agree; extending $PATH seems like a common use case. it would be nice to have parity with Dockerfile ENV which supports interpolation.
>
> It might be a surprising default, since who knows what values people might try to set in env vars. An expand: true param would be simple enough to implement by using [os.Expand](https://pkg.go.dev/os#Expand) and fetching values from the current image config.
>
> ```
> container {
> withEnvVariable(name: "PATH", value: "/opt/venv/bin:${PATH}", expand: true) {
> withExec(args: []string{"sh", "-c", "echo $PATH"}) {
> stdout
> }
> }
> }
> ```
> (Interpolate might be a more obvious name.) | https://github.com/dagger/dagger/issues/5140 | https://github.com/dagger/dagger/pull/5160 | c2fcf8390801585188042d12ee8190b436cc9c2f | e171dc4252e464031737b51fee4c54531b4b537d | 2023-05-16T15:18:49Z | go | 2023-05-25T09:29:47Z | sdk/go/api.gen.go | c: r.c,
}
}
func (r *Container) WithRootfs(id *Directory) *Container {
q := r.q.Select("withRootfs")
q = q.Arg("id", id)
return &Container{
q: q,
c: r.c,
}
}
func (r *Container) WithSecretVariable(name string, secret *Secret) *Container {
q := r.q.Select("withSecretVariable")
q = q.Arg("name", name)
q = q.Arg("secret", secret)
return &Container{
q: q,
c: r.c,
}
}
func (r *Container) WithServiceBinding(alias string, service *Container) *Container {
q := r.q.Select("withServiceBinding")
q = q.Arg("alias", alias)
q = q.Arg("service", service)
return &Container{
q: q,
c: r.c,
}
}
type ContainerWithUnixSocketOpts struct { |
closed | dagger/dagger | https://github.com/dagger/dagger | 5,140 | Expand environment variables in `withEnvVariable` values | ### Discussed in https://github.com/dagger/dagger/discussions/5001
<div type='discussions-op-text'>
<sup>Originally posted by **wingyplus** April 21, 2023</sup>
I want to install something and append it to `PATH` to make it accessible. So how to prepend the new directory into the env variable as we do with `PATH`?</div>
Solution proposed by @vito :
> I agree; extending $PATH seems like a common use case. it would be nice to have parity with Dockerfile ENV which supports interpolation.
>
> It might be a surprising default, since who knows what values people might try to set in env vars. An expand: true param would be simple enough to implement by using [os.Expand](https://pkg.go.dev/os#Expand) and fetching values from the current image config.
>
> ```
> container {
> withEnvVariable(name: "PATH", value: "/opt/venv/bin:${PATH}", expand: true) {
> withExec(args: []string{"sh", "-c", "echo $PATH"}) {
> stdout
> }
> }
> }
> ```
> (Interpolate might be a more obvious name.) | https://github.com/dagger/dagger/issues/5140 | https://github.com/dagger/dagger/pull/5160 | c2fcf8390801585188042d12ee8190b436cc9c2f | e171dc4252e464031737b51fee4c54531b4b537d | 2023-05-16T15:18:49Z | go | 2023-05-25T09:29:47Z | sdk/go/api.gen.go | Owner string
}
func (r *Container) WithUnixSocket(path string, source *Socket, opts ...ContainerWithUnixSocketOpts) *Container {
q := r.q.Select("withUnixSocket")
q = q.Arg("path", path)
q = q.Arg("source", source)
for i := len(opts) - 1; i >= 0; i-- {
if !querybuilder.IsZeroValue(opts[i].Owner) {
q = q.Arg("owner", opts[i].Owner)
break
}
} |
closed | dagger/dagger | https://github.com/dagger/dagger | 5,140 | Expand environment variables in `withEnvVariable` values | ### Discussed in https://github.com/dagger/dagger/discussions/5001
<div type='discussions-op-text'>
<sup>Originally posted by **wingyplus** April 21, 2023</sup>
I want to install something and append it to `PATH` to make it accessible. So how to prepend the new directory into the env variable as we do with `PATH`?</div>
Solution proposed by @vito :
> I agree; extending $PATH seems like a common use case. it would be nice to have parity with Dockerfile ENV which supports interpolation.
>
> It might be a surprising default, since who knows what values people might try to set in env vars. An expand: true param would be simple enough to implement by using [os.Expand](https://pkg.go.dev/os#Expand) and fetching values from the current image config.
>
> ```
> container {
> withEnvVariable(name: "PATH", value: "/opt/venv/bin:${PATH}", expand: true) {
> withExec(args: []string{"sh", "-c", "echo $PATH"}) {
> stdout
> }
> }
> }
> ```
> (Interpolate might be a more obvious name.) | https://github.com/dagger/dagger/issues/5140 | https://github.com/dagger/dagger/pull/5160 | c2fcf8390801585188042d12ee8190b436cc9c2f | e171dc4252e464031737b51fee4c54531b4b537d | 2023-05-16T15:18:49Z | go | 2023-05-25T09:29:47Z | sdk/go/api.gen.go | return &Container{
q: q,
c: r.c,
}
}
func (r *Container) WithUser(name string) *Container {
q := r.q.Select("withUser")
q = q.Arg("name", name)
return &Container{
q: q,
c: r.c,
}
}
func (r *Container) WithWorkdir(path string) *Container {
q := r.q.Select("withWorkdir")
q = q.Arg("path", path)
return &Container{
q: q,
c: r.c,
}
}
func (r *Container) WithoutEnvVariable(name string) *Container {
q := r.q.Select("withoutEnvVariable")
q = q.Arg("name", name)
return &Container{
q: q,
c: r.c,
}
}
type ContainerWithoutExposedPortOpts struct { |
closed | dagger/dagger | https://github.com/dagger/dagger | 5,140 | Expand environment variables in `withEnvVariable` values | ### Discussed in https://github.com/dagger/dagger/discussions/5001
<div type='discussions-op-text'>
<sup>Originally posted by **wingyplus** April 21, 2023</sup>
I want to install something and append it to `PATH` to make it accessible. So how to prepend the new directory into the env variable as we do with `PATH`?</div>
Solution proposed by @vito :
> I agree; extending $PATH seems like a common use case. it would be nice to have parity with Dockerfile ENV which supports interpolation.
>
> It might be a surprising default, since who knows what values people might try to set in env vars. An expand: true param would be simple enough to implement by using [os.Expand](https://pkg.go.dev/os#Expand) and fetching values from the current image config.
>
> ```
> container {
> withEnvVariable(name: "PATH", value: "/opt/venv/bin:${PATH}", expand: true) {
> withExec(args: []string{"sh", "-c", "echo $PATH"}) {
> stdout
> }
> }
> }
> ```
> (Interpolate might be a more obvious name.) | https://github.com/dagger/dagger/issues/5140 | https://github.com/dagger/dagger/pull/5160 | c2fcf8390801585188042d12ee8190b436cc9c2f | e171dc4252e464031737b51fee4c54531b4b537d | 2023-05-16T15:18:49Z | go | 2023-05-25T09:29:47Z | sdk/go/api.gen.go | Protocol NetworkProtocol
}
func (r *Container) WithoutExposedPort(port int, opts ...ContainerWithoutExposedPortOpts) *Container {
q := r.q.Select("withoutExposedPort")
q = q.Arg("port", port)
for i := len(opts) - 1; i >= 0; i-- {
if !querybuilder.IsZeroValue(opts[i].Protocol) {
q = q.Arg("protocol", opts[i].Protocol)
break
}
}
return &Container{
q: q,
c: r.c,
}
}
func (r *Container) WithoutLabel(name string) *Container {
q := r.q.Select("withoutLabel")
q = q.Arg("name", name)
return &Container{
q: q,
c: r.c,
}
}
func (r *Container) WithoutMount(path string) *Container {
q := r.q.Select("withoutMount")
q = q.Arg("path", path)
return &Container{ |
closed | dagger/dagger | https://github.com/dagger/dagger | 5,140 | Expand environment variables in `withEnvVariable` values | ### Discussed in https://github.com/dagger/dagger/discussions/5001
<div type='discussions-op-text'>
<sup>Originally posted by **wingyplus** April 21, 2023</sup>
I want to install something and append it to `PATH` to make it accessible. So how to prepend the new directory into the env variable as we do with `PATH`?</div>
Solution proposed by @vito :
> I agree; extending $PATH seems like a common use case. it would be nice to have parity with Dockerfile ENV which supports interpolation.
>
> It might be a surprising default, since who knows what values people might try to set in env vars. An expand: true param would be simple enough to implement by using [os.Expand](https://pkg.go.dev/os#Expand) and fetching values from the current image config.
>
> ```
> container {
> withEnvVariable(name: "PATH", value: "/opt/venv/bin:${PATH}", expand: true) {
> withExec(args: []string{"sh", "-c", "echo $PATH"}) {
> stdout
> }
> }
> }
> ```
> (Interpolate might be a more obvious name.) | https://github.com/dagger/dagger/issues/5140 | https://github.com/dagger/dagger/pull/5160 | c2fcf8390801585188042d12ee8190b436cc9c2f | e171dc4252e464031737b51fee4c54531b4b537d | 2023-05-16T15:18:49Z | go | 2023-05-25T09:29:47Z | sdk/go/api.gen.go | q: q,
c: r.c,
}
}
func (r *Container) WithoutRegistryAuth(address string) *Container {
q := r.q.Select("withoutRegistryAuth")
q = q.Arg("address", address)
return &Container{
q: q,
c: r.c,
}
}
func (r *Container) WithoutUnixSocket(path string) *Container {
q := r.q.Select("withoutUnixSocket")
q = q.Arg("path", path)
return &Container{
q: q,
c: r.c,
}
}
func (r *Container) Workdir(ctx context.Context) (string, error) {
if r.workdir != nil {
return *r.workdir, nil
}
q := r.q.Select("workdir")
var response string
q = q.Bind(&response)
return response, q.Execute(ctx, r.c)
}
type Directory struct { |
closed | dagger/dagger | https://github.com/dagger/dagger | 5,140 | Expand environment variables in `withEnvVariable` values | ### Discussed in https://github.com/dagger/dagger/discussions/5001
<div type='discussions-op-text'>
<sup>Originally posted by **wingyplus** April 21, 2023</sup>
I want to install something and append it to `PATH` to make it accessible. So how to prepend the new directory into the env variable as we do with `PATH`?</div>
Solution proposed by @vito :
> I agree; extending $PATH seems like a common use case. it would be nice to have parity with Dockerfile ENV which supports interpolation.
>
> It might be a surprising default, since who knows what values people might try to set in env vars. An expand: true param would be simple enough to implement by using [os.Expand](https://pkg.go.dev/os#Expand) and fetching values from the current image config.
>
> ```
> container {
> withEnvVariable(name: "PATH", value: "/opt/venv/bin:${PATH}", expand: true) {
> withExec(args: []string{"sh", "-c", "echo $PATH"}) {
> stdout
> }
> }
> }
> ```
> (Interpolate might be a more obvious name.) | https://github.com/dagger/dagger/issues/5140 | https://github.com/dagger/dagger/pull/5160 | c2fcf8390801585188042d12ee8190b436cc9c2f | e171dc4252e464031737b51fee4c54531b4b537d | 2023-05-16T15:18:49Z | go | 2023-05-25T09:29:47Z | sdk/go/api.gen.go | q *querybuilder.Selection
c graphql.Client
export *bool
id *DirectoryID
}
type WithDirectoryFunc func(r *Directory) *Directory
func (r *Directory) With(f WithDirectoryFunc) *Directory {
return f(r)
}
func (r *Directory) Diff(other *Directory) *Directory {
q := r.q.Select("diff")
q = q.Arg("other", other)
return &Directory{
q: q,
c: r.c,
}
}
func (r *Directory) Directory(path string) *Directory {
q := r.q.Select("directory")
q = q.Arg("path", path)
return &Directory{
q: q,
c: r.c,
}
}
type DirectoryDockerBuildOpts struct { |
closed | dagger/dagger | https://github.com/dagger/dagger | 5,140 | Expand environment variables in `withEnvVariable` values | ### Discussed in https://github.com/dagger/dagger/discussions/5001
<div type='discussions-op-text'>
<sup>Originally posted by **wingyplus** April 21, 2023</sup>
I want to install something and append it to `PATH` to make it accessible. So how to prepend the new directory into the env variable as we do with `PATH`?</div>
Solution proposed by @vito :
> I agree; extending $PATH seems like a common use case. it would be nice to have parity with Dockerfile ENV which supports interpolation.
>
> It might be a surprising default, since who knows what values people might try to set in env vars. An expand: true param would be simple enough to implement by using [os.Expand](https://pkg.go.dev/os#Expand) and fetching values from the current image config.
>
> ```
> container {
> withEnvVariable(name: "PATH", value: "/opt/venv/bin:${PATH}", expand: true) {
> withExec(args: []string{"sh", "-c", "echo $PATH"}) {
> stdout
> }
> }
> }
> ```
> (Interpolate might be a more obvious name.) | https://github.com/dagger/dagger/issues/5140 | https://github.com/dagger/dagger/pull/5160 | c2fcf8390801585188042d12ee8190b436cc9c2f | e171dc4252e464031737b51fee4c54531b4b537d | 2023-05-16T15:18:49Z | go | 2023-05-25T09:29:47Z | sdk/go/api.gen.go | Dockerfile string
Platform Platform
BuildArgs []BuildArg
Target string
Secrets []*Secret
}
func (r *Directory) DockerBuild(opts ...DirectoryDockerBuildOpts) *Container {
q := r.q.Select("dockerBuild")
for i := len(opts) - 1; i >= 0; i-- {
if !querybuilder.IsZeroValue(opts[i].Dockerfile) {
q = q.Arg("dockerfile", opts[i].Dockerfile)
break
}
}
for i := len(opts) - 1; i >= 0; i-- {
if !querybuilder.IsZeroValue(opts[i].Platform) {
q = q.Arg("platform", opts[i].Platform) |
closed | dagger/dagger | https://github.com/dagger/dagger | 5,140 | Expand environment variables in `withEnvVariable` values | ### Discussed in https://github.com/dagger/dagger/discussions/5001
<div type='discussions-op-text'>
<sup>Originally posted by **wingyplus** April 21, 2023</sup>
I want to install something and append it to `PATH` to make it accessible. So how to prepend the new directory into the env variable as we do with `PATH`?</div>
Solution proposed by @vito :
> I agree; extending $PATH seems like a common use case. it would be nice to have parity with Dockerfile ENV which supports interpolation.
>
> It might be a surprising default, since who knows what values people might try to set in env vars. An expand: true param would be simple enough to implement by using [os.Expand](https://pkg.go.dev/os#Expand) and fetching values from the current image config.
>
> ```
> container {
> withEnvVariable(name: "PATH", value: "/opt/venv/bin:${PATH}", expand: true) {
> withExec(args: []string{"sh", "-c", "echo $PATH"}) {
> stdout
> }
> }
> }
> ```
> (Interpolate might be a more obvious name.) | https://github.com/dagger/dagger/issues/5140 | https://github.com/dagger/dagger/pull/5160 | c2fcf8390801585188042d12ee8190b436cc9c2f | e171dc4252e464031737b51fee4c54531b4b537d | 2023-05-16T15:18:49Z | go | 2023-05-25T09:29:47Z | sdk/go/api.gen.go | break
}
}
for i := len(opts) - 1; i >= 0; i-- {
if !querybuilder.IsZeroValue(opts[i].BuildArgs) {
q = q.Arg("buildArgs", opts[i].BuildArgs)
break
}
}
for i := len(opts) - 1; i >= 0; i-- {
if !querybuilder.IsZeroValue(opts[i].Target) {
q = q.Arg("target", opts[i].Target)
break
}
}
for i := len(opts) - 1; i >= 0; i-- {
if !querybuilder.IsZeroValue(opts[i].Secrets) {
q = q.Arg("secrets", opts[i].Secrets)
break
}
}
return &Container{
q: q,
c: r.c,
}
}
type DirectoryEntriesOpts struct { |
closed | dagger/dagger | https://github.com/dagger/dagger | 5,140 | Expand environment variables in `withEnvVariable` values | ### Discussed in https://github.com/dagger/dagger/discussions/5001
<div type='discussions-op-text'>
<sup>Originally posted by **wingyplus** April 21, 2023</sup>
I want to install something and append it to `PATH` to make it accessible. So how to prepend the new directory into the env variable as we do with `PATH`?</div>
Solution proposed by @vito :
> I agree; extending $PATH seems like a common use case. it would be nice to have parity with Dockerfile ENV which supports interpolation.
>
> It might be a surprising default, since who knows what values people might try to set in env vars. An expand: true param would be simple enough to implement by using [os.Expand](https://pkg.go.dev/os#Expand) and fetching values from the current image config.
>
> ```
> container {
> withEnvVariable(name: "PATH", value: "/opt/venv/bin:${PATH}", expand: true) {
> withExec(args: []string{"sh", "-c", "echo $PATH"}) {
> stdout
> }
> }
> }
> ```
> (Interpolate might be a more obvious name.) | https://github.com/dagger/dagger/issues/5140 | https://github.com/dagger/dagger/pull/5160 | c2fcf8390801585188042d12ee8190b436cc9c2f | e171dc4252e464031737b51fee4c54531b4b537d | 2023-05-16T15:18:49Z | go | 2023-05-25T09:29:47Z | sdk/go/api.gen.go | Path string
}
func (r *Directory) Entries(ctx context.Context, opts ...DirectoryEntriesOpts) ([]string, error) {
q := r.q.Select("entries")
for i := len(opts) - 1; i >= 0; i-- {
if !querybuilder.IsZeroValue(opts[i].Path) {
q = q.Arg("path", opts[i].Path)
break
}
}
var response []string
q = q.Bind(&response)
return response, q.Execute(ctx, r.c)
}
func (r *Directory) Export(ctx context.Context, path string) (bool, error) {
if r.export != nil {
return *r.export, nil
}
q := r.q.Select("export")
q = q.Arg("path", path)
var response bool
q = q.Bind(&response) |
closed | dagger/dagger | https://github.com/dagger/dagger | 5,140 | Expand environment variables in `withEnvVariable` values | ### Discussed in https://github.com/dagger/dagger/discussions/5001
<div type='discussions-op-text'>
<sup>Originally posted by **wingyplus** April 21, 2023</sup>
I want to install something and append it to `PATH` to make it accessible. So how to prepend the new directory into the env variable as we do with `PATH`?</div>
Solution proposed by @vito :
> I agree; extending $PATH seems like a common use case. it would be nice to have parity with Dockerfile ENV which supports interpolation.
>
> It might be a surprising default, since who knows what values people might try to set in env vars. An expand: true param would be simple enough to implement by using [os.Expand](https://pkg.go.dev/os#Expand) and fetching values from the current image config.
>
> ```
> container {
> withEnvVariable(name: "PATH", value: "/opt/venv/bin:${PATH}", expand: true) {
> withExec(args: []string{"sh", "-c", "echo $PATH"}) {
> stdout
> }
> }
> }
> ```
> (Interpolate might be a more obvious name.) | https://github.com/dagger/dagger/issues/5140 | https://github.com/dagger/dagger/pull/5160 | c2fcf8390801585188042d12ee8190b436cc9c2f | e171dc4252e464031737b51fee4c54531b4b537d | 2023-05-16T15:18:49Z | go | 2023-05-25T09:29:47Z | sdk/go/api.gen.go | return response, q.Execute(ctx, r.c)
}
func (r *Directory) File(path string) *File {
q := r.q.Select("file")
q = q.Arg("path", path)
return &File{
q: q,
c: r.c,
}
}
func (r *Directory) ID(ctx context.Context) (DirectoryID, error) {
if r.id != nil {
return *r.id, nil
}
q := r.q.Select("id")
var response DirectoryID
q = q.Bind(&response)
return response, q.Execute(ctx, r.c)
}
func (r *Directory) XXX_GraphQLType() string {
return "Directory"
}
func (r *Directory) XXX_GraphQLID(ctx context.Context) (string, error) {
id, err := r.ID(ctx)
if err != nil {
return "", err
}
return string(id), nil
}
type DirectoryPipelineOpts struct { |
closed | dagger/dagger | https://github.com/dagger/dagger | 5,140 | Expand environment variables in `withEnvVariable` values | ### Discussed in https://github.com/dagger/dagger/discussions/5001
<div type='discussions-op-text'>
<sup>Originally posted by **wingyplus** April 21, 2023</sup>
I want to install something and append it to `PATH` to make it accessible. So how to prepend the new directory into the env variable as we do with `PATH`?</div>
Solution proposed by @vito :
> I agree; extending $PATH seems like a common use case. it would be nice to have parity with Dockerfile ENV which supports interpolation.
>
> It might be a surprising default, since who knows what values people might try to set in env vars. An expand: true param would be simple enough to implement by using [os.Expand](https://pkg.go.dev/os#Expand) and fetching values from the current image config.
>
> ```
> container {
> withEnvVariable(name: "PATH", value: "/opt/venv/bin:${PATH}", expand: true) {
> withExec(args: []string{"sh", "-c", "echo $PATH"}) {
> stdout
> }
> }
> }
> ```
> (Interpolate might be a more obvious name.) | https://github.com/dagger/dagger/issues/5140 | https://github.com/dagger/dagger/pull/5160 | c2fcf8390801585188042d12ee8190b436cc9c2f | e171dc4252e464031737b51fee4c54531b4b537d | 2023-05-16T15:18:49Z | go | 2023-05-25T09:29:47Z | sdk/go/api.gen.go | Description string
Labels []PipelineLabel
}
func (r *Directory) Pipeline(name string, opts ...DirectoryPipelineOpts) *Directory {
q := r.q.Select("pipeline")
q = q.Arg("name", name)
for i := len(opts) - 1; i >= 0; i-- {
if !querybuilder.IsZeroValue(opts[i].Description) {
q = q.Arg("description", opts[i].Description)
break
}
}
for i := len(opts) - 1; i >= 0; i-- {
if !querybuilder.IsZeroValue(opts[i].Labels) {
q = q.Arg("labels", opts[i].Labels)
break
}
}
return &Directory{
q: q,
c: r.c,
}
}
type DirectoryWithDirectoryOpts struct { |
closed | dagger/dagger | https://github.com/dagger/dagger | 5,140 | Expand environment variables in `withEnvVariable` values | ### Discussed in https://github.com/dagger/dagger/discussions/5001
<div type='discussions-op-text'>
<sup>Originally posted by **wingyplus** April 21, 2023</sup>
I want to install something and append it to `PATH` to make it accessible. So how to prepend the new directory into the env variable as we do with `PATH`?</div>
Solution proposed by @vito :
> I agree; extending $PATH seems like a common use case. it would be nice to have parity with Dockerfile ENV which supports interpolation.
>
> It might be a surprising default, since who knows what values people might try to set in env vars. An expand: true param would be simple enough to implement by using [os.Expand](https://pkg.go.dev/os#Expand) and fetching values from the current image config.
>
> ```
> container {
> withEnvVariable(name: "PATH", value: "/opt/venv/bin:${PATH}", expand: true) {
> withExec(args: []string{"sh", "-c", "echo $PATH"}) {
> stdout
> }
> }
> }
> ```
> (Interpolate might be a more obvious name.) | https://github.com/dagger/dagger/issues/5140 | https://github.com/dagger/dagger/pull/5160 | c2fcf8390801585188042d12ee8190b436cc9c2f | e171dc4252e464031737b51fee4c54531b4b537d | 2023-05-16T15:18:49Z | go | 2023-05-25T09:29:47Z | sdk/go/api.gen.go | Exclude []string
Include []string
}
func (r *Directory) WithDirectory(path string, directory *Directory, opts ...DirectoryWithDirectoryOpts) *Directory {
q := r.q.Select("withDirectory")
q = q.Arg("path", path)
q = q.Arg("directory", directory)
for i := len(opts) - 1; i >= 0; i-- {
if !querybuilder.IsZeroValue(opts[i].Exclude) {
q = q.Arg("exclude", opts[i].Exclude)
break
}
}
for i := len(opts) - 1; i >= 0; i-- {
if !querybuilder.IsZeroValue(opts[i].Include) {
q = q.Arg("include", opts[i].Include)
break
}
}
return &Directory{
q: q,
c: r.c,
}
}
type DirectoryWithFileOpts struct { |
closed | dagger/dagger | https://github.com/dagger/dagger | 5,140 | Expand environment variables in `withEnvVariable` values | ### Discussed in https://github.com/dagger/dagger/discussions/5001
<div type='discussions-op-text'>
<sup>Originally posted by **wingyplus** April 21, 2023</sup>
I want to install something and append it to `PATH` to make it accessible. So how to prepend the new directory into the env variable as we do with `PATH`?</div>
Solution proposed by @vito :
> I agree; extending $PATH seems like a common use case. it would be nice to have parity with Dockerfile ENV which supports interpolation.
>
> It might be a surprising default, since who knows what values people might try to set in env vars. An expand: true param would be simple enough to implement by using [os.Expand](https://pkg.go.dev/os#Expand) and fetching values from the current image config.
>
> ```
> container {
> withEnvVariable(name: "PATH", value: "/opt/venv/bin:${PATH}", expand: true) {
> withExec(args: []string{"sh", "-c", "echo $PATH"}) {
> stdout
> }
> }
> }
> ```
> (Interpolate might be a more obvious name.) | https://github.com/dagger/dagger/issues/5140 | https://github.com/dagger/dagger/pull/5160 | c2fcf8390801585188042d12ee8190b436cc9c2f | e171dc4252e464031737b51fee4c54531b4b537d | 2023-05-16T15:18:49Z | go | 2023-05-25T09:29:47Z | sdk/go/api.gen.go | Permissions int
}
func (r *Directory) WithFile(path string, source *File, opts ...DirectoryWithFileOpts) *Directory {
q := r.q.Select("withFile")
q = q.Arg("path", path)
q = q.Arg("source", source)
for i := len(opts) - 1; i >= 0; i-- {
if !querybuilder.IsZeroValue(opts[i].Permissions) {
q = q.Arg("permissions", opts[i].Permissions)
break
}
}
return &Directory{
q: q,
c: r.c,
}
}
type DirectoryWithNewDirectoryOpts struct { |
closed | dagger/dagger | https://github.com/dagger/dagger | 5,140 | Expand environment variables in `withEnvVariable` values | ### Discussed in https://github.com/dagger/dagger/discussions/5001
<div type='discussions-op-text'>
<sup>Originally posted by **wingyplus** April 21, 2023</sup>
I want to install something and append it to `PATH` to make it accessible. So how to prepend the new directory into the env variable as we do with `PATH`?</div>
Solution proposed by @vito :
> I agree; extending $PATH seems like a common use case. it would be nice to have parity with Dockerfile ENV which supports interpolation.
>
> It might be a surprising default, since who knows what values people might try to set in env vars. An expand: true param would be simple enough to implement by using [os.Expand](https://pkg.go.dev/os#Expand) and fetching values from the current image config.
>
> ```
> container {
> withEnvVariable(name: "PATH", value: "/opt/venv/bin:${PATH}", expand: true) {
> withExec(args: []string{"sh", "-c", "echo $PATH"}) {
> stdout
> }
> }
> }
> ```
> (Interpolate might be a more obvious name.) | https://github.com/dagger/dagger/issues/5140 | https://github.com/dagger/dagger/pull/5160 | c2fcf8390801585188042d12ee8190b436cc9c2f | e171dc4252e464031737b51fee4c54531b4b537d | 2023-05-16T15:18:49Z | go | 2023-05-25T09:29:47Z | sdk/go/api.gen.go | Permissions int
}
func (r *Directory) WithNewDirectory(path string, opts ...DirectoryWithNewDirectoryOpts) *Directory {
q := r.q.Select("withNewDirectory")
q = q.Arg("path", path)
for i := len(opts) - 1; i >= 0; i-- {
if !querybuilder.IsZeroValue(opts[i].Permissions) {
q = q.Arg("permissions", opts[i].Permissions)
break
}
}
return &Directory{
q: q,
c: r.c,
}
}
type DirectoryWithNewFileOpts struct { |
closed | dagger/dagger | https://github.com/dagger/dagger | 5,140 | Expand environment variables in `withEnvVariable` values | ### Discussed in https://github.com/dagger/dagger/discussions/5001
<div type='discussions-op-text'>
<sup>Originally posted by **wingyplus** April 21, 2023</sup>
I want to install something and append it to `PATH` to make it accessible. So how to prepend the new directory into the env variable as we do with `PATH`?</div>
Solution proposed by @vito :
> I agree; extending $PATH seems like a common use case. it would be nice to have parity with Dockerfile ENV which supports interpolation.
>
> It might be a surprising default, since who knows what values people might try to set in env vars. An expand: true param would be simple enough to implement by using [os.Expand](https://pkg.go.dev/os#Expand) and fetching values from the current image config.
>
> ```
> container {
> withEnvVariable(name: "PATH", value: "/opt/venv/bin:${PATH}", expand: true) {
> withExec(args: []string{"sh", "-c", "echo $PATH"}) {
> stdout
> }
> }
> }
> ```
> (Interpolate might be a more obvious name.) | https://github.com/dagger/dagger/issues/5140 | https://github.com/dagger/dagger/pull/5160 | c2fcf8390801585188042d12ee8190b436cc9c2f | e171dc4252e464031737b51fee4c54531b4b537d | 2023-05-16T15:18:49Z | go | 2023-05-25T09:29:47Z | sdk/go/api.gen.go | Permissions int
}
func (r *Directory) WithNewFile(path string, contents string, opts ...DirectoryWithNewFileOpts) *Directory {
q := r.q.Select("withNewFile")
q = q.Arg("path", path)
q = q.Arg("contents", contents)
for i := len(opts) - 1; i >= 0; i-- {
if !querybuilder.IsZeroValue(opts[i].Permissions) {
q = q.Arg("permissions", opts[i].Permissions)
break
}
} |
closed | dagger/dagger | https://github.com/dagger/dagger | 5,140 | Expand environment variables in `withEnvVariable` values | ### Discussed in https://github.com/dagger/dagger/discussions/5001
<div type='discussions-op-text'>
<sup>Originally posted by **wingyplus** April 21, 2023</sup>
I want to install something and append it to `PATH` to make it accessible. So how to prepend the new directory into the env variable as we do with `PATH`?</div>
Solution proposed by @vito :
> I agree; extending $PATH seems like a common use case. it would be nice to have parity with Dockerfile ENV which supports interpolation.
>
> It might be a surprising default, since who knows what values people might try to set in env vars. An expand: true param would be simple enough to implement by using [os.Expand](https://pkg.go.dev/os#Expand) and fetching values from the current image config.
>
> ```
> container {
> withEnvVariable(name: "PATH", value: "/opt/venv/bin:${PATH}", expand: true) {
> withExec(args: []string{"sh", "-c", "echo $PATH"}) {
> stdout
> }
> }
> }
> ```
> (Interpolate might be a more obvious name.) | https://github.com/dagger/dagger/issues/5140 | https://github.com/dagger/dagger/pull/5160 | c2fcf8390801585188042d12ee8190b436cc9c2f | e171dc4252e464031737b51fee4c54531b4b537d | 2023-05-16T15:18:49Z | go | 2023-05-25T09:29:47Z | sdk/go/api.gen.go | return &Directory{
q: q,
c: r.c,
}
}
func (r *Directory) WithTimestamps(timestamp int) *Directory {
q := r.q.Select("withTimestamps")
q = q.Arg("timestamp", timestamp)
return &Directory{
q: q,
c: r.c,
}
}
func (r *Directory) WithoutDirectory(path string) *Directory {
q := r.q.Select("withoutDirectory")
q = q.Arg("path", path)
return &Directory{
q: q,
c: r.c,
}
}
func (r *Directory) WithoutFile(path string) *Directory {
q := r.q.Select("withoutFile")
q = q.Arg("path", path)
return &Directory{
q: q,
c: r.c,
}
}
type EnvVariable struct { |
closed | dagger/dagger | https://github.com/dagger/dagger | 5,140 | Expand environment variables in `withEnvVariable` values | ### Discussed in https://github.com/dagger/dagger/discussions/5001
<div type='discussions-op-text'>
<sup>Originally posted by **wingyplus** April 21, 2023</sup>
I want to install something and append it to `PATH` to make it accessible. So how to prepend the new directory into the env variable as we do with `PATH`?</div>
Solution proposed by @vito :
> I agree; extending $PATH seems like a common use case. it would be nice to have parity with Dockerfile ENV which supports interpolation.
>
> It might be a surprising default, since who knows what values people might try to set in env vars. An expand: true param would be simple enough to implement by using [os.Expand](https://pkg.go.dev/os#Expand) and fetching values from the current image config.
>
> ```
> container {
> withEnvVariable(name: "PATH", value: "/opt/venv/bin:${PATH}", expand: true) {
> withExec(args: []string{"sh", "-c", "echo $PATH"}) {
> stdout
> }
> }
> }
> ```
> (Interpolate might be a more obvious name.) | https://github.com/dagger/dagger/issues/5140 | https://github.com/dagger/dagger/pull/5160 | c2fcf8390801585188042d12ee8190b436cc9c2f | e171dc4252e464031737b51fee4c54531b4b537d | 2023-05-16T15:18:49Z | go | 2023-05-25T09:29:47Z | sdk/go/api.gen.go | q *querybuilder.Selection
c graphql.Client
name *string
value *string
}
func (r *EnvVariable) Name(ctx context.Context) (string, error) {
if r.name != nil {
return *r.name, nil
}
q := r.q.Select("name")
var response string
q = q.Bind(&response)
return response, q.Execute(ctx, r.c)
}
func (r *EnvVariable) Value(ctx context.Context) (string, error) {
if r.value != nil {
return *r.value, nil
}
q := r.q.Select("value")
var response string
q = q.Bind(&response)
return response, q.Execute(ctx, r.c)
}
type File struct { |
closed | dagger/dagger | https://github.com/dagger/dagger | 5,140 | Expand environment variables in `withEnvVariable` values | ### Discussed in https://github.com/dagger/dagger/discussions/5001
<div type='discussions-op-text'>
<sup>Originally posted by **wingyplus** April 21, 2023</sup>
I want to install something and append it to `PATH` to make it accessible. So how to prepend the new directory into the env variable as we do with `PATH`?</div>
Solution proposed by @vito :
> I agree; extending $PATH seems like a common use case. it would be nice to have parity with Dockerfile ENV which supports interpolation.
>
> It might be a surprising default, since who knows what values people might try to set in env vars. An expand: true param would be simple enough to implement by using [os.Expand](https://pkg.go.dev/os#Expand) and fetching values from the current image config.
>
> ```
> container {
> withEnvVariable(name: "PATH", value: "/opt/venv/bin:${PATH}", expand: true) {
> withExec(args: []string{"sh", "-c", "echo $PATH"}) {
> stdout
> }
> }
> }
> ```
> (Interpolate might be a more obvious name.) | https://github.com/dagger/dagger/issues/5140 | https://github.com/dagger/dagger/pull/5160 | c2fcf8390801585188042d12ee8190b436cc9c2f | e171dc4252e464031737b51fee4c54531b4b537d | 2023-05-16T15:18:49Z | go | 2023-05-25T09:29:47Z | sdk/go/api.gen.go | q *querybuilder.Selection
c graphql.Client
contents *string
export *bool
id *FileID
size *int
}
func (r *File) Contents(ctx context.Context) (string, error) {
if r.contents != nil {
return *r.contents, nil
}
q := r.q.Select("contents")
var response string
q = q.Bind(&response)
return response, q.Execute(ctx, r.c)
}
func (r *File) Export(ctx context.Context, path string) (bool, error) {
if r.export != nil {
return *r.export, nil
}
q := r.q.Select("export")
q = q.Arg("path", path)
var response bool
q = q.Bind(&response) |
closed | dagger/dagger | https://github.com/dagger/dagger | 5,140 | Expand environment variables in `withEnvVariable` values | ### Discussed in https://github.com/dagger/dagger/discussions/5001
<div type='discussions-op-text'>
<sup>Originally posted by **wingyplus** April 21, 2023</sup>
I want to install something and append it to `PATH` to make it accessible. So how to prepend the new directory into the env variable as we do with `PATH`?</div>
Solution proposed by @vito :
> I agree; extending $PATH seems like a common use case. it would be nice to have parity with Dockerfile ENV which supports interpolation.
>
> It might be a surprising default, since who knows what values people might try to set in env vars. An expand: true param would be simple enough to implement by using [os.Expand](https://pkg.go.dev/os#Expand) and fetching values from the current image config.
>
> ```
> container {
> withEnvVariable(name: "PATH", value: "/opt/venv/bin:${PATH}", expand: true) {
> withExec(args: []string{"sh", "-c", "echo $PATH"}) {
> stdout
> }
> }
> }
> ```
> (Interpolate might be a more obvious name.) | https://github.com/dagger/dagger/issues/5140 | https://github.com/dagger/dagger/pull/5160 | c2fcf8390801585188042d12ee8190b436cc9c2f | e171dc4252e464031737b51fee4c54531b4b537d | 2023-05-16T15:18:49Z | go | 2023-05-25T09:29:47Z | sdk/go/api.gen.go | return response, q.Execute(ctx, r.c)
}
func (r *File) ID(ctx context.Context) (FileID, error) {
if r.id != nil {
return *r.id, nil
}
q := r.q.Select("id")
var response FileID
q = q.Bind(&response)
return response, q.Execute(ctx, r.c)
}
func (r *File) XXX_GraphQLType() string {
return "File"
}
func (r *File) XXX_GraphQLID(ctx context.Context) (string, error) {
id, err := r.ID(ctx)
if err != nil {
return "", err
}
return string(id), nil
}
func (r *File) Secret() *Secret {
q := r.q.Select("secret")
return &Secret{
q: q,
c: r.c,
}
}
func (r *File) Size(ctx context.Context) (int, error) {
if r.size != nil { |
closed | dagger/dagger | https://github.com/dagger/dagger | 5,140 | Expand environment variables in `withEnvVariable` values | ### Discussed in https://github.com/dagger/dagger/discussions/5001
<div type='discussions-op-text'>
<sup>Originally posted by **wingyplus** April 21, 2023</sup>
I want to install something and append it to `PATH` to make it accessible. So how to prepend the new directory into the env variable as we do with `PATH`?</div>
Solution proposed by @vito :
> I agree; extending $PATH seems like a common use case. it would be nice to have parity with Dockerfile ENV which supports interpolation.
>
> It might be a surprising default, since who knows what values people might try to set in env vars. An expand: true param would be simple enough to implement by using [os.Expand](https://pkg.go.dev/os#Expand) and fetching values from the current image config.
>
> ```
> container {
> withEnvVariable(name: "PATH", value: "/opt/venv/bin:${PATH}", expand: true) {
> withExec(args: []string{"sh", "-c", "echo $PATH"}) {
> stdout
> }
> }
> }
> ```
> (Interpolate might be a more obvious name.) | https://github.com/dagger/dagger/issues/5140 | https://github.com/dagger/dagger/pull/5160 | c2fcf8390801585188042d12ee8190b436cc9c2f | e171dc4252e464031737b51fee4c54531b4b537d | 2023-05-16T15:18:49Z | go | 2023-05-25T09:29:47Z | sdk/go/api.gen.go | return *r.size, nil
}
q := r.q.Select("size")
var response int
q = q.Bind(&response)
return response, q.Execute(ctx, r.c)
}
func (r *File) WithTimestamps(timestamp int) *File {
q := r.q.Select("withTimestamps")
q = q.Arg("timestamp", timestamp)
return &File{
q: q,
c: r.c,
}
}
type GitRef struct {
q *querybuilder.Selection
c graphql.Client
digest *string
}
func (r *GitRef) Digest(ctx context.Context) (string, error) {
if r.digest != nil {
return *r.digest, nil
}
q := r.q.Select("digest")
var response string
q = q.Bind(&response)
return response, q.Execute(ctx, r.c)
}
type GitRefTreeOpts struct { |
closed | dagger/dagger | https://github.com/dagger/dagger | 5,140 | Expand environment variables in `withEnvVariable` values | ### Discussed in https://github.com/dagger/dagger/discussions/5001
<div type='discussions-op-text'>
<sup>Originally posted by **wingyplus** April 21, 2023</sup>
I want to install something and append it to `PATH` to make it accessible. So how to prepend the new directory into the env variable as we do with `PATH`?</div>
Solution proposed by @vito :
> I agree; extending $PATH seems like a common use case. it would be nice to have parity with Dockerfile ENV which supports interpolation.
>
> It might be a surprising default, since who knows what values people might try to set in env vars. An expand: true param would be simple enough to implement by using [os.Expand](https://pkg.go.dev/os#Expand) and fetching values from the current image config.
>
> ```
> container {
> withEnvVariable(name: "PATH", value: "/opt/venv/bin:${PATH}", expand: true) {
> withExec(args: []string{"sh", "-c", "echo $PATH"}) {
> stdout
> }
> }
> }
> ```
> (Interpolate might be a more obvious name.) | https://github.com/dagger/dagger/issues/5140 | https://github.com/dagger/dagger/pull/5160 | c2fcf8390801585188042d12ee8190b436cc9c2f | e171dc4252e464031737b51fee4c54531b4b537d | 2023-05-16T15:18:49Z | go | 2023-05-25T09:29:47Z | sdk/go/api.gen.go | SSHKnownHosts string
SSHAuthSocket *Socket
}
func (r *GitRef) Tree(opts ...GitRefTreeOpts) *Directory {
q := r.q.Select("tree")
for i := len(opts) - 1; i >= 0; i-- {
if !querybuilder.IsZeroValue(opts[i].SSHKnownHosts) {
q = q.Arg("sshKnownHosts", opts[i].SSHKnownHosts)
break
}
}
for i := len(opts) - 1; i >= 0; i-- {
if !querybuilder.IsZeroValue(opts[i].SSHAuthSocket) {
q = q.Arg("sshAuthSocket", opts[i].SSHAuthSocket)
break
}
}
return &Directory{
q: q,
c: r.c,
}
}
type GitRepository struct { |
closed | dagger/dagger | https://github.com/dagger/dagger | 5,140 | Expand environment variables in `withEnvVariable` values | ### Discussed in https://github.com/dagger/dagger/discussions/5001
<div type='discussions-op-text'>
<sup>Originally posted by **wingyplus** April 21, 2023</sup>
I want to install something and append it to `PATH` to make it accessible. So how to prepend the new directory into the env variable as we do with `PATH`?</div>
Solution proposed by @vito :
> I agree; extending $PATH seems like a common use case. it would be nice to have parity with Dockerfile ENV which supports interpolation.
>
> It might be a surprising default, since who knows what values people might try to set in env vars. An expand: true param would be simple enough to implement by using [os.Expand](https://pkg.go.dev/os#Expand) and fetching values from the current image config.
>
> ```
> container {
> withEnvVariable(name: "PATH", value: "/opt/venv/bin:${PATH}", expand: true) {
> withExec(args: []string{"sh", "-c", "echo $PATH"}) {
> stdout
> }
> }
> }
> ```
> (Interpolate might be a more obvious name.) | https://github.com/dagger/dagger/issues/5140 | https://github.com/dagger/dagger/pull/5160 | c2fcf8390801585188042d12ee8190b436cc9c2f | e171dc4252e464031737b51fee4c54531b4b537d | 2023-05-16T15:18:49Z | go | 2023-05-25T09:29:47Z | sdk/go/api.gen.go | q *querybuilder.Selection
c graphql.Client
}
func (r *GitRepository) Branch(name string) *GitRef {
q := r.q.Select("branch")
q = q.Arg("name", name)
return &GitRef{
q: q,
c: r.c,
}
}
func (r *GitRepository) Branches(ctx context.Context) ([]string, error) {
q := r.q.Select("branches")
var response []string
q = q.Bind(&response)
return response, q.Execute(ctx, r.c)
}
func (r *GitRepository) Commit(id string) *GitRef {
q := r.q.Select("commit")
q = q.Arg("id", id)
return &GitRef{
q: q,
c: r.c,
}
}
func (r *GitRepository) Tag(name string) *GitRef {
q := r.q.Select("tag")
q = q.Arg("name", name) |
closed | dagger/dagger | https://github.com/dagger/dagger | 5,140 | Expand environment variables in `withEnvVariable` values | ### Discussed in https://github.com/dagger/dagger/discussions/5001
<div type='discussions-op-text'>
<sup>Originally posted by **wingyplus** April 21, 2023</sup>
I want to install something and append it to `PATH` to make it accessible. So how to prepend the new directory into the env variable as we do with `PATH`?</div>
Solution proposed by @vito :
> I agree; extending $PATH seems like a common use case. it would be nice to have parity with Dockerfile ENV which supports interpolation.
>
> It might be a surprising default, since who knows what values people might try to set in env vars. An expand: true param would be simple enough to implement by using [os.Expand](https://pkg.go.dev/os#Expand) and fetching values from the current image config.
>
> ```
> container {
> withEnvVariable(name: "PATH", value: "/opt/venv/bin:${PATH}", expand: true) {
> withExec(args: []string{"sh", "-c", "echo $PATH"}) {
> stdout
> }
> }
> }
> ```
> (Interpolate might be a more obvious name.) | https://github.com/dagger/dagger/issues/5140 | https://github.com/dagger/dagger/pull/5160 | c2fcf8390801585188042d12ee8190b436cc9c2f | e171dc4252e464031737b51fee4c54531b4b537d | 2023-05-16T15:18:49Z | go | 2023-05-25T09:29:47Z | sdk/go/api.gen.go | return &GitRef{
q: q,
c: r.c,
}
}
func (r *GitRepository) Tags(ctx context.Context) ([]string, error) {
q := r.q.Select("tags")
var response []string
q = q.Bind(&response)
return response, q.Execute(ctx, r.c)
}
type Host struct {
q *querybuilder.Selection
c graphql.Client
}
type HostDirectoryOpts struct {
Exclude []string
Include []string
}
func (r *Host) Directory(path string, opts ...HostDirectoryOpts) *Directory {
q := r.q.Select("directory")
q = q.Arg("path", path)
for i := len(opts) - 1; i >= 0; i-- {
if !querybuilder.IsZeroValue(opts[i].Exclude) {
q = q.Arg("exclude", opts[i].Exclude)
break
} |
closed | dagger/dagger | https://github.com/dagger/dagger | 5,140 | Expand environment variables in `withEnvVariable` values | ### Discussed in https://github.com/dagger/dagger/discussions/5001
<div type='discussions-op-text'>
<sup>Originally posted by **wingyplus** April 21, 2023</sup>
I want to install something and append it to `PATH` to make it accessible. So how to prepend the new directory into the env variable as we do with `PATH`?</div>
Solution proposed by @vito :
> I agree; extending $PATH seems like a common use case. it would be nice to have parity with Dockerfile ENV which supports interpolation.
>
> It might be a surprising default, since who knows what values people might try to set in env vars. An expand: true param would be simple enough to implement by using [os.Expand](https://pkg.go.dev/os#Expand) and fetching values from the current image config.
>
> ```
> container {
> withEnvVariable(name: "PATH", value: "/opt/venv/bin:${PATH}", expand: true) {
> withExec(args: []string{"sh", "-c", "echo $PATH"}) {
> stdout
> }
> }
> }
> ```
> (Interpolate might be a more obvious name.) | https://github.com/dagger/dagger/issues/5140 | https://github.com/dagger/dagger/pull/5160 | c2fcf8390801585188042d12ee8190b436cc9c2f | e171dc4252e464031737b51fee4c54531b4b537d | 2023-05-16T15:18:49Z | go | 2023-05-25T09:29:47Z | sdk/go/api.gen.go | }
for i := len(opts) - 1; i >= 0; i-- {
if !querybuilder.IsZeroValue(opts[i].Include) {
q = q.Arg("include", opts[i].Include)
break
}
}
return &Directory{
q: q,
c: r.c,
}
}
func (r *Host) EnvVariable(name string) *HostVariable {
q := r.q.Select("envVariable")
q = q.Arg("name", name)
return &HostVariable{
q: q,
c: r.c,
}
}
func (r *Host) UnixSocket(path string) *Socket {
q := r.q.Select("unixSocket")
q = q.Arg("path", path)
return &Socket{
q: q,
c: r.c,
}
}
type HostWorkdirOpts struct { |
closed | dagger/dagger | https://github.com/dagger/dagger | 5,140 | Expand environment variables in `withEnvVariable` values | ### Discussed in https://github.com/dagger/dagger/discussions/5001
<div type='discussions-op-text'>
<sup>Originally posted by **wingyplus** April 21, 2023</sup>
I want to install something and append it to `PATH` to make it accessible. So how to prepend the new directory into the env variable as we do with `PATH`?</div>
Solution proposed by @vito :
> I agree; extending $PATH seems like a common use case. it would be nice to have parity with Dockerfile ENV which supports interpolation.
>
> It might be a surprising default, since who knows what values people might try to set in env vars. An expand: true param would be simple enough to implement by using [os.Expand](https://pkg.go.dev/os#Expand) and fetching values from the current image config.
>
> ```
> container {
> withEnvVariable(name: "PATH", value: "/opt/venv/bin:${PATH}", expand: true) {
> withExec(args: []string{"sh", "-c", "echo $PATH"}) {
> stdout
> }
> }
> }
> ```
> (Interpolate might be a more obvious name.) | https://github.com/dagger/dagger/issues/5140 | https://github.com/dagger/dagger/pull/5160 | c2fcf8390801585188042d12ee8190b436cc9c2f | e171dc4252e464031737b51fee4c54531b4b537d | 2023-05-16T15:18:49Z | go | 2023-05-25T09:29:47Z | sdk/go/api.gen.go | Exclude []string
Include []string
}
func (r *Host) Workdir(opts ...HostWorkdirOpts) *Directory {
q := r.q.Select("workdir")
for i := len(opts) - 1; i >= 0; i-- {
if !querybuilder.IsZeroValue(opts[i].Exclude) {
q = q.Arg("exclude", opts[i].Exclude)
break
}
}
for i := len(opts) - 1; i >= 0; i-- {
if !querybuilder.IsZeroValue(opts[i].Include) {
q = q.Arg("include", opts[i].Include)
break
}
}
return &Directory{
q: q,
c: r.c,
}
}
type HostVariable struct { |
closed | dagger/dagger | https://github.com/dagger/dagger | 5,140 | Expand environment variables in `withEnvVariable` values | ### Discussed in https://github.com/dagger/dagger/discussions/5001
<div type='discussions-op-text'>
<sup>Originally posted by **wingyplus** April 21, 2023</sup>
I want to install something and append it to `PATH` to make it accessible. So how to prepend the new directory into the env variable as we do with `PATH`?</div>
Solution proposed by @vito :
> I agree; extending $PATH seems like a common use case. it would be nice to have parity with Dockerfile ENV which supports interpolation.
>
> It might be a surprising default, since who knows what values people might try to set in env vars. An expand: true param would be simple enough to implement by using [os.Expand](https://pkg.go.dev/os#Expand) and fetching values from the current image config.
>
> ```
> container {
> withEnvVariable(name: "PATH", value: "/opt/venv/bin:${PATH}", expand: true) {
> withExec(args: []string{"sh", "-c", "echo $PATH"}) {
> stdout
> }
> }
> }
> ```
> (Interpolate might be a more obvious name.) | https://github.com/dagger/dagger/issues/5140 | https://github.com/dagger/dagger/pull/5160 | c2fcf8390801585188042d12ee8190b436cc9c2f | e171dc4252e464031737b51fee4c54531b4b537d | 2023-05-16T15:18:49Z | go | 2023-05-25T09:29:47Z | sdk/go/api.gen.go | q *querybuilder.Selection
c graphql.Client
value *string
}
func (r *HostVariable) Secret() *Secret {
q := r.q.Select("secret")
return &Secret{
q: q,
c: r.c,
}
}
func (r *HostVariable) Value(ctx context.Context) (string, error) {
if r.value != nil {
return *r.value, nil
}
q := r.q.Select("value")
var response string
q = q.Bind(&response)
return response, q.Execute(ctx, r.c)
}
type Label struct { |
closed | dagger/dagger | https://github.com/dagger/dagger | 5,140 | Expand environment variables in `withEnvVariable` values | ### Discussed in https://github.com/dagger/dagger/discussions/5001
<div type='discussions-op-text'>
<sup>Originally posted by **wingyplus** April 21, 2023</sup>
I want to install something and append it to `PATH` to make it accessible. So how to prepend the new directory into the env variable as we do with `PATH`?</div>
Solution proposed by @vito :
> I agree; extending $PATH seems like a common use case. it would be nice to have parity with Dockerfile ENV which supports interpolation.
>
> It might be a surprising default, since who knows what values people might try to set in env vars. An expand: true param would be simple enough to implement by using [os.Expand](https://pkg.go.dev/os#Expand) and fetching values from the current image config.
>
> ```
> container {
> withEnvVariable(name: "PATH", value: "/opt/venv/bin:${PATH}", expand: true) {
> withExec(args: []string{"sh", "-c", "echo $PATH"}) {
> stdout
> }
> }
> }
> ```
> (Interpolate might be a more obvious name.) | https://github.com/dagger/dagger/issues/5140 | https://github.com/dagger/dagger/pull/5160 | c2fcf8390801585188042d12ee8190b436cc9c2f | e171dc4252e464031737b51fee4c54531b4b537d | 2023-05-16T15:18:49Z | go | 2023-05-25T09:29:47Z | sdk/go/api.gen.go | q *querybuilder.Selection
c graphql.Client
name *string
value *string
}
func (r *Label) Name(ctx context.Context) (string, error) {
if r.name != nil {
return *r.name, nil
}
q := r.q.Select("name")
var response string
q = q.Bind(&response)
return response, q.Execute(ctx, r.c)
}
func (r *Label) Value(ctx context.Context) (string, error) {
if r.value != nil {
return *r.value, nil
}
q := r.q.Select("value")
var response string
q = q.Bind(&response)
return response, q.Execute(ctx, r.c)
}
type Port struct { |
closed | dagger/dagger | https://github.com/dagger/dagger | 5,140 | Expand environment variables in `withEnvVariable` values | ### Discussed in https://github.com/dagger/dagger/discussions/5001
<div type='discussions-op-text'>
<sup>Originally posted by **wingyplus** April 21, 2023</sup>
I want to install something and append it to `PATH` to make it accessible. So how to prepend the new directory into the env variable as we do with `PATH`?</div>
Solution proposed by @vito :
> I agree; extending $PATH seems like a common use case. it would be nice to have parity with Dockerfile ENV which supports interpolation.
>
> It might be a surprising default, since who knows what values people might try to set in env vars. An expand: true param would be simple enough to implement by using [os.Expand](https://pkg.go.dev/os#Expand) and fetching values from the current image config.
>
> ```
> container {
> withEnvVariable(name: "PATH", value: "/opt/venv/bin:${PATH}", expand: true) {
> withExec(args: []string{"sh", "-c", "echo $PATH"}) {
> stdout
> }
> }
> }
> ```
> (Interpolate might be a more obvious name.) | https://github.com/dagger/dagger/issues/5140 | https://github.com/dagger/dagger/pull/5160 | c2fcf8390801585188042d12ee8190b436cc9c2f | e171dc4252e464031737b51fee4c54531b4b537d | 2023-05-16T15:18:49Z | go | 2023-05-25T09:29:47Z | sdk/go/api.gen.go | q *querybuilder.Selection
c graphql.Client
description *string
port *int
protocol *NetworkProtocol
}
func (r *Port) Description(ctx context.Context) (string, error) {
if r.description != nil {
return *r.description, nil
}
q := r.q.Select("description")
var response string
q = q.Bind(&response) |
closed | dagger/dagger | https://github.com/dagger/dagger | 5,140 | Expand environment variables in `withEnvVariable` values | ### Discussed in https://github.com/dagger/dagger/discussions/5001
<div type='discussions-op-text'>
<sup>Originally posted by **wingyplus** April 21, 2023</sup>
I want to install something and append it to `PATH` to make it accessible. So how to prepend the new directory into the env variable as we do with `PATH`?</div>
Solution proposed by @vito :
> I agree; extending $PATH seems like a common use case. it would be nice to have parity with Dockerfile ENV which supports interpolation.
>
> It might be a surprising default, since who knows what values people might try to set in env vars. An expand: true param would be simple enough to implement by using [os.Expand](https://pkg.go.dev/os#Expand) and fetching values from the current image config.
>
> ```
> container {
> withEnvVariable(name: "PATH", value: "/opt/venv/bin:${PATH}", expand: true) {
> withExec(args: []string{"sh", "-c", "echo $PATH"}) {
> stdout
> }
> }
> }
> ```
> (Interpolate might be a more obvious name.) | https://github.com/dagger/dagger/issues/5140 | https://github.com/dagger/dagger/pull/5160 | c2fcf8390801585188042d12ee8190b436cc9c2f | e171dc4252e464031737b51fee4c54531b4b537d | 2023-05-16T15:18:49Z | go | 2023-05-25T09:29:47Z | sdk/go/api.gen.go | return response, q.Execute(ctx, r.c)
}
func (r *Port) Port(ctx context.Context) (int, error) {
if r.port != nil {
return *r.port, nil
}
q := r.q.Select("port")
var response int
q = q.Bind(&response)
return response, q.Execute(ctx, r.c)
}
func (r *Port) Protocol(ctx context.Context) (NetworkProtocol, error) {
if r.protocol != nil {
return *r.protocol, nil
}
q := r.q.Select("protocol")
var response NetworkProtocol
q = q.Bind(&response)
return response, q.Execute(ctx, r.c)
}
type Project struct {
q *querybuilder.Selection
c graphql.Client
id *string
name *string
}
func (r *Project) Commands(ctx context.Context) ([]ProjectCommand, error) {
q := r.q.Select("commands")
q = q.Select("description id name")
type commands struct { |
closed | dagger/dagger | https://github.com/dagger/dagger | 5,140 | Expand environment variables in `withEnvVariable` values | ### Discussed in https://github.com/dagger/dagger/discussions/5001
<div type='discussions-op-text'>
<sup>Originally posted by **wingyplus** April 21, 2023</sup>
I want to install something and append it to `PATH` to make it accessible. So how to prepend the new directory into the env variable as we do with `PATH`?</div>
Solution proposed by @vito :
> I agree; extending $PATH seems like a common use case. it would be nice to have parity with Dockerfile ENV which supports interpolation.
>
> It might be a surprising default, since who knows what values people might try to set in env vars. An expand: true param would be simple enough to implement by using [os.Expand](https://pkg.go.dev/os#Expand) and fetching values from the current image config.
>
> ```
> container {
> withEnvVariable(name: "PATH", value: "/opt/venv/bin:${PATH}", expand: true) {
> withExec(args: []string{"sh", "-c", "echo $PATH"}) {
> stdout
> }
> }
> }
> ```
> (Interpolate might be a more obvious name.) | https://github.com/dagger/dagger/issues/5140 | https://github.com/dagger/dagger/pull/5160 | c2fcf8390801585188042d12ee8190b436cc9c2f | e171dc4252e464031737b51fee4c54531b4b537d | 2023-05-16T15:18:49Z | go | 2023-05-25T09:29:47Z | sdk/go/api.gen.go | Description string
Id string
Name string
}
convert := func(fields []commands) []ProjectCommand {
out := []ProjectCommand{}
for i := range fields {
out = append(out, ProjectCommand{description: &fields[i].Description, id: &fields[i].Id, name: &fields[i].Name})
}
return out
}
var response []commands
q = q.Bind(&response)
err := q.Execute(ctx, r.c)
if err != nil {
return nil, err
}
return convert(response), nil
}
func (r *Project) ID(ctx context.Context) (string, error) {
if r.id != nil {
return *r.id, nil
}
q := r.q.Select("id")
var response string
q = q.Bind(&response)
return response, q.Execute(ctx, r.c) |
closed | dagger/dagger | https://github.com/dagger/dagger | 5,140 | Expand environment variables in `withEnvVariable` values | ### Discussed in https://github.com/dagger/dagger/discussions/5001
<div type='discussions-op-text'>
<sup>Originally posted by **wingyplus** April 21, 2023</sup>
I want to install something and append it to `PATH` to make it accessible. So how to prepend the new directory into the env variable as we do with `PATH`?</div>
Solution proposed by @vito :
> I agree; extending $PATH seems like a common use case. it would be nice to have parity with Dockerfile ENV which supports interpolation.
>
> It might be a surprising default, since who knows what values people might try to set in env vars. An expand: true param would be simple enough to implement by using [os.Expand](https://pkg.go.dev/os#Expand) and fetching values from the current image config.
>
> ```
> container {
> withEnvVariable(name: "PATH", value: "/opt/venv/bin:${PATH}", expand: true) {
> withExec(args: []string{"sh", "-c", "echo $PATH"}) {
> stdout
> }
> }
> }
> ```
> (Interpolate might be a more obvious name.) | https://github.com/dagger/dagger/issues/5140 | https://github.com/dagger/dagger/pull/5160 | c2fcf8390801585188042d12ee8190b436cc9c2f | e171dc4252e464031737b51fee4c54531b4b537d | 2023-05-16T15:18:49Z | go | 2023-05-25T09:29:47Z | sdk/go/api.gen.go | }
func (r *Project) XXX_GraphQLType() string {
return "Project"
}
func (r *Project) XXX_GraphQLID(ctx context.Context) (string, error) {
id, err := r.ID(ctx)
if err != nil {
return "", err
}
return string(id), nil
}
func (r *Project) Load(source *Directory, configPath string) *Project {
q := r.q.Select("load")
q = q.Arg("source", source)
q = q.Arg("configPath", configPath)
return &Project{
q: q,
c: r.c,
}
}
func (r *Project) Name(ctx context.Context) (string, error) {
if r.name != nil {
return *r.name, nil
}
q := r.q.Select("name")
var response string
q = q.Bind(&response)
return response, q.Execute(ctx, r.c)
}
type ProjectCommand struct { |
closed | dagger/dagger | https://github.com/dagger/dagger | 5,140 | Expand environment variables in `withEnvVariable` values | ### Discussed in https://github.com/dagger/dagger/discussions/5001
<div type='discussions-op-text'>
<sup>Originally posted by **wingyplus** April 21, 2023</sup>
I want to install something and append it to `PATH` to make it accessible. So how to prepend the new directory into the env variable as we do with `PATH`?</div>
Solution proposed by @vito :
> I agree; extending $PATH seems like a common use case. it would be nice to have parity with Dockerfile ENV which supports interpolation.
>
> It might be a surprising default, since who knows what values people might try to set in env vars. An expand: true param would be simple enough to implement by using [os.Expand](https://pkg.go.dev/os#Expand) and fetching values from the current image config.
>
> ```
> container {
> withEnvVariable(name: "PATH", value: "/opt/venv/bin:${PATH}", expand: true) {
> withExec(args: []string{"sh", "-c", "echo $PATH"}) {
> stdout
> }
> }
> }
> ```
> (Interpolate might be a more obvious name.) | https://github.com/dagger/dagger/issues/5140 | https://github.com/dagger/dagger/pull/5160 | c2fcf8390801585188042d12ee8190b436cc9c2f | e171dc4252e464031737b51fee4c54531b4b537d | 2023-05-16T15:18:49Z | go | 2023-05-25T09:29:47Z | sdk/go/api.gen.go | q *querybuilder.Selection
c graphql.Client
description *string
id *string
name *string
}
func (r *ProjectCommand) Description(ctx context.Context) (string, error) {
if r.description != nil {
return *r.description, nil
}
q := r.q.Select("description")
var response string
q = q.Bind(&response)
return response, q.Execute(ctx, r.c)
}
func (r *ProjectCommand) Flags(ctx context.Context) ([]ProjectCommandFlag, error) {
q := r.q.Select("flags")
q = q.Select("description name")
type flags struct { |
closed | dagger/dagger | https://github.com/dagger/dagger | 5,140 | Expand environment variables in `withEnvVariable` values | ### Discussed in https://github.com/dagger/dagger/discussions/5001
<div type='discussions-op-text'>
<sup>Originally posted by **wingyplus** April 21, 2023</sup>
I want to install something and append it to `PATH` to make it accessible. So how to prepend the new directory into the env variable as we do with `PATH`?</div>
Solution proposed by @vito :
> I agree; extending $PATH seems like a common use case. it would be nice to have parity with Dockerfile ENV which supports interpolation.
>
> It might be a surprising default, since who knows what values people might try to set in env vars. An expand: true param would be simple enough to implement by using [os.Expand](https://pkg.go.dev/os#Expand) and fetching values from the current image config.
>
> ```
> container {
> withEnvVariable(name: "PATH", value: "/opt/venv/bin:${PATH}", expand: true) {
> withExec(args: []string{"sh", "-c", "echo $PATH"}) {
> stdout
> }
> }
> }
> ```
> (Interpolate might be a more obvious name.) | https://github.com/dagger/dagger/issues/5140 | https://github.com/dagger/dagger/pull/5160 | c2fcf8390801585188042d12ee8190b436cc9c2f | e171dc4252e464031737b51fee4c54531b4b537d | 2023-05-16T15:18:49Z | go | 2023-05-25T09:29:47Z | sdk/go/api.gen.go | Description string
Name string
}
convert := func(fields []flags) []ProjectCommandFlag {
out := []ProjectCommandFlag{}
for i := range fields {
out = append(out, ProjectCommandFlag{description: &fields[i].Description, name: &fields[i].Name})
}
return out
}
var response []flags
q = q.Bind(&response)
err := q.Execute(ctx, r.c)
if err != nil {
return nil, err
}
return convert(response), nil
}
func (r *ProjectCommand) ID(ctx context.Context) (string, error) {
if r.id != nil { |
closed | dagger/dagger | https://github.com/dagger/dagger | 5,140 | Expand environment variables in `withEnvVariable` values | ### Discussed in https://github.com/dagger/dagger/discussions/5001
<div type='discussions-op-text'>
<sup>Originally posted by **wingyplus** April 21, 2023</sup>
I want to install something and append it to `PATH` to make it accessible. So how to prepend the new directory into the env variable as we do with `PATH`?</div>
Solution proposed by @vito :
> I agree; extending $PATH seems like a common use case. it would be nice to have parity with Dockerfile ENV which supports interpolation.
>
> It might be a surprising default, since who knows what values people might try to set in env vars. An expand: true param would be simple enough to implement by using [os.Expand](https://pkg.go.dev/os#Expand) and fetching values from the current image config.
>
> ```
> container {
> withEnvVariable(name: "PATH", value: "/opt/venv/bin:${PATH}", expand: true) {
> withExec(args: []string{"sh", "-c", "echo $PATH"}) {
> stdout
> }
> }
> }
> ```
> (Interpolate might be a more obvious name.) | https://github.com/dagger/dagger/issues/5140 | https://github.com/dagger/dagger/pull/5160 | c2fcf8390801585188042d12ee8190b436cc9c2f | e171dc4252e464031737b51fee4c54531b4b537d | 2023-05-16T15:18:49Z | go | 2023-05-25T09:29:47Z | sdk/go/api.gen.go | return *r.id, nil
}
q := r.q.Select("id")
var response string
q = q.Bind(&response)
return response, q.Execute(ctx, r.c)
}
func (r *ProjectCommand) XXX_GraphQLType() string {
return "ProjectCommand"
}
func (r *ProjectCommand) XXX_GraphQLID(ctx context.Context) (string, error) {
id, err := r.ID(ctx)
if err != nil {
return "", err
}
return string(id), nil
}
func (r *ProjectCommand) Name(ctx context.Context) (string, error) {
if r.name != nil {
return *r.name, nil
}
q := r.q.Select("name")
var response string
q = q.Bind(&response)
return response, q.Execute(ctx, r.c)
}
func (r *ProjectCommand) Subcommands(ctx context.Context) ([]ProjectCommand, error) {
q := r.q.Select("subcommands")
q = q.Select("description id name")
type subcommands struct { |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.