|
35 | 35 |
|
36 | 36 | // sonarDashStatic is a static string used in the dashboard URL. |
37 | 37 | sonarDashStatic = "/dashboard?id=" |
38 | | - |
| 38 | + //https://sonar.dfinsolutions.com/dashboard?id=dfinsolutions_Saturn-UI_AYezvlRKNrcjU-xpGTBl&pullRequest=1244 |
39 | 39 | // basicAuth is the basic authentication string. |
40 | 40 | basicAuth = "Basic " |
41 | 41 | ) |
|
88 | 88 | TaskId string |
89 | 89 | SkipScan bool |
90 | 90 | WaitQualityGate bool |
| 91 | + Workspace string |
91 | 92 | } |
92 | 93 | Output struct { |
93 | 94 | OutputFile string // File where plugin output are saved |
@@ -346,6 +347,11 @@ func ParseJunit(projectArray Project, projectName string) Testsuites { |
346 | 347 | os.Setenv("SONAR_RESULT_OVERALL_ERRORS", fmt.Sprintf("%d", errors)) // Set the number of errors as an environment variable |
347 | 348 |
|
348 | 349 | dashboardLink := os.Getenv("PLUGIN_SONAR_HOST") + sonarDashStatic + os.Getenv("PLUGIN_SONAR_KEY") |
| 350 | + if os.Getenv("PLUGIN_PR_KEY") != "" { |
| 351 | + dashboardLink = os.Getenv("PLUGIN_SONAR_HOST") + sonarDashStatic + os.Getenv("PLUGIN_SONAR_KEY") + "&pullRequest=" + os.Getenv("PLUGIN_PR_KEY") |
| 352 | + } else if os.Getenv("PLUGIN_BRANCHANALYSIS") == "true" { |
| 353 | + dashboardLink = os.Getenv("PLUGIN_SONAR_HOST") + sonarDashStatic + os.Getenv("PLUGIN_SONAR_KEY") + "&branch=" + os.Getenv("PLUGIN_BRANCH") |
| 354 | + } |
349 | 355 | SonarJunitReport := &Testsuites{ |
350 | 356 | TestSuite: []Testsuite{ |
351 | 357 | Testsuite{ |
@@ -468,6 +474,10 @@ func (p Plugin) Exec() error { |
468 | 474 | args = append(args, params...) |
469 | 475 | } |
470 | 476 |
|
| 477 | + if len(p.Config.Workspace) >= 1 { |
| 478 | + args = append(args, "-Dsonar.projectBaseDir="+p.Config.Workspace) |
| 479 | + } |
| 480 | + |
471 | 481 | // Assuming your struct has a print or log method |
472 | 482 | if len(p.Config.JacocoReportPath) >= 1 { |
473 | 483 | fmt.Printf("\n\n==> Sonar Java Plugin Jacoco configured!\n\n") |
|
0 commit comments