Skip to content

Commit

Permalink
dev-doctor: Add docker and docker buildx checks
Browse files Browse the repository at this point in the history
Signed-off-by: Tom Payne <tom@isovalent.com>
  • Loading branch information
twpayne committed May 25, 2021
1 parent 5d2e72f commit 05776b8
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 1 deletion.
7 changes: 6 additions & 1 deletion tools/dev-doctor/binarycheck.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ import (
// least version minVersion.
type binaryCheck struct {
name string
command string
alternateNames []string
ifNotFound checkResult
versionArgs []string
Expand All @@ -41,7 +42,11 @@ func (c *binaryCheck) Name() string {

func (c *binaryCheck) Run() (checkResult, string) {
var path string
for _, name := range append([]string{c.name}, c.alternateNames...) {
command := c.command
if command == "" {
command = c.name
}
for _, name := range append([]string{command}, c.alternateNames...) {
var err error
path, err = exec.LookPath(name)
switch {
Expand Down
22 changes: 22 additions & 0 deletions tools/dev-doctor/rootcmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,28 @@ func rootCmdRun(cmd *cobra.Command, args []string) {
versionRegexp: regexp.MustCompile(`clang version (\d+\.\d+\.\d+)`),
minVersion: &semver.Version{Major: 10, Minor: 0, Patch: 0},
},
&binaryCheck{
name: "docker-server",
command: "docker",
ifNotFound: checkWarning,
versionArgs: []string{"version", "--format", "{{ .Server.Version }}"},
versionRegexp: regexp.MustCompile(`(\d+\.\d+\.\d+)`),
},
&binaryCheck{
name: "docker-client",
command: "docker",
ifNotFound: checkWarning,
versionArgs: []string{"version", "--format", "{{ .Client.Version }}"},
versionRegexp: regexp.MustCompile(`(\d+\.\d+\.\d+)`),
},
&binaryCheck{
name: "docker-buildx",
command: "docker",
ifNotFound: checkWarning,
versionArgs: []string{"buildx", "version"},
versionRegexp: regexp.MustCompile(`github.com/docker/buildx v(\d+\.\d+\.\d+)`),
hint: "see https://docs.docker.com/engine/install/",
},
// FIXME add libelf-devel check?
&binaryCheck{
name: "ginkgo",
Expand Down

0 comments on commit 05776b8

Please sign in to comment.