From 70c6d022b1854d95cdd7616a017d4cac41bd3527 Mon Sep 17 00:00:00 2001 From: Corneil du Plessis Date: Tue, 2 Apr 2024 17:47:47 +0200 Subject: [PATCH] [CI] Check sarif location --- .github/workflows/common.yml | 27 ++++++++++++++++++++++++--- 1 file changed, 24 insertions(+), 3 deletions(-) diff --git a/.github/workflows/common.yml b/.github/workflows/common.yml index fe110775..b973434e 100644 --- a/.github/workflows/common.yml +++ b/.github/workflows/common.yml @@ -359,15 +359,22 @@ jobs: popd > /dev/null - name: Scan Jar files shell: bash + id: scan run: | ROOT_DIR=$(realpath $PWD) pushd stream-applications > /dev/null $ROOT_DIR/scan-folders.sh popd > /dev/null + if [ -f scan.sarif ]; then + echo "scan_file=$(realpath scan.sarif)" >> $GITHUB_OUTPUT + else + echo "scan_file=" >> $GITHUB_OUTPUT + fi - name: Upload Trivy scan results to GitHub Security tab + if: ${{ steps.scan.output.scan_file != null && steps.scan.output.scan_file != '' }} uses: github/codeql-action/upload-sarif@v3 with: - sarif_file: 'scan.sarif' + sarif_file: '${{ steps.scan.output.scan_file }}' - name: 'Configure: Docker login' uses: docker/login-action@v2 with: @@ -498,16 +505,23 @@ jobs: fi popd > /dev/null - name: Scan Jar files + id: scan shell: bash run: | ROOT_DIR=$(realpath $PWD) pushd stream-applications > /dev/null $ROOT_DIR/scan-folders.sh popd > /dev/null + if [ -f scan.sarif ]; then + echo "scan_file=$(realpath scan.sarif)" >> $GITHUB_OUTPUT + else + echo "scan_file=" >> $GITHUB_OUTPUT + fi - name: Upload Trivy scan results to GitHub Security tab + if: ${{ steps.scan.output.scan_file != null && steps.scan.output.scan_file != '' }} uses: github/codeql-action/upload-sarif@v3 with: - sarif_file: 'scan.sarif' + sarif_file: '${{ steps.scan.output.scan_file }}' - name: 'Configure: Docker login' uses: docker/login-action@v2 with: @@ -640,15 +654,22 @@ jobs: popd > /dev/null - name: Scan Jar files shell: bash + id: scan run: | ROOT_DIR=$(realpath $PWD) pushd stream-applications > /dev/null $ROOT_DIR/scan-folders.sh popd > /dev/null + if [ -f scan.sarif ]; then + echo "scan_file=$(realpath scan.sarif)" >> $GITHUB_OUTPUT + else + echo "scan_file=" >> $GITHUB_OUTPUT + fi - name: Upload Trivy scan results to GitHub Security tab + if: ${{ steps.scan.output.scan_file != null && steps.scan.output.scan_file != '' }} uses: github/codeql-action/upload-sarif@v3 with: - sarif_file: 'scan.sarif' + sarif_file: '${{ steps.scan.output.scan_file }}' - name: 'Configure: Docker login' uses: docker/login-action@v2 with: