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
276
Multiple deployments with the same name?
It appears multiple deployments can have the same name, which is confusing. ``` $ dagger up 7:50PM FTL system | multiple deployments match the current directory, select one with `--deployment` deploymentPath=/home/shykes/dagger deployments=[ "dagger", "dagger-dev", "dagger-dev" ] ``` ``` $ ls ~/.dagger/store/ dagger dagger-dev react ```
https://github.com/dagger/dagger/issues/276
https://github.com/dagger/dagger/pull/279
1ae0ce65e90e4ff3b67317c957636b64058e1f35
7cf1163a2b7055a1dae6cdf36aad295398e2487a
2021-04-05T19:52:47Z
go
2021-04-06T00:09:35Z
dagger/store.go
return st, nil } func (s *Store) LookupDeploymentByName(ctx context.Context, name string) (*DeploymentState, error) { s.l.RLock() defer s.l.RUnlock() st, ok := s.deploymentsByName[name] if !ok { return nil, fmt.Errorf("%s: %w", name, ErrDeploymentNotExist) } return st, nil } func (s *Store) LookupDeploymentByPath(ctx context.Context, path string) ([]*DeploymentState, error) { s.l.RLock() defer s.l.RUnlock() st, ok := s.deploymentsByPath[path] if !ok { return []*DeploymentState{}, nil } return st, nil } func (s *Store) ListDeployments(ctx context.Context) ([]*DeploymentState, error) { s.l.RLock() defer s.l.RUnlock() deployments := make([]*DeploymentState, 0, len(s.deployments)) for _, st := range s.deployments { deployments = append(deployments, st) } return deployments, nil }
closed
dagger/dagger
https://github.com/dagger/dagger
316
Support command "up --no-cache" to temporarily disable the cache
It's important to be able to to disable the cache on-demand, one-time. `dagger up --no-cache`
https://github.com/dagger/dagger/issues/316
https://github.com/dagger/dagger/pull/327
551f281bf7bc404a02b01600655cfdc42097880e
493406afe75277a50478cb4a69cf349674bc1858
2021-04-12T21:47:18Z
go
2021-04-15T18:37:45Z
cmd/dagger/cmd/common/common.go
package common import ( "context" "os" "dagger.io/go/dagger" "github.com/rs/zerolog/log" "github.com/spf13/viper" ) func GetCurrentDeploymentState(ctx context.Context, store *dagger.Store) *dagger.DeploymentState { lg := log.Ctx(ctx) deploymentName := viper.GetString("deployment") if deploymentName != "" { st, err := store.LookupDeploymentByName(ctx, deploymentName) if err != nil { lg. Fatal(). Err(err). Str("deploymentName", deploymentName). Msg("failed to lookup deployment by name") } return st } wd, err := os.Getwd() if err != nil { lg.Fatal().Err(err).Msg("cannot get current working directory") }
closed
dagger/dagger
https://github.com/dagger/dagger
316
Support command "up --no-cache" to temporarily disable the cache
It's important to be able to to disable the cache on-demand, one-time. `dagger up --no-cache`
https://github.com/dagger/dagger/issues/316
https://github.com/dagger/dagger/pull/327
551f281bf7bc404a02b01600655cfdc42097880e
493406afe75277a50478cb4a69cf349674bc1858
2021-04-12T21:47:18Z
go
2021-04-15T18:37:45Z
cmd/dagger/cmd/common/common.go
st, err := store.LookupDeploymentByPath(ctx, wd) if err != nil { lg. Fatal(). Err(err). Str("deploymentPath", wd). Msg("failed to lookup deployment by path") } if len(st) == 0 { lg. Fatal(). Err(err). Str("deploymentPath", wd). Msg("no deployments match the current directory") } if len(st) > 1 { deployments := []string{} for _, s := range st { deployments = append(deployments, s.Name) } lg. Fatal(). Err(err). Str("deploymentPath", wd). Strs("deployments", deployments). Msg("multiple deployments match the current directory, select one with `--deployment`") } return st[0] } func DeploymentUp(ctx context.Context, state *dagger.DeploymentState) *dagger.Deployment {
closed
dagger/dagger
https://github.com/dagger/dagger
316
Support command "up --no-cache" to temporarily disable the cache
It's important to be able to to disable the cache on-demand, one-time. `dagger up --no-cache`
https://github.com/dagger/dagger/issues/316
https://github.com/dagger/dagger/pull/327
551f281bf7bc404a02b01600655cfdc42097880e
493406afe75277a50478cb4a69cf349674bc1858
2021-04-12T21:47:18Z
go
2021-04-15T18:37:45Z
cmd/dagger/cmd/common/common.go
lg := log.Ctx(ctx) c, err := dagger.NewClient(ctx, "") if err != nil { lg.Fatal().Err(err).Msg("unable to create client") } result, err := c.Do(ctx, state, func(ctx context.Context, deployment *dagger.Deployment, s dagger.Solver) error { log.Ctx(ctx).Debug().Msg("bringing deployment up") return deployment.Up(ctx, s) }) if err != nil { lg.Fatal().Err(err).Msg("failed to up deployment") } return result }
closed
dagger/dagger
https://github.com/dagger/dagger
316
Support command "up --no-cache" to temporarily disable the cache
It's important to be able to to disable the cache on-demand, one-time. `dagger up --no-cache`
https://github.com/dagger/dagger/issues/316
https://github.com/dagger/dagger/pull/327
551f281bf7bc404a02b01600655cfdc42097880e
493406afe75277a50478cb4a69cf349674bc1858
2021-04-12T21:47:18Z
go
2021-04-15T18:37:45Z
cmd/dagger/cmd/compute.go
package cmd import ( "encoding/json" "errors" "fmt" "os" "strings" "cuelang.org/go/cue" "dagger.io/go/cmd/dagger/cmd/common" "dagger.io/go/cmd/dagger/logger" "dagger.io/go/dagger" "dagger.io/go/dagger/compiler" "go.mozilla.org/sops/v3" "go.mozilla.org/sops/v3/decrypt" "github.com/google/uuid" "github.com/spf13/cobra" "github.com/spf13/viper" ) var computeCmd = &cobra.Command{ Use: "compute CONFIG", Short: "Compute a configuration", Args: cobra.ExactArgs(1),
closed
dagger/dagger
https://github.com/dagger/dagger
316
Support command "up --no-cache" to temporarily disable the cache
It's important to be able to to disable the cache on-demand, one-time. `dagger up --no-cache`
https://github.com/dagger/dagger/issues/316
https://github.com/dagger/dagger/pull/327
551f281bf7bc404a02b01600655cfdc42097880e
493406afe75277a50478cb4a69cf349674bc1858
2021-04-12T21:47:18Z
go
2021-04-15T18:37:45Z
cmd/dagger/cmd/compute.go
PreRun: func(cmd *cobra.Command, args []string) { if err := viper.BindPFlags(cmd.Flags()); err != nil { panic(err) } }, Run: func(cmd *cobra.Command, args []string) { lg := logger.New() ctx := lg.WithContext(cmd.Context()) st := &dagger.DeploymentState{ ID: uuid.New().String(), Name: "FIXME", PlanSource: dagger.DirInput(args[0], []string{"*.cue", "cue.mod"}), } for _, input := range viper.GetStringSlice("input-string") { parts := strings.SplitN(input, "=", 2) k, v := parts[0], parts[1] err := st.SetInput(k, dagger.TextInput(v)) if err != nil { lg. Fatal(). Err(err). Str("input", k). Msg("failed to add input") } } for _, input := range viper.GetStringSlice("input-dir") { parts := strings.SplitN(input, "=", 2) k, v := parts[0], parts[1]
closed
dagger/dagger
https://github.com/dagger/dagger
316
Support command "up --no-cache" to temporarily disable the cache
It's important to be able to to disable the cache on-demand, one-time. `dagger up --no-cache`
https://github.com/dagger/dagger/issues/316
https://github.com/dagger/dagger/pull/327
551f281bf7bc404a02b01600655cfdc42097880e
493406afe75277a50478cb4a69cf349674bc1858
2021-04-12T21:47:18Z
go
2021-04-15T18:37:45Z
cmd/dagger/cmd/compute.go
err := st.SetInput(k, dagger.DirInput(v, []string{})) if err != nil { lg. Fatal(). Err(err). Str("input", k). Msg("failed to add input") } } for _, input := range viper.GetStringSlice("input-git") { parts := strings.SplitN(input, "=", 2) k, v := parts[0], parts[1] err := st.SetInput(k, dagger.GitInput(v, "", "")) if err != nil { lg. Fatal(). Err(err). Str("input", k). Msg("failed to add input") } } if f := viper.GetString("input-json"); f != "" { lg := lg.With().Str("path", f).Logger() content, err := os.ReadFile(f) if err != nil { lg.Fatal().Err(err).Msg("failed to read file") } plaintext, err := decrypt.Data(content, "json") if err != nil && !errors.Is(err, sops.MetadataNotFound) { lg.Fatal().Err(err).Msg("unable to decrypt")
closed
dagger/dagger
https://github.com/dagger/dagger
316
Support command "up --no-cache" to temporarily disable the cache
It's important to be able to to disable the cache on-demand, one-time. `dagger up --no-cache`
https://github.com/dagger/dagger/issues/316
https://github.com/dagger/dagger/pull/327
551f281bf7bc404a02b01600655cfdc42097880e
493406afe75277a50478cb4a69cf349674bc1858
2021-04-12T21:47:18Z
go
2021-04-15T18:37:45Z
cmd/dagger/cmd/compute.go
} if len(plaintext) > 0 { content = plaintext } if !json.Valid(content) { lg.Fatal().Msg("invalid json") } err = st.SetInput("", dagger.JSONInput(string(content))) if err != nil { lg.Fatal().Err(err).Msg("failed to add input") } } if f := viper.GetString("input-yaml"); f != "" { lg := lg.With().Str("path", f).Logger() content, err := os.ReadFile(f) if err != nil { lg.Fatal().Err(err).Msg("failed to read file") } plaintext, err := decrypt.Data(content, "yaml") if err != nil && !errors.Is(err, sops.MetadataNotFound) { lg.Fatal().Err(err).Msg("unable to decrypt") } if len(plaintext) > 0 { content = plaintext } err = st.SetInput("", dagger.YAMLInput(string(content))) if err != nil { lg.Fatal().Err(err).Msg("failed to add input") } }
closed
dagger/dagger
https://github.com/dagger/dagger
316
Support command "up --no-cache" to temporarily disable the cache
It's important to be able to to disable the cache on-demand, one-time. `dagger up --no-cache`
https://github.com/dagger/dagger/issues/316
https://github.com/dagger/dagger/pull/327
551f281bf7bc404a02b01600655cfdc42097880e
493406afe75277a50478cb4a69cf349674bc1858
2021-04-12T21:47:18Z
go
2021-04-15T18:37:45Z
cmd/dagger/cmd/compute.go
if f := viper.GetString("input-file"); f != "" { lg := lg.With().Str("path", f).Logger() parts := strings.SplitN(f, "=", 2) k, v := parts[0], parts[1] content, err := os.ReadFile(v) if err != nil { lg.Fatal().Err(err).Msg("failed to read file") } if len(content) > 0 { err = st.SetInput(k, dagger.FileInput(v)) if err != nil { lg.Fatal().Err(err).Msg("failed to set input string") } } } deployment := common.DeploymentUp(ctx, st) v := compiler.NewValue() if err := v.FillPath(cue.MakePath(), deployment.Plan()); err != nil { lg.Fatal().Err(err).Msg("failed to merge") } if err := v.FillPath(cue.MakePath(), deployment.Input()); err != nil { lg.Fatal().Err(err).Msg("failed to merge") } if err := v.FillPath(cue.MakePath(), deployment.Computed()); err != nil { lg.Fatal().Err(err).Msg("failed to merge") } fmt.Println(v.JSON()) }, } func init() {
closed
dagger/dagger
https://github.com/dagger/dagger
316
Support command "up --no-cache" to temporarily disable the cache
It's important to be able to to disable the cache on-demand, one-time. `dagger up --no-cache`
https://github.com/dagger/dagger/issues/316
https://github.com/dagger/dagger/pull/327
551f281bf7bc404a02b01600655cfdc42097880e
493406afe75277a50478cb4a69cf349674bc1858
2021-04-12T21:47:18Z
go
2021-04-15T18:37:45Z
cmd/dagger/cmd/compute.go
computeCmd.Flags().StringSlice("input-string", []string{}, "TARGET=STRING") computeCmd.Flags().StringSlice("input-dir", []string{}, "TARGET=PATH") computeCmd.Flags().String("input-file", "", "TARGET=PATH") computeCmd.Flags().StringSlice("input-git", []string{}, "TARGET=REMOTE#REF") computeCmd.Flags().String("input-json", "", "JSON") computeCmd.Flags().String("input-yaml", "", "YAML") if err := viper.BindPFlags(computeCmd.Flags()); err != nil { panic(err) } }
closed
dagger/dagger
https://github.com/dagger/dagger
316
Support command "up --no-cache" to temporarily disable the cache
It's important to be able to to disable the cache on-demand, one-time. `dagger up --no-cache`
https://github.com/dagger/dagger/issues/316
https://github.com/dagger/dagger/pull/327
551f281bf7bc404a02b01600655cfdc42097880e
493406afe75277a50478cb4a69cf349674bc1858
2021-04-12T21:47:18Z
go
2021-04-15T18:37:45Z
cmd/dagger/cmd/down.go
package cmd import ( "github.com/spf13/cobra" "github.com/spf13/viper" ) var downCmd = &cobra.Command{ Use: "down", Short: "Take a deployment offline (WARNING: may destroy infrastructure)", Args: cobra.NoArgs, PreRun: func(cmd *cobra.Command, args []string) { if err := viper.BindPFlags(cmd.Flags()); err != nil { panic(err) } }, Run: func(cmd *cobra.Command, args []string) { panic("not implemented") }, } func init() { downCmd.Flags().Bool("--no-cache", false, "Disable all run cache") if err := viper.BindPFlags(downCmd.Flags()); err != nil { panic(err) } }
closed
dagger/dagger
https://github.com/dagger/dagger
316
Support command "up --no-cache" to temporarily disable the cache
It's important to be able to to disable the cache on-demand, one-time. `dagger up --no-cache`
https://github.com/dagger/dagger/issues/316
https://github.com/dagger/dagger/pull/327
551f281bf7bc404a02b01600655cfdc42097880e
493406afe75277a50478cb4a69cf349674bc1858
2021-04-12T21:47:18Z
go
2021-04-15T18:37:45Z
cmd/dagger/cmd/new.go
package cmd import ( "context" "net/url" "os" "path/filepath" "dagger.io/go/cmd/dagger/cmd/common" "dagger.io/go/cmd/dagger/logger" "dagger.io/go/dagger" "github.com/rs/zerolog/log" "github.com/spf13/cobra" "github.com/spf13/viper" ) var newCmd = &cobra.Command{ Use: "new", Short: "Create a new deployment",
closed
dagger/dagger
https://github.com/dagger/dagger
316
Support command "up --no-cache" to temporarily disable the cache
It's important to be able to to disable the cache on-demand, one-time. `dagger up --no-cache`
https://github.com/dagger/dagger/issues/316
https://github.com/dagger/dagger/pull/327
551f281bf7bc404a02b01600655cfdc42097880e
493406afe75277a50478cb4a69cf349674bc1858
2021-04-12T21:47:18Z
go
2021-04-15T18:37:45Z
cmd/dagger/cmd/new.go
Args: cobra.MaximumNArgs(1), PreRun: func(cmd *cobra.Command, args []string) { if err := viper.BindPFlags(cmd.Flags()); err != nil { panic(err) } }, Run: func(cmd *cobra.Command, args []string) { lg := logger.New() ctx := lg.WithContext(cmd.Context()) store, err := dagger.DefaultStore() if err != nil { lg.Fatal().Err(err).Msg("failed to load store") } if viper.GetString("deployment") != "" { lg. Fatal(). Msg("cannot use option -d,--deployment for this command") } name := "" if len(args) > 0 { name = args[0] } else { name = getNewDeploymentName(ctx) } st := &dagger.DeploymentState{ Name: name, PlanSource: getPlanSource(ctx), }
closed
dagger/dagger
https://github.com/dagger/dagger
316
Support command "up --no-cache" to temporarily disable the cache
It's important to be able to to disable the cache on-demand, one-time. `dagger up --no-cache`
https://github.com/dagger/dagger/issues/316
https://github.com/dagger/dagger/pull/327
551f281bf7bc404a02b01600655cfdc42097880e
493406afe75277a50478cb4a69cf349674bc1858
2021-04-12T21:47:18Z
go
2021-04-15T18:37:45Z
cmd/dagger/cmd/new.go
err = store.CreateDeployment(ctx, st) if err != nil { lg.Fatal().Err(err).Msg("failed to create deployment") } lg. Info(). Str("deploymentId", st.ID). Str("deploymentName", st.Name). Msg("deployment created") if viper.GetBool("up") { common.DeploymentUp(ctx, st) } }, } func getNewDeploymentName(ctx context.Context) string { lg := log.Ctx(ctx) workDir, err := os.Getwd() if err != nil { lg. Fatal(). Err(err). Msg("failed to get current working dir") } currentDir := filepath.Base(workDir) if currentDir == "/" { return "root" } return currentDir } func getPlanSource(ctx context.Context) dagger.Input {
closed
dagger/dagger
https://github.com/dagger/dagger
316
Support command "up --no-cache" to temporarily disable the cache
It's important to be able to to disable the cache on-demand, one-time. `dagger up --no-cache`
https://github.com/dagger/dagger/issues/316
https://github.com/dagger/dagger/pull/327
551f281bf7bc404a02b01600655cfdc42097880e
493406afe75277a50478cb4a69cf349674bc1858
2021-04-12T21:47:18Z
go
2021-04-15T18:37:45Z
cmd/dagger/cmd/new.go
lg := log.Ctx(ctx) src := dagger.Input{} checkFirstSet := func() { if src.Type != dagger.InputTypeEmpty { lg.Fatal().Msg("only one of those options can be set: --plan-dir, --plan-git, --plan-package, --plan-file") } } planDir := viper.GetString("plan-dir") planGit := viper.GetString("plan-git") if planDir != "" { checkFirstSet() src = dagger.DirInput(planDir, []string{"*.cue", "cue.mod"}) } if planGit != "" { checkFirstSet() u, err := url.Parse(planGit)
closed
dagger/dagger
https://github.com/dagger/dagger
316
Support command "up --no-cache" to temporarily disable the cache
It's important to be able to to disable the cache on-demand, one-time. `dagger up --no-cache`
https://github.com/dagger/dagger/issues/316
https://github.com/dagger/dagger/pull/327
551f281bf7bc404a02b01600655cfdc42097880e
493406afe75277a50478cb4a69cf349674bc1858
2021-04-12T21:47:18Z
go
2021-04-15T18:37:45Z
cmd/dagger/cmd/new.go
if err != nil { lg.Fatal().Err(err).Str("url", planGit).Msg("cannot get current working directory") } ref := u.Fragment u.Fragment = "" remote := u.String() src = dagger.GitInput(remote, ref, "") } if src.Type == dagger.InputTypeEmpty { var err error wd, err := os.Getwd() if err != nil { lg.Fatal().Err(err).Msg("cannot get current working directory") } return dagger.DirInput(wd, []string{"*.cue", "cue.mod"}) } return src } func init() { newCmd.Flags().BoolP("up", "u", false, "Bring the deployment online") newCmd.Flags().String("plan-dir", "", "Load plan from a local directory") newCmd.Flags().String("plan-git", "", "Load plan from a git repository") newCmd.Flags().String("plan-package", "", "Load plan from a cue package") newCmd.Flags().String("plan-file", "", "Load plan from a cue or json file") newCmd.Flags().String("setup", "auto", "Specify whether to prompt user for initial setup (no|yes|auto)") if err := viper.BindPFlags(newCmd.Flags()); err != nil { panic(err) } }
closed
dagger/dagger
https://github.com/dagger/dagger
316
Support command "up --no-cache" to temporarily disable the cache
It's important to be able to to disable the cache on-demand, one-time. `dagger up --no-cache`
https://github.com/dagger/dagger/issues/316
https://github.com/dagger/dagger/pull/327
551f281bf7bc404a02b01600655cfdc42097880e
493406afe75277a50478cb4a69cf349674bc1858
2021-04-12T21:47:18Z
go
2021-04-15T18:37:45Z
cmd/dagger/cmd/query.go
package cmd import ( "fmt" "cuelang.org/go/cue" "dagger.io/go/cmd/dagger/cmd/common" "dagger.io/go/cmd/dagger/logger" "dagger.io/go/dagger"
closed
dagger/dagger
https://github.com/dagger/dagger
316
Support command "up --no-cache" to temporarily disable the cache
It's important to be able to to disable the cache on-demand, one-time. `dagger up --no-cache`
https://github.com/dagger/dagger/issues/316
https://github.com/dagger/dagger/pull/327
551f281bf7bc404a02b01600655cfdc42097880e
493406afe75277a50478cb4a69cf349674bc1858
2021-04-12T21:47:18Z
go
2021-04-15T18:37:45Z
cmd/dagger/cmd/query.go
"dagger.io/go/dagger/compiler" "github.com/spf13/cobra" "github.com/spf13/viper" ) var queryCmd = &cobra.Command{ Use: "query [TARGET] [flags]", Short: "Query the contents of a deployment", Args: cobra.MaximumNArgs(1), PreRun: func(cmd *cobra.Command, args []string) { if err := viper.BindPFlags(cmd.Flags()); err != nil { panic(err) } }, Run: func(cmd *cobra.Command, args []string) { lg := logger.New() ctx := lg.WithContext(cmd.Context()) cueOpts := parseQueryFlags() store, err := dagger.DefaultStore() if err != nil { lg.Fatal().Err(err).Msg("failed to load store") } state := common.GetCurrentDeploymentState(ctx, store) lg = lg.With(). Str("deploymentName", state.Name). Str("deploymentId", state.ID). Logger() cuePath := cue.MakePath() if len(args) > 0 {
closed
dagger/dagger
https://github.com/dagger/dagger
316
Support command "up --no-cache" to temporarily disable the cache
It's important to be able to to disable the cache on-demand, one-time. `dagger up --no-cache`
https://github.com/dagger/dagger/issues/316
https://github.com/dagger/dagger/pull/327
551f281bf7bc404a02b01600655cfdc42097880e
493406afe75277a50478cb4a69cf349674bc1858
2021-04-12T21:47:18Z
go
2021-04-15T18:37:45Z
cmd/dagger/cmd/query.go
cuePath = cue.ParsePath(args[0]) } c, err := dagger.NewClient(ctx, "") if err != nil { lg.Fatal().Err(err).Msg("unable to create client") } deployment, err := c.Do(ctx, state, nil) if err != nil { lg.Fatal().Err(err).Msg("failed to query deployment") } cueVal := compiler.NewValue() if !viper.GetBool("no-plan") { if err := cueVal.FillPath(cue.MakePath(), deployment.Plan()); err != nil { lg.Fatal().Err(err).Msg("failed to merge plan") } } if !viper.GetBool("no-input") { if err := cueVal.FillPath(cue.MakePath(), deployment.Input()); err != nil { lg.Fatal().Err(err).Msg("failed to merge plan with output") } } if !viper.GetBool("no-computed") && state.Computed != "" { computed, err := compiler.DecodeJSON("", []byte(state.Computed)) if err != nil { lg.Fatal().Err(err).Msg("failed to decode json") } if err := cueVal.FillPath(cue.MakePath(), computed); err != nil { lg.Fatal().Err(err).Msg("failed to merge plan with computed") } }
closed
dagger/dagger
https://github.com/dagger/dagger
316
Support command "up --no-cache" to temporarily disable the cache
It's important to be able to to disable the cache on-demand, one-time. `dagger up --no-cache`
https://github.com/dagger/dagger/issues/316
https://github.com/dagger/dagger/pull/327
551f281bf7bc404a02b01600655cfdc42097880e
493406afe75277a50478cb4a69cf349674bc1858
2021-04-12T21:47:18Z
go
2021-04-15T18:37:45Z
cmd/dagger/cmd/query.go
cueVal = cueVal.LookupPath(cuePath) if viper.GetBool("concrete") { if err := cueVal.IsConcreteR(); err != nil { lg.Fatal().Err(compiler.Err(err)).Msg("not concrete") } } format := viper.GetString("format") switch format { case "cue": out, err := cueVal.Source(cueOpts...) if err != nil { lg.Fatal().Err(err).Msg("failed to lookup source") } fmt.Println(string(out)) case "json": fmt.Println(cueVal.JSON().PrettyString()) case "yaml": lg.Fatal().Err(err).Msg("yaml format not yet implemented") case "text": out, err := cueVal.String() if err != nil { lg.Fatal().Err(err).Msg("value can't be formatted as text") } fmt.Println(out) default: lg.Fatal().Msgf("unsupported format: %q", format) } }, } func parseQueryFlags() []cue.Option {
closed
dagger/dagger
https://github.com/dagger/dagger
316
Support command "up --no-cache" to temporarily disable the cache
It's important to be able to to disable the cache on-demand, one-time. `dagger up --no-cache`
https://github.com/dagger/dagger/issues/316
https://github.com/dagger/dagger/pull/327
551f281bf7bc404a02b01600655cfdc42097880e
493406afe75277a50478cb4a69cf349674bc1858
2021-04-12T21:47:18Z
go
2021-04-15T18:37:45Z
cmd/dagger/cmd/query.go
opts := []cue.Option{ cue.Definitions(true), } if viper.GetBool("concrete") { opts = append(opts, cue.Concrete(true)) } if viper.GetBool("show-optional") { opts = append(opts, cue.Optional(true)) } if viper.GetBool("show-attributes") { opts = append(opts, cue.Attributes(true)) } return opts } func init() { queryCmd.Flags().BoolP("concrete", "c", false, "Require the evaluation to be concrete") queryCmd.Flags().BoolP("show-optional", "O", false, "Display optional fields (cue format only)") queryCmd.Flags().BoolP("show-attributes", "A", false, "Display field attributes (cue format only)") queryCmd.Flags().StringP("format", "f", "json", "Output format (json|yaml|cue|text|env)") queryCmd.Flags().BoolP("no-plan", "P", false, "Exclude plan from query") queryCmd.Flags().BoolP("no-input", "I", false, "Exclude inputs from query") queryCmd.Flags().BoolP("no-computed", "C", false, "Exclude computed values from query") if err := viper.BindPFlags(queryCmd.Flags()); err != nil { panic(err) } }
closed
dagger/dagger
https://github.com/dagger/dagger
316
Support command "up --no-cache" to temporarily disable the cache
It's important to be able to to disable the cache on-demand, one-time. `dagger up --no-cache`
https://github.com/dagger/dagger/issues/316
https://github.com/dagger/dagger/pull/327
551f281bf7bc404a02b01600655cfdc42097880e
493406afe75277a50478cb4a69cf349674bc1858
2021-04-12T21:47:18Z
go
2021-04-15T18:37:45Z
cmd/dagger/cmd/up.go
package cmd import ( "dagger.io/go/cmd/dagger/cmd/common" "dagger.io/go/cmd/dagger/logger" "dagger.io/go/dagger" "github.com/spf13/cobra" "github.com/spf13/viper" ) var upCmd = &cobra.Command{ Use: "up", Short: "Bring a deployment online with latest plan and inputs", Args: cobra.NoArgs,
closed
dagger/dagger
https://github.com/dagger/dagger
316
Support command "up --no-cache" to temporarily disable the cache
It's important to be able to to disable the cache on-demand, one-time. `dagger up --no-cache`
https://github.com/dagger/dagger/issues/316
https://github.com/dagger/dagger/pull/327
551f281bf7bc404a02b01600655cfdc42097880e
493406afe75277a50478cb4a69cf349674bc1858
2021-04-12T21:47:18Z
go
2021-04-15T18:37:45Z
cmd/dagger/cmd/up.go
PreRun: func(cmd *cobra.Command, args []string) { if err := viper.BindPFlags(cmd.Flags()); err != nil { panic(err) } }, Run: func(cmd *cobra.Command, args []string) { lg := logger.New() ctx := lg.WithContext(cmd.Context()) store, err := dagger.DefaultStore() if err != nil { lg.Fatal().Err(err).Msg("failed to load store") } state := common.GetCurrentDeploymentState(ctx, store) result := common.DeploymentUp(ctx, state) state.Computed = result.Computed().JSON().String() if err := store.UpdateDeployment(ctx, state, nil); err != nil { lg.Fatal().Err(err).Msg("failed to update deployment") } }, } func init() { newCmd.Flags().Bool("--no-cache", false, "Disable all run cache") if err := viper.BindPFlags(upCmd.Flags()); err != nil { panic(err) } }
closed
dagger/dagger
https://github.com/dagger/dagger
316
Support command "up --no-cache" to temporarily disable the cache
It's important to be able to to disable the cache on-demand, one-time. `dagger up --no-cache`
https://github.com/dagger/dagger/issues/316
https://github.com/dagger/dagger/pull/327
551f281bf7bc404a02b01600655cfdc42097880e
493406afe75277a50478cb4a69cf349674bc1858
2021-04-12T21:47:18Z
go
2021-04-15T18:37:45Z
dagger/client.go
package dagger import ( "context" "fmt" "os" "path/filepath" "strings" "golang.org/x/sync/errgroup" "github.com/opentracing/opentracing-go" "github.com/rs/zerolog/log" bk "github.com/moby/buildkit/client" _ "github.com/moby/buildkit/client/connhelper/dockercontainer" "github.com/moby/buildkit/client/llb" bkgw "github.com/moby/buildkit/frontend/gateway/client" "dagger.io/go/pkg/buildkitd" "dagger.io/go/pkg/progressui" "dagger.io/go/dagger/compiler" ) type Client struct {
closed
dagger/dagger
https://github.com/dagger/dagger
316
Support command "up --no-cache" to temporarily disable the cache
It's important to be able to to disable the cache on-demand, one-time. `dagger up --no-cache`
https://github.com/dagger/dagger/issues/316
https://github.com/dagger/dagger/pull/327
551f281bf7bc404a02b01600655cfdc42097880e
493406afe75277a50478cb4a69cf349674bc1858
2021-04-12T21:47:18Z
go
2021-04-15T18:37:45Z
dagger/client.go
c *bk.Client } func NewClient(ctx context.Context, host string) (*Client, error) { if host == "" { host = os.Getenv("BUILDKIT_HOST") } if host == "" { h, err := buildkitd.Start(ctx) if err != nil { return nil, err } host = h } opts := []bk.ClientOpt{} if span := opentracing.SpanFromContext(ctx); span != nil { opts = append(opts, bk.WithTracer(span.Tracer())) } c, err := bk.New(ctx, host, opts...) if err != nil { return nil, fmt.Errorf("buildkit client: %w", err) } return &Client{
closed
dagger/dagger
https://github.com/dagger/dagger
316
Support command "up --no-cache" to temporarily disable the cache
It's important to be able to to disable the cache on-demand, one-time. `dagger up --no-cache`
https://github.com/dagger/dagger/issues/316
https://github.com/dagger/dagger/pull/327
551f281bf7bc404a02b01600655cfdc42097880e
493406afe75277a50478cb4a69cf349674bc1858
2021-04-12T21:47:18Z
go
2021-04-15T18:37:45Z
dagger/client.go
c: c, }, nil } type ClientDoFunc func(context.Context, *Deployment, Solver) error func (c *Client) Do(ctx context.Context, state *DeploymentState, fn ClientDoFunc) (*Deployment, error) { lg := log.Ctx(ctx) eg, gctx := errgroup.WithContext(ctx) deployment, err := NewDeployment(state) if err != nil { return nil, err } events := make(chan *bk.SolveStatus) eg.Go(func() error { dispCtx := lg.WithContext(context.Background()) return c.logSolveStatus(dispCtx, events) }) eg.Go(func() error { return c.buildfn(gctx, deployment, fn, events) }) return deployment, eg.Wait() } func (c *Client) buildfn(ctx context.Context, deployment *Deployment, fn ClientDoFunc, ch chan *bk.SolveStatus) error { lg := log.Ctx(ctx) localdirs := deployment.LocalDirs() for label, dir := range localdirs {
closed
dagger/dagger
https://github.com/dagger/dagger
316
Support command "up --no-cache" to temporarily disable the cache
It's important to be able to to disable the cache on-demand, one-time. `dagger up --no-cache`
https://github.com/dagger/dagger/issues/316
https://github.com/dagger/dagger/pull/327
551f281bf7bc404a02b01600655cfdc42097880e
493406afe75277a50478cb4a69cf349674bc1858
2021-04-12T21:47:18Z
go
2021-04-15T18:37:45Z
dagger/client.go
abs, err := filepath.Abs(dir) if err != nil { return err } localdirs[label] = abs } opts := bk.SolveOpt{ LocalDirs: localdirs, } lg.Debug(). Interface("localdirs", opts.LocalDirs). Interface("attrs", opts.FrontendAttrs). Msg("spawning buildkit job") resp, err := c.c.Build(ctx, opts, "", func(ctx context.Context, gw bkgw.Client) (*bkgw.Result, error) { s := NewSolver(c.c, gw, ch) lg.Debug().Msg("loading configuration") if err := deployment.LoadPlan(ctx, s); err != nil { return nil, err } if fn != nil { if err := fn(ctx, deployment, s); err != nil { return nil, compiler.Err(err) } } lg.Debug().Msg("exporting deployment")
closed
dagger/dagger
https://github.com/dagger/dagger
316
Support command "up --no-cache" to temporarily disable the cache
It's important to be able to to disable the cache on-demand, one-time. `dagger up --no-cache`
https://github.com/dagger/dagger/issues/316
https://github.com/dagger/dagger/pull/327
551f281bf7bc404a02b01600655cfdc42097880e
493406afe75277a50478cb4a69cf349674bc1858
2021-04-12T21:47:18Z
go
2021-04-15T18:37:45Z
dagger/client.go
span, _ := opentracing.StartSpanFromContext(ctx, "Deployment.Export") defer span.Finish() computed := deployment.Computed().JSON().PrettyString() st := llb. Scratch(). File( llb.Mkfile("computed.json", 0600, []byte(computed)), llb.WithCustomName("[internal] serializing computed values"), ) ref, err := s.Solve(ctx, st) if err != nil { return nil, err } res := bkgw.NewResult() res.SetRef(ref) return res, nil }, ch) if err != nil { return fmt.Errorf("buildkit solve: %w", bkCleanError(err)) } for k, v := range resp.ExporterResponse { lg. Debug(). Str("key", k). Str("value", v). Msg("exporter response") } return nil }
closed
dagger/dagger
https://github.com/dagger/dagger
316
Support command "up --no-cache" to temporarily disable the cache
It's important to be able to to disable the cache on-demand, one-time. `dagger up --no-cache`
https://github.com/dagger/dagger/issues/316
https://github.com/dagger/dagger/pull/327
551f281bf7bc404a02b01600655cfdc42097880e
493406afe75277a50478cb4a69cf349674bc1858
2021-04-12T21:47:18Z
go
2021-04-15T18:37:45Z
dagger/client.go
func (c *Client) logSolveStatus(ctx context.Context, ch chan *bk.SolveStatus) error { parseName := func(v *bk.Vertex) (string, string) { if len(v.Name) < 2 || !strings.HasPrefix(v.Name, "@") { return "", v.Name } prefixEndPos := strings.Index(v.Name[1:], "@") if prefixEndPos == -1 { return "", v.Name } component := v.Name[1 : prefixEndPos+1] return component, v.Name[prefixEndPos+3 : len(v.Name)] } return progressui.PrintSolveStatus(ctx, ch, func(v *bk.Vertex, index int) { component, name := parseName(v) lg := log. Ctx(ctx). With(). Str("component", component). Logger() lg. Debug(). Msg(fmt.Sprintf("#%d %s\n", index, name)) lg. Debug(). Msg(fmt.Sprintf("#%d %s\n", index, v.Digest)) }, func(v *bk.Vertex, format string, a ...interface{}) { component, _ := parseName(v)
closed
dagger/dagger
https://github.com/dagger/dagger
316
Support command "up --no-cache" to temporarily disable the cache
It's important to be able to to disable the cache on-demand, one-time. `dagger up --no-cache`
https://github.com/dagger/dagger/issues/316
https://github.com/dagger/dagger/pull/327
551f281bf7bc404a02b01600655cfdc42097880e
493406afe75277a50478cb4a69cf349674bc1858
2021-04-12T21:47:18Z
go
2021-04-15T18:37:45Z
dagger/client.go
lg := log. Ctx(ctx). With(). Str("component", component). Logger() lg. Debug(). Msg(fmt.Sprintf(format, a...)) }, func(v *bk.Vertex, stream int, partial bool, format string, a ...interface{}) { component, _ := parseName(v) lg := log. Ctx(ctx). With(). Str("component", component). Logger() switch stream { case 1: lg. Info(). Msg(fmt.Sprintf(format, a...)) case 2: lg. Error(). Msg(fmt.Sprintf(format, a...)) } }, ) }
closed
dagger/dagger
https://github.com/dagger/dagger
316
Support command "up --no-cache" to temporarily disable the cache
It's important to be able to to disable the cache on-demand, one-time. `dagger up --no-cache`
https://github.com/dagger/dagger/issues/316
https://github.com/dagger/dagger/pull/327
551f281bf7bc404a02b01600655cfdc42097880e
493406afe75277a50478cb4a69cf349674bc1858
2021-04-12T21:47:18Z
go
2021-04-15T18:37:45Z
dagger/pipeline.go
package dagger import ( "bytes" "context" "encoding/json" "errors" "fmt" "io/fs" "path" "strings" "cuelang.org/go/cue" "github.com/docker/distribution/reference" bk "github.com/moby/buildkit/client" "github.com/moby/buildkit/client/llb" "github.com/moby/buildkit/exporter/containerimage/exptypes" dockerfilebuilder "github.com/moby/buildkit/frontend/dockerfile/builder" "github.com/moby/buildkit/frontend/dockerfile/dockerfile2llb" "github.com/moby/buildkit/frontend/dockerfile/dockerignore" bkgw "github.com/moby/buildkit/frontend/gateway/client" bkpb "github.com/moby/buildkit/solver/pb" "github.com/rs/zerolog/log" "gopkg.in/yaml.v3" "dagger.io/go/dagger/compiler" ) const ( daggerignoreFilename = ".daggerignore" ) type Pipeline struct {
closed
dagger/dagger
https://github.com/dagger/dagger
316
Support command "up --no-cache" to temporarily disable the cache
It's important to be able to to disable the cache on-demand, one-time. `dagger up --no-cache`
https://github.com/dagger/dagger/issues/316
https://github.com/dagger/dagger/pull/327
551f281bf7bc404a02b01600655cfdc42097880e
493406afe75277a50478cb4a69cf349674bc1858
2021-04-12T21:47:18Z
go
2021-04-15T18:37:45Z
dagger/pipeline.go
name string s Solver state llb.State result bkgw.Reference image dockerfile2llb.Image computed *compiler.Value } func NewPipeline(name string, s Solver) *Pipeline {
closed
dagger/dagger
https://github.com/dagger/dagger
316
Support command "up --no-cache" to temporarily disable the cache
It's important to be able to to disable the cache on-demand, one-time. `dagger up --no-cache`
https://github.com/dagger/dagger/issues/316
https://github.com/dagger/dagger/pull/327
551f281bf7bc404a02b01600655cfdc42097880e
493406afe75277a50478cb4a69cf349674bc1858
2021-04-12T21:47:18Z
go
2021-04-15T18:37:45Z
dagger/pipeline.go
return &Pipeline{ name: name, s: s, state: llb.Scratch(), computed: compiler.NewValue(), } } func (p *Pipeline) State() llb.State { return p.state } func (p *Pipeline) Result() (llb.State, error) { if p.result == nil { return llb.Scratch(), nil } return p.result.ToState() } func (p *Pipeline) FS() fs.FS { return NewBuildkitFS(p.result) } func (p *Pipeline) ImageConfig() dockerfile2llb.Image { return p.image } func (p *Pipeline) Computed() *compiler.Value { return p.computed } func isComponent(v *compiler.Value) bool { return v.Lookup("#up").Exists() } func ops(code ...*compiler.Value) ([]*compiler.Value, error) {
closed
dagger/dagger
https://github.com/dagger/dagger
316
Support command "up --no-cache" to temporarily disable the cache
It's important to be able to to disable the cache on-demand, one-time. `dagger up --no-cache`
https://github.com/dagger/dagger/issues/316
https://github.com/dagger/dagger/pull/327
551f281bf7bc404a02b01600655cfdc42097880e
493406afe75277a50478cb4a69cf349674bc1858
2021-04-12T21:47:18Z
go
2021-04-15T18:37:45Z
dagger/pipeline.go
ops := []*compiler.Value{} for _, x := range code { if isComponent(x) { xops, err := x.Lookup("#up").List() if err != nil { return nil, err } ops = append(ops, xops...) } else if _, err := x.Lookup("do").String(); err == nil { ops = append(ops, x) } else if xops, err := x.List(); err == nil { ops = append(ops, xops...) } else { source, err := x.Source() if err != nil { panic(err) } return nil, fmt.Errorf("not executable: %s", source) } } return ops, nil } func Analyze(fn func(*compiler.Value) error, code ...*compiler.Value) error {
closed
dagger/dagger
https://github.com/dagger/dagger
316
Support command "up --no-cache" to temporarily disable the cache
It's important to be able to to disable the cache on-demand, one-time. `dagger up --no-cache`
https://github.com/dagger/dagger/issues/316
https://github.com/dagger/dagger/pull/327
551f281bf7bc404a02b01600655cfdc42097880e
493406afe75277a50478cb4a69cf349674bc1858
2021-04-12T21:47:18Z
go
2021-04-15T18:37:45Z
dagger/pipeline.go
ops, err := ops(code...) if err != nil { return err } for _, op := range ops { if err := analyzeOp(fn, op); err != nil { return err } } return nil } func analyzeOp(fn func(*compiler.Value) error, op *compiler.Value) error { if err := fn(op); err != nil { return err } do, err := op.Lookup("do").String() if err != nil { return err }
closed
dagger/dagger
https://github.com/dagger/dagger
316
Support command "up --no-cache" to temporarily disable the cache
It's important to be able to to disable the cache on-demand, one-time. `dagger up --no-cache`
https://github.com/dagger/dagger/issues/316
https://github.com/dagger/dagger/pull/327
551f281bf7bc404a02b01600655cfdc42097880e
493406afe75277a50478cb4a69cf349674bc1858
2021-04-12T21:47:18Z
go
2021-04-15T18:37:45Z
dagger/pipeline.go
switch do { case "load", "copy": return Analyze(fn, op.Lookup("from")) case "exec": fields, err := op.Lookup("mount").Fields() if err != nil { return err } for _, mnt := range fields { if from := mnt.Value.Lookup("from"); from.Exists() { return Analyze(fn, from) } } } return nil } func (p *Pipeline) Do(ctx context.Context, code ...*compiler.Value) error { ops, err := ops(code...) if err != nil { return err } for idx, op := range ops { if err := op.IsConcreteR(); err != nil { log. Ctx(ctx). Warn().
closed
dagger/dagger
https://github.com/dagger/dagger
316
Support command "up --no-cache" to temporarily disable the cache
It's important to be able to to disable the cache on-demand, one-time. `dagger up --no-cache`
https://github.com/dagger/dagger/issues/316
https://github.com/dagger/dagger/pull/327
551f281bf7bc404a02b01600655cfdc42097880e
493406afe75277a50478cb4a69cf349674bc1858
2021-04-12T21:47:18Z
go
2021-04-15T18:37:45Z
dagger/pipeline.go
Str("original_cue_error", err.Error()). Int("op", idx). Msg("pipeline was partially executed because of missing inputs") return nil } p.state, err = p.doOp(ctx, op, p.state) if err != nil { return err } p.result, err = p.s.Solve(ctx, p.state) if err != nil { return err } } return nil } func (p *Pipeline) doOp(ctx context.Context, op *compiler.Value, st llb.State) (llb.State, error) { do, err := op.Lookup("do").String() if err != nil { return st, err } switch do { case "copy": return p.Copy(ctx, op, st) case "exec": return p.Exec(ctx, op, st)
closed
dagger/dagger
https://github.com/dagger/dagger
316
Support command "up --no-cache" to temporarily disable the cache
It's important to be able to to disable the cache on-demand, one-time. `dagger up --no-cache`
https://github.com/dagger/dagger/issues/316
https://github.com/dagger/dagger/pull/327
551f281bf7bc404a02b01600655cfdc42097880e
493406afe75277a50478cb4a69cf349674bc1858
2021-04-12T21:47:18Z
go
2021-04-15T18:37:45Z
dagger/pipeline.go
case "export": return p.Export(ctx, op, st) case "fetch-container": return p.FetchContainer(ctx, op, st) case "push-container": return p.PushContainer(ctx, op, st) case "fetch-git": return p.FetchGit(ctx, op, st) case "local": return p.Local(ctx, op, st) case "load": return p.Load(ctx, op, st) case "subdir": return p.Subdir(ctx, op, st) case "docker-build": return p.DockerBuild(ctx, op, st) case "write-file": return p.WriteFile(ctx, op, st) case "mkdir": return p.Mkdir(ctx, op, st) default: return st, fmt.Errorf("invalid operation: %s", op.JSON()) } } func (p *Pipeline) vertexNamef(format string, a ...interface{}) string { prefix := fmt.Sprintf("@%s@", p.name) name := fmt.Sprintf(format, a...) return prefix + " " + name } func (p *Pipeline) Subdir(ctx context.Context, op *compiler.Value, st llb.State) (llb.State, error) {
closed
dagger/dagger
https://github.com/dagger/dagger
316
Support command "up --no-cache" to temporarily disable the cache
It's important to be able to to disable the cache on-demand, one-time. `dagger up --no-cache`
https://github.com/dagger/dagger/issues/316
https://github.com/dagger/dagger/pull/327
551f281bf7bc404a02b01600655cfdc42097880e
493406afe75277a50478cb4a69cf349674bc1858
2021-04-12T21:47:18Z
go
2021-04-15T18:37:45Z
dagger/pipeline.go
dir, err := op.Lookup("dir").String() if err != nil { return st, err } return st.File( llb.Copy( st, dir, "/", &llb.CopyInfo{ CopyDirContentsOnly: true, }, ), llb.WithCustomName(p.vertexNamef("Subdir %s", dir)), ), nil } func (p *Pipeline) Copy(ctx context.Context, op *compiler.Value, st llb.State) (llb.State, error) { src, err := op.Lookup("src").String() if err != nil { return st, err } dest, err := op.Lookup("dest").String() if err != nil { return st, err } from := NewPipeline(op.Lookup("from").Path().String(), p.s)
closed
dagger/dagger
https://github.com/dagger/dagger
316
Support command "up --no-cache" to temporarily disable the cache
It's important to be able to to disable the cache on-demand, one-time. `dagger up --no-cache`
https://github.com/dagger/dagger/issues/316
https://github.com/dagger/dagger/pull/327
551f281bf7bc404a02b01600655cfdc42097880e
493406afe75277a50478cb4a69cf349674bc1858
2021-04-12T21:47:18Z
go
2021-04-15T18:37:45Z
dagger/pipeline.go
if err := from.Do(ctx, op.Lookup("from")); err != nil { return st, err } return st.File( llb.Copy( from.State(), src, dest, &llb.CopyInfo{ CopyDirContentsOnly: true, CreateDestPath: true, AllowWildcard: true, }, ), llb.WithCustomName(p.vertexNamef("Copy %s %s", src, dest)), ), nil } func (p *Pipeline) Local(ctx context.Context, op *compiler.Value, st llb.State) (llb.State, error) { dir, err := op.Lookup("dir").String() if err != nil { return st, err } daggerignoreState := llb.Local( dir, llb.SessionID(p.s.SessionID()), llb.FollowPaths([]string{daggerignoreFilename}),
closed
dagger/dagger
https://github.com/dagger/dagger
316
Support command "up --no-cache" to temporarily disable the cache
It's important to be able to to disable the cache on-demand, one-time. `dagger up --no-cache`
https://github.com/dagger/dagger/issues/316
https://github.com/dagger/dagger/pull/327
551f281bf7bc404a02b01600655cfdc42097880e
493406afe75277a50478cb4a69cf349674bc1858
2021-04-12T21:47:18Z
go
2021-04-15T18:37:45Z
dagger/pipeline.go
llb.SharedKeyHint(dir+"-"+daggerignoreFilename), llb.WithCustomName(p.vertexNamef("Try loading %s", path.Join(dir, daggerignoreFilename))), ) ref, err := p.s.Solve(ctx, daggerignoreState) if err != nil { return st, err } var daggerignore []byte ignorefound := true daggerignore, err = ref.ReadFile(ctx, bkgw.ReadRequest{ Filename: daggerignoreFilename, }) if err != nil { if !strings.Contains(err.Error(), ".daggerignore: no such file or directory") { return st, err } ignorefound = false } var excludes []string excludes, err = dockerignore.ReadAll(bytes.NewBuffer(daggerignore)) if err != nil { return st, fmt.Errorf("%w failed to parse daggerignore", err) } if ignorefound { log.
closed
dagger/dagger
https://github.com/dagger/dagger
316
Support command "up --no-cache" to temporarily disable the cache
It's important to be able to to disable the cache on-demand, one-time. `dagger up --no-cache`
https://github.com/dagger/dagger/issues/316
https://github.com/dagger/dagger/pull/327
551f281bf7bc404a02b01600655cfdc42097880e
493406afe75277a50478cb4a69cf349674bc1858
2021-04-12T21:47:18Z
go
2021-04-15T18:37:45Z
dagger/pipeline.go
Ctx(ctx). Debug(). Str("patterns", fmt.Sprint(excludes)). Msg("daggerignore exclude patterns") } return st.File( llb.Copy( llb.Local( dir, llb.ExcludePatterns(excludes), llb.WithCustomName(p.vertexNamef("Local %s [transfer]", dir)), llb.SessionID(p.s.SessionID()), llb.SharedKeyHint(dir), ), "/", "/", ), llb.WithCustomName(p.vertexNamef("Local %s [copy]", dir)), ), nil } func (p *Pipeline) Exec(ctx context.Context, op *compiler.Value, st llb.State) (llb.State, error) { opts := []llb.RunOption{} var cmd struct {
closed
dagger/dagger
https://github.com/dagger/dagger
316
Support command "up --no-cache" to temporarily disable the cache
It's important to be able to to disable the cache on-demand, one-time. `dagger up --no-cache`
https://github.com/dagger/dagger/issues/316
https://github.com/dagger/dagger/pull/327
551f281bf7bc404a02b01600655cfdc42097880e
493406afe75277a50478cb4a69cf349674bc1858
2021-04-12T21:47:18Z
go
2021-04-15T18:37:45Z
dagger/pipeline.go
Args []string Dir string Always bool } if err := op.Decode(&cmd); err != nil { return st, err } opts = append(opts, llb.Args(cmd.Args)) opts = append(opts, llb.Dir(cmd.Dir)) if env := op.Lookup("env"); env.Exists() { envs, err := op.Lookup("env").Fields() if err != nil {
closed
dagger/dagger
https://github.com/dagger/dagger
316
Support command "up --no-cache" to temporarily disable the cache
It's important to be able to to disable the cache on-demand, one-time. `dagger up --no-cache`
https://github.com/dagger/dagger/issues/316
https://github.com/dagger/dagger/pull/327
551f281bf7bc404a02b01600655cfdc42097880e
493406afe75277a50478cb4a69cf349674bc1858
2021-04-12T21:47:18Z
go
2021-04-15T18:37:45Z
dagger/pipeline.go
return st, err } for _, env := range envs { v, err := env.Value.String() if err != nil { return st, err } opts = append(opts, llb.AddEnv(env.Label, v)) } } if cmd.Always { cacheBuster, err := randomID(8) if err != nil { return st, err } opts = append(opts, llb.AddEnv("DAGGER_CACHEBUSTER", cacheBuster)) } if mounts := op.Lookup("mount"); mounts.Exists() { mntOpts, err := p.mountAll(ctx, mounts) if err != nil { return st, err } opts = append(opts, mntOpts...) } args := make([]string, 0, len(cmd.Args))
closed
dagger/dagger
https://github.com/dagger/dagger
316
Support command "up --no-cache" to temporarily disable the cache
It's important to be able to to disable the cache on-demand, one-time. `dagger up --no-cache`
https://github.com/dagger/dagger/issues/316
https://github.com/dagger/dagger/pull/327
551f281bf7bc404a02b01600655cfdc42097880e
493406afe75277a50478cb4a69cf349674bc1858
2021-04-12T21:47:18Z
go
2021-04-15T18:37:45Z
dagger/pipeline.go
for _, a := range cmd.Args { args = append(args, fmt.Sprintf("%q", a)) } opts = append(opts, llb.WithCustomName(p.vertexNamef("Exec [%s]", strings.Join(args, ", ")))) return st.Run(opts...).Root(), nil } func (p *Pipeline) mountAll(ctx context.Context, mounts *compiler.Value) ([]llb.RunOption, error) { opts := []llb.RunOption{} fields, err := mounts.Fields() if err != nil { return nil, err } for _, mnt := range fields { o, err := p.mount(ctx, mnt.Label, mnt.Value) if err != nil { return nil, err } opts = append(opts, o) } return opts, err } func (p *Pipeline) mount(ctx context.Context, dest string, mnt *compiler.Value) (llb.RunOption, error) { if s, err := mnt.String(); err == nil { switch s { case "cache": return llb.AddMount( dest, llb.Scratch(),
closed
dagger/dagger
https://github.com/dagger/dagger
316
Support command "up --no-cache" to temporarily disable the cache
It's important to be able to to disable the cache on-demand, one-time. `dagger up --no-cache`
https://github.com/dagger/dagger/issues/316
https://github.com/dagger/dagger/pull/327
551f281bf7bc404a02b01600655cfdc42097880e
493406afe75277a50478cb4a69cf349674bc1858
2021-04-12T21:47:18Z
go
2021-04-15T18:37:45Z
dagger/pipeline.go
llb.AsPersistentCacheDir( mnt.Path().String(), llb.CacheMountShared, ), ), nil case "tmpfs": return llb.AddMount( dest, llb.Scratch(), llb.Tmpfs(), ), nil default: return nil, fmt.Errorf("invalid mount source: %q", s) } } from := NewPipeline(mnt.Lookup("from").Path().String(), p.s) if err := from.Do(ctx, mnt.Lookup("from")); err != nil { return nil, err } var mo []llb.MountOption if mp := mnt.Lookup("path"); mp.Exists() { mps, err := mp.String() if err != nil { return nil, err } mo = append(mo, llb.SourcePath(mps)) }
closed
dagger/dagger
https://github.com/dagger/dagger
316
Support command "up --no-cache" to temporarily disable the cache
It's important to be able to to disable the cache on-demand, one-time. `dagger up --no-cache`
https://github.com/dagger/dagger/issues/316
https://github.com/dagger/dagger/pull/327
551f281bf7bc404a02b01600655cfdc42097880e
493406afe75277a50478cb4a69cf349674bc1858
2021-04-12T21:47:18Z
go
2021-04-15T18:37:45Z
dagger/pipeline.go
return llb.AddMount(dest, from.State(), mo...), nil } func (p *Pipeline) Export(ctx context.Context, op *compiler.Value, st llb.State) (llb.State, error) { source, err := op.Lookup("source").String() if err != nil { return st, err } format, err := op.Lookup("format").String() if err != nil { return st, err } contents, err := fs.ReadFile(p.FS(), source) if err != nil { return st, fmt.Errorf("export %s: %w", source, err) } switch format { case "string": log. Ctx(ctx). Debug(). Bytes("contents", contents). Msg("exporting string") if err := p.computed.FillPath(cue.MakePath(), string(contents)); err != nil { return st, err } case "json": var o interface{} o, err := unmarshalAnything(contents, json.Unmarshal) if err != nil { return st, err
closed
dagger/dagger
https://github.com/dagger/dagger
316
Support command "up --no-cache" to temporarily disable the cache
It's important to be able to to disable the cache on-demand, one-time. `dagger up --no-cache`
https://github.com/dagger/dagger/issues/316
https://github.com/dagger/dagger/pull/327
551f281bf7bc404a02b01600655cfdc42097880e
493406afe75277a50478cb4a69cf349674bc1858
2021-04-12T21:47:18Z
go
2021-04-15T18:37:45Z
dagger/pipeline.go
} log. Ctx(ctx). Debug(). Interface("contents", o). Msg("exporting json") if err := p.computed.FillPath(cue.MakePath(), o); err != nil { return st, err } case "yaml": var o interface{} o, err := unmarshalAnything(contents, yaml.Unmarshal) if err != nil { return st, err } log. Ctx(ctx). Debug(). Interface("contents", o). Msg("exporting yaml") if err := p.computed.FillPath(cue.MakePath(), o); err != nil { return st, err } default: return st, fmt.Errorf("unsupported export format: %q", format) } return st, nil } type unmarshaller func([]byte, interface{}) error func unmarshalAnything(data []byte, fn unmarshaller) (interface{}, error) {
closed
dagger/dagger
https://github.com/dagger/dagger
316
Support command "up --no-cache" to temporarily disable the cache
It's important to be able to to disable the cache on-demand, one-time. `dagger up --no-cache`
https://github.com/dagger/dagger/issues/316
https://github.com/dagger/dagger/pull/327
551f281bf7bc404a02b01600655cfdc42097880e
493406afe75277a50478cb4a69cf349674bc1858
2021-04-12T21:47:18Z
go
2021-04-15T18:37:45Z
dagger/pipeline.go
var oMap map[string]interface{} if err := fn(data, &oMap); err == nil { return oMap, nil } var o interface{} err := fn(data, &o) return o, err } func (p *Pipeline) Load(ctx context.Context, op *compiler.Value, st llb.State) (llb.State, error) { from := NewPipeline(op.Lookup("from").Path().String(), p.s) if err := from.Do(ctx, op.Lookup("from")); err != nil {
closed
dagger/dagger
https://github.com/dagger/dagger
316
Support command "up --no-cache" to temporarily disable the cache
It's important to be able to to disable the cache on-demand, one-time. `dagger up --no-cache`
https://github.com/dagger/dagger/issues/316
https://github.com/dagger/dagger/pull/327
551f281bf7bc404a02b01600655cfdc42097880e
493406afe75277a50478cb4a69cf349674bc1858
2021-04-12T21:47:18Z
go
2021-04-15T18:37:45Z
dagger/pipeline.go
return st, err } p.image = from.ImageConfig() return from.State(), nil } func (p *Pipeline) FetchContainer(ctx context.Context, op *compiler.Value, st llb.State) (llb.State, error) { rawRef, err := op.Lookup("ref").String() if err != nil { return st, err } ref, err := reference.ParseNormalizedNamed(rawRef) if err != nil { return st, fmt.Errorf("failed to parse ref %s: %w", rawRef, err) } ref = reference.TagNameOnly(ref) st = llb.Image( ref.String(), llb.WithCustomName(p.vertexNamef("FetchContainer %s", rawRef)), ) p.image, err = p.s.ResolveImageConfig(ctx, ref.String(), llb.ResolveImageConfigOpt{ LogName: p.vertexNamef("load metadata for %s", ref.String()), }) if err != nil { return st, err } return applyImageToState(p.image, st), nil } func applyImageToState(image dockerfile2llb.Image, st llb.State) llb.State {
closed
dagger/dagger
https://github.com/dagger/dagger
316
Support command "up --no-cache" to temporarily disable the cache
It's important to be able to to disable the cache on-demand, one-time. `dagger up --no-cache`
https://github.com/dagger/dagger/issues/316
https://github.com/dagger/dagger/pull/327
551f281bf7bc404a02b01600655cfdc42097880e
493406afe75277a50478cb4a69cf349674bc1858
2021-04-12T21:47:18Z
go
2021-04-15T18:37:45Z
dagger/pipeline.go
for _, env := range image.Config.Env { k, v := parseKeyValue(env) st = st.AddEnv(k, v) } if image.Config.WorkingDir != "" { st = st.Dir(image.Config.WorkingDir) } if image.Config.User != "" { st = st.User(image.Config.User) } return st } func parseKeyValue(env string) (string, string) {
closed
dagger/dagger
https://github.com/dagger/dagger
316
Support command "up --no-cache" to temporarily disable the cache
It's important to be able to to disable the cache on-demand, one-time. `dagger up --no-cache`
https://github.com/dagger/dagger/issues/316
https://github.com/dagger/dagger/pull/327
551f281bf7bc404a02b01600655cfdc42097880e
493406afe75277a50478cb4a69cf349674bc1858
2021-04-12T21:47:18Z
go
2021-04-15T18:37:45Z
dagger/pipeline.go
parts := strings.SplitN(env, "=", 2) v := "" if len(parts) > 1 { v = parts[1] } return parts[0], v } func (p *Pipeline) PushContainer(ctx context.Context, op *compiler.Value, st llb.State) (llb.State, error) { rawRef, err := op.Lookup("ref").String() if err != nil { return st, err } ref, err := reference.ParseNormalizedNamed(rawRef) if err != nil { return st, fmt.Errorf("failed to parse ref %s: %w", rawRef, err) } ref = reference.TagNameOnly(ref) _, err = p.s.Export(ctx, p.State(), &p.image, bk.ExportEntry{ Type: bk.ExporterImage, Attrs: map[string]string{ "name": ref.String(), "push": "true",
closed
dagger/dagger
https://github.com/dagger/dagger
316
Support command "up --no-cache" to temporarily disable the cache
It's important to be able to to disable the cache on-demand, one-time. `dagger up --no-cache`
https://github.com/dagger/dagger/issues/316
https://github.com/dagger/dagger/pull/327
551f281bf7bc404a02b01600655cfdc42097880e
493406afe75277a50478cb4a69cf349674bc1858
2021-04-12T21:47:18Z
go
2021-04-15T18:37:45Z
dagger/pipeline.go
}, }) return st, err } func (p *Pipeline) FetchGit(ctx context.Context, op *compiler.Value, st llb.State) (llb.State, error) { remote, err := op.Lookup("remote").String() if err != nil { return st, err } ref, err := op.Lookup("ref").String() if err != nil { return st, err } return st.File( llb.Copy( llb.Git( remote, ref, llb.WithCustomName(p.vertexNamef("FetchGit %s@%s", remote, ref)), ), "/", "/", ), llb.WithCustomName(p.vertexNamef("FetchGit %s@%s [copy]", remote, ref)), ), nil }
closed
dagger/dagger
https://github.com/dagger/dagger
316
Support command "up --no-cache" to temporarily disable the cache
It's important to be able to to disable the cache on-demand, one-time. `dagger up --no-cache`
https://github.com/dagger/dagger/issues/316
https://github.com/dagger/dagger/pull/327
551f281bf7bc404a02b01600655cfdc42097880e
493406afe75277a50478cb4a69cf349674bc1858
2021-04-12T21:47:18Z
go
2021-04-15T18:37:45Z
dagger/pipeline.go
func (p *Pipeline) DockerBuild(ctx context.Context, op *compiler.Value, st llb.State) (llb.State, error) { var ( dockerContext = op.Lookup("context") dockerfile = op.Lookup("dockerfile") contextDef *bkpb.Definition dockerfileDef *bkpb.Definition err error ) if !dockerContext.Exists() && !dockerfile.Exists() { return st, errors.New("context or dockerfile required") } if dockerContext.Exists() { from := NewPipeline(op.Lookup("context").Path().String(), p.s) if err := from.Do(ctx, dockerContext); err != nil { return st, err } contextDef, err = p.s.Marshal(ctx, from.State()) if err != nil { return st, err } dockerfileDef = contextDef } if dockerfile.Exists() { content, err := dockerfile.String() if err != nil { return st, err }
closed
dagger/dagger
https://github.com/dagger/dagger
316
Support command "up --no-cache" to temporarily disable the cache
It's important to be able to to disable the cache on-demand, one-time. `dagger up --no-cache`
https://github.com/dagger/dagger/issues/316
https://github.com/dagger/dagger/pull/327
551f281bf7bc404a02b01600655cfdc42097880e
493406afe75277a50478cb4a69cf349674bc1858
2021-04-12T21:47:18Z
go
2021-04-15T18:37:45Z
dagger/pipeline.go
dockerfileDef, err = p.s.Marshal(ctx, llb.Scratch().File( llb.Mkfile("/Dockerfile", 0644, []byte(content)), ), ) if err != nil { return st, err } if contextDef == nil { contextDef = dockerfileDef } } opts, err := dockerBuildOpts(op) if err != nil { return st, err } req := bkgw.SolveRequest{ Frontend: "dockerfile.v0", FrontendOpt: opts, FrontendInputs: map[string]*bkpb.Definition{ dockerfilebuilder.DefaultLocalNameContext: contextDef, dockerfilebuilder.DefaultLocalNameDockerfile: dockerfileDef, }, } res, err := p.s.SolveRequest(ctx, req) if err != nil { return st, err } if meta, ok := res.Metadata[exptypes.ExporterImageConfigKey]; ok { if err := json.Unmarshal(meta, &p.image); err != nil {
closed
dagger/dagger
https://github.com/dagger/dagger
316
Support command "up --no-cache" to temporarily disable the cache
It's important to be able to to disable the cache on-demand, one-time. `dagger up --no-cache`
https://github.com/dagger/dagger/issues/316
https://github.com/dagger/dagger/pull/327
551f281bf7bc404a02b01600655cfdc42097880e
493406afe75277a50478cb4a69cf349674bc1858
2021-04-12T21:47:18Z
go
2021-04-15T18:37:45Z
dagger/pipeline.go
return st, fmt.Errorf("failed to unmarshal image config: %w", err) } } ref, err := res.SingleRef() if err != nil { return st, err } st, err = ref.ToState() if err != nil { return st, err } return applyImageToState(p.image, st), nil } func dockerBuildOpts(op *compiler.Value) (map[string]string, error) { opts := map[string]string{} if dockerfilePath := op.Lookup("dockerfilePath"); dockerfilePath.Exists() { filename, err := dockerfilePath.String() if err != nil { return nil, err } opts["filename"] = filename } if buildArgs := op.Lookup("buildArg"); buildArgs.Exists() { fields, err := buildArgs.Fields() if err != nil { return nil, err } for _, buildArg := range fields { v, err := buildArg.Value.String() if err != nil {
closed
dagger/dagger
https://github.com/dagger/dagger
316
Support command "up --no-cache" to temporarily disable the cache
It's important to be able to to disable the cache on-demand, one-time. `dagger up --no-cache`
https://github.com/dagger/dagger/issues/316
https://github.com/dagger/dagger/pull/327
551f281bf7bc404a02b01600655cfdc42097880e
493406afe75277a50478cb4a69cf349674bc1858
2021-04-12T21:47:18Z
go
2021-04-15T18:37:45Z
dagger/pipeline.go
return nil, err } opts["build-arg:"+buildArg.Label] = v } } if labels := op.Lookup("label"); labels.Exists() { fields, err := labels.Fields() if err != nil { return nil, err } for _, label := range fields { s, err := label.Value.String() if err != nil { return nil, err } opts["label:"+label.Label] = s } } if platforms := op.Lookup("platforms"); platforms.Exists() { p := []string{} list, err := platforms.List() if err != nil { return nil, err } for _, platform := range list { s, err := platform.String() if err != nil { return nil, err } p = append(p, s)
closed
dagger/dagger
https://github.com/dagger/dagger
316
Support command "up --no-cache" to temporarily disable the cache
It's important to be able to to disable the cache on-demand, one-time. `dagger up --no-cache`
https://github.com/dagger/dagger/issues/316
https://github.com/dagger/dagger/pull/327
551f281bf7bc404a02b01600655cfdc42097880e
493406afe75277a50478cb4a69cf349674bc1858
2021-04-12T21:47:18Z
go
2021-04-15T18:37:45Z
dagger/pipeline.go
} if len(p) > 0 { opts["platform"] = strings.Join(p, ",") } if len(p) > 1 { opts["multi-platform"] = "true" } } return opts, nil } func (p *Pipeline) WriteFile(ctx context.Context, op *compiler.Value, st llb.State) (llb.State, error) { var content []byte var err error switch kind := op.Lookup("content").Kind(); kind { case cue.BytesKind: content, err = op.Lookup("content").Bytes() case cue.StringKind: var str string str, err = op.Lookup("content").String() if err == nil { content = []byte(str) } default: err = fmt.Errorf("unhandled data type in WriteFile: %s", kind) } if err != nil { return st, err } dest, err := op.Lookup("dest").String() if err != nil {
closed
dagger/dagger
https://github.com/dagger/dagger
316
Support command "up --no-cache" to temporarily disable the cache
It's important to be able to to disable the cache on-demand, one-time. `dagger up --no-cache`
https://github.com/dagger/dagger/issues/316
https://github.com/dagger/dagger/pull/327
551f281bf7bc404a02b01600655cfdc42097880e
493406afe75277a50478cb4a69cf349674bc1858
2021-04-12T21:47:18Z
go
2021-04-15T18:37:45Z
dagger/pipeline.go
return st, err } mode, err := op.Lookup("mode").Int64() if err != nil { return st, err } return st.File( llb.Mkfile(dest, fs.FileMode(mode), content), llb.WithCustomName(p.vertexNamef("WriteFile %s", dest)), ), nil } func (p *Pipeline) Mkdir(ctx context.Context, op *compiler.Value, st llb.State) (llb.State, error) { pathString, err := op.Lookup("path").String() if err != nil { return st, err } dir, err := op.Lookup("dir").String() if err != nil { return st, err } mode, err := op.Lookup("mode").Int64() if err != nil { return st, err } return st.Dir(dir).File( llb.Mkdir(pathString, fs.FileMode(mode)), llb.WithCustomName(p.vertexNamef("Mkdir %s", pathString)), ), nil }
closed
dagger/dagger
https://github.com/dagger/dagger
316
Support command "up --no-cache" to temporarily disable the cache
It's important to be able to to disable the cache on-demand, one-time. `dagger up --no-cache`
https://github.com/dagger/dagger/issues/316
https://github.com/dagger/dagger/pull/327
551f281bf7bc404a02b01600655cfdc42097880e
493406afe75277a50478cb4a69cf349674bc1858
2021-04-12T21:47:18Z
go
2021-04-15T18:37:45Z
dagger/solver.go
package dagger import ( "context" "encoding/json" "errors" "fmt" "strings" bk "github.com/moby/buildkit/client" "github.com/moby/buildkit/client/llb" "github.com/moby/buildkit/exporter/containerimage/exptypes" "github.com/moby/buildkit/frontend/dockerfile/dockerfile2llb" bkgw "github.com/moby/buildkit/frontend/gateway/client" "github.com/moby/buildkit/session" "github.com/moby/buildkit/session/auth/authprovider" bkpb "github.com/moby/buildkit/solver/pb" "github.com/opencontainers/go-digest" "github.com/rs/zerolog/log" ) type Solver struct {
closed
dagger/dagger
https://github.com/dagger/dagger
316
Support command "up --no-cache" to temporarily disable the cache
It's important to be able to to disable the cache on-demand, one-time. `dagger up --no-cache`
https://github.com/dagger/dagger/issues/316
https://github.com/dagger/dagger/pull/327
551f281bf7bc404a02b01600655cfdc42097880e
493406afe75277a50478cb4a69cf349674bc1858
2021-04-12T21:47:18Z
go
2021-04-15T18:37:45Z
dagger/solver.go
events chan *bk.SolveStatus control *bk.Client gw bkgw.Client } func NewSolver(control *bk.Client, gw bkgw.Client, events chan *bk.SolveStatus) Solver { return Solver{ events: events, control: control, gw: gw, } } func (s Solver) Marshal(ctx context.Context, st llb.State) (*bkpb.Definition, error) { def, err := st.Marshal(ctx, llb.LinuxAmd64) if err != nil { return nil, err } return def.ToPB(), nil } func (s Solver) SessionID() string { return s.gw.BuildOpts().SessionID } func (s Solver) ResolveImageConfig(ctx context.Context, ref string, opts llb.ResolveImageConfigOpt) (dockerfile2llb.Image, error) { var image dockerfile2llb.Image
closed
dagger/dagger
https://github.com/dagger/dagger
316
Support command "up --no-cache" to temporarily disable the cache
It's important to be able to to disable the cache on-demand, one-time. `dagger up --no-cache`
https://github.com/dagger/dagger/issues/316
https://github.com/dagger/dagger/pull/327
551f281bf7bc404a02b01600655cfdc42097880e
493406afe75277a50478cb4a69cf349674bc1858
2021-04-12T21:47:18Z
go
2021-04-15T18:37:45Z
dagger/solver.go
_, meta, err := s.gw.ResolveImageConfig(ctx, ref, opts) if err != nil { return image, err } if err := json.Unmarshal(meta, &image); err != nil { return image, err } return image, nil } func (s Solver) SolveRequest(ctx context.Context, req bkgw.SolveRequest) (*bkgw.Result, error) { res, err := s.gw.Solve(ctx, req) if err != nil { return nil, bkCleanError(err) } return res, nil } func (s Solver) Solve(ctx context.Context, st llb.State) (bkgw.Reference, error) { def, err := s.Marshal(ctx, st) if err != nil { return nil, err } jsonLLB, err := dumpLLB(def) if err != nil { return nil, err } log.
closed
dagger/dagger
https://github.com/dagger/dagger
316
Support command "up --no-cache" to temporarily disable the cache
It's important to be able to to disable the cache on-demand, one-time. `dagger up --no-cache`
https://github.com/dagger/dagger/issues/316
https://github.com/dagger/dagger/pull/327
551f281bf7bc404a02b01600655cfdc42097880e
493406afe75277a50478cb4a69cf349674bc1858
2021-04-12T21:47:18Z
go
2021-04-15T18:37:45Z
dagger/solver.go
Ctx(ctx). Trace(). RawJSON("llb", jsonLLB). Msg("solving") res, err := s.SolveRequest(ctx, bkgw.SolveRequest{ Definition: def, Evaluate: true, }) if err != nil { return nil, err } return res.SingleRef() } func (s Solver) Export(ctx context.Context, st llb.State, img *dockerfile2llb.Image, output bk.ExportEntry) (*bk.SolveResponse, error) { def, err := s.Marshal(ctx, st) if err != nil { return nil, err } opts := bk.SolveOpt{ Exports: []bk.ExportEntry{output}, Session: []session.Attachable{ authprovider.NewDockerAuthProvider(log.Ctx(ctx)), }, } ch := make(chan *bk.SolveStatus)
closed
dagger/dagger
https://github.com/dagger/dagger
316
Support command "up --no-cache" to temporarily disable the cache
It's important to be able to to disable the cache on-demand, one-time. `dagger up --no-cache`
https://github.com/dagger/dagger/issues/316
https://github.com/dagger/dagger/pull/327
551f281bf7bc404a02b01600655cfdc42097880e
493406afe75277a50478cb4a69cf349674bc1858
2021-04-12T21:47:18Z
go
2021-04-15T18:37:45Z
dagger/solver.go
go func() { for event := range ch { s.events <- event } }() return s.control.Build(ctx, opts, "", func(ctx context.Context, c bkgw.Client) (*bkgw.Result, error) { res, err := c.Solve(ctx, bkgw.SolveRequest{ Definition: def, }) if err != nil { return nil, err } if img != nil { config, err := json.Marshal(img) if err != nil { return nil, fmt.Errorf("failed to marshal image config: %w", err) } res.AddMeta(exptypes.ExporterImageConfigKey, config) } return res, nil }, ch) } type llbOp struct { Op bkpb.Op Digest digest.Digest OpMetadata bkpb.OpMetadata } func dumpLLB(def *bkpb.Definition) ([]byte, error) {
closed
dagger/dagger
https://github.com/dagger/dagger
316
Support command "up --no-cache" to temporarily disable the cache
It's important to be able to to disable the cache on-demand, one-time. `dagger up --no-cache`
https://github.com/dagger/dagger/issues/316
https://github.com/dagger/dagger/pull/327
551f281bf7bc404a02b01600655cfdc42097880e
493406afe75277a50478cb4a69cf349674bc1858
2021-04-12T21:47:18Z
go
2021-04-15T18:37:45Z
dagger/solver.go
ops := make([]llbOp, 0, len(def.Def)) for _, dt := range def.Def { var op bkpb.Op if err := (&op).Unmarshal(dt); err != nil { return nil, fmt.Errorf("failed to parse op: %w", err) } dgst := digest.FromBytes(dt) ent := llbOp{Op: op, Digest: dgst, OpMetadata: def.Metadata[dgst]} ops = append(ops, ent) } return json.Marshal(ops) } func bkCleanError(err error) error { noise := []string{ "executor failed running ", "buildkit-runc did not terminate successfully", "rpc error: code = Unknown desc = ", "failed to solve: ", } msg := err.Error() for _, s := range noise { msg = strings.ReplaceAll(msg, s, "") } return errors.New(msg) }
closed
dagger/dagger
https://github.com/dagger/dagger
312
No way to know the current deployment based on local path
We need a way to know the current deployment when working from a local directory. For instance a small `*` or any visual indication when doing `dagger list`. Otherwise, there is no way to know a given directory is mapped to a deployment. It would also be nice to know which path is mapped to which deployment. Example: ``` $ dagger list myapp (~/work/myapp) test (/tmp/thisisatest) $ cd ~/work/myapp $ dagger list myapp (~/work/myapp) - current test (/tmp/thisisatest) ```
https://github.com/dagger/dagger/issues/312
https://github.com/dagger/dagger/pull/343
d000b2912b45f927c25a390c53a52823bce06362
d2d0734eaa926485d6f1e22271b765f9a7a6cc42
2021-04-11T02:21:35Z
go
2021-04-22T18:50:09Z
cmd/dagger/cmd/list.go
package cmd import ( "fmt" "dagger.io/go/cmd/dagger/logger" "dagger.io/go/dagger" "github.com/spf13/cobra" "github.com/spf13/viper" ) var listCmd = &cobra.Command{ Use: "list", Short: "List available deployments", Args: cobra.NoArgs, PreRun: func(cmd *cobra.Command, args []string) {
closed
dagger/dagger
https://github.com/dagger/dagger
312
No way to know the current deployment based on local path
We need a way to know the current deployment when working from a local directory. For instance a small `*` or any visual indication when doing `dagger list`. Otherwise, there is no way to know a given directory is mapped to a deployment. It would also be nice to know which path is mapped to which deployment. Example: ``` $ dagger list myapp (~/work/myapp) test (/tmp/thisisatest) $ cd ~/work/myapp $ dagger list myapp (~/work/myapp) - current test (/tmp/thisisatest) ```
https://github.com/dagger/dagger/issues/312
https://github.com/dagger/dagger/pull/343
d000b2912b45f927c25a390c53a52823bce06362
d2d0734eaa926485d6f1e22271b765f9a7a6cc42
2021-04-11T02:21:35Z
go
2021-04-22T18:50:09Z
cmd/dagger/cmd/list.go
if err := viper.BindPFlags(cmd.Flags()); err != nil { panic(err) } }, Run: func(cmd *cobra.Command, args []string) { lg := logger.New() ctx := lg.WithContext(cmd.Context()) store, err := dagger.DefaultStore() if err != nil { lg.Fatal().Err(err).Msg("failed to load store") } deployments, err := store.ListDeployments(ctx) if err != nil { lg. Fatal(). Err(err). Msg("cannot list deployments") } for _, r := range deployments { fmt.Println(r.Name) } }, } func init() { if err := viper.BindPFlags(listCmd.Flags()); err != nil { panic(err) } }
closed
dagger/dagger
https://github.com/dagger/dagger
2,014
🐞 website renders wrong on mac m1 safari
### What is the issue? https://twitter.com/alexellisuk/status/1510880710294396928 ### Log output _No response_ ### Steps to reproduce Visit https://dagger.io on safari on a mac m1. ### Dagger version should not be required ### OS version should not be required
https://github.com/dagger/dagger/issues/2014
https://github.com/dagger/dagger/pull/394
2804feb004399b7bd75f0a7e4fa6ddcc63e07837
9d421c6c4299f6ab6ea147322199e32e87b82a49
2022-04-04T07:41:39Z
go
2021-04-30T17:12:49Z
pkg/buildkitd/buildkitd.go
package buildkitd import ( "context" "errors" "fmt" "os/exec" "strings" "time" "github.com/docker/distribution/reference" bk "github.com/moby/buildkit/client" _ "github.com/moby/buildkit/client/connhelper/dockercontainer" "github.com/rs/zerolog/log" ) const ( image = "moby/buildkit" version = "v0.8.2" imageVersion = image + ":" + version containerName = "dagger-buildkitd" volumeName = "dagger-buildkitd" ) func Start(ctx context.Context) (string, error) {
closed
dagger/dagger
https://github.com/dagger/dagger
2,014
🐞 website renders wrong on mac m1 safari
### What is the issue? https://twitter.com/alexellisuk/status/1510880710294396928 ### Log output _No response_ ### Steps to reproduce Visit https://dagger.io on safari on a mac m1. ### Dagger version should not be required ### OS version should not be required
https://github.com/dagger/dagger/issues/2014
https://github.com/dagger/dagger/pull/394
2804feb004399b7bd75f0a7e4fa6ddcc63e07837
9d421c6c4299f6ab6ea147322199e32e87b82a49
2022-04-04T07:41:39Z
go
2021-04-30T17:12:49Z
pkg/buildkitd/buildkitd.go
lg := log.Ctx(ctx) currentVersion, err := getBuildkitVersion(ctx) if err != nil { if err := checkDocker(ctx); err != nil { return "", err } currentVersion = "" lg.Debug().Msg("no buildkit daemon detected") } else { lg.Debug().Str("version", currentVersion).Msg("detected buildkit version") } if currentVersion != version { if currentVersion != "" { lg. Info(). Str("version", version). Msg("upgrading buildkit")
closed
dagger/dagger
https://github.com/dagger/dagger
2,014
🐞 website renders wrong on mac m1 safari
### What is the issue? https://twitter.com/alexellisuk/status/1510880710294396928 ### Log output _No response_ ### Steps to reproduce Visit https://dagger.io on safari on a mac m1. ### Dagger version should not be required ### OS version should not be required
https://github.com/dagger/dagger/issues/2014
https://github.com/dagger/dagger/pull/394
2804feb004399b7bd75f0a7e4fa6ddcc63e07837
9d421c6c4299f6ab6ea147322199e32e87b82a49
2022-04-04T07:41:39Z
go
2021-04-30T17:12:49Z
pkg/buildkitd/buildkitd.go
if err := remvoveBuildkit(ctx); err != nil { return "", err } } else { lg. Info(). Str("version", version). Msg("starting buildkit") } if err := startBuildkit(ctx); err != nil { return "", err } } return fmt.Sprintf("docker-container://%s", containerName), nil } func checkDocker(ctx context.Context) error { cmd := exec.CommandContext(ctx, "docker", "info") output, err := cmd.CombinedOutput() if err != nil { log. Ctx(ctx). Error(). Err(err). Bytes("output", output). Msg("failed to run docker") return err } return nil } func startBuildkit(ctx context.Context) error {
closed
dagger/dagger
https://github.com/dagger/dagger
2,014
🐞 website renders wrong on mac m1 safari
### What is the issue? https://twitter.com/alexellisuk/status/1510880710294396928 ### Log output _No response_ ### Steps to reproduce Visit https://dagger.io on safari on a mac m1. ### Dagger version should not be required ### OS version should not be required
https://github.com/dagger/dagger/issues/2014
https://github.com/dagger/dagger/pull/394
2804feb004399b7bd75f0a7e4fa6ddcc63e07837
9d421c6c4299f6ab6ea147322199e32e87b82a49
2022-04-04T07:41:39Z
go
2021-04-30T17:12:49Z
pkg/buildkitd/buildkitd.go
lg := log. Ctx(ctx). With(). Str("version", version). Logger() lg.Debug().Msg("pulling buildkit image") cmd := exec.CommandContext(ctx, "docker", "pull", imageVersion, ) output, err := cmd.CombinedOutput() if err != nil { lg. Error(). Err(err). Bytes("output", output). Msg("failed to pull buildkit image") return err }
closed
dagger/dagger
https://github.com/dagger/dagger
2,014
🐞 website renders wrong on mac m1 safari
### What is the issue? https://twitter.com/alexellisuk/status/1510880710294396928 ### Log output _No response_ ### Steps to reproduce Visit https://dagger.io on safari on a mac m1. ### Dagger version should not be required ### OS version should not be required
https://github.com/dagger/dagger/issues/2014
https://github.com/dagger/dagger/pull/394
2804feb004399b7bd75f0a7e4fa6ddcc63e07837
9d421c6c4299f6ab6ea147322199e32e87b82a49
2022-04-04T07:41:39Z
go
2021-04-30T17:12:49Z
pkg/buildkitd/buildkitd.go
cmd = exec.CommandContext(ctx, "docker", "run", "--net=host", "-d", "--restart", "always", "-v", volumeName+":/var/lib/buildkit", "--name", containerName, "--privileged", imageVersion, ) output, err = cmd.CombinedOutput() if err != nil { if !strings.Contains(string(output), "Error response from daemon: Conflict.") { log. Ctx(ctx). Error(). Err(err). Bytes("output", output). Msg("unable to start buildkitd") return err } } return waitBuildkit(ctx) } func waitBuildkit(ctx context.Context) error {
closed
dagger/dagger
https://github.com/dagger/dagger
2,014
🐞 website renders wrong on mac m1 safari
### What is the issue? https://twitter.com/alexellisuk/status/1510880710294396928 ### Log output _No response_ ### Steps to reproduce Visit https://dagger.io on safari on a mac m1. ### Dagger version should not be required ### OS version should not be required
https://github.com/dagger/dagger/issues/2014
https://github.com/dagger/dagger/pull/394
2804feb004399b7bd75f0a7e4fa6ddcc63e07837
9d421c6c4299f6ab6ea147322199e32e87b82a49
2022-04-04T07:41:39Z
go
2021-04-30T17:12:49Z
pkg/buildkitd/buildkitd.go
c, err := bk.New(ctx, "docker-container://"+containerName) if err != nil { return err } defer c.Close() const ( retryPeriod = 100 * time.Millisecond retryAttempts = 50 ) for retry := 0; retry < retryAttempts; retry++ { _, err = c.ListWorkers(ctx) if err == nil { return nil } time.Sleep(retryPeriod) } return errors.New("buildkit failed to respond") } func remvoveBuildkit(ctx context.Context) error {
closed
dagger/dagger
https://github.com/dagger/dagger
2,014
🐞 website renders wrong on mac m1 safari
### What is the issue? https://twitter.com/alexellisuk/status/1510880710294396928 ### Log output _No response_ ### Steps to reproduce Visit https://dagger.io on safari on a mac m1. ### Dagger version should not be required ### OS version should not be required
https://github.com/dagger/dagger/issues/2014
https://github.com/dagger/dagger/pull/394
2804feb004399b7bd75f0a7e4fa6ddcc63e07837
9d421c6c4299f6ab6ea147322199e32e87b82a49
2022-04-04T07:41:39Z
go
2021-04-30T17:12:49Z
pkg/buildkitd/buildkitd.go
lg := log. Ctx(ctx) cmd := exec.CommandContext(ctx, "docker", "rm", "-fv", containerName, ) output, err := cmd.CombinedOutput() if err != nil { lg. Error(). Err(err). Bytes("output", output). Msg("failed to stop buildkit") return err } return nil } func getBuildkitVersion(ctx context.Context) (string, error) {
closed
dagger/dagger
https://github.com/dagger/dagger
2,014
🐞 website renders wrong on mac m1 safari
### What is the issue? https://twitter.com/alexellisuk/status/1510880710294396928 ### Log output _No response_ ### Steps to reproduce Visit https://dagger.io on safari on a mac m1. ### Dagger version should not be required ### OS version should not be required
https://github.com/dagger/dagger/issues/2014
https://github.com/dagger/dagger/pull/394
2804feb004399b7bd75f0a7e4fa6ddcc63e07837
9d421c6c4299f6ab6ea147322199e32e87b82a49
2022-04-04T07:41:39Z
go
2021-04-30T17:12:49Z
pkg/buildkitd/buildkitd.go
cmd := exec.CommandContext(ctx, "docker", "inspect", "--format", "{{.Config.Image}}", containerName, ) output, err := cmd.CombinedOutput() if err != nil { return "", err } ref, err := reference.ParseNormalizedNamed(strings.TrimSpace(string(output))) if err != nil { return "", err } tag, ok := ref.(reference.Tagged) if !ok { return "", fmt.Errorf("failed to parse image: %s", output) } return tag.Tag(), nil }
closed
dagger/dagger
https://github.com/dagger/dagger
364
Unset input on deployment
## Problem Actually, it's not possible to remove an `input` from a deployment and that's really frustrating... Imagine an user who do a typo when adding an input ? He will not delete the deployment and restart all from the beggining. ## Proposal Add a flag `unset` on `dagger input` which take the `cue path` as argument and remove the input ### Example ``` $ dagger input text name "John Doe" updated deployment... $ dagger input list Saved Inputs: name: {text <nil> <nil> <nil> 0xc000612710 <nil> <nil> <nil>} # This display is not really friendly btw Plan Inputs: Path From Type name (plan) string $ dagger input unset name updated deployment... $ dagger input list Saved Inputs: Plan Inputs: Path From Type name (plan) string ```
https://github.com/dagger/dagger/issues/364
https://github.com/dagger/dagger/pull/385
9d421c6c4299f6ab6ea147322199e32e87b82a49
8abf06cb9bb8764eabc77fe0641e7602e5300b05
2021-04-23T14:37:50Z
go
2021-04-30T18:19:17Z
cmd/dagger/cmd/input/root.go
package input import ( "context" "io" "os" "dagger.io/go/cmd/dagger/cmd/common" "dagger.io/go/dagger" "github.com/rs/zerolog/log" "github.com/spf13/cobra" "github.com/spf13/viper" ) var Cmd = &cobra.Command{ Use: "input", Short: "Manage an environment's inputs", } func init() {
closed
dagger/dagger
https://github.com/dagger/dagger
364
Unset input on deployment
## Problem Actually, it's not possible to remove an `input` from a deployment and that's really frustrating... Imagine an user who do a typo when adding an input ? He will not delete the deployment and restart all from the beggining. ## Proposal Add a flag `unset` on `dagger input` which take the `cue path` as argument and remove the input ### Example ``` $ dagger input text name "John Doe" updated deployment... $ dagger input list Saved Inputs: name: {text <nil> <nil> <nil> 0xc000612710 <nil> <nil> <nil>} # This display is not really friendly btw Plan Inputs: Path From Type name (plan) string $ dagger input unset name updated deployment... $ dagger input list Saved Inputs: Plan Inputs: Path From Type name (plan) string ```
https://github.com/dagger/dagger/issues/364
https://github.com/dagger/dagger/pull/385
9d421c6c4299f6ab6ea147322199e32e87b82a49
8abf06cb9bb8764eabc77fe0641e7602e5300b05
2021-04-23T14:37:50Z
go
2021-04-30T18:19:17Z
cmd/dagger/cmd/input/root.go
Cmd.AddCommand( dirCmd, gitCmd, containerCmd, secretCmd, textCmd, jsonCmd, yamlCmd, listCmd, ) } func updateEnvironmentInput(ctx context.Context, target string, input dagger.Input) { lg := log.Ctx(ctx) store, err := dagger.DefaultStore() if err != nil { lg.Fatal().Err(err).Msg("failed to load store") } st := common.GetCurrentEnvironmentState(ctx, store) st.SetInput(target, input) if err := store.UpdateEnvironment(ctx, st, nil); err != nil { lg.Fatal().Err(err).Str("environmentId", st.ID).Str("environmentName", st.Name).Msg("cannot update environment") } lg.Info().Str("environmentId", st.ID).Str("environmentName", st.Name).Msg("updated environment") } func readInput(ctx context.Context, source string) string {
closed
dagger/dagger
https://github.com/dagger/dagger
364
Unset input on deployment
## Problem Actually, it's not possible to remove an `input` from a deployment and that's really frustrating... Imagine an user who do a typo when adding an input ? He will not delete the deployment and restart all from the beggining. ## Proposal Add a flag `unset` on `dagger input` which take the `cue path` as argument and remove the input ### Example ``` $ dagger input text name "John Doe" updated deployment... $ dagger input list Saved Inputs: name: {text <nil> <nil> <nil> 0xc000612710 <nil> <nil> <nil>} # This display is not really friendly btw Plan Inputs: Path From Type name (plan) string $ dagger input unset name updated deployment... $ dagger input list Saved Inputs: Plan Inputs: Path From Type name (plan) string ```
https://github.com/dagger/dagger/issues/364
https://github.com/dagger/dagger/pull/385
9d421c6c4299f6ab6ea147322199e32e87b82a49
8abf06cb9bb8764eabc77fe0641e7602e5300b05
2021-04-23T14:37:50Z
go
2021-04-30T18:19:17Z
cmd/dagger/cmd/input/root.go
lg := log.Ctx(ctx) if !viper.GetBool("file") { return source } if source == "-" { data, err := io.ReadAll(os.Stdin) if err != nil { lg. Fatal(). Err(err). Msg("failed to read input from stdin") } return string(data) } data, err := os.ReadFile(source) if err != nil { lg. Fatal(). Err(err). Str("path", source). Msg("failed to read input from file") } return string(data) }
closed
dagger/dagger
https://github.com/dagger/dagger
432
SIGSEGV on wrong cue syntax
``` debian: #up: [ op.#DockerBuild & { dockerfile: """FROM debian """ }, ] ``` Should have been a new line before FROM - but then, should not SIGSEGV right? (seems like a cue bug?)
https://github.com/dagger/dagger/issues/432
https://github.com/dagger/dagger/pull/456
668d6ae23f15d672397f85df59f1aa09d8420b20
835ac9eef3ff5e710d1472f6afa16d058465689a
2021-05-07T19:09:54Z
go
2021-05-12T23:20:32Z
dagger/compiler/build.go
package compiler import ( "errors" "fmt" "io/fs" "path" "path/filepath" cueerrors "cuelang.org/go/cue/errors" cueload "cuelang.org/go/cue/load" ) func Build(sources map[string]fs.FS, args ...string) (*Value, error) { c := DefaultCompiler buildConfig := &cueload.Config{ Dir: "/config", Overlay: map[string]cueload.Source{}, } for mnt, f := range sources { f := f mnt := mnt err := fs.WalkDir(f, ".", func(p string, entry fs.DirEntry, err error) error { if err != nil { return err } if !entry.Type().IsRegular() { return nil
closed
dagger/dagger
https://github.com/dagger/dagger
432
SIGSEGV on wrong cue syntax
``` debian: #up: [ op.#DockerBuild & { dockerfile: """FROM debian """ }, ] ``` Should have been a new line before FROM - but then, should not SIGSEGV right? (seems like a cue bug?)
https://github.com/dagger/dagger/issues/432
https://github.com/dagger/dagger/pull/456
668d6ae23f15d672397f85df59f1aa09d8420b20
835ac9eef3ff5e710d1472f6afa16d058465689a
2021-05-07T19:09:54Z
go
2021-05-12T23:20:32Z
dagger/compiler/build.go
} if filepath.Ext(entry.Name()) != ".cue" { return nil } contents, err := fs.ReadFile(f, p) if err != nil { return fmt.Errorf("%s: %w", p, err) } overlayPath := path.Join(buildConfig.Dir, mnt, p) buildConfig.Overlay[overlayPath] = cueload.FromBytes(contents) return nil }) if err != nil { return nil, err } } instances := cueload.Instances(args, buildConfig) if len(instances) != 1 { return nil, errors.New("only one package is supported at a time") } v, err := c.Context.BuildInstances(instances) if err != nil { return nil, errors.New(cueerrors.Details(err, &cueerrors.Config{})) } if len(v) != 1 { return nil, errors.New("internal: wrong number of values") } return Wrap(v[0]), nil }
closed
dagger/dagger
https://github.com/dagger/dagger
519
dagger list and other commands that access the env are broken with official release (Mac OS)
Happens only with the official release (not if I compile myself), due to cgo that is disabled. <img width="675" alt="Screen Shot 2021-05-28 at 2 50 44 PM" src="https://user-images.githubusercontent.com/216487/119986517-c9598500-bf78-11eb-8d67-200a3255f058.png"> Workaround: ```sh export USER=$LOGNAME ``` If `dagger list`, try `dagger new foobar` from an empty workspace. cc @aluzzardi
https://github.com/dagger/dagger/issues/519
https://github.com/dagger/dagger/pull/520
8d5c3f4f0fa9815f5e9cf59320ec8d8c3f82db1b
e045366e82b3fb352c1f744e9510222ff7a3eb8b
2021-05-28T12:53:28Z
go
2021-05-28T19:08:52Z
cmd/dagger/cmd/version.go
package cmd import ( "errors" "fmt" "io/ioutil" "net/http" "os" "path" "runtime" "runtime/debug" "strings" "time" goVersion "github.com/hashicorp/go-version" "github.com/spf13/cobra" "github.com/spf13/viper" "golang.org/x/term" ) const ( defaultVersion = "devel" versionFile = "$HOME/.dagger/version-check" versionURL = "https://releases.dagger.io/dagger/latest_version" )
closed
dagger/dagger
https://github.com/dagger/dagger
519
dagger list and other commands that access the env are broken with official release (Mac OS)
Happens only with the official release (not if I compile myself), due to cgo that is disabled. <img width="675" alt="Screen Shot 2021-05-28 at 2 50 44 PM" src="https://user-images.githubusercontent.com/216487/119986517-c9598500-bf78-11eb-8d67-200a3255f058.png"> Workaround: ```sh export USER=$LOGNAME ``` If `dagger list`, try `dagger new foobar` from an empty workspace. cc @aluzzardi
https://github.com/dagger/dagger/issues/519
https://github.com/dagger/dagger/pull/520
8d5c3f4f0fa9815f5e9cf59320ec8d8c3f82db1b
e045366e82b3fb352c1f744e9510222ff7a3eb8b
2021-05-28T12:53:28Z
go
2021-05-28T19:08:52Z
cmd/dagger/cmd/version.go
var ( version = defaultVersion versionMessage = "" ) var versionCmd = &cobra.Command{ Use: "version", Short: "Print dagger version", PersistentPreRun: func(*cobra.Command, []string) {}, PersistentPostRun: func(*cobra.Command, []string) {}, Args: cobra.NoArgs, Run: func(cmd *cobra.Command, args []string) { if bi, ok := debug.ReadBuildInfo(); ok && version == defaultVersion { version = bi.Main.Version } fmt.Printf("dagger version %v %s/%s\n", version, runtime.GOOS, runtime.GOARCH, ) if check := viper.GetBool("check"); check { _ = os.Remove(os.ExpandEnv(versionFile)) checkVersion() if !warnVersion() { fmt.Println("dagger is up to date.") } } }, } func init() {
closed
dagger/dagger
https://github.com/dagger/dagger
519
dagger list and other commands that access the env are broken with official release (Mac OS)
Happens only with the official release (not if I compile myself), due to cgo that is disabled. <img width="675" alt="Screen Shot 2021-05-28 at 2 50 44 PM" src="https://user-images.githubusercontent.com/216487/119986517-c9598500-bf78-11eb-8d67-200a3255f058.png"> Workaround: ```sh export USER=$LOGNAME ``` If `dagger list`, try `dagger new foobar` from an empty workspace. cc @aluzzardi
https://github.com/dagger/dagger/issues/519
https://github.com/dagger/dagger/pull/520
8d5c3f4f0fa9815f5e9cf59320ec8d8c3f82db1b
e045366e82b3fb352c1f744e9510222ff7a3eb8b
2021-05-28T12:53:28Z
go
2021-05-28T19:08:52Z
cmd/dagger/cmd/version.go
versionCmd.Flags().Bool("check", false, "check if dagger is up to date") versionCmd.InheritedFlags().MarkHidden("environment") versionCmd.InheritedFlags().MarkHidden("log-level") versionCmd.InheritedFlags().MarkHidden("log-format") if err := viper.BindPFlags(versionCmd.Flags()); err != nil { panic(err) } } func isCheckOutdated(path string) bool { if !term.IsTerminal(int(os.Stdout.Fd())) || !term.IsTerminal(int(os.Stderr.Fd())) { return false } if os.Getenv("CI") != "" || os.Getenv("BUILD_NUMBER") != "" || os.Getenv("RUN_ID") != "" { return false } data, err := ioutil.ReadFile(path) if err != nil { return true } lastCheck, err := time.Parse(time.RFC3339, string(data)) if err != nil { return true } nextCheck := lastCheck.Add(24 * time.Hour) return !time.Now().Before(nextCheck) } func getCurrentVersion() (*goVersion.Version, error) {
closed
dagger/dagger
https://github.com/dagger/dagger
519
dagger list and other commands that access the env are broken with official release (Mac OS)
Happens only with the official release (not if I compile myself), due to cgo that is disabled. <img width="675" alt="Screen Shot 2021-05-28 at 2 50 44 PM" src="https://user-images.githubusercontent.com/216487/119986517-c9598500-bf78-11eb-8d67-200a3255f058.png"> Workaround: ```sh export USER=$LOGNAME ``` If `dagger list`, try `dagger new foobar` from an empty workspace. cc @aluzzardi
https://github.com/dagger/dagger/issues/519
https://github.com/dagger/dagger/pull/520
8d5c3f4f0fa9815f5e9cf59320ec8d8c3f82db1b
e045366e82b3fb352c1f744e9510222ff7a3eb8b
2021-05-28T12:53:28Z
go
2021-05-28T19:08:52Z
cmd/dagger/cmd/version.go
if version != defaultVersion { return goVersion.NewVersion(version) } if build, ok := debug.ReadBuildInfo(); ok { return goVersion.NewVersion(build.Main.Version) } return nil, errors.New("could not read dagger version") } func getLatestVersion(currentVersion *goVersion.Version) (*goVersion.Version, error) { req, err := http.NewRequest("GET", versionURL, nil) if err != nil { return nil, err } agent := fmt.Sprintf("dagger/%s (%s; %s)", currentVersion.String(), runtime.GOOS, runtime.GOARCH) req.Header.Set("User-Agent", agent) resp, err := http.DefaultClient.Do(req) if err != nil { return nil, err } defer resp.Body.Close() data, err := ioutil.ReadAll(resp.Body) if err != nil { return nil, err } latestVersion := strings.TrimSuffix(string(data), "\n") return goVersion.NewVersion(latestVersion) } func isVersionLatest() (string, error) {
closed
dagger/dagger
https://github.com/dagger/dagger
519
dagger list and other commands that access the env are broken with official release (Mac OS)
Happens only with the official release (not if I compile myself), due to cgo that is disabled. <img width="675" alt="Screen Shot 2021-05-28 at 2 50 44 PM" src="https://user-images.githubusercontent.com/216487/119986517-c9598500-bf78-11eb-8d67-200a3255f058.png"> Workaround: ```sh export USER=$LOGNAME ``` If `dagger list`, try `dagger new foobar` from an empty workspace. cc @aluzzardi
https://github.com/dagger/dagger/issues/519
https://github.com/dagger/dagger/pull/520
8d5c3f4f0fa9815f5e9cf59320ec8d8c3f82db1b
e045366e82b3fb352c1f744e9510222ff7a3eb8b
2021-05-28T12:53:28Z
go
2021-05-28T19:08:52Z
cmd/dagger/cmd/version.go
currentVersion, err := getCurrentVersion() if err != nil { return "", err } latestVersion, err := getLatestVersion(currentVersion) if err != nil { return "", err } if currentVersion.LessThan(latestVersion) { return latestVersion.String(), nil } return "", nil } func checkVersion() {
closed
dagger/dagger
https://github.com/dagger/dagger
519
dagger list and other commands that access the env are broken with official release (Mac OS)
Happens only with the official release (not if I compile myself), due to cgo that is disabled. <img width="675" alt="Screen Shot 2021-05-28 at 2 50 44 PM" src="https://user-images.githubusercontent.com/216487/119986517-c9598500-bf78-11eb-8d67-200a3255f058.png"> Workaround: ```sh export USER=$LOGNAME ``` If `dagger list`, try `dagger new foobar` from an empty workspace. cc @aluzzardi
https://github.com/dagger/dagger/issues/519
https://github.com/dagger/dagger/pull/520
8d5c3f4f0fa9815f5e9cf59320ec8d8c3f82db1b
e045366e82b3fb352c1f744e9510222ff7a3eb8b
2021-05-28T12:53:28Z
go
2021-05-28T19:08:52Z
cmd/dagger/cmd/version.go
if version == defaultVersion { return } versionFilePath := os.ExpandEnv(versionFile) baseDir := path.Dir(versionFilePath) if _, err := os.Stat(baseDir); os.IsNotExist(err) { if err := os.MkdirAll(baseDir, 0755); err != nil { return } } if !isCheckOutdated(versionFilePath) { return } latestVersion, err := isVersionLatest() if err != nil { return } if latestVersion != "" { versionMessage = fmt.Sprintf("\nA new version is available (%s), please go to https://github.com/dagger/dagger/doc/install.md for instructions.", latestVersion) } now := time.Now().Format(time.RFC3339) ioutil.WriteFile(path.Join(versionFilePath), []byte(now), 0600) } func warnVersion() bool {
closed
dagger/dagger
https://github.com/dagger/dagger
519
dagger list and other commands that access the env are broken with official release (Mac OS)
Happens only with the official release (not if I compile myself), due to cgo that is disabled. <img width="675" alt="Screen Shot 2021-05-28 at 2 50 44 PM" src="https://user-images.githubusercontent.com/216487/119986517-c9598500-bf78-11eb-8d67-200a3255f058.png"> Workaround: ```sh export USER=$LOGNAME ``` If `dagger list`, try `dagger new foobar` from an empty workspace. cc @aluzzardi
https://github.com/dagger/dagger/issues/519
https://github.com/dagger/dagger/pull/520
8d5c3f4f0fa9815f5e9cf59320ec8d8c3f82db1b
e045366e82b3fb352c1f744e9510222ff7a3eb8b
2021-05-28T12:53:28Z
go
2021-05-28T19:08:52Z
cmd/dagger/cmd/version.go
if versionMessage == "" { return false } if binPath, err := os.Executable(); err == nil { if p, err := os.Readlink(binPath); err == nil { if strings.Contains(p, "/Cellar/") { fmt.Println("\nA new version is available, please run:\n\nbrew update && brew upgrade dagger") return true } } } fmt.Println(versionMessage) return true }
closed
dagger/dagger
https://github.com/dagger/dagger
519
dagger list and other commands that access the env are broken with official release (Mac OS)
Happens only with the official release (not if I compile myself), due to cgo that is disabled. <img width="675" alt="Screen Shot 2021-05-28 at 2 50 44 PM" src="https://user-images.githubusercontent.com/216487/119986517-c9598500-bf78-11eb-8d67-200a3255f058.png"> Workaround: ```sh export USER=$LOGNAME ``` If `dagger list`, try `dagger new foobar` from an empty workspace. cc @aluzzardi
https://github.com/dagger/dagger/issues/519
https://github.com/dagger/dagger/pull/520
8d5c3f4f0fa9815f5e9cf59320ec8d8c3f82db1b
e045366e82b3fb352c1f744e9510222ff7a3eb8b
2021-05-28T12:53:28Z
go
2021-05-28T19:08:52Z
keychain/keys.go
package keychain import ( "context" "errors" "fmt" "os" "os/user" "path" "path/filepath" "time" "filippo.io/age" "github.com/rs/zerolog/log" ) func Path() (string, error) {
closed
dagger/dagger
https://github.com/dagger/dagger
519
dagger list and other commands that access the env are broken with official release (Mac OS)
Happens only with the official release (not if I compile myself), due to cgo that is disabled. <img width="675" alt="Screen Shot 2021-05-28 at 2 50 44 PM" src="https://user-images.githubusercontent.com/216487/119986517-c9598500-bf78-11eb-8d67-200a3255f058.png"> Workaround: ```sh export USER=$LOGNAME ``` If `dagger list`, try `dagger new foobar` from an empty workspace. cc @aluzzardi
https://github.com/dagger/dagger/issues/519
https://github.com/dagger/dagger/pull/520
8d5c3f4f0fa9815f5e9cf59320ec8d8c3f82db1b
e045366e82b3fb352c1f744e9510222ff7a3eb8b
2021-05-28T12:53:28Z
go
2021-05-28T19:08:52Z
keychain/keys.go
usr, err := user.Current() if err != nil { return "", err } return path.Join(usr.HomeDir, ".dagger", "keys.txt"), nil } func Default(ctx context.Context) (string, error) { keys, err := List(ctx) if err != nil { if errors.Is(err, os.ErrNotExist) { return Generate(ctx) } return "", err } if len(keys) == 0 { return "", errors.New("no identities found in the keys file") } return keys[0].Recipient().String(), nil } func Generate(ctx context.Context) (string, error) {
closed
dagger/dagger
https://github.com/dagger/dagger
519
dagger list and other commands that access the env are broken with official release (Mac OS)
Happens only with the official release (not if I compile myself), due to cgo that is disabled. <img width="675" alt="Screen Shot 2021-05-28 at 2 50 44 PM" src="https://user-images.githubusercontent.com/216487/119986517-c9598500-bf78-11eb-8d67-200a3255f058.png"> Workaround: ```sh export USER=$LOGNAME ``` If `dagger list`, try `dagger new foobar` from an empty workspace. cc @aluzzardi
https://github.com/dagger/dagger/issues/519
https://github.com/dagger/dagger/pull/520
8d5c3f4f0fa9815f5e9cf59320ec8d8c3f82db1b
e045366e82b3fb352c1f744e9510222ff7a3eb8b
2021-05-28T12:53:28Z
go
2021-05-28T19:08:52Z
keychain/keys.go
keysFile, err := Path() if err != nil { return "", err } k, err := age.GenerateX25519Identity() if err != nil { return "", fmt.Errorf("internal error: %v", err) } if err := os.MkdirAll(filepath.Dir(keysFile), 0755); err != nil { return "", err } f, err := os.OpenFile(keysFile, os.O_WRONLY|os.O_CREATE|os.O_EXCL, 0600) if err != nil { return "", fmt.Errorf("failed to open keys file %q: %v", keysFile, err) } defer f.Close() fmt.Fprintf(f, "# created: %s\n", time.Now().Format(time.RFC3339)) fmt.Fprintf(f, "# public key: %s\n", k.Recipient()) fmt.Fprintf(f, "%s\n", k) pubkey := k.Recipient().String() log.Ctx(ctx).Debug().Str("publicKey", pubkey).Msg("generating keypair") return pubkey, nil } func List(ctx context.Context) ([]*age.X25519Identity, error) {
closed
dagger/dagger
https://github.com/dagger/dagger
519
dagger list and other commands that access the env are broken with official release (Mac OS)
Happens only with the official release (not if I compile myself), due to cgo that is disabled. <img width="675" alt="Screen Shot 2021-05-28 at 2 50 44 PM" src="https://user-images.githubusercontent.com/216487/119986517-c9598500-bf78-11eb-8d67-200a3255f058.png"> Workaround: ```sh export USER=$LOGNAME ``` If `dagger list`, try `dagger new foobar` from an empty workspace. cc @aluzzardi
https://github.com/dagger/dagger/issues/519
https://github.com/dagger/dagger/pull/520
8d5c3f4f0fa9815f5e9cf59320ec8d8c3f82db1b
e045366e82b3fb352c1f744e9510222ff7a3eb8b
2021-05-28T12:53:28Z
go
2021-05-28T19:08:52Z
keychain/keys.go
keysFile, err := Path() if err != nil { return nil, err } f, err := os.Open(keysFile) if err != nil { return nil, fmt.Errorf("failed to open keys file file %q: %w", keysFile, err) } ids, err := age.ParseIdentities(f) if err != nil { return nil, fmt.Errorf("failed to parse input: %w", err) } keys := make([]*age.X25519Identity, 0, len(ids)) for _, id := range ids { key, ok := ids[0].(*age.X25519Identity) if !ok { return nil, fmt.Errorf("internal error: unexpected identity type: %T", id) } keys = append(keys, key) } return keys, nil }
closed
dagger/dagger
https://github.com/dagger/dagger
699
Default plan directory to `.`
To complete #631: #648 introduced a `--module` and `--package` flag to `dagger new`. By default, we use `.dagger/env/XXX/plan` as the cue module. Instead, we should default to `.`.
https://github.com/dagger/dagger/issues/699
https://github.com/dagger/dagger/pull/772
21bed8aee69fd4d9547c0c67777eeae7bddcb94d
f8531fdb0b7df9eacf05a52b24dd78e169ca353b
2021-06-21T15:50:52Z
go
2021-07-07T15:34:23Z
cmd/dagger/cmd/init.go
package cmd import ( "os" "github.com/spf13/cobra" "github.com/spf13/viper" "go.dagger.io/dagger/cmd/dagger/logger" "go.dagger.io/dagger/state" ) var initCmd = &cobra.Command{ Use: "init", Short: "Initialize a new empty workspace", Args: cobra.NoArgs, PreRun: func(cmd *cobra.Command, args []string) { if err := viper.BindPFlags(cmd.Flags()); err != nil {
closed
dagger/dagger
https://github.com/dagger/dagger
699
Default plan directory to `.`
To complete #631: #648 introduced a `--module` and `--package` flag to `dagger new`. By default, we use `.dagger/env/XXX/plan` as the cue module. Instead, we should default to `.`.
https://github.com/dagger/dagger/issues/699
https://github.com/dagger/dagger/pull/772
21bed8aee69fd4d9547c0c67777eeae7bddcb94d
f8531fdb0b7df9eacf05a52b24dd78e169ca353b
2021-06-21T15:50:52Z
go
2021-07-07T15:34:23Z
cmd/dagger/cmd/init.go
panic(err) } }, Run: func(cmd *cobra.Command, args []string) { lg := logger.New() ctx := lg.WithContext(cmd.Context()) dir := viper.GetString("workspace") if dir == "" { cwd, err := os.Getwd() if err != nil { lg. Fatal(). Err(err). Msg("failed to get current working dir") } dir = cwd } ws, err := state.Init(ctx, dir) if err != nil { lg.Fatal().Err(err).Msg("failed to initialize workspace") } lg.Info().Str("path", ws.DaggerDir()).Msg("initialized new empty workspace") }, } func init() { if err := viper.BindPFlags(initCmd.Flags()); err != nil { panic(err) } }
closed
dagger/dagger
https://github.com/dagger/dagger
699
Default plan directory to `.`
To complete #631: #648 introduced a `--module` and `--package` flag to `dagger new`. By default, we use `.dagger/env/XXX/plan` as the cue module. Instead, we should default to `.`.
https://github.com/dagger/dagger/issues/699
https://github.com/dagger/dagger/pull/772
21bed8aee69fd4d9547c0c67777eeae7bddcb94d
f8531fdb0b7df9eacf05a52b24dd78e169ca353b
2021-06-21T15:50:52Z
go
2021-07-07T15:34:23Z
cmd/dagger/cmd/list.go
package cmd import ( "fmt" "os" "os/user" "path" "strings" "text/tabwriter" "github.com/spf13/cobra" "github.com/spf13/viper" "go.dagger.io/dagger/cmd/dagger/cmd/common" "go.dagger.io/dagger/cmd/dagger/logger" ) var listCmd = &cobra.Command{
closed
dagger/dagger
https://github.com/dagger/dagger
699
Default plan directory to `.`
To complete #631: #648 introduced a `--module` and `--package` flag to `dagger new`. By default, we use `.dagger/env/XXX/plan` as the cue module. Instead, we should default to `.`.
https://github.com/dagger/dagger/issues/699
https://github.com/dagger/dagger/pull/772
21bed8aee69fd4d9547c0c67777eeae7bddcb94d
f8531fdb0b7df9eacf05a52b24dd78e169ca353b
2021-06-21T15:50:52Z
go
2021-07-07T15:34:23Z
cmd/dagger/cmd/list.go
Use: "list", Short: "List available environments", Args: cobra.NoArgs, PreRun: func(cmd *cobra.Command, args []string) { if err := viper.BindPFlags(cmd.Flags()); err != nil { panic(err) } }, Run: func(cmd *cobra.Command, args []string) { lg := logger.New() ctx := lg.WithContext(cmd.Context()) workspace := common.CurrentWorkspace(ctx) environments, err := workspace.List(ctx) if err != nil { lg. Fatal(). Err(err). Msg("cannot list environments") } w := tabwriter.NewWriter(os.Stdout, 0, 0, 1, ' ', tabwriter.TabIndent) defer w.Flush() for _, e := range environments { line := fmt.Sprintf("%s\t%s\t", e.Name, formatPath(e.Path)) fmt.Fprintln(w, line) } }, } func formatPath(p string) string {
closed
dagger/dagger
https://github.com/dagger/dagger
699
Default plan directory to `.`
To complete #631: #648 introduced a `--module` and `--package` flag to `dagger new`. By default, we use `.dagger/env/XXX/plan` as the cue module. Instead, we should default to `.`.
https://github.com/dagger/dagger/issues/699
https://github.com/dagger/dagger/pull/772
21bed8aee69fd4d9547c0c67777eeae7bddcb94d
f8531fdb0b7df9eacf05a52b24dd78e169ca353b
2021-06-21T15:50:52Z
go
2021-07-07T15:34:23Z
cmd/dagger/cmd/list.go
usr, err := user.Current() if err != nil { return p } dir := usr.HomeDir if strings.HasPrefix(p, dir) { return path.Join("~", p[len(dir):]) } return p } func init() { if err := viper.BindPFlags(listCmd.Flags()); err != nil { panic(err) } }
closed
dagger/dagger
https://github.com/dagger/dagger
699
Default plan directory to `.`
To complete #631: #648 introduced a `--module` and `--package` flag to `dagger new`. By default, we use `.dagger/env/XXX/plan` as the cue module. Instead, we should default to `.`.
https://github.com/dagger/dagger/issues/699
https://github.com/dagger/dagger/pull/772
21bed8aee69fd4d9547c0c67777eeae7bddcb94d
f8531fdb0b7df9eacf05a52b24dd78e169ca353b
2021-06-21T15:50:52Z
go
2021-07-07T15:34:23Z
cmd/dagger/cmd/new.go
package cmd import ( "fmt" "path/filepath" "strings" "github.com/spf13/cobra" "github.com/spf13/viper" "go.dagger.io/dagger/cmd/dagger/cmd/common" "go.dagger.io/dagger/cmd/dagger/logger"
closed
dagger/dagger
https://github.com/dagger/dagger
699
Default plan directory to `.`
To complete #631: #648 introduced a `--module` and `--package` flag to `dagger new`. By default, we use `.dagger/env/XXX/plan` as the cue module. Instead, we should default to `.`.
https://github.com/dagger/dagger/issues/699
https://github.com/dagger/dagger/pull/772
21bed8aee69fd4d9547c0c67777eeae7bddcb94d
f8531fdb0b7df9eacf05a52b24dd78e169ca353b
2021-06-21T15:50:52Z
go
2021-07-07T15:34:23Z
cmd/dagger/cmd/new.go
"go.dagger.io/dagger/state" ) var newCmd = &cobra.Command{ Use: "new <NAME>", Short: "Create a new empty environment", Args: cobra.ExactArgs(1), PreRun: func(cmd *cobra.Command, args []string) { if err := viper.BindPFlags(cmd.Flags()); err != nil { panic(err) } }, Run: func(cmd *cobra.Command, args []string) { lg := logger.New() ctx := lg.WithContext(cmd.Context()) workspace := common.CurrentWorkspace(ctx) if viper.GetString("environment") != "" { lg. Fatal(). Msg("cannot use option -e,--environment for this command") } name := args[0] module := viper.GetString("module") if module != "" { p, err := filepath.Abs(module) if err != nil { lg.Fatal().Err(err).Str("path", module).Msg("unable to resolve path") } if !strings.HasPrefix(p, workspace.Path) {
closed
dagger/dagger
https://github.com/dagger/dagger
699
Default plan directory to `.`
To complete #631: #648 introduced a `--module` and `--package` flag to `dagger new`. By default, we use `.dagger/env/XXX/plan` as the cue module. Instead, we should default to `.`.
https://github.com/dagger/dagger/issues/699
https://github.com/dagger/dagger/pull/772
21bed8aee69fd4d9547c0c67777eeae7bddcb94d
f8531fdb0b7df9eacf05a52b24dd78e169ca353b
2021-06-21T15:50:52Z
go
2021-07-07T15:34:23Z
cmd/dagger/cmd/new.go
lg.Fatal().Err(err).Str("path", module).Msg("module is outside the workspace") } p, err = filepath.Rel(workspace.Path, p) if err != nil { lg.Fatal().Err(err).Str("path", module).Msg("unable to resolve path") } if !strings.HasPrefix(p, ".") { p = "./" + p } module = p } ws, err := workspace.Create(ctx, name, state.CreateOpts{ Module: module, Package: viper.GetString("package"), }) if err != nil { lg.Fatal().Err(err).Msg("failed to create environment") } lg.Info().Str("name", name).Msg("created new empty environment") lg.Info().Str("name", name).Msg(fmt.Sprintf("to add code to the plan, copy or create cue files under: %s", ws.Plan.Module)) }, } func init() { newCmd.Flags().StringP("module", "m", "", "references the local path of the cue module to use as a plan, relative to the workspace root") newCmd.Flags().StringP("package", "p", "", "references the name of the Cue package within the module to use as a plan. Default: defer to cue loader") if err := viper.BindPFlags(newCmd.Flags()); err != nil { panic(err) } }
closed
dagger/dagger
https://github.com/dagger/dagger
699
Default plan directory to `.`
To complete #631: #648 introduced a `--module` and `--package` flag to `dagger new`. By default, we use `.dagger/env/XXX/plan` as the cue module. Instead, we should default to `.`.
https://github.com/dagger/dagger/issues/699
https://github.com/dagger/dagger/pull/772
21bed8aee69fd4d9547c0c67777eeae7bddcb94d
f8531fdb0b7df9eacf05a52b24dd78e169ca353b
2021-06-21T15:50:52Z
go
2021-07-07T15:34:23Z
environment/environment.go
package environment import ( "context" "fmt" "io/fs" "strings" "time" "cuelang.org/go/cue" cueflow "cuelang.org/go/tools/flow" "go.dagger.io/dagger/compiler" "go.dagger.io/dagger/solver" "go.dagger.io/dagger/state" "go.dagger.io/dagger/stdlib" "github.com/opentracing/opentracing-go" "github.com/opentracing/opentracing-go/ext" otlog "github.com/opentracing/opentracing-go/log" "github.com/rs/zerolog/log" ) type Environment struct { state *state.State plan *compiler.Value input *compiler.Value computed *compiler.Value } func New(st *state.State) (*Environment, error) {