Skip to content

chore(deps): update aquasecurity/trivy-action action to v0.29.0 #1716

chore(deps): update aquasecurity/trivy-action action to v0.29.0

chore(deps): update aquasecurity/trivy-action action to v0.29.0 #1716

Workflow file for this run

name: Analysis
on:
pull_request:
types: [opened, reopened, synchronize, ready_for_review, converted_to_draft]
push:
branches: [main]
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
tests-backend:
name: Tests (Backend)
if: github.event_name != 'pull_request' || !github.event.pull_request.draft
runs-on: ubuntu-latest
steps:
- uses: bcgov-nr/action-test-and-analyse-java@v1.0.2
with:
commands: mvn --no-transfer-progress clean compile verify package checkstyle:checkstyle -P all-tests
dir: backend
java-cache: maven
java-distribution: temurin
java-version: 21
sonar_args: >
-Dsonar.exclusions=**/configuration/**,**/dto/**,**/entity/**,**/exception/**,**/job/**,**/*$*Builder*,**/ResultsApplication.*,**/*Constants.*,**/security/*Converter.*
-Dsonar.coverage.jacoco.xmlReportPaths=target/coverage-reports/merged-test-report/jacoco.xml
-Dsonar.organization=bcgov-sonarcloud
-Dsonar.project.monorepo.enabled=true
-Dsonar.projectKey=nr-silva-backend
sonar_token: ${{ secrets.SONAR_TOKEN_BACKEND }}
# Only use triggers for PRs
triggers: ${{ github.event_name == 'pull_request' && '("backend/")' || '' }}
lint-frontend:
name: Lint (Frontend)
if: github.event_name != 'pull_request' || !github.event.pull_request.draft
runs-on: ubuntu-latest
steps:
- uses: bcgov-nr/action-test-and-analyse@v1.2.1
with:
commands: |
npm ci
npm run lint || true
dir: frontend
node_version: "20"
# Only use triggers for PRs
triggers: ${{ github.event_name == 'pull_request' && '("frontend/")' || '' }}
tests-frontend:
name: Tests (Frontend)
if: github.event_name != 'pull_request' || !github.event.pull_request.draft
runs-on: ubuntu-latest
steps:
- uses: bcgov-nr/action-test-and-analyse@v1.2.1
env:
VITE_ZONE: test
VITE_USER_POOLS_ID: ca-central-1_abc123
VITE_USER_POOLS_WEB_CLIENT_ID: abc123
VITE_BACKEND_URL: http://localhost:8080
with:
commands: |
npm ci
npm run test:coverage
dir: frontend
node_version: "20"
sonar_args: >
-Dsonar.organization=bcgov-sonarcloud
-Dsonar.projectKey=nr-silva-frontend
-Dsonar.javascript.lcov.reportPaths=coverage/lcov.info
-Dsonar.typescript.tsconfigPaths=tsconfig.json
-Dsonar.sources=src/
-Dsonar.exclusions=src/__test__/**,src/amplifyconfiguration.*,src/**/*.scss,src/**/*.css,src/**/*.d.*,src/setupTests.*
-Dsonar.tests=src/__test__/
-Dsonar.project.monorepo.enabled=true
sonar_token: ${{ secrets.SONAR_TOKEN_FRONTEND }}
# Only use triggers for PRs
triggers: ${{ github.event_name == 'pull_request' && '("frontend/")' || '' }}
# https://github.com/marketplace/actions/aqua-security-trivy
trivy:
name: Trivy Security Scan
if: github.event_name != 'pull_request' || !github.event.pull_request.draft
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Run Trivy vulnerability scanner in repo mode
uses: aquasecurity/trivy-action@0.29.0
with:
format: "sarif"
output: "trivy-results.sarif"
ignore-unfixed: true
scan-type: "fs"
scanners: "vuln,secret,config"
severity: "CRITICAL,HIGH"
- name: Upload Trivy scan results to GitHub Security tab
uses: github/codeql-action/upload-sarif@v3
with:
sarif_file: "trivy-results.sarif"
results:
name: Analysis Results
if: always()
# Include all needs that could have failures!
needs: [lint-frontend, tests-backend, tests-frontend] # Include trivy when/if it gets back to being reliable
runs-on: ubuntu-latest
steps:
- run: |
# View results
echo "needs.*.result: ${{ toJson(needs.*.result) }}"
- if: contains(needs.*.result, 'failure')
run: |
# Job failure found
echo "At least one job has failed"
exit 1