Skip to content

Commit

Permalink
feat: output git version for troubleshooting (#78)
Browse files Browse the repository at this point in the history
  • Loading branch information
jbrockopp authored May 17, 2021
1 parent 7352271 commit 962f215
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 1 deletion.
14 changes: 14 additions & 0 deletions cmd/vela-git/command.go
Original file line number Diff line number Diff line change
Expand Up @@ -140,3 +140,17 @@ func submoduleCmd() *exec.Cmd {
"--init",
)
}

// versionCmd is a helper function to output
// the client version information.
func versionCmd() *exec.Cmd {
logrus.Trace("creating git version command")

// variable to store flags for command
var flags []string

// add flag for version git command
flags = append(flags, "version")

return exec.Command("git", flags...)
}
2 changes: 1 addition & 1 deletion cmd/vela-git/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ func run(c *cli.Context) error {

logrus.WithFields(logrus.Fields{
"code": "https://github.com/go-vela/vela-git",
"docs": "https://go-vela.github.io/docs/plugins/registry/git",
"docs": "https://go-vela.github.io/docs/plugins/registry/pipeline/git",
"registry": "https://hub.docker.com/r/target/vela-git",
}).Info("Vela Git Plugin")

Expand Down
6 changes: 6 additions & 0 deletions cmd/vela-git/plugin.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,12 @@ func (p *Plugin) Exec() error {
return err
}

// output the git version for troubleshooting
err = execCmd(versionCmd())
if err != nil {
return err
}

// initialize git repo
err = execCmd(initCmd())
if err != nil {
Expand Down

0 comments on commit 962f215

Please sign in to comment.