Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bump urfave/cli to 2.23.5 #3330

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
32 changes: 16 additions & 16 deletions cmd/buildctl/build.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,11 @@ import (
digest "github.com/opencontainers/go-digest"
"github.com/pkg/errors"
"github.com/sirupsen/logrus"
"github.com/urfave/cli"
"github.com/urfave/cli/v2"
"golang.org/x/sync/errgroup"
)

var buildCommand = cli.Command{
var buildCommand = &cli.Command{
Name: "build",
Aliases: []string{"b"},
Usage: "build",
Expand All @@ -38,60 +38,60 @@ var buildCommand = cli.Command{
`,
Action: buildAction,
Flags: []cli.Flag{
cli.StringSliceFlag{
&cli.StringSliceFlag{
Name: "output,o",
Usage: "Define exports for build result, e.g. --output type=image,name=docker.io/username/image,push=true",
},
cli.StringFlag{
&cli.StringFlag{
Name: "progress",
Usage: "Set type of progress (auto, plain, tty). Use plain to show container output",
Value: "auto",
},
cli.StringFlag{
&cli.StringFlag{
Name: "trace",
Usage: "Path to trace file. Defaults to no tracing.",
},
cli.StringSliceFlag{
&cli.StringSliceFlag{
Name: "local",
Usage: "Allow build access to the local directory",
},
cli.StringSliceFlag{
&cli.StringSliceFlag{
Name: "oci-layout",
Usage: "Allow build access to the local OCI layout",
},
cli.StringFlag{
&cli.StringFlag{
Name: "frontend",
Usage: "Define frontend used for build",
},
cli.StringSliceFlag{
&cli.StringSliceFlag{
Name: "opt",
Usage: "Define custom options for frontend, e.g. --opt target=foo --opt build-arg:foo=bar",
},
cli.BoolFlag{
&cli.BoolFlag{
Name: "no-cache",
Usage: "Disable cache for all the vertices",
},
cli.StringSliceFlag{
&cli.StringSliceFlag{
Name: "export-cache",
Usage: "Export build cache, e.g. --export-cache type=registry,ref=example.com/foo/bar, or --export-cache type=local,dest=path/to/dir",
},
cli.StringSliceFlag{
&cli.StringSliceFlag{
Name: "import-cache",
Usage: "Import build cache, e.g. --import-cache type=registry,ref=example.com/foo/bar, or --import-cache type=local,src=path/to/dir",
},
cli.StringSliceFlag{
&cli.StringSliceFlag{
Name: "secret",
Usage: "Secret value exposed to the build. Format id=secretname,src=filepath",
},
cli.StringSliceFlag{
&cli.StringSliceFlag{
Name: "allow",
Usage: "Allow extra privileged entitlement, e.g. network.host, security.insecure",
},
cli.StringSliceFlag{
&cli.StringSliceFlag{
Name: "ssh",
Usage: "Allow forwarding SSH agent to the builder. Format default|<id>[=<socket>|<key>[,<key>]]",
},
cli.StringFlag{
&cli.StringFlag{
Name: "metadata-file",
Usage: "Output build metadata (e.g., image digest) to a file as JSON",
},
Expand Down
24 changes: 12 additions & 12 deletions cmd/buildctl/common/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,16 @@ import (
"github.com/moby/buildkit/client"
"github.com/moby/buildkit/util/tracing/detect"
"github.com/pkg/errors"
"github.com/urfave/cli"
"github.com/urfave/cli/v2"
"go.opentelemetry.io/otel/trace"
)

// ResolveClient resolves a client from CLI args
func ResolveClient(c *cli.Context) (*client.Client, error) {
serverName := c.GlobalString("tlsservername")
func ResolveClient(clicontext *cli.Context) (*client.Client, error) {
serverName := clicontext.String("tlsservername")
if serverName == "" {
// guess servername as hostname of target address
uri, err := url.Parse(c.GlobalString("addr"))
uri, err := url.Parse(clicontext.String("addr"))
if err != nil {
return nil, err
}
Expand All @@ -34,7 +34,7 @@ func ResolveClient(c *cli.Context) (*client.Client, error) {
var cert string
var key string

tlsDir := c.GlobalString("tlsdir")
tlsDir := clicontext.String("tlsdir")

if tlsDir != "" {
// Look for ca.pem and, if it exists, set caCert to that
Expand All @@ -56,18 +56,18 @@ func ResolveClient(c *cli.Context) (*client.Client, error) {
}
}

if c.GlobalString("tlscacert") != "" || c.GlobalString("tlscert") != "" || c.GlobalString("tlskey") != "" {
if clicontext.String("tlscacert") != "" || clicontext.String("tlscert") != "" || clicontext.String("tlskey") != "" {
return nil, errors.New("cannot specify tlsdir and tlscacert/tlscert/tlskey at the same time")
}
} else {
caCert = c.GlobalString("tlscacert")
cert = c.GlobalString("tlscert")
key = c.GlobalString("tlskey")
caCert = clicontext.String("tlscacert")
cert = clicontext.String("tlscert")
key = clicontext.String("tlskey")
}

opts := []client.ClientOpt{client.WithFailFast()}

ctx := CommandContext(c)
ctx := CommandContext(clicontext)

if span := trace.SpanFromContext(ctx); span.SpanContext().IsValid() {
opts = append(opts, client.WithTracerProvider(span.TracerProvider()))
Expand All @@ -86,11 +86,11 @@ func ResolveClient(c *cli.Context) (*client.Client, error) {
opts = append(opts, client.WithCredentials(serverName, caCert, cert, key))
}

timeout := time.Duration(c.GlobalInt("timeout"))
timeout := time.Duration(clicontext.Int("timeout"))
ctx, cancel := context.WithTimeout(ctx, timeout*time.Second)
defer cancel()

return client.New(ctx, c.GlobalString("addr"), opts...)
return client.New(ctx, clicontext.String("addr"), opts...)
}

func ParseTemplate(format string) (*template.Template, error) {
Expand Down
2 changes: 1 addition & 1 deletion cmd/buildctl/common/trace.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (

"github.com/moby/buildkit/util/appcontext"
"github.com/moby/buildkit/util/tracing/detect"
"github.com/urfave/cli"
"github.com/urfave/cli/v2"
"go.opentelemetry.io/otel/attribute"
"go.opentelemetry.io/otel/codes"
"go.opentelemetry.io/otel/trace"
Expand Down
6 changes: 3 additions & 3 deletions cmd/buildctl/debug.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@ package main

import (
"github.com/moby/buildkit/cmd/buildctl/debug"
"github.com/urfave/cli"
"github.com/urfave/cli/v2"
)

var debugCommand = cli.Command{
var debugCommand = &cli.Command{
Name: "debug",
Usage: "debug utilities",
Subcommands: []cli.Command{
Subcommands: []*cli.Command{
debug.DumpLLBCommand,
debug.DumpMetadataCommand,
debug.WorkersCommand,
Expand Down
6 changes: 3 additions & 3 deletions cmd/buildctl/debug/dumpllb.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,16 @@ import (
"github.com/moby/buildkit/solver/pb"
digest "github.com/opencontainers/go-digest"
"github.com/pkg/errors"
"github.com/urfave/cli"
"github.com/urfave/cli/v2"
)

var DumpLLBCommand = cli.Command{
var DumpLLBCommand = &cli.Command{
Name: "dump-llb",
Usage: "dump LLB in human-readable format. LLB can be also passed via stdin. This command does not require the daemon to be running.",
ArgsUsage: "<llbfile>",
Action: dumpLLB,
Flags: []cli.Flag{
cli.BoolFlag{
&cli.BoolFlag{
Name: "dot",
Usage: "Output dot format",
},
Expand Down
6 changes: 3 additions & 3 deletions cmd/buildctl/debug/dumpmetadata.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@ import (

"github.com/moby/buildkit/util/appdefaults"
"github.com/pkg/errors"
"github.com/urfave/cli"
"github.com/urfave/cli/v2"
bolt "go.etcd.io/bbolt"
)

var DumpMetadataCommand = cli.Command{
var DumpMetadataCommand = &cli.Command{
Name: "dump-metadata",
Usage: "dump the meta in human-readable format. This command requires the daemon NOT to be running.",
Flags: []cli.Flag{
cli.StringFlag{
&cli.StringFlag{
Name: "root",
Usage: "path to state directory",
Value: appdefaults.Root,
Expand Down
6 changes: 3 additions & 3 deletions cmd/buildctl/debug/info.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,15 @@ import (
"text/tabwriter"

bccommon "github.com/moby/buildkit/cmd/buildctl/common"
"github.com/urfave/cli"
"github.com/urfave/cli/v2"
)

var InfoCommand = cli.Command{
var InfoCommand = &cli.Command{
Name: "info",
Usage: "display internal information",
Action: info,
Flags: []cli.Flag{
cli.StringFlag{
&cli.StringFlag{
Name: "format",
Usage: "Format the output using the given Go template, e.g, '{{json .}}'",
},
Expand Down
10 changes: 5 additions & 5 deletions cmd/buildctl/debug/logs.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,15 @@ import (
"github.com/moby/buildkit/util/appcontext"
"github.com/moby/buildkit/util/progress/progresswriter"
"github.com/pkg/errors"
"github.com/urfave/cli"
"github.com/urfave/cli/v2"
)

var LogsCommand = cli.Command{
var LogsCommand = &cli.Command{
Name: "logs",
Usage: "display build logs",
Action: logs,
Flags: []cli.Flag{
cli.StringFlag{
&cli.StringFlag{
Name: "progress",
Usage: "progress output type",
Value: "auto",
Expand All @@ -28,10 +28,10 @@ var LogsCommand = cli.Command{

func logs(clicontext *cli.Context) error {
args := clicontext.Args()
if len(args) == 0 {
if args.Len() == 0 {
return errors.Errorf("build ref must be specified")
}
ref := args[0]
ref := args.Get(0)

c, err := bccommon.ResolveClient(clicontext)
if err != nil {
Expand Down
8 changes: 4 additions & 4 deletions cmd/buildctl/debug/monitor.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,19 @@ import (
controlapi "github.com/moby/buildkit/api/services/control"
bccommon "github.com/moby/buildkit/cmd/buildctl/common"
"github.com/moby/buildkit/util/appcontext"
"github.com/urfave/cli"
"github.com/urfave/cli/v2"
)

var MonitorCommand = cli.Command{
var MonitorCommand = &cli.Command{
Name: "monitor",
Usage: "display build events",
Action: monitor,
Flags: []cli.Flag{
cli.BoolFlag{
&cli.BoolFlag{
Name: "completed",
Usage: "show completed builds",
},
cli.StringFlag{
&cli.StringFlag{
Name: "ref",
Usage: "show events for a specific build",
},
Expand Down
10 changes: 5 additions & 5 deletions cmd/buildctl/debug/workers.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,23 +14,23 @@ import (
ocispecs "github.com/opencontainers/image-spec/specs-go/v1"
"github.com/sirupsen/logrus"
"github.com/tonistiigi/units"
"github.com/urfave/cli"
"github.com/urfave/cli/v2"
)

var WorkersCommand = cli.Command{
var WorkersCommand = &cli.Command{
Name: "workers",
Usage: "list workers",
Action: listWorkers,
Flags: []cli.Flag{
cli.StringSliceFlag{
&cli.StringSliceFlag{
Name: "filter, f",
Usage: "containerd-style filter string slice",
},
cli.BoolFlag{
&cli.BoolFlag{
Name: "verbose, v",
Usage: "Verbose output",
},
cli.StringFlag{
&cli.StringFlag{
Name: "format",
Usage: "Format the output using the given Go template, e.g, '{{json .}}'",
},
Expand Down
8 changes: 4 additions & 4 deletions cmd/buildctl/dialstdio.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,19 @@ import (

"github.com/pkg/errors"
"github.com/sirupsen/logrus"
"github.com/urfave/cli"
"github.com/urfave/cli/v2"
)

var dialStdioCommand = cli.Command{
var dialStdioCommand = &cli.Command{
Name: "dial-stdio",
Usage: "Proxy the stdio stream to the daemon connection. Should not be invoked manually.",
Hidden: true,
Action: dialStdioAction,
}

func dialStdioAction(clicontext *cli.Context) error {
addr := clicontext.GlobalString("addr")
timeout := time.Duration(clicontext.GlobalInt("timeout")) * time.Second
addr := clicontext.String("addr")
timeout := time.Duration(clicontext.Int("timeout")) * time.Second
conn, err := dialer(addr, timeout)
if err != nil {
return err
Expand Down
10 changes: 5 additions & 5 deletions cmd/buildctl/diskusage.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,23 +11,23 @@ import (
bccommon "github.com/moby/buildkit/cmd/buildctl/common"
"github.com/sirupsen/logrus"
"github.com/tonistiigi/units"
"github.com/urfave/cli"
"github.com/urfave/cli/v2"
)

var diskUsageCommand = cli.Command{
var diskUsageCommand = &cli.Command{
Name: "du",
Usage: "disk usage",
Action: diskUsage,
Flags: []cli.Flag{
cli.StringSliceFlag{
&cli.StringSliceFlag{
Name: "filter, f",
Usage: "Filter records",
},
cli.BoolFlag{
&cli.BoolFlag{
Name: "verbose, v",
Usage: "Verbose output",
},
cli.StringFlag{
&cli.StringFlag{
Name: "format",
Usage: "Format the output using the given Go template, e.g, '{{json .}}'",
},
Expand Down