Skip to content

Commit 84616ab

Browse files
committed
Add live docs links to sonar webhook docs page
1 parent 8e5e75a commit 84616ab

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

cmd/kosli/attestSonar.go

+4-1
Original file line numberDiff line numberDiff line change
@@ -34,12 +34,15 @@ Retrieves results for the specified scan from SonarCloud or SonarQube and attest
3434
The results are parsed to find the status of the project's quality gate which is used to determine the attestation's compliance status.
3535
3636
The scan to be retrieved can be specified in two ways:
37-
1. Using metadata created by the Sonar scanner. By default this is located within a temporary .scannerwork folder in the repo base directory.
37+
1. (Default) Using metadata created by the Sonar scanner. By default this is located within a temporary .scannerwork folder in the repo base directory.
3838
If you have overriden the location of this folder by passing parameters to the Sonar scanner, or are running Kosli's CLI locally outside the repo's base directory,
3939
you can provide the correct path using the --sonar-working-dir flag. This metadata is generated by a specific scan, allowing Kosli to retrieve the results of that scan.
4040
2. Providing the Sonar project key and the revision of the scan (plus the SonarQube server URL if relevant). If running the Kosli CLI in some CI/CD pipeline, the revision
4141
is defaulted to the commit SHA. If you are running the command locally, or have overriden the revision in SonarCloud/SonarQube via parameters to the Sonar scanner, you can
4242
provide the correct revision using the --sonar-revision flag. Kosli then finds the scan results for the specified project key and revision.
43+
44+
Note that if your project is very large and you are using SonarCloud's automatic analysis, it is possible for the attest sonar command to run before the SonarCloud scan is completed.
45+
In this case, we recommend using Kosli's Sonar webhook integration ( https://docs.kosli.com/integrations/sonar/ ) rather than the CLI to attest the scan results.
4346
` + attestationBindingDesc
4447

4548
const attestSonarExample = `

docs.kosli.com/content/integrations/sonar.md

+6-1
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ $ sonar scanner \
6868
```
6969

7070

71-
### Possible scanner parameters:
71+
### Scanner parameters:
7272
- `sonar.analysis.kosli_flow=<YourFlowName>`
7373
- The name of the Flow relevant to your project. If a Flow does not already exist with the given name, it is created. If no Flow name is provided, the project key of your project in SonarCloud/SonarQube is used as the name (with any invalid symbols replaced by '-').
7474
- `sonar.analysis.kosli_trail=<YourTrailName>`
@@ -87,5 +87,10 @@ $ sonar scanner \
8787
To test the webhook once configured, simply scan a project in SonarCloud or SonarQube. If successful, the results of the scan will be attested to the relevant Flow and Trail (and artifact, if applicable) as a sonar attestation. <br>
8888
If the webhook fails, check that you have passed the parameters to the scanner correctly, and that the trail name, attestation name and artifact fingerprint are valid.
8989

90+
## Live Example in CI system
91+
View an example of a sonar attestation via webhook in Github.
92+
93+
In [this YAML file](https://app.kosli.com/api/v2/livedocs/cyber-dojo/yaml?ci=github&command=-Dsonar.analysis.kosli_flow), which created [this Kosli event](https://app.kosli.com/api/v2/livedocs/cyber-dojo/event?ci=github&command=-Dsonar.analysis.kosli_flow).
94+
9095
## Alternatives:
9196
If you'd rather not use webhooks, or they don't quite fit your use-case, we also have a [CLI command](/client_reference/kosli_attest_sonar/) for attesting Sonar scan results to Kosli.

0 commit comments

Comments
 (0)