Pass branch name to Sonar
This commit is contained in:
parent
d2afbb890a
commit
6c61395706
BIN
drone-sonar
BIN
drone-sonar
Binary file not shown.
6
main.go
6
main.go
@ -43,6 +43,11 @@ func main() {
|
||||
Usage: "Project version",
|
||||
EnvVar: "DRONE_BUILD_NUMBER",
|
||||
},
|
||||
cli.StringFlag{
|
||||
Name: "branch",
|
||||
Usage: "Project branch",
|
||||
EnvVar: "DRONE_BRANCH",
|
||||
},
|
||||
cli.StringFlag{
|
||||
Name: "timeout",
|
||||
Usage: "Web request timeout",
|
||||
@ -91,6 +96,7 @@ func run(c *cli.Context) {
|
||||
Token: c.String("token"),
|
||||
|
||||
Version: c.String("ver"),
|
||||
Branch: c.String("branch"),
|
||||
Timeout: c.String("timeout"),
|
||||
Sources: c.String("sources"),
|
||||
Inclusions: c.String("inclusions"),
|
||||
|
@ -1,9 +1,9 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"strings"
|
||||
"fmt"
|
||||
"os/exec"
|
||||
"strings"
|
||||
)
|
||||
|
||||
type (
|
||||
@ -14,6 +14,7 @@ type (
|
||||
Token string
|
||||
|
||||
Version string
|
||||
Branch string
|
||||
Sources string
|
||||
Timeout string
|
||||
Inclusions string
|
||||
@ -34,6 +35,7 @@ func (p Plugin) Exec() error {
|
||||
"-Dsonar.login=" + p.Config.Token,
|
||||
|
||||
"-Dsonar.projectVersion=" + p.Config.Version,
|
||||
"-Dsonar.branch.name=" + p.Config.Branch,
|
||||
"-Dsonar.sources=" + p.Config.Sources,
|
||||
"-Dsonar.ws.timeout=" + p.Config.Timeout,
|
||||
"-Dsonar.inclusions=" + p.Config.Inclusions,
|
||||
@ -41,7 +43,6 @@ func (p Plugin) Exec() error {
|
||||
"-Dsonar.log.level=" + p.Config.Level,
|
||||
"-Dsonar.showProfiling=" + p.Config.showProfiling,
|
||||
"-Dsonar.scm.provider=git",
|
||||
|
||||
}
|
||||
cmd := exec.Command("sonar-scanner", args...)
|
||||
// fmt.Printf("==> Executing: %s\n", strings.Join(cmd.Args, " "))
|
||||
|
Loading…
Reference in New Issue
Block a user