Skip to content

Commit 136ea9a

Browse files
Merge pull request #106 from diegopereiraeng/main
Doc Fix - Host override fix
2 parents 91e8d95 + def0747 commit 136ea9a

File tree

2 files changed

+24
-2
lines changed

2 files changed

+24
-2
lines changed

README.md

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ This plugin is designed to run SonarQube scans, handle the results, and convert
1212

1313
- **New Parameter: `sonar_config_file_override`**
1414
- **Type**: Boolean
15-
- **Description**: If set to true, the plugin will use the `sonar-project.properties` file and allow overriding of host, login, and/or project key settings.
15+
- **Description**: If set to true, the plugin will use the `sonar-project.properties` file and allow overriding of project key setting.
1616
- **Environment Variable**: `PLUGIN_SONAR_CONFIG_FILE_OVERRIDE`
1717
- **Allowed Values**: `"true"`, `"false"`
1818

@@ -22,6 +22,28 @@ This plugin is designed to run SonarQube scans, handle the results, and convert
2222
- **Environment Variable**: `PLUGIN_QUALITY_GATE_ERROR_EXIT_CODE`
2323
- **Default Value**: `5`
2424

25+
### Example
26+
27+
```yaml
28+
- step:
29+
type: Plugin
30+
name: "Sonar Scan"
31+
identifier: run_sonar
32+
spec:
33+
connectorRef: account.DockerHubDiego
34+
image: plugins/sonarqube-scanner:v2.4.2
35+
reports:
36+
type: JUnit
37+
spec:
38+
paths:
39+
- "sonarResults.xml"
40+
privileged: false
41+
settings:
42+
sonar_host: https://mysonar.com
43+
sonar_token: <+secrets.getValue("sonar_diego")>
44+
sonar_config_file: "true"
45+
```
46+
2547
## Main Features - v2.4.1
2648
2749
- Sonar CLI downgraded from 6.0.0.4432 to 5.0.1.3006

plugin.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -513,7 +513,7 @@ func (p Plugin) Exec() error {
513513
// Configuration file exists, let sonar-scanner use it without additional parameters
514514
fmt.Println("Configuration file found. Using sonar-project.properties.")
515515

516-
if len(p.Config.Host) >= 1 && p.Config.UseSonarConfigFileOverride {
516+
if len(p.Config.Host) >= 1 {
517517
fmt.Println("OVERRIDING sonar.host.url=" + p.Config.Host)
518518
args = append(args, "-Dsonar.host.url="+p.Config.Host)
519519
}

0 commit comments

Comments
 (0)