re-wire logging on top of zerolog
Signed-off-by: Andrea Luzzardi <aluzzardi@gmail.com>
This commit is contained in:
parent
49f0c0e149
commit
e09723861f
@ -1,37 +1,45 @@
|
|||||||
package cmd
|
package cmd
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
|
||||||
"fmt"
|
"fmt"
|
||||||
|
|
||||||
"dagger.cloud/go/cmd/dagger/ui"
|
"dagger.cloud/go/cmd/dagger/logger"
|
||||||
"dagger.cloud/go/dagger"
|
"dagger.cloud/go/dagger"
|
||||||
|
|
||||||
|
"github.com/moby/buildkit/util/appcontext"
|
||||||
|
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
|
"github.com/spf13/viper"
|
||||||
)
|
)
|
||||||
|
|
||||||
var computeCmd = &cobra.Command{
|
var computeCmd = &cobra.Command{
|
||||||
Use: "compute CONFIG",
|
Use: "compute CONFIG",
|
||||||
Short: "Compute a configuration",
|
Short: "Compute a configuration",
|
||||||
Args: cobra.ExactArgs(1),
|
Args: cobra.ExactArgs(1),
|
||||||
|
PreRun: func(cmd *cobra.Command, args []string) {
|
||||||
|
// Fix Viper bug for duplicate flags:
|
||||||
|
// https://github.com/spf13/viper/issues/233
|
||||||
|
if err := viper.BindPFlags(cmd.Flags()); err != nil {
|
||||||
|
panic(err)
|
||||||
|
}
|
||||||
|
},
|
||||||
Run: func(cmd *cobra.Command, args []string) {
|
Run: func(cmd *cobra.Command, args []string) {
|
||||||
ctx := context.TODO()
|
lg := logger.New()
|
||||||
|
ctx := lg.WithContext(appcontext.Context())
|
||||||
|
|
||||||
// FIXME: boot and bootdir should be config fields, not args
|
// FIXME: boot and bootdir should be config fields, not args
|
||||||
c, err := dagger.NewClient(ctx, "", "", args[0])
|
c, err := dagger.NewClient(ctx, "", "", args[0])
|
||||||
if err != nil {
|
if err != nil {
|
||||||
ui.FatalErr(err)
|
lg.Fatal().Err(err).Msg("unable to create client")
|
||||||
}
|
}
|
||||||
// FIXME: configure which config to compute (duh)
|
// FIXME: configure which config to compute (duh)
|
||||||
// FIXME: configure inputs
|
// FIXME: configure inputs
|
||||||
ui.Info("Running")
|
lg.Info().Msg("running")
|
||||||
output, err := c.Compute(ctx)
|
output, err := c.Compute(ctx)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
ui.FatalErr(err)
|
lg.Fatal().Err(err).Msg("failed to compute")
|
||||||
}
|
}
|
||||||
ui.Info("Processing output")
|
lg.Info().Msg("processing output")
|
||||||
fmt.Println(output.JSON())
|
fmt.Println(output.JSON())
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
func init() {
|
|
||||||
// computeCmd.Flags().StringP("catalog", "c", "", "Cue package catalog")
|
|
||||||
}
|
|
||||||
|
@ -1,8 +1,11 @@
|
|||||||
package cmd
|
package cmd
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"dagger.cloud/go/cmd/dagger/ui"
|
"strings"
|
||||||
|
|
||||||
|
"dagger.cloud/go/cmd/dagger/logger"
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
|
"github.com/spf13/viper"
|
||||||
)
|
)
|
||||||
|
|
||||||
var rootCmd = &cobra.Command{
|
var rootCmd = &cobra.Command{
|
||||||
@ -11,9 +14,9 @@ var rootCmd = &cobra.Command{
|
|||||||
}
|
}
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
// --debug
|
rootCmd.PersistentFlags().String("log-format", "", "Log format (json, pretty). Defaults to json if the terminal is not a tty")
|
||||||
rootCmd.PersistentFlags().Bool("debug", false, "Enable debug mode")
|
rootCmd.PersistentFlags().StringP("log-level", "l", "debug", "Log level")
|
||||||
// --workspace
|
|
||||||
rootCmd.AddCommand(
|
rootCmd.AddCommand(
|
||||||
computeCmd,
|
computeCmd,
|
||||||
// Create an env
|
// Create an env
|
||||||
@ -26,10 +29,19 @@ func init() {
|
|||||||
// computeCmd,
|
// computeCmd,
|
||||||
// listCmd,
|
// listCmd,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
if err := viper.BindPFlags(rootCmd.PersistentFlags()); err != nil {
|
||||||
|
panic(err)
|
||||||
|
}
|
||||||
|
viper.SetEnvPrefix("dagger")
|
||||||
|
viper.SetEnvKeyReplacer(strings.NewReplacer("-", "_"))
|
||||||
|
viper.AutomaticEnv()
|
||||||
}
|
}
|
||||||
|
|
||||||
func Execute() {
|
func Execute() {
|
||||||
|
lg := logger.New()
|
||||||
|
|
||||||
if err := rootCmd.Execute(); err != nil {
|
if err := rootCmd.Execute(); err != nil {
|
||||||
ui.FatalErr(err)
|
lg.Fatal().Err(err).Msg("failed to execute command")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
51
cmd/dagger/logger/logger.go
Normal file
51
cmd/dagger/logger/logger.go
Normal file
@ -0,0 +1,51 @@
|
|||||||
|
// Logger utilities for the CLI
|
||||||
|
//
|
||||||
|
// These utilities rely on command line flags to set up the logger, therefore
|
||||||
|
// they are tightly coupled with the CLI and should not be used outside.
|
||||||
|
|
||||||
|
package logger
|
||||||
|
|
||||||
|
import (
|
||||||
|
"fmt"
|
||||||
|
"os"
|
||||||
|
|
||||||
|
"github.com/rs/zerolog"
|
||||||
|
"github.com/spf13/viper"
|
||||||
|
"golang.org/x/term"
|
||||||
|
)
|
||||||
|
|
||||||
|
func New() zerolog.Logger {
|
||||||
|
logger := zerolog.
|
||||||
|
New(os.Stderr).
|
||||||
|
With().
|
||||||
|
Timestamp().
|
||||||
|
Logger()
|
||||||
|
|
||||||
|
if prettyLogs() {
|
||||||
|
logger = logger.Output(zerolog.ConsoleWriter{Out: os.Stderr})
|
||||||
|
} else {
|
||||||
|
logger = logger.With().Timestamp().Caller().Logger()
|
||||||
|
}
|
||||||
|
|
||||||
|
level := viper.GetString("log-level")
|
||||||
|
lvl, err := zerolog.ParseLevel(level)
|
||||||
|
if err != nil {
|
||||||
|
panic(err)
|
||||||
|
}
|
||||||
|
return logger.Level(lvl)
|
||||||
|
}
|
||||||
|
|
||||||
|
func prettyLogs() bool {
|
||||||
|
switch f := viper.GetString("log-format"); f {
|
||||||
|
case "json":
|
||||||
|
return false
|
||||||
|
case "pretty":
|
||||||
|
return true
|
||||||
|
case "":
|
||||||
|
return term.IsTerminal(int(os.Stdout.Fd()))
|
||||||
|
default:
|
||||||
|
fmt.Fprintf(os.Stderr, "invalid --log-format %q\n", f)
|
||||||
|
os.Exit(1)
|
||||||
|
}
|
||||||
|
return false
|
||||||
|
}
|
@ -11,6 +11,8 @@ import (
|
|||||||
"github.com/pkg/errors"
|
"github.com/pkg/errors"
|
||||||
"golang.org/x/sync/errgroup"
|
"golang.org/x/sync/errgroup"
|
||||||
|
|
||||||
|
"github.com/rs/zerolog/log"
|
||||||
|
|
||||||
// Cue
|
// Cue
|
||||||
"cuelang.org/go/cue"
|
"cuelang.org/go/cue"
|
||||||
|
|
||||||
@ -80,12 +82,12 @@ func NewClient(ctx context.Context, host, boot, bootdir string) (*Client, error)
|
|||||||
}, nil
|
}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *Client) LocalDirs() ([]string, error) {
|
func (c *Client) LocalDirs(ctx context.Context) ([]string, error) {
|
||||||
boot, err := c.BootScript()
|
boot, err := c.BootScript()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
return boot.LocalDirs()
|
return boot.LocalDirs(ctx)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *Client) BootScript() (*Script, error) {
|
func (c *Client) BootScript() (*Script, error) {
|
||||||
@ -102,6 +104,8 @@ func (c *Client) BootScript() (*Script, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (c *Client) Compute(ctx context.Context) (*Value, error) {
|
func (c *Client) Compute(ctx context.Context) (*Value, error) {
|
||||||
|
lg := log.Ctx(ctx)
|
||||||
|
|
||||||
cc := &Compiler{}
|
cc := &Compiler{}
|
||||||
out, err := cc.EmptyStruct()
|
out, err := cc.EmptyStruct()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -140,7 +144,7 @@ func (c *Client) Compute(ctx context.Context) (*Value, error) {
|
|||||||
})
|
})
|
||||||
|
|
||||||
eg.Go(func() error {
|
eg.Go(func() error {
|
||||||
return c.dockerprintfn(dispCtx, eventsDockerPrint, os.Stderr)
|
return c.dockerprintfn(dispCtx, eventsDockerPrint, lg)
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
eg.Go(func() error {
|
eg.Go(func() error {
|
||||||
@ -157,6 +161,8 @@ func (c *Client) Compute(ctx context.Context) (*Value, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (c *Client) buildfn(ctx context.Context, ch chan *bk.SolveStatus, w io.WriteCloser) error {
|
func (c *Client) buildfn(ctx context.Context, ch chan *bk.SolveStatus, w io.WriteCloser) error {
|
||||||
|
lg := log.Ctx(ctx)
|
||||||
|
|
||||||
boot, err := c.BootScript()
|
boot, err := c.BootScript()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return errors.Wrap(err, "assemble boot script")
|
return errors.Wrap(err, "assemble boot script")
|
||||||
@ -165,7 +171,7 @@ func (c *Client) buildfn(ctx context.Context, ch chan *bk.SolveStatus, w io.Writ
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return errors.Wrap(err, "serialize boot script")
|
return errors.Wrap(err, "serialize boot script")
|
||||||
}
|
}
|
||||||
debugf("client: assembled boot script: %s\n", bootSource)
|
lg.Debug().Bytes("bootSource", bootSource).Msg("assembled boot script")
|
||||||
// Setup solve options
|
// Setup solve options
|
||||||
opts := bk.SolveOpt{
|
opts := bk.SolveOpt{
|
||||||
FrontendAttrs: map[string]string{
|
FrontendAttrs: map[string]string{
|
||||||
@ -184,7 +190,7 @@ func (c *Client) buildfn(ctx context.Context, ch chan *bk.SolveStatus, w io.Writ
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
// Connect local dirs
|
// Connect local dirs
|
||||||
localdirs, err := c.LocalDirs()
|
localdirs, err := c.LocalDirs(ctx)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return errors.Wrap(err, "connect local dirs")
|
return errors.Wrap(err, "connect local dirs")
|
||||||
}
|
}
|
||||||
@ -199,14 +205,19 @@ func (c *Client) buildfn(ctx context.Context, ch chan *bk.SolveStatus, w io.Writ
|
|||||||
}
|
}
|
||||||
for k, v := range resp.ExporterResponse {
|
for k, v := range resp.ExporterResponse {
|
||||||
// FIXME consume exporter response
|
// FIXME consume exporter response
|
||||||
fmt.Printf("exporter response: %s=%s\n", k, v)
|
lg.
|
||||||
|
Debug().
|
||||||
|
Str("key", k).
|
||||||
|
Str("value", v).
|
||||||
|
Msg("exporter response")
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// Read tar export stream from buildkit Build(), and extract cue output
|
// Read tar export stream from buildkit Build(), and extract cue output
|
||||||
func (c *Client) outputfn(_ context.Context, r io.Reader, out *Value) error {
|
func (c *Client) outputfn(ctx context.Context, r io.Reader, out *Value) error {
|
||||||
defer debugf("outputfn complete")
|
lg := log.Ctx(ctx)
|
||||||
|
|
||||||
tr := tar.NewReader(r)
|
tr := tar.NewReader(r)
|
||||||
for {
|
for {
|
||||||
h, err := tr.Next()
|
h, err := tr.Next()
|
||||||
@ -216,11 +227,17 @@ func (c *Client) outputfn(_ context.Context, r io.Reader, out *Value) error {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return errors.Wrap(err, "read tar stream")
|
return errors.Wrap(err, "read tar stream")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
lg := lg.
|
||||||
|
With().
|
||||||
|
Str("file", h.Name).
|
||||||
|
Logger()
|
||||||
|
|
||||||
if !strings.HasSuffix(h.Name, ".cue") {
|
if !strings.HasSuffix(h.Name, ".cue") {
|
||||||
debugf("skipping non-cue file from exporter tar stream: %s", h.Name)
|
lg.Debug().Msg("skipping non-cue file from exporter tar stream")
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
debugf("outputfn: compiling & merging %q", h.Name)
|
lg.Debug().Msg("outputfn: compiling & merging")
|
||||||
|
|
||||||
cc := out.Compiler()
|
cc := out.Compiler()
|
||||||
v, err := cc.Compile(h.Name, tr)
|
v, err := cc.Compile(h.Name, tr)
|
||||||
@ -230,7 +247,6 @@ func (c *Client) outputfn(_ context.Context, r io.Reader, out *Value) error {
|
|||||||
if err := out.Fill(v); err != nil {
|
if err := out.Fill(v); err != nil {
|
||||||
return errors.Wrap(err, h.Name)
|
return errors.Wrap(err, h.Name)
|
||||||
}
|
}
|
||||||
debugf("outputfn: DONE: compiling & merging %q", h.Name)
|
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
@ -254,7 +270,7 @@ func (n Node) ComponentPath() cue.Path {
|
|||||||
return cue.MakePath(parts...)
|
return cue.MakePath(parts...)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (n Node) Logf(msg string, args ...interface{}) {
|
func (n Node) Logf(ctx context.Context, msg string, args ...interface{}) {
|
||||||
componentPath := n.ComponentPath().String()
|
componentPath := n.ComponentPath().String()
|
||||||
args = append([]interface{}{componentPath}, args...)
|
args = append([]interface{}{componentPath}, args...)
|
||||||
if msg != "" && !strings.HasSuffix(msg, "\n") {
|
if msg != "" && !strings.HasSuffix(msg, "\n") {
|
||||||
@ -263,34 +279,41 @@ func (n Node) Logf(msg string, args ...interface{}) {
|
|||||||
fmt.Fprintf(os.Stderr, "[%s] "+msg, args...)
|
fmt.Fprintf(os.Stderr, "[%s] "+msg, args...)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (n Node) LogStream(nStream int, data []byte) {
|
func (n Node) LogStream(ctx context.Context, nStream int, data []byte) {
|
||||||
var stream string
|
lg := log.
|
||||||
|
Ctx(ctx).
|
||||||
|
With().
|
||||||
|
Str("path", n.ComponentPath().String()).
|
||||||
|
Logger()
|
||||||
|
|
||||||
switch nStream {
|
switch nStream {
|
||||||
case 1:
|
case 1:
|
||||||
stream = "stdout"
|
lg = lg.With().Str("stream", "stdout").Logger()
|
||||||
case 2:
|
case 2:
|
||||||
stream = "stderr"
|
lg = lg.With().Str("stream", "stderr").Logger()
|
||||||
default:
|
default:
|
||||||
stream = fmt.Sprintf("%d", nStream)
|
lg = lg.With().Str("stream", fmt.Sprintf("%d", nStream)).Logger()
|
||||||
}
|
|
||||||
// FIXME: use bufio reader?
|
|
||||||
lines := strings.Split(string(data), "\n")
|
|
||||||
for _, line := range lines {
|
|
||||||
n.Logf("[%s] %s", stream, line)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (n Node) LogError(errmsg string) {
|
lg.Debug().Msg(string(data))
|
||||||
n.Logf("ERROR: %s", bkCleanError(errmsg))
|
}
|
||||||
|
|
||||||
|
func (n Node) LogError(ctx context.Context, errmsg string) {
|
||||||
|
log.
|
||||||
|
Ctx(ctx).
|
||||||
|
Error().
|
||||||
|
Str("path", n.ComponentPath().String()).
|
||||||
|
Msg(bkCleanError(errmsg))
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *Client) printfn(ctx context.Context, ch chan *bk.SolveStatus) error {
|
func (c *Client) printfn(ctx context.Context, ch chan *bk.SolveStatus) error {
|
||||||
|
lg := log.Ctx(ctx)
|
||||||
|
|
||||||
// Node status mapped to buildkit vertex digest
|
// Node status mapped to buildkit vertex digest
|
||||||
nodesByDigest := map[string]*Node{}
|
nodesByDigest := map[string]*Node{}
|
||||||
// Node status mapped to cue path
|
// Node status mapped to cue path
|
||||||
nodesByPath := map[string]*Node{}
|
nodesByPath := map[string]*Node{}
|
||||||
|
|
||||||
defer debugf("printfn complete")
|
|
||||||
for {
|
for {
|
||||||
select {
|
select {
|
||||||
case <-ctx.Done():
|
case <-ctx.Done():
|
||||||
@ -299,11 +322,13 @@ func (c *Client) printfn(ctx context.Context, ch chan *bk.SolveStatus) error {
|
|||||||
if !ok {
|
if !ok {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
debugf("status event: vertexes:%d statuses:%d logs:%d\n",
|
lg.
|
||||||
len(status.Vertexes),
|
Debug().
|
||||||
len(status.Statuses),
|
Int("vertexes", len(status.Vertexes)).
|
||||||
len(status.Logs),
|
Int("statuses", len(status.Statuses)).
|
||||||
)
|
Int("logs", len(status.Logs)).
|
||||||
|
Msg("status event")
|
||||||
|
|
||||||
for _, v := range status.Vertexes {
|
for _, v := range status.Vertexes {
|
||||||
// FIXME: insert raw buildkit telemetry here (ie for debugging, etc.)
|
// FIXME: insert raw buildkit telemetry here (ie for debugging, etc.)
|
||||||
|
|
||||||
@ -320,12 +345,12 @@ func (c *Client) printfn(ctx context.Context, ch chan *bk.SolveStatus) error {
|
|||||||
nodesByPath[n.Path.String()] = n
|
nodesByPath[n.Path.String()] = n
|
||||||
nodesByDigest[n.Digest.String()] = n
|
nodesByDigest[n.Digest.String()] = n
|
||||||
if n.Error != "" {
|
if n.Error != "" {
|
||||||
n.LogError(n.Error)
|
n.LogError(ctx, n.Error)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for _, log := range status.Logs {
|
for _, log := range status.Logs {
|
||||||
if n, ok := nodesByDigest[log.Vertex.String()]; ok {
|
if n, ok := nodesByDigest[log.Vertex.String()]; ok {
|
||||||
n.LogStream(log.Stream, log.Data)
|
n.LogStream(ctx, log.Stream, log.Data)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// debugJSON(status)
|
// debugJSON(status)
|
||||||
@ -351,7 +376,6 @@ func bkCleanError(msg string) string {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (c *Client) dockerprintfn(ctx context.Context, ch chan *bk.SolveStatus, out io.Writer) error {
|
func (c *Client) dockerprintfn(ctx context.Context, ch chan *bk.SolveStatus, out io.Writer) error {
|
||||||
defer debugf("dockerprintfn complete")
|
|
||||||
var cons console.Console
|
var cons console.Console
|
||||||
// FIXME: use smarter writer from blr
|
// FIXME: use smarter writer from blr
|
||||||
return progressui.DisplaySolveStatus(ctx, "", cons, out, ch)
|
return progressui.DisplaySolveStatus(ctx, "", cons, out, ch)
|
||||||
|
@ -11,6 +11,7 @@ import (
|
|||||||
cueerrors "cuelang.org/go/cue/errors"
|
cueerrors "cuelang.org/go/cue/errors"
|
||||||
cueload "cuelang.org/go/cue/load"
|
cueload "cuelang.org/go/cue/load"
|
||||||
"github.com/pkg/errors"
|
"github.com/pkg/errors"
|
||||||
|
"github.com/rs/zerolog/log"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Polyfill for a cue runtime
|
// Polyfill for a cue runtime
|
||||||
@ -66,8 +67,8 @@ func (cc *Compiler) CompileScript(name string, src interface{}) (*Script, error)
|
|||||||
|
|
||||||
// Build a cue configuration tree from the files in fs.
|
// Build a cue configuration tree from the files in fs.
|
||||||
func (cc *Compiler) Build(ctx context.Context, fs FS, args ...string) (*Value, error) {
|
func (cc *Compiler) Build(ctx context.Context, fs FS, args ...string) (*Value, error) {
|
||||||
debugf("Compiler.Build")
|
lg := log.Ctx(ctx)
|
||||||
defer debugf("COMPLETE: Compiler.Build")
|
|
||||||
// The CUE overlay needs to be prefixed by a non-conflicting path with the
|
// The CUE overlay needs to be prefixed by a non-conflicting path with the
|
||||||
// local filesystem, otherwise Cue will merge the Overlay with whatever Cue
|
// local filesystem, otherwise Cue will merge the Overlay with whatever Cue
|
||||||
// files it finds locally.
|
// files it finds locally.
|
||||||
@ -80,7 +81,7 @@ func (cc *Compiler) Build(ctx context.Context, fs FS, args ...string) (*Value, e
|
|||||||
buildArgs := args
|
buildArgs := args
|
||||||
|
|
||||||
err := fs.Walk(ctx, func(p string, f Stat) error {
|
err := fs.Walk(ctx, func(p string, f Stat) error {
|
||||||
debugf(" Compiler.Build: processing %q", p)
|
lg.Debug().Str("path", p).Msg("Compiler.Build: processing")
|
||||||
if f.IsDir() {
|
if f.IsDir() {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
@ -67,10 +67,10 @@ func (c *Component) Execute(ctx context.Context, fs FS, out Fillable) (FS, error
|
|||||||
return script.Execute(ctx, fs, out)
|
return script.Execute(ctx, fs, out)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *Component) Walk(fn func(*Op) error) error {
|
func (c *Component) Walk(ctx context.Context, fn func(*Op) error) error {
|
||||||
script, err := c.ComputeScript()
|
script, err := c.ComputeScript()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
return script.Walk(fn)
|
return script.Walk(ctx, fn)
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package dagger
|
package dagger
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"context"
|
||||||
"testing"
|
"testing"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -31,7 +32,7 @@ func TestValidateSimpleComponent(t *testing.T) {
|
|||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
n := 0
|
n := 0
|
||||||
if err := s.Walk(func(op *Op) error {
|
if err := s.Walk(context.TODO(), func(op *Op) error {
|
||||||
n++
|
n++
|
||||||
return nil
|
return nil
|
||||||
}); err != nil {
|
}); err != nil {
|
||||||
|
@ -6,17 +6,19 @@ import (
|
|||||||
|
|
||||||
cueerrors "cuelang.org/go/cue/errors"
|
cueerrors "cuelang.org/go/cue/errors"
|
||||||
bkgw "github.com/moby/buildkit/frontend/gateway/client"
|
bkgw "github.com/moby/buildkit/frontend/gateway/client"
|
||||||
|
"github.com/rs/zerolog/log"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Buildkit compute entrypoint (BK calls if "solve" or "build")
|
// Buildkit compute entrypoint (BK calls if "solve" or "build")
|
||||||
// Use by wrapping in a buildkit client Build call, or buildkit frontend.
|
// Use by wrapping in a buildkit client Build call, or buildkit frontend.
|
||||||
func Compute(ctx context.Context, c bkgw.Client) (r *bkgw.Result, err error) {
|
func Compute(ctx context.Context, c bkgw.Client) (r *bkgw.Result, err error) {
|
||||||
|
lg := log.Ctx(ctx)
|
||||||
|
|
||||||
// FIXME: wrap errors to avoid crashing buildkit Build()
|
// FIXME: wrap errors to avoid crashing buildkit Build()
|
||||||
// with cue error types (why??)
|
// with cue error types (why??)
|
||||||
defer func() {
|
defer func() {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
err = fmt.Errorf("%s", cueerrors.Details(err, nil))
|
err = fmt.Errorf("%s", cueerrors.Details(err, nil))
|
||||||
debugf("execute returned an error. Wrapping...")
|
|
||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
// Retrieve boot script form client
|
// Retrieve boot script form client
|
||||||
@ -24,12 +26,12 @@ func Compute(ctx context.Context, c bkgw.Client) (r *bkgw.Result, err error) {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
debugf("computing env")
|
lg.Debug().Msg("computing env")
|
||||||
// Compute output overlay
|
// Compute output overlay
|
||||||
if err := env.Compute(ctx); err != nil {
|
if err := env.Compute(ctx); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
debugf("exporting env")
|
lg.Debug().Msg("exporting env")
|
||||||
// Export env to a cue directory
|
// Export env to a cue directory
|
||||||
outdir := NewSolver(c).Scratch()
|
outdir := NewSolver(c).Scratch()
|
||||||
outdir, err = env.Export(outdir)
|
outdir, err = env.Export(outdir)
|
||||||
|
@ -8,6 +8,7 @@ import (
|
|||||||
"cuelang.org/go/cue"
|
"cuelang.org/go/cue"
|
||||||
cueflow "cuelang.org/go/tools/flow"
|
cueflow "cuelang.org/go/tools/flow"
|
||||||
"github.com/pkg/errors"
|
"github.com/pkg/errors"
|
||||||
|
"github.com/rs/zerolog/log"
|
||||||
)
|
)
|
||||||
|
|
||||||
type Env struct {
|
type Env struct {
|
||||||
@ -29,7 +30,14 @@ type Env struct {
|
|||||||
|
|
||||||
// Initialize a new environment
|
// Initialize a new environment
|
||||||
func NewEnv(ctx context.Context, s Solver, bootsrc, inputsrc string) (*Env, error) {
|
func NewEnv(ctx context.Context, s Solver, bootsrc, inputsrc string) (*Env, error) {
|
||||||
debugf("NewEnv(boot=%q input=%q)", bootsrc, inputsrc)
|
lg := log.Ctx(ctx)
|
||||||
|
|
||||||
|
lg.
|
||||||
|
Debug().
|
||||||
|
Str("boot", bootsrc).
|
||||||
|
Str("input", inputsrc).
|
||||||
|
Msg("New Env")
|
||||||
|
|
||||||
cc := &Compiler{}
|
cc := &Compiler{}
|
||||||
// 1. Compile & execute boot script
|
// 1. Compile & execute boot script
|
||||||
boot, err := cc.CompileScript("boot.cue", bootsrc)
|
boot, err := cc.CompileScript("boot.cue", bootsrc)
|
||||||
@ -42,13 +50,13 @@ func NewEnv(ctx context.Context, s Solver, bootsrc, inputsrc string) (*Env, erro
|
|||||||
}
|
}
|
||||||
// 2. load cue files produced by boot script
|
// 2. load cue files produced by boot script
|
||||||
// FIXME: BuildAll() to force all files (no required package..)
|
// FIXME: BuildAll() to force all files (no required package..)
|
||||||
debugf("building cue configuration from boot state")
|
lg.Debug().Msg("building cue configuration from boot state")
|
||||||
base, err := cc.Build(ctx, bootfs)
|
base, err := cc.Build(ctx, bootfs)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, errors.Wrap(err, "load base config")
|
return nil, errors.Wrap(err, "load base config")
|
||||||
}
|
}
|
||||||
// 3. Compile & merge input overlay (user settings, input directories, secrets.)
|
// 3. Compile & merge input overlay (user settings, input directories, secrets.)
|
||||||
debugf("Loading input overlay")
|
lg.Debug().Msg("loading input overlay")
|
||||||
input, err := cc.Compile("input.cue", inputsrc)
|
input, err := cc.Compile("input.cue", inputsrc)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
@ -58,7 +66,11 @@ func NewEnv(ctx context.Context, s Solver, bootsrc, inputsrc string) (*Env, erro
|
|||||||
return nil, errors.Wrap(err, "merge base & input")
|
return nil, errors.Wrap(err, "merge base & input")
|
||||||
}
|
}
|
||||||
|
|
||||||
debugf("ENV: base=%q input=%q", base.JSON(), input.JSON())
|
lg.
|
||||||
|
Debug().
|
||||||
|
Str("base", base.JSON().String()).
|
||||||
|
Str("input", input.JSON().String()).
|
||||||
|
Msg("ENV")
|
||||||
|
|
||||||
return &Env{
|
return &Env{
|
||||||
base: base,
|
base: base,
|
||||||
@ -70,9 +82,18 @@ func NewEnv(ctx context.Context, s Solver, bootsrc, inputsrc string) (*Env, erro
|
|||||||
|
|
||||||
// Compute missing values in env configuration, and write them to state.
|
// Compute missing values in env configuration, and write them to state.
|
||||||
func (env *Env) Compute(ctx context.Context) error {
|
func (env *Env) Compute(ctx context.Context) error {
|
||||||
debugf("Computing environment")
|
lg := log.Ctx(ctx)
|
||||||
|
|
||||||
output, err := env.Walk(ctx, func(c *Component, out Fillable) error {
|
output, err := env.Walk(ctx, func(c *Component, out Fillable) error {
|
||||||
debugf(" [Env.Compute] processing %s", c.Value().Path().String())
|
lg := lg.
|
||||||
|
With().
|
||||||
|
Str("path", c.Value().Path().String()).
|
||||||
|
Logger()
|
||||||
|
ctx := lg.WithContext(ctx)
|
||||||
|
|
||||||
|
lg.
|
||||||
|
Debug().
|
||||||
|
Msg("[Env.Compute] processing")
|
||||||
_, err := c.Compute(ctx, env.s, out)
|
_, err := c.Compute(ctx, env.s, out)
|
||||||
return err
|
return err
|
||||||
})
|
})
|
||||||
@ -103,35 +124,51 @@ type EnvWalkFunc func(*Component, Fillable) error
|
|||||||
|
|
||||||
// Walk components and return any computed values
|
// Walk components and return any computed values
|
||||||
func (env *Env) Walk(ctx context.Context, fn EnvWalkFunc) (*Value, error) {
|
func (env *Env) Walk(ctx context.Context, fn EnvWalkFunc) (*Value, error) {
|
||||||
debugf("Env.Walk")
|
lg := log.Ctx(ctx)
|
||||||
defer debugf("COMPLETE: Env.Walk")
|
|
||||||
l := sync.Mutex{}
|
|
||||||
// Cueflow cue instance
|
// Cueflow cue instance
|
||||||
// FIXME: make this cleaner in *Value by keeping intermediary instances
|
// FIXME: make this cleaner in *Value by keeping intermediary instances
|
||||||
flowInst, err := env.base.CueInst().Fill(env.input.CueInst().Value())
|
flowInst, err := env.base.CueInst().Fill(env.input.CueInst().Value())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
debugf("walking: \n----\n%s\n----\n", env.cc.Wrap(flowInst.Value(), flowInst).JSON())
|
|
||||||
|
lg.
|
||||||
|
Debug().
|
||||||
|
Str("value", env.cc.Wrap(flowInst.Value(), flowInst).JSON().String()).
|
||||||
|
Msg("walking")
|
||||||
|
|
||||||
// Initialize empty output
|
// Initialize empty output
|
||||||
out, err := env.cc.EmptyStruct()
|
out, err := env.cc.EmptyStruct()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
l := sync.Mutex{}
|
||||||
|
|
||||||
// Cueflow config
|
// Cueflow config
|
||||||
flowCfg := &cueflow.Config{
|
flowCfg := &cueflow.Config{
|
||||||
UpdateFunc: func(c *cueflow.Controller, t *cueflow.Task) error {
|
UpdateFunc: func(c *cueflow.Controller, t *cueflow.Task) error {
|
||||||
l.Lock()
|
l.Lock()
|
||||||
defer l.Unlock()
|
defer l.Unlock()
|
||||||
debugf("compute step")
|
|
||||||
if t == nil {
|
if t == nil {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
debugf("cueflow task %q: %s", t.Path().String(), t.State().String())
|
|
||||||
|
lg := lg.
|
||||||
|
With().
|
||||||
|
Str("path", t.Path().String()).
|
||||||
|
Str("state", t.State().String()).
|
||||||
|
Logger()
|
||||||
|
|
||||||
|
lg.
|
||||||
|
Debug().
|
||||||
|
Msg("cueflow task")
|
||||||
if t.State() != cueflow.Terminated {
|
if t.State() != cueflow.Terminated {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
debugf("cueflow task %q: filling result", t.Path().String())
|
lg.Debug().Msg("cueflow task: filling result")
|
||||||
// Merge task value into output
|
// Merge task value into output
|
||||||
var err error
|
var err error
|
||||||
// FIXME: does cueflow.Task.Value() contain only filled values,
|
// FIXME: does cueflow.Task.Value() contain only filled values,
|
||||||
@ -147,7 +184,13 @@ func (env *Env) Walk(ctx context.Context, fn EnvWalkFunc) (*Value, error) {
|
|||||||
flowMatchFn := func(v cue.Value) (cueflow.Runner, error) {
|
flowMatchFn := func(v cue.Value) (cueflow.Runner, error) {
|
||||||
l.Lock()
|
l.Lock()
|
||||||
defer l.Unlock()
|
defer l.Unlock()
|
||||||
debugf("Env.Walk: processing %s", v.Path().String())
|
|
||||||
|
lg := lg.
|
||||||
|
With().
|
||||||
|
Str("path", v.Path().String()).
|
||||||
|
Logger()
|
||||||
|
|
||||||
|
lg.Debug().Msg("Env.Walk: processing")
|
||||||
val := env.cc.Wrap(v, flowInst)
|
val := env.cc.Wrap(v, flowInst)
|
||||||
c, err := val.Component()
|
c, err := val.Component()
|
||||||
if os.IsNotExist(err) {
|
if os.IsNotExist(err) {
|
||||||
@ -160,6 +203,7 @@ func (env *Env) Walk(ctx context.Context, fn EnvWalkFunc) (*Value, error) {
|
|||||||
return cueflow.RunnerFunc(func(t *cueflow.Task) error {
|
return cueflow.RunnerFunc(func(t *cueflow.Task) error {
|
||||||
l.Lock()
|
l.Lock()
|
||||||
defer l.Unlock()
|
defer l.Unlock()
|
||||||
|
|
||||||
return fn(c, t)
|
return fn(c, t)
|
||||||
}), nil
|
}), nil
|
||||||
}
|
}
|
||||||
|
13
dagger/op.go
13
dagger/op.go
@ -7,6 +7,7 @@ import (
|
|||||||
|
|
||||||
"github.com/moby/buildkit/client/llb"
|
"github.com/moby/buildkit/client/llb"
|
||||||
"github.com/pkg/errors"
|
"github.com/pkg/errors"
|
||||||
|
"github.com/rs/zerolog/log"
|
||||||
)
|
)
|
||||||
|
|
||||||
type Op struct {
|
type Op struct {
|
||||||
@ -21,14 +22,15 @@ func (op *Op) Execute(ctx context.Context, fs FS, out Fillable) (FS, error) {
|
|||||||
return action(ctx, fs, out)
|
return action(ctx, fs, out)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (op *Op) Walk(fn func(*Op) error) error {
|
func (op *Op) Walk(ctx context.Context, fn func(*Op) error) error {
|
||||||
debugf("Walk %v", op.v)
|
lg := log.Ctx(ctx)
|
||||||
|
|
||||||
|
lg.Debug().Interface("v", op.v).Msg("Op.Walk")
|
||||||
isCopy := (op.Validate("#Copy") == nil)
|
isCopy := (op.Validate("#Copy") == nil)
|
||||||
isLoad := (op.Validate("#Load") == nil)
|
isLoad := (op.Validate("#Load") == nil)
|
||||||
if isCopy || isLoad {
|
if isCopy || isLoad {
|
||||||
debugf("MATCH %v", op.v)
|
|
||||||
if from, err := op.Get("from").Executable(); err == nil {
|
if from, err := op.Get("from").Executable(); err == nil {
|
||||||
if err := from.Walk(fn); err != nil {
|
if err := from.Walk(ctx, fn); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -37,7 +39,7 @@ func (op *Op) Walk(fn func(*Op) error) error {
|
|||||||
if err := op.Validate("#Exec"); err == nil {
|
if err := op.Validate("#Exec"); err == nil {
|
||||||
return op.Get("mount").RangeStruct(func(k string, v *Value) error {
|
return op.Get("mount").RangeStruct(func(k string, v *Value) error {
|
||||||
if from, err := op.Get("from").Executable(); err == nil {
|
if from, err := op.Get("from").Executable(); err == nil {
|
||||||
if err := from.Walk(fn); err != nil {
|
if err := from.Walk(ctx, fn); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -75,7 +77,6 @@ func (op *Op) Action() (Action, error) {
|
|||||||
}
|
}
|
||||||
for def, action := range actions {
|
for def, action := range actions {
|
||||||
if err := op.Validate(def); err == nil {
|
if err := op.Validate(def); err == nil {
|
||||||
op.v.Debugf("OP MATCH: %s", def)
|
|
||||||
return action, nil
|
return action, nil
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,10 +1,13 @@
|
|||||||
package dagger
|
package dagger
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"context"
|
||||||
"testing"
|
"testing"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestLocalMatch(t *testing.T) {
|
func TestLocalMatch(t *testing.T) {
|
||||||
|
ctx := context.TODO()
|
||||||
|
|
||||||
cc := &Compiler{}
|
cc := &Compiler{}
|
||||||
src := `do: "local", dir: "foo"`
|
src := `do: "local", dir: "foo"`
|
||||||
v, err := cc.Compile("", src)
|
v, err := cc.Compile("", src)
|
||||||
@ -16,7 +19,7 @@ func TestLocalMatch(t *testing.T) {
|
|||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
n := 0
|
n := 0
|
||||||
err = op.Walk(func(op *Op) error {
|
err = op.Walk(ctx, func(op *Op) error {
|
||||||
n++
|
n++
|
||||||
return nil
|
return nil
|
||||||
})
|
})
|
||||||
@ -29,6 +32,8 @@ func TestLocalMatch(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestCopyMatch(t *testing.T) {
|
func TestCopyMatch(t *testing.T) {
|
||||||
|
ctx := context.TODO()
|
||||||
|
|
||||||
cc := &Compiler{}
|
cc := &Compiler{}
|
||||||
src := `do: "copy", from: [{do: "local", dir: "foo"}]`
|
src := `do: "copy", from: [{do: "local", dir: "foo"}]`
|
||||||
v, err := cc.Compile("", src)
|
v, err := cc.Compile("", src)
|
||||||
@ -43,7 +48,7 @@ func TestCopyMatch(t *testing.T) {
|
|||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
n := 0
|
n := 0
|
||||||
err = op.Walk(func(op *Op) error {
|
err = op.Walk(ctx, func(op *Op) error {
|
||||||
n++
|
n++
|
||||||
return nil
|
return nil
|
||||||
})
|
})
|
||||||
|
@ -41,22 +41,22 @@ func (s *Script) Execute(ctx context.Context, fs FS, out Fillable) (FS, error) {
|
|||||||
return fs, err
|
return fs, err
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *Script) Walk(fn func(op *Op) error) error {
|
func (s *Script) Walk(ctx context.Context, fn func(op *Op) error) error {
|
||||||
return s.v.RangeList(func(idx int, v *Value) error {
|
return s.v.RangeList(func(idx int, v *Value) error {
|
||||||
op, err := v.Op()
|
op, err := v.Op()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return errors.Wrapf(err, "validate op %d/%d", idx+1, s.v.Len())
|
return errors.Wrapf(err, "validate op %d/%d", idx+1, s.v.Len())
|
||||||
}
|
}
|
||||||
if err := op.Walk(fn); err != nil {
|
if err := op.Walk(ctx, fn); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *Script) LocalDirs() ([]string, error) {
|
func (s *Script) LocalDirs(ctx context.Context) ([]string, error) {
|
||||||
var dirs []string
|
var dirs []string
|
||||||
err := s.Walk(func(op *Op) error {
|
err := s.Walk(ctx, func(op *Op) error {
|
||||||
if err := op.Validate("#Local"); err != nil {
|
if err := op.Validate("#Local"); err != nil {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package dagger
|
package dagger
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"context"
|
||||||
"strings"
|
"strings"
|
||||||
"testing"
|
"testing"
|
||||||
)
|
)
|
||||||
@ -17,6 +18,8 @@ func TestValidateEmptyValue(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestLocalScript(t *testing.T) {
|
func TestLocalScript(t *testing.T) {
|
||||||
|
ctx := context.TODO()
|
||||||
|
|
||||||
cc := &Compiler{}
|
cc := &Compiler{}
|
||||||
src := `[{do: "local", dir: "foo"}]`
|
src := `[{do: "local", dir: "foo"}]`
|
||||||
v, err := cc.Compile("", src)
|
v, err := cc.Compile("", src)
|
||||||
@ -28,7 +31,7 @@ func TestLocalScript(t *testing.T) {
|
|||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
n := 0
|
n := 0
|
||||||
err = s.Walk(func(op *Op) error {
|
err = s.Walk(ctx, func(op *Op) error {
|
||||||
n++
|
n++
|
||||||
return nil
|
return nil
|
||||||
})
|
})
|
||||||
@ -41,6 +44,8 @@ func TestLocalScript(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestWalkBootScript(t *testing.T) {
|
func TestWalkBootScript(t *testing.T) {
|
||||||
|
ctx := context.TODO()
|
||||||
|
|
||||||
cc := &Compiler{}
|
cc := &Compiler{}
|
||||||
cfg, err := cc.Compile("clientconfig.cue", defaultBootScript)
|
cfg, err := cc.Compile("clientconfig.cue", defaultBootScript)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -50,7 +55,7 @@ func TestWalkBootScript(t *testing.T) {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
dirs, err := script.LocalDirs()
|
dirs, err := script.LocalDirs(ctx)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
@ -64,6 +69,8 @@ func TestWalkBootScript(t *testing.T) {
|
|||||||
|
|
||||||
func TestWalkBiggerScript(t *testing.T) {
|
func TestWalkBiggerScript(t *testing.T) {
|
||||||
t.Skip("FIXME")
|
t.Skip("FIXME")
|
||||||
|
|
||||||
|
ctx := context.TODO()
|
||||||
cc := &Compiler{}
|
cc := &Compiler{}
|
||||||
script, err := cc.CompileScript("boot.cue", `
|
script, err := cc.CompileScript("boot.cue", `
|
||||||
[
|
[
|
||||||
@ -102,7 +109,7 @@ func TestWalkBiggerScript(t *testing.T) {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
dirs, err := script.LocalDirs()
|
dirs, err := script.LocalDirs(ctx)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
|
@ -1,10 +1,9 @@
|
|||||||
package dagger
|
package dagger
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
|
||||||
|
|
||||||
"cuelang.org/go/cue"
|
"cuelang.org/go/cue"
|
||||||
cueerrors "cuelang.org/go/cue/errors"
|
cueerrors "cuelang.org/go/cue/errors"
|
||||||
|
"github.com/pkg/errors"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Cue spec validator
|
// Cue spec validator
|
||||||
@ -18,8 +17,7 @@ func (s Spec) Validate(v *Value, defpath string) (err error) {
|
|||||||
// FIXME: there is probably a cleaner way to do this.
|
// FIXME: there is probably a cleaner way to do this.
|
||||||
defer func() {
|
defer func() {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
//debugf("ERROR while validating %v against %v err=%q", v, defpath, err)
|
err = errors.New(cueerrors.Details(err, nil))
|
||||||
err = fmt.Errorf("%s", cueerrors.Details(err, nil))
|
|
||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
|
|
||||||
|
@ -7,7 +7,7 @@ import (
|
|||||||
// Implemented by Component, Script, Op
|
// Implemented by Component, Script, Op
|
||||||
type Executable interface {
|
type Executable interface {
|
||||||
Execute(context.Context, FS, Fillable) (FS, error)
|
Execute(context.Context, FS, Fillable) (FS, error)
|
||||||
Walk(func(*Op) error) error
|
Walk(context.Context, func(*Op) error) error
|
||||||
}
|
}
|
||||||
|
|
||||||
// Something which can be filled in-place with a cue value
|
// Something which can be filled in-place with a cue value
|
||||||
|
@ -3,24 +3,14 @@ package dagger
|
|||||||
import (
|
import (
|
||||||
"crypto/rand"
|
"crypto/rand"
|
||||||
"fmt"
|
"fmt"
|
||||||
"os"
|
|
||||||
"strings"
|
|
||||||
|
|
||||||
"cuelang.org/go/cue"
|
"cuelang.org/go/cue"
|
||||||
cueerrors "cuelang.org/go/cue/errors"
|
cueerrors "cuelang.org/go/cue/errors"
|
||||||
|
"github.com/pkg/errors"
|
||||||
)
|
)
|
||||||
|
|
||||||
func cueErr(err error) error {
|
func cueErr(err error) error {
|
||||||
return fmt.Errorf("%s", cueerrors.Details(err, &cueerrors.Config{}))
|
return errors.New(cueerrors.Details(err, &cueerrors.Config{}))
|
||||||
}
|
|
||||||
|
|
||||||
func debugf(msg string, args ...interface{}) {
|
|
||||||
if !strings.HasSuffix(msg, "\n") {
|
|
||||||
msg += "\n"
|
|
||||||
}
|
|
||||||
if os.Getenv("DEBUG") != "" {
|
|
||||||
fmt.Fprintf(os.Stderr, msg, args...)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func randomID(size int) (string, error) {
|
func randomID(size int) (string, error) {
|
||||||
|
@ -319,12 +319,6 @@ func (v *Value) Compiler() *Compiler {
|
|||||||
return v.cc
|
return v.cc
|
||||||
}
|
}
|
||||||
|
|
||||||
func (v *Value) Debugf(msg string, args ...interface{}) {
|
|
||||||
prefix := v.Path().String()
|
|
||||||
args = append([]interface{}{prefix}, args...)
|
|
||||||
debugf("%s: "+msg, args...)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (v *Value) Wrap(v2 cue.Value) *Value {
|
func (v *Value) Wrap(v2 cue.Value) *Value {
|
||||||
return wrapValue(v2, v.inst, v.cc)
|
return wrapValue(v2, v.inst, v.cc)
|
||||||
}
|
}
|
||||||
|
3
go.mod
3
go.mod
@ -10,9 +10,12 @@ require (
|
|||||||
github.com/mitchellh/colorstring v0.0.0-20190213212951-d06e56a500db
|
github.com/mitchellh/colorstring v0.0.0-20190213212951-d06e56a500db
|
||||||
github.com/moby/buildkit v0.8.1
|
github.com/moby/buildkit v0.8.1
|
||||||
github.com/pkg/errors v0.9.1
|
github.com/pkg/errors v0.9.1
|
||||||
|
github.com/rs/zerolog v1.20.0
|
||||||
github.com/spf13/cobra v1.0.0
|
github.com/spf13/cobra v1.0.0
|
||||||
|
github.com/spf13/viper v1.7.0
|
||||||
github.com/tonistiigi/fsutil v0.0.0-20201103201449-0834f99b7b85
|
github.com/tonistiigi/fsutil v0.0.0-20201103201449-0834f99b7b85
|
||||||
golang.org/x/sync v0.0.0-20200625203802-6e8e738ad208
|
golang.org/x/sync v0.0.0-20200625203802-6e8e738ad208
|
||||||
|
golang.org/x/term v0.0.0-20201117132131-f5c789dd3221
|
||||||
gopkg.in/yaml.v3 v3.0.0-20200506231410-2ff61e1afc86 // indirect
|
gopkg.in/yaml.v3 v3.0.0-20200506231410-2ff61e1afc86 // indirect
|
||||||
)
|
)
|
||||||
|
|
||||||
|
18
go.sum
18
go.sum
@ -312,6 +312,7 @@ github.com/flynn/go-shlex v0.0.0-20150515145356-3f9db97f8568/go.mod h1:xEzjJPgXI
|
|||||||
github.com/fortytw2/leaktest v1.2.0/go.mod h1:jDsjWgpAGjm2CA7WthBh/CdZYEPF31XHquHwclZch5g=
|
github.com/fortytw2/leaktest v1.2.0/go.mod h1:jDsjWgpAGjm2CA7WthBh/CdZYEPF31XHquHwclZch5g=
|
||||||
github.com/fortytw2/leaktest v1.3.0/go.mod h1:jDsjWgpAGjm2CA7WthBh/CdZYEPF31XHquHwclZch5g=
|
github.com/fortytw2/leaktest v1.3.0/go.mod h1:jDsjWgpAGjm2CA7WthBh/CdZYEPF31XHquHwclZch5g=
|
||||||
github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo=
|
github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo=
|
||||||
|
github.com/fsnotify/fsnotify v1.4.9 h1:hsms1Qyu0jgnwNXIxa+/V/PDsU6CfLf6CNO8H7IWoS4=
|
||||||
github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ=
|
github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ=
|
||||||
github.com/garyburd/redigo v0.0.0-20150301180006-535138d7bcd7/go.mod h1:NR3MbYisc3/PwhQ00EMzDiPmrwpPxAn5GI05/YaO1SY=
|
github.com/garyburd/redigo v0.0.0-20150301180006-535138d7bcd7/go.mod h1:NR3MbYisc3/PwhQ00EMzDiPmrwpPxAn5GI05/YaO1SY=
|
||||||
github.com/ghodss/yaml v0.0.0-20150909031657-73d445a93680/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04=
|
github.com/ghodss/yaml v0.0.0-20150909031657-73d445a93680/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04=
|
||||||
@ -461,6 +462,7 @@ github.com/googleapis/gnostic v0.2.2/go.mod h1:sJBsCZ4ayReDTBIg8b9dl28c5xFWyhBTV
|
|||||||
github.com/googleapis/gnostic v0.4.1/go.mod h1:LRhVm6pbyptWbWbuZ38d1eyptfvIytN3ir6b65WBswg=
|
github.com/googleapis/gnostic v0.4.1/go.mod h1:LRhVm6pbyptWbWbuZ38d1eyptfvIytN3ir6b65WBswg=
|
||||||
github.com/gookit/color v1.2.4/go.mod h1:AhIE+pS6D4Ql0SQWbBeXPHw7gY0/sjHoA4s/n1KB7xg=
|
github.com/gookit/color v1.2.4/go.mod h1:AhIE+pS6D4Ql0SQWbBeXPHw7gY0/sjHoA4s/n1KB7xg=
|
||||||
github.com/gophercloud/gophercloud v0.1.0/go.mod h1:vxM41WHh5uqHVBMZHzuwNOHh8XEoIEcSTewFxm1c5g8=
|
github.com/gophercloud/gophercloud v0.1.0/go.mod h1:vxM41WHh5uqHVBMZHzuwNOHh8XEoIEcSTewFxm1c5g8=
|
||||||
|
github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1 h1:EGx4pi6eqNxGaHF6qqu48+N2wcFQ5qg5FXgOdqsJ5d8=
|
||||||
github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY=
|
github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY=
|
||||||
github.com/goreleaser/goreleaser v0.136.0/go.mod h1:wiKrPUeSNh6Wu8nUHxZydSOVQ/OZvOaO7DTtFqie904=
|
github.com/goreleaser/goreleaser v0.136.0/go.mod h1:wiKrPUeSNh6Wu8nUHxZydSOVQ/OZvOaO7DTtFqie904=
|
||||||
github.com/goreleaser/nfpm v1.2.1/go.mod h1:TtWrABZozuLOttX2uDlYyECfQX7x5XYkVxhjYcR6G9w=
|
github.com/goreleaser/nfpm v1.2.1/go.mod h1:TtWrABZozuLOttX2uDlYyECfQX7x5XYkVxhjYcR6G9w=
|
||||||
@ -514,6 +516,7 @@ github.com/hashicorp/go.net v0.0.1/go.mod h1:hjKkEWcCURg++eb33jQU7oqQcI9XDCnUzHA
|
|||||||
github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8=
|
github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8=
|
||||||
github.com/hashicorp/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8=
|
github.com/hashicorp/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8=
|
||||||
github.com/hashicorp/golang-lru v0.5.3/go.mod h1:iADmTwqILo4mZ8BN3D2Q6+9jd8WM5uGBxy+E8yxSoD4=
|
github.com/hashicorp/golang-lru v0.5.3/go.mod h1:iADmTwqILo4mZ8BN3D2Q6+9jd8WM5uGBxy+E8yxSoD4=
|
||||||
|
github.com/hashicorp/hcl v1.0.0 h1:0Anlzjpi4vEasTeNFn2mLJgTSwt0+6sfsiTG8qcWGx4=
|
||||||
github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ=
|
github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ=
|
||||||
github.com/hashicorp/logutils v1.0.0/go.mod h1:QIAnNjmIWmVIIkWDTG1z5v++HQmx9WQRO+LraFDTW64=
|
github.com/hashicorp/logutils v1.0.0/go.mod h1:QIAnNjmIWmVIIkWDTG1z5v++HQmx9WQRO+LraFDTW64=
|
||||||
github.com/hashicorp/mdns v1.0.0/go.mod h1:tL+uN++7HEJ6SQLQ2/p+z2pH24WQKWjBPkE0mNTz8vQ=
|
github.com/hashicorp/mdns v1.0.0/go.mod h1:tL+uN++7HEJ6SQLQ2/p+z2pH24WQKWjBPkE0mNTz8vQ=
|
||||||
@ -551,6 +554,7 @@ github.com/json-iterator/go v1.1.8/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/u
|
|||||||
github.com/json-iterator/go v1.1.10/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4=
|
github.com/json-iterator/go v1.1.10/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4=
|
||||||
github.com/jstemmer/go-junit-report v0.0.0-20190106144839-af01ea7f8024/go.mod h1:6v2b51hI/fHJwM22ozAgKL4VKDeJcHhJFhtBdhmNjmU=
|
github.com/jstemmer/go-junit-report v0.0.0-20190106144839-af01ea7f8024/go.mod h1:6v2b51hI/fHJwM22ozAgKL4VKDeJcHhJFhtBdhmNjmU=
|
||||||
github.com/jstemmer/go-junit-report v0.9.1/go.mod h1:Brl9GWCQeLvo8nXZwPNNblvFj/XSXhF0NWZEnDohbsk=
|
github.com/jstemmer/go-junit-report v0.9.1/go.mod h1:Brl9GWCQeLvo8nXZwPNNblvFj/XSXhF0NWZEnDohbsk=
|
||||||
|
github.com/jtolds/gls v4.20.0+incompatible h1:xdiiI2gbIgH/gLH7ADydsJ1uDOEzR8yvV7C0MuV77Wo=
|
||||||
github.com/jtolds/gls v4.20.0+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfVYBRgL+9YlvaHOwJU=
|
github.com/jtolds/gls v4.20.0+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfVYBRgL+9YlvaHOwJU=
|
||||||
github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w=
|
github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w=
|
||||||
github.com/kisielk/errcheck v1.1.0/go.mod h1:EZBBE59ingxPouuu3KfxchcWSUPOHkagtvWXihfKN4Q=
|
github.com/kisielk/errcheck v1.1.0/go.mod h1:EZBBE59ingxPouuu3KfxchcWSUPOHkagtvWXihfKN4Q=
|
||||||
@ -583,6 +587,7 @@ github.com/lib/pq v1.2.0 h1:LXpIM/LZ5xGFhOpXAQUIMM1HdyqzVYM13zNdjCEEcA0=
|
|||||||
github.com/lib/pq v1.2.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo=
|
github.com/lib/pq v1.2.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo=
|
||||||
github.com/logrusorgru/aurora v0.0.0-20181002194514-a7b3b318ed4e/go.mod h1:7rIyQOR62GCctdiQpZ/zOJlFyk6y+94wXzv6RNZgaR4=
|
github.com/logrusorgru/aurora v0.0.0-20181002194514-a7b3b318ed4e/go.mod h1:7rIyQOR62GCctdiQpZ/zOJlFyk6y+94wXzv6RNZgaR4=
|
||||||
github.com/magiconair/properties v1.8.0/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ=
|
github.com/magiconair/properties v1.8.0/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ=
|
||||||
|
github.com/magiconair/properties v1.8.1 h1:ZC2Vc7/ZFkGmsVC9KvOjumD+G5lXy2RtTKyzRKO2BQ4=
|
||||||
github.com/magiconair/properties v1.8.1/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ=
|
github.com/magiconair/properties v1.8.1/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ=
|
||||||
github.com/mailru/easyjson v0.0.0-20160728113105-d5b7844b561a/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc=
|
github.com/mailru/easyjson v0.0.0-20160728113105-d5b7844b561a/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc=
|
||||||
github.com/mailru/easyjson v0.0.0-20190614124828-94de47d64c63/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc=
|
github.com/mailru/easyjson v0.0.0-20190614124828-94de47d64c63/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc=
|
||||||
@ -626,6 +631,7 @@ github.com/mitchellh/hashstructure v1.0.0/go.mod h1:QjSHrPWS+BGUVBYkbTZWEnOh3G1D
|
|||||||
github.com/mitchellh/iochan v1.0.0/go.mod h1:JwYml1nuB7xOzsp52dPpHFffvOCDupsG0QubkSMEySY=
|
github.com/mitchellh/iochan v1.0.0/go.mod h1:JwYml1nuB7xOzsp52dPpHFffvOCDupsG0QubkSMEySY=
|
||||||
github.com/mitchellh/mapstructure v0.0.0-20160808181253-ca63d7c062ee/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y=
|
github.com/mitchellh/mapstructure v0.0.0-20160808181253-ca63d7c062ee/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y=
|
||||||
github.com/mitchellh/mapstructure v1.1.2/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y=
|
github.com/mitchellh/mapstructure v1.1.2/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y=
|
||||||
|
github.com/mitchellh/mapstructure v1.3.1 h1:cCBH2gTD2K0OtLlv/Y5H01VQCqmlDxz30kS5Y5bqfLA=
|
||||||
github.com/mitchellh/mapstructure v1.3.1/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo=
|
github.com/mitchellh/mapstructure v1.3.1/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo=
|
||||||
github.com/mitchellh/osext v0.0.0-20151018003038-5e2d6d41470f/go.mod h1:OkQIRizQZAeMln+1tSwduZz7+Af5oFlKirV/MSYes2A=
|
github.com/mitchellh/osext v0.0.0-20151018003038-5e2d6d41470f/go.mod h1:OkQIRizQZAeMln+1tSwduZz7+Af5oFlKirV/MSYes2A=
|
||||||
github.com/moby/buildkit v0.8.1 h1:zrGxLwffKM8nVxBvaJa7H404eQLfqlg1GB6YVIzXVQ0=
|
github.com/moby/buildkit v0.8.1 h1:zrGxLwffKM8nVxBvaJa7H404eQLfqlg1GB6YVIzXVQ0=
|
||||||
@ -711,6 +717,7 @@ github.com/openzipkin/zipkin-go v0.1.6/go.mod h1:QgAqvLzwWbR/WpD4A3cGpPtJrZXNIiJ
|
|||||||
github.com/pascaldekloe/goe v0.0.0-20180627143212-57f6aae5913c/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc=
|
github.com/pascaldekloe/goe v0.0.0-20180627143212-57f6aae5913c/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc=
|
||||||
github.com/pborman/uuid v1.2.0/go.mod h1:X/NO0urCmaxf9VXbdlT7C2Yzkj2IKimNn4k+gtPdI/k=
|
github.com/pborman/uuid v1.2.0/go.mod h1:X/NO0urCmaxf9VXbdlT7C2Yzkj2IKimNn4k+gtPdI/k=
|
||||||
github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic=
|
github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic=
|
||||||
|
github.com/pelletier/go-toml v1.8.0 h1:Keo9qb7iRJs2voHvunFtuuYFsbWeOBh8/P9v/kVMFtw=
|
||||||
github.com/pelletier/go-toml v1.8.0/go.mod h1:D6yutnOGMveHEPV7VQOuvI/gXY61bv+9bAOTRnLElKs=
|
github.com/pelletier/go-toml v1.8.0/go.mod h1:D6yutnOGMveHEPV7VQOuvI/gXY61bv+9bAOTRnLElKs=
|
||||||
github.com/peterbourgon/diskv v2.0.1+incompatible/go.mod h1:uqqh8zWWbv1HBMNONnaR/tNboyR3/BZd58JJSHlUSCU=
|
github.com/peterbourgon/diskv v2.0.1+incompatible/go.mod h1:uqqh8zWWbv1HBMNONnaR/tNboyR3/BZd58JJSHlUSCU=
|
||||||
github.com/phayes/checkstyle v0.0.0-20170904204023-bfd46e6a821d/go.mod h1:3OzsM7FXDQlpCiw2j81fOmAwQLnZnLGXVKUzeKQXIAw=
|
github.com/phayes/checkstyle v0.0.0-20170904204023-bfd46e6a821d/go.mod h1:3OzsM7FXDQlpCiw2j81fOmAwQLnZnLGXVKUzeKQXIAw=
|
||||||
@ -764,6 +771,8 @@ github.com/rogpeppe/go-internal v1.5.2/go.mod h1:xXDCJY+GAPziupqXw64V24skbSoqbTE
|
|||||||
github.com/rogpeppe/go-internal v1.6.2-0.20200830194709-1115b6af0369 h1:wdCVGtPadWC/ZuuLC7Hv58VQ5UF7V98ewE71n5mJfrM=
|
github.com/rogpeppe/go-internal v1.6.2-0.20200830194709-1115b6af0369 h1:wdCVGtPadWC/ZuuLC7Hv58VQ5UF7V98ewE71n5mJfrM=
|
||||||
github.com/rogpeppe/go-internal v1.6.2-0.20200830194709-1115b6af0369/go.mod h1:xXDCJY+GAPziupqXw64V24skbSoqbTEfhy4qGm1nDQc=
|
github.com/rogpeppe/go-internal v1.6.2-0.20200830194709-1115b6af0369/go.mod h1:xXDCJY+GAPziupqXw64V24skbSoqbTEfhy4qGm1nDQc=
|
||||||
github.com/rs/xid v1.2.1/go.mod h1:+uKXf+4Djp6Md1KODXJxgGQPKngRmWyn10oCKFzNHOQ=
|
github.com/rs/xid v1.2.1/go.mod h1:+uKXf+4Djp6Md1KODXJxgGQPKngRmWyn10oCKFzNHOQ=
|
||||||
|
github.com/rs/zerolog v1.20.0 h1:38k9hgtUBdxFwE34yS8rTHmHBa4eN16E4DJlv177LNs=
|
||||||
|
github.com/rs/zerolog v1.20.0/go.mod h1:IzD0RJ65iWH0w97OQQebJEvTZYvsCUm9WVLWBQrJRjo=
|
||||||
github.com/rubiojr/go-vhd v0.0.0-20160810183302-0bfd3b39853c/go.mod h1:DM5xW0nvfNNm2uytzsvhI3OnX8uzaRAg8UX/CnDqbto=
|
github.com/rubiojr/go-vhd v0.0.0-20160810183302-0bfd3b39853c/go.mod h1:DM5xW0nvfNNm2uytzsvhI3OnX8uzaRAg8UX/CnDqbto=
|
||||||
github.com/russross/blackfriday v1.5.2/go.mod h1:JO/DiYxRf+HjHt06OyowR9PTA263kcR/rfWxYHBV53g=
|
github.com/russross/blackfriday v1.5.2/go.mod h1:JO/DiYxRf+HjHt06OyowR9PTA263kcR/rfWxYHBV53g=
|
||||||
github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
|
github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
|
||||||
@ -794,9 +803,11 @@ github.com/sirupsen/logrus v1.6.0/go.mod h1:7uNnSEd1DgxDLC74fIahvMZmmYsHGZGEOFrf
|
|||||||
github.com/sirupsen/logrus v1.7.0 h1:ShrD1U9pZB12TX0cVy0DtePoCH97K8EtX+mg7ZARUtM=
|
github.com/sirupsen/logrus v1.7.0 h1:ShrD1U9pZB12TX0cVy0DtePoCH97K8EtX+mg7ZARUtM=
|
||||||
github.com/sirupsen/logrus v1.7.0/go.mod h1:yWOB1SBYBC5VeMP7gHvWumXLIWorT60ONWic61uBYv0=
|
github.com/sirupsen/logrus v1.7.0/go.mod h1:yWOB1SBYBC5VeMP7gHvWumXLIWorT60ONWic61uBYv0=
|
||||||
github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc=
|
github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc=
|
||||||
|
github.com/smartystreets/assertions v1.0.0 h1:UVQPSSmc3qtTi+zPPkCXvZX9VvW/xT/NsRvKfwY81a8=
|
||||||
github.com/smartystreets/assertions v1.0.0/go.mod h1:kHHU4qYBaI3q23Pp3VPrmWhuIUrLW/7eUrw0BU5VaoM=
|
github.com/smartystreets/assertions v1.0.0/go.mod h1:kHHU4qYBaI3q23Pp3VPrmWhuIUrLW/7eUrw0BU5VaoM=
|
||||||
github.com/smartystreets/go-aws-auth v0.0.0-20180515143844-0c1422d1fdb9/go.mod h1:SnhjPscd9TpLiy1LpzGSKh3bXCfxxXuqd9xmQJy3slM=
|
github.com/smartystreets/go-aws-auth v0.0.0-20180515143844-0c1422d1fdb9/go.mod h1:SnhjPscd9TpLiy1LpzGSKh3bXCfxxXuqd9xmQJy3slM=
|
||||||
github.com/smartystreets/goconvey v0.0.0-20190330032615-68dc04aab96a/go.mod h1:syvi0/a8iFYH4r/RixwvyeAJjdLS9QV7WQ/tjFTllLA=
|
github.com/smartystreets/goconvey v0.0.0-20190330032615-68dc04aab96a/go.mod h1:syvi0/a8iFYH4r/RixwvyeAJjdLS9QV7WQ/tjFTllLA=
|
||||||
|
github.com/smartystreets/goconvey v1.6.4 h1:fv0U8FUIMPNf1L9lnHLvLhgicrIVChEkdzIKYqbNC9s=
|
||||||
github.com/smartystreets/goconvey v1.6.4/go.mod h1:syvi0/a8iFYH4r/RixwvyeAJjdLS9QV7WQ/tjFTllLA=
|
github.com/smartystreets/goconvey v1.6.4/go.mod h1:syvi0/a8iFYH4r/RixwvyeAJjdLS9QV7WQ/tjFTllLA=
|
||||||
github.com/smartystreets/gunit v1.0.0/go.mod h1:qwPWnhz6pn0NnRBP++URONOVyNkPyr4SauJk4cUOwJs=
|
github.com/smartystreets/gunit v1.0.0/go.mod h1:qwPWnhz6pn0NnRBP++URONOVyNkPyr4SauJk4cUOwJs=
|
||||||
github.com/soheilhy/cmux v0.1.4/go.mod h1:IM3LyeVVIOuxMH7sFAkER9+bJ4dT7Ms6E4xg4kGIyLM=
|
github.com/soheilhy/cmux v0.1.4/go.mod h1:IM3LyeVVIOuxMH7sFAkER9+bJ4dT7Ms6E4xg4kGIyLM=
|
||||||
@ -804,8 +815,10 @@ github.com/sourcegraph/go-diff v0.5.1/go.mod h1:j2dHj3m8aZgQO8lMTcTnBcXkRRRqi34c
|
|||||||
github.com/sourcegraph/go-diff v0.5.3/go.mod h1:v9JDtjCE4HHHCZGId75rg8gkKKa98RVjBcBGsVmMmak=
|
github.com/sourcegraph/go-diff v0.5.3/go.mod h1:v9JDtjCE4HHHCZGId75rg8gkKKa98RVjBcBGsVmMmak=
|
||||||
github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA=
|
github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA=
|
||||||
github.com/spf13/afero v1.1.2/go.mod h1:j4pytiNVoe2o6bmDsKpLACNPDBIoEAkihy7loJ1B0CQ=
|
github.com/spf13/afero v1.1.2/go.mod h1:j4pytiNVoe2o6bmDsKpLACNPDBIoEAkihy7loJ1B0CQ=
|
||||||
|
github.com/spf13/afero v1.2.2 h1:5jhuqJyZCZf2JRofRvN/nIFgIWNzPa3/Vz8mYylgbWc=
|
||||||
github.com/spf13/afero v1.2.2/go.mod h1:9ZxEEn6pIJ8Rxe320qSDBk6AsU0r9pR7Q4OcevTdifk=
|
github.com/spf13/afero v1.2.2/go.mod h1:9ZxEEn6pIJ8Rxe320qSDBk6AsU0r9pR7Q4OcevTdifk=
|
||||||
github.com/spf13/cast v1.3.0/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE=
|
github.com/spf13/cast v1.3.0/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE=
|
||||||
|
github.com/spf13/cast v1.3.1 h1:nFm6S0SMdyzrzcmThSipiEubIDy8WEXKNZ0UOgiRpng=
|
||||||
github.com/spf13/cast v1.3.1/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE=
|
github.com/spf13/cast v1.3.1/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE=
|
||||||
github.com/spf13/cobra v0.0.2-0.20171109065643-2da4a54c5cee/go.mod h1:1l0Ry5zgKvJasoi3XT1TypsSe7PqH0Sj9dhYf7v3XqQ=
|
github.com/spf13/cobra v0.0.2-0.20171109065643-2da4a54c5cee/go.mod h1:1l0Ry5zgKvJasoi3XT1TypsSe7PqH0Sj9dhYf7v3XqQ=
|
||||||
github.com/spf13/cobra v0.0.3/go.mod h1:1l0Ry5zgKvJasoi3XT1TypsSe7PqH0Sj9dhYf7v3XqQ=
|
github.com/spf13/cobra v0.0.3/go.mod h1:1l0Ry5zgKvJasoi3XT1TypsSe7PqH0Sj9dhYf7v3XqQ=
|
||||||
@ -813,6 +826,7 @@ github.com/spf13/cobra v0.0.5/go.mod h1:3K3wKZymM7VvHMDS9+Akkh4K60UwM26emMESw8tL
|
|||||||
github.com/spf13/cobra v1.0.0 h1:6m/oheQuQ13N9ks4hubMG6BnvwOeaJrqSPLahSnczz8=
|
github.com/spf13/cobra v1.0.0 h1:6m/oheQuQ13N9ks4hubMG6BnvwOeaJrqSPLahSnczz8=
|
||||||
github.com/spf13/cobra v1.0.0/go.mod h1:/6GTrnGXV9HjY+aR4k0oJ5tcvakLuG6EuKReYlHNrgE=
|
github.com/spf13/cobra v1.0.0/go.mod h1:/6GTrnGXV9HjY+aR4k0oJ5tcvakLuG6EuKReYlHNrgE=
|
||||||
github.com/spf13/jwalterweatherman v1.0.0/go.mod h1:cQK4TGJAtQXfYWX+Ddv3mKDzgVb68N+wFjFa4jdeBTo=
|
github.com/spf13/jwalterweatherman v1.0.0/go.mod h1:cQK4TGJAtQXfYWX+Ddv3mKDzgVb68N+wFjFa4jdeBTo=
|
||||||
|
github.com/spf13/jwalterweatherman v1.1.0 h1:ue6voC5bR5F8YxI5S67j9i582FU4Qvo2bmqnqMYADFk=
|
||||||
github.com/spf13/jwalterweatherman v1.1.0/go.mod h1:aNWZUN0dPAAO/Ljvb5BEdw96iTZ0EXowPYD95IqWIGo=
|
github.com/spf13/jwalterweatherman v1.1.0/go.mod h1:aNWZUN0dPAAO/Ljvb5BEdw96iTZ0EXowPYD95IqWIGo=
|
||||||
github.com/spf13/pflag v0.0.0-20170130214245-9ff6c6923cff/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4=
|
github.com/spf13/pflag v0.0.0-20170130214245-9ff6c6923cff/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4=
|
||||||
github.com/spf13/pflag v1.0.1-0.20171106142849-4c012f6dcd95/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4=
|
github.com/spf13/pflag v1.0.1-0.20171106142849-4c012f6dcd95/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4=
|
||||||
@ -823,6 +837,7 @@ github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An
|
|||||||
github.com/spf13/viper v1.3.2/go.mod h1:ZiWeW+zYFKm7srdB9IoDzzZXaJaI5eL9QjNiN/DMA2s=
|
github.com/spf13/viper v1.3.2/go.mod h1:ZiWeW+zYFKm7srdB9IoDzzZXaJaI5eL9QjNiN/DMA2s=
|
||||||
github.com/spf13/viper v1.4.0/go.mod h1:PTJ7Z/lr49W6bUbkmS1V3by4uWynFiR9p7+dSq/yZzE=
|
github.com/spf13/viper v1.4.0/go.mod h1:PTJ7Z/lr49W6bUbkmS1V3by4uWynFiR9p7+dSq/yZzE=
|
||||||
github.com/spf13/viper v1.6.1/go.mod h1:t3iDnF5Jlj76alVNuyFBk5oUMCvsrkbvZK0WQdfDi5k=
|
github.com/spf13/viper v1.6.1/go.mod h1:t3iDnF5Jlj76alVNuyFBk5oUMCvsrkbvZK0WQdfDi5k=
|
||||||
|
github.com/spf13/viper v1.7.0 h1:xVKxvI7ouOI5I+U9s2eeiUfMaWBVoXA3AWskkrqK0VM=
|
||||||
github.com/spf13/viper v1.7.0/go.mod h1:8WkrPz2fc9jxqZNCJI/76HCieCp4Q8HaLFoCha5qpdg=
|
github.com/spf13/viper v1.7.0/go.mod h1:8WkrPz2fc9jxqZNCJI/76HCieCp4Q8HaLFoCha5qpdg=
|
||||||
github.com/stretchr/objx v0.0.0-20180129172003-8a3f7159479f/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
|
github.com/stretchr/objx v0.0.0-20180129172003-8a3f7159479f/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
|
||||||
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
|
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
|
||||||
@ -835,6 +850,7 @@ github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UV
|
|||||||
github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4=
|
github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4=
|
||||||
github.com/stretchr/testify v1.5.1 h1:nOGnQDM7FYENwehXlg/kFVnos3rEvtKTjRvOWSzb6H4=
|
github.com/stretchr/testify v1.5.1 h1:nOGnQDM7FYENwehXlg/kFVnos3rEvtKTjRvOWSzb6H4=
|
||||||
github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA=
|
github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA=
|
||||||
|
github.com/subosito/gotenv v1.2.0 h1:Slr1R9HxAlEKefgq5jn9U+DnETlIUa6HfgEzj0g5d7s=
|
||||||
github.com/subosito/gotenv v1.2.0/go.mod h1:N0PQaV/YGNqwC0u51sEeR/aUtSLEXKX9iv69rRypqCw=
|
github.com/subosito/gotenv v1.2.0/go.mod h1:N0PQaV/YGNqwC0u51sEeR/aUtSLEXKX9iv69rRypqCw=
|
||||||
github.com/syndtr/gocapability v0.0.0-20170704070218-db04d3cc01c8/go.mod h1:hkRG7XYTFWNJGYcbNJQlaLq0fg1yr4J4t/NcTQtrfww=
|
github.com/syndtr/gocapability v0.0.0-20170704070218-db04d3cc01c8/go.mod h1:hkRG7XYTFWNJGYcbNJQlaLq0fg1yr4J4t/NcTQtrfww=
|
||||||
github.com/syndtr/gocapability v0.0.0-20180916011248-d98352740cb2 h1:b6uOv7YOFK0TYG7HtkIgExQo+2RdLuwRft63jn2HWj8=
|
github.com/syndtr/gocapability v0.0.0-20180916011248-d98352740cb2 h1:b6uOv7YOFK0TYG7HtkIgExQo+2RdLuwRft63jn2HWj8=
|
||||||
@ -1148,6 +1164,7 @@ golang.org/x/tools v0.0.0-20190628153133-6cdbf07be9d0/go.mod h1:/rFqwRUd4F7ZHNgw
|
|||||||
golang.org/x/tools v0.0.0-20190706070813-72ffa07ba3db/go.mod h1:jcCCGcm9btYwXyDqrUWc6MKQKKGJCWEQ3AfLSRIbEuI=
|
golang.org/x/tools v0.0.0-20190706070813-72ffa07ba3db/go.mod h1:jcCCGcm9btYwXyDqrUWc6MKQKKGJCWEQ3AfLSRIbEuI=
|
||||||
golang.org/x/tools v0.0.0-20190719005602-e377ae9d6386/go.mod h1:jcCCGcm9btYwXyDqrUWc6MKQKKGJCWEQ3AfLSRIbEuI=
|
golang.org/x/tools v0.0.0-20190719005602-e377ae9d6386/go.mod h1:jcCCGcm9btYwXyDqrUWc6MKQKKGJCWEQ3AfLSRIbEuI=
|
||||||
golang.org/x/tools v0.0.0-20190816200558-6889da9d5479/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
|
golang.org/x/tools v0.0.0-20190816200558-6889da9d5479/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
|
||||||
|
golang.org/x/tools v0.0.0-20190828213141-aed303cbaa74/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
|
||||||
golang.org/x/tools v0.0.0-20190910044552-dd2b5c81c578/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
|
golang.org/x/tools v0.0.0-20190910044552-dd2b5c81c578/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
|
||||||
golang.org/x/tools v0.0.0-20190911174233-4f2ddba30aff/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
|
golang.org/x/tools v0.0.0-20190911174233-4f2ddba30aff/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
|
||||||
golang.org/x/tools v0.0.0-20190920225731-5eefd052ad72/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
|
golang.org/x/tools v0.0.0-20190920225731-5eefd052ad72/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
|
||||||
@ -1261,6 +1278,7 @@ gopkg.in/gcfg.v1 v1.2.0/go.mod h1:yesOnuUOFQAhST5vPY4nbZsb/huCgGGXlipJsBn0b3o=
|
|||||||
gopkg.in/gemnasium/logrus-airbrake-hook.v2 v2.1.2/go.mod h1:Xk6kEKp8OKb+X14hQBKWaSkCsqBpgog8nAV2xsGOxlo=
|
gopkg.in/gemnasium/logrus-airbrake-hook.v2 v2.1.2/go.mod h1:Xk6kEKp8OKb+X14hQBKWaSkCsqBpgog8nAV2xsGOxlo=
|
||||||
gopkg.in/inf.v0 v0.9.1/go.mod h1:cWUDdTG/fYaXco+Dcufb5Vnc6Gp2YChqWtbxRZE0mXw=
|
gopkg.in/inf.v0 v0.9.1/go.mod h1:cWUDdTG/fYaXco+Dcufb5Vnc6Gp2YChqWtbxRZE0mXw=
|
||||||
gopkg.in/ini.v1 v1.51.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k=
|
gopkg.in/ini.v1 v1.51.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k=
|
||||||
|
gopkg.in/ini.v1 v1.56.0 h1:DPMeDvGTM54DXbPkVIZsp19fp/I2K7zwA/itHYHKo8Y=
|
||||||
gopkg.in/ini.v1 v1.56.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k=
|
gopkg.in/ini.v1 v1.56.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k=
|
||||||
gopkg.in/natefinch/lumberjack.v2 v2.0.0/go.mod h1:l0ndWWf7gzL7RNwBG7wST/UCcT4T24xpD6X8LsfU/+k=
|
gopkg.in/natefinch/lumberjack.v2 v2.0.0/go.mod h1:l0ndWWf7gzL7RNwBG7wST/UCcT4T24xpD6X8LsfU/+k=
|
||||||
gopkg.in/resty.v1 v1.12.0/go.mod h1:mDo4pnntr5jdWRML875a/NmxYqAlA73dVijT2AXvQQo=
|
gopkg.in/resty.v1 v1.12.0/go.mod h1:mDo4pnntr5jdWRML875a/NmxYqAlA73dVijT2AXvQQo=
|
||||||
|
Reference in New Issue
Block a user