From 8750bc224272dd88a7308eca02a22b4096a107a1 Mon Sep 17 00:00:00 2001 From: Corneil du Plessis Date: Wed, 30 Oct 2024 12:49:53 +0200 Subject: [PATCH] [CI] Update builds so that Trivy scan is in a separate job. --- .github/workflows/milestone-worker.yml | 38 +++++++++++++------ .github/workflows/next-dev-version-worker.yml | 26 +++++++++++++ .github/workflows/release-worker.yml | 38 +++++++++++++------ 3 files changed, 78 insertions(+), 24 deletions(-) diff --git a/.github/workflows/milestone-worker.yml b/.github/workflows/milestone-worker.yml index 2f805d64..70645bf3 100644 --- a/.github/workflows/milestone-worker.yml +++ b/.github/workflows/milestone-worker.yml @@ -74,18 +74,6 @@ jobs: jfrog rt build-publish echo BUILD_ZOO_HANDLER_spring_cloud_deployer_buildname=spring-cloud-deployer-2-9-x-milestone >> $GITHUB_ENV echo BUILD_ZOO_HANDLER_spring_cloud_deployer_buildnumber=$GITHUB_RUN_NUMBER >> $GITHUB_ENV - - name: Run Trivy vulnerability scanner in repo mode - uses: aquasecurity/trivy-action@master - with: - scan-type: 'fs' - ignore-unfixed: true - format: 'sarif' - output: 'trivy-results.sarif' - severity: 'CRITICAL,HIGH' - - name: Upload Trivy scan results to GitHub Security tab - uses: github/codeql-action/upload-sarif@v2 - with: - sarif_file: 'trivy-results.sarif' # zoo tag - name: Tag Release uses: jvalkeal/build-zoo-handler@v0.0.4 @@ -119,3 +107,29 @@ jobs: - name: Clean cache run: | find ~/.m2/repository -type d -name '*SNAPSHOT' | xargs rm -fr + scan: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Run Trivy vulnerability scanner in repo mode + uses: aquasecurity/trivy-action@master + with: + scan-type: 'fs' + ignore-unfixed: true + format: 'sarif' + output: 'trivy-results.sarif' + severity: 'CRITICAL,HIGH' + - name: Upload Trivy scan results to GitHub Security tab + uses: github/codeql-action/upload-sarif@v2 + with: + sarif_file: 'trivy-results.sarif' + - name: 'Scanned' + shell: bash + run: echo "::info ::Scanned" + done: + runs-on: ubuntu-latest + needs: [ scan, build ] + steps: + - name: 'Done' + shell: bash + run: echo "::info ::Done" diff --git a/.github/workflows/next-dev-version-worker.yml b/.github/workflows/next-dev-version-worker.yml index 4c9ce096..b6ef7e02 100644 --- a/.github/workflows/next-dev-version-worker.yml +++ b/.github/workflows/next-dev-version-worker.yml @@ -103,3 +103,29 @@ jobs: - name: Clean cache run: | find ~/.m2/repository -type d -name '*SNAPSHOT' | xargs rm -fr + scan: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Run Trivy vulnerability scanner in repo mode + uses: aquasecurity/trivy-action@master + with: + scan-type: 'fs' + ignore-unfixed: true + format: 'sarif' + output: 'trivy-results.sarif' + severity: 'CRITICAL,HIGH' + - name: Upload Trivy scan results to GitHub Security tab + uses: github/codeql-action/upload-sarif@v2 + with: + sarif_file: 'trivy-results.sarif' + - name: 'Scanned' + shell: bash + run: echo "::info ::Scanned" + done: + runs-on: ubuntu-latest + needs: [ scan, build ] + steps: + - name: 'Done' + shell: bash + run: echo "::info ::Done" diff --git a/.github/workflows/release-worker.yml b/.github/workflows/release-worker.yml index b934d97a..c816d733 100644 --- a/.github/workflows/release-worker.yml +++ b/.github/workflows/release-worker.yml @@ -72,18 +72,6 @@ jobs: jfrog rt build-publish echo BUILD_ZOO_HANDLER_spring_cloud_deployer_buildname=spring-cloud-deployer-2-9-x-release >> $GITHUB_ENV echo BUILD_ZOO_HANDLER_spring_cloud_deployer_buildnumber=$GITHUB_RUN_NUMBER >> $GITHUB_ENV - - name: Run Trivy vulnerability scanner in repo mode - uses: aquasecurity/trivy-action@master - with: - scan-type: 'fs' - ignore-unfixed: true - format: 'sarif' - output: 'trivy-results.sarif' - severity: 'CRITICAL,HIGH' - - name: Upload Trivy scan results to GitHub Security tab - uses: github/codeql-action/upload-sarif@v2 - with: - sarif_file: 'trivy-results.sarif' # zoo tag - name: Tag Release uses: jvalkeal/build-zoo-handler@v0.0.4 @@ -117,3 +105,29 @@ jobs: - name: Clean cache run: | find ~/.m2/repository -type d -name '*SNAPSHOT' | xargs rm -fr + scan: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Run Trivy vulnerability scanner in repo mode + uses: aquasecurity/trivy-action@master + with: + scan-type: 'fs' + ignore-unfixed: true + format: 'sarif' + output: 'trivy-results.sarif' + severity: 'CRITICAL,HIGH' + - name: Upload Trivy scan results to GitHub Security tab + uses: github/codeql-action/upload-sarif@v2 + with: + sarif_file: 'trivy-results.sarif' + - name: 'Scanned' + shell: bash + run: echo "::info ::Scanned" + done: + runs-on: ubuntu-latest + needs: [ scan, build ] + steps: + - name: 'Done' + shell: bash + run: echo "::info ::Done"