forked from moby/buildkit
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com> (cherry picked from commit 859ad49) Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
- Loading branch information
Showing
7 changed files
with
840 additions
and
101 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
package client | ||
|
||
import ( | ||
"context" | ||
|
||
controlapi "github.com/moby/buildkit/api/services/control" | ||
"github.com/pkg/errors" | ||
) | ||
|
||
type InfoResponse struct { | ||
BuildkitVersion Version | ||
} | ||
|
||
func (c *Client) Info(ctx context.Context) (*InfoResponse, error) { | ||
res, err := c.controlClient().Info(ctx, &controlapi.InfoRequest{}) | ||
if err != nil { | ||
return nil, errors.Wrap(err, "failed to call info") | ||
} | ||
return &InfoResponse{ | ||
BuildkitVersion: Version{ | ||
Package: res.BuildkitVersion.Package, | ||
Version: res.BuildkitVersion.Version, | ||
Revision: res.BuildkitVersion.Revision, | ||
}, | ||
}, nil | ||
} | ||
|
||
type Version struct { | ||
Package string | ||
Version string | ||
Revision string | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
package debug | ||
|
||
import ( | ||
"fmt" | ||
"os" | ||
"text/tabwriter" | ||
|
||
bccommon "github.com/moby/buildkit/cmd/buildctl/common" | ||
"github.com/urfave/cli" | ||
) | ||
|
||
var InfoCommand = cli.Command{ | ||
Name: "info", | ||
Usage: "display internal information", | ||
Action: info, | ||
} | ||
|
||
func info(clicontext *cli.Context) error { | ||
c, err := bccommon.ResolveClient(clicontext) | ||
if err != nil { | ||
return err | ||
} | ||
res, err := c.Info(bccommon.CommandContext(clicontext)) | ||
if err != nil { | ||
return err | ||
} | ||
w := tabwriter.NewWriter(os.Stdout, 0, 0, 1, ' ', 0) | ||
_, _ = fmt.Fprintf(w, "BuildKit:\t%s %s %s\n", res.BuildkitVersion.Package, res.BuildkitVersion.Version, res.BuildkitVersion.Revision) | ||
return w.Flush() | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters