Skip to content

Commit

Permalink
CCS-4 create sonar evidence only on successfull analysis result
Browse files Browse the repository at this point in the history
  • Loading branch information
carmithersh committed Feb 9, 2025
1 parent 6316687 commit f8f81b2
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions .github/workflows/sonar-evidence-example.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ jobs:
distribution: 'temurin' # You can also use 'temurin', 'zulu', etc.

- name: Run SonarScanner
id: run-sonar-scanner
env:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
run: |
Expand All @@ -63,7 +64,14 @@ jobs:
./examples/sonar-scan-example/bin/sonar-scan-extractor-linux-amd64 --reportTaskFile=$PWD/.scannerwork/report-task.txt --FailOnAnalysisFailure > predicate.json || true
EXIT_CODE=$?
echo "Sonar scan extractor exist code: $EXIT_CODE"
echo "::set-output name=create_sonar_evidence::$EXIT_CODE"
echo "Sonar scan report:"
cat $PWD/.scannerwork/report-task.txt
echo "Sonar scan extractor output:"
cat predicate.json
echo "Sonar scan extractor log:"
cat sonar-scan.log
echo echo "create-sonar-evidence=$EXIT_CODE" >> $GITHUB_OUTPUT
- name: Log in to Artifactory Docker Registry
Expand Down Expand Up @@ -100,7 +108,7 @@ jobs:
- name: Create evidence
if: ${{ steps.run-sonar-scanner.outputs.exit_code }}
if: ${{ steps.run-sonar-scanner.outputs.create-sonar-evidence == 0 }}
run: |
# Attach evidence onto build using JFrog CLI
jf evd create \
Expand Down

0 comments on commit f8f81b2

Please sign in to comment.