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 4f9c85f commit 6316687
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions .github/workflows/sonar-evidence-example.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ permissions:
id-token: write
contents: read


jobs:
docker-build-with-sonar-evidence:
runs-on: ubuntu-latest
Expand Down Expand Up @@ -61,7 +60,11 @@ jobs:
-Dsonar.verbose=true \
-Dsonar.token=$SONAR_TOKEN
# create evidence from sonar-scan analysis
./examples/sonar-scan-example/bin/sonar-scan-extractor-linux-amd64 --reportTaskFile=$PWD/.scannerwork/report-task.txt --FailOnAnalysisFailure > predicate.json
./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"
- name: Log in to Artifactory Docker Registry
uses: docker/login-action@v3
Expand Down Expand Up @@ -97,7 +100,8 @@ jobs:
- name: Create evidence
run: |
if: ${{ steps.run-sonar-scanner.outputs.exit_code }}
run: |
# Attach evidence onto build using JFrog CLI
jf evd create \
--build-name $GITHUB_WORKFLOW \
Expand Down

0 comments on commit 6316687

Please sign in to comment.