Lock file maintenance Python dependencies (#211) #102
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Copyright 2025 Canonical Ltd. | |
| # See LICENSE file for licensing details. | |
| name: Trivy Security Scanner | |
| on: | |
| push: | |
| branches: | |
| - 16-24.04 | |
| pull_request: | |
| permissions: | |
| contents: read # Set the GITHUB_TOKEN permissions to read-only | |
| jobs: | |
| build: | |
| name: Build rock | |
| uses: canonical/data-platform-workflows/.github/workflows/build_rock.yaml@v41.0.0 | |
| scan: | |
| name: Trivy scan | |
| needs: build | |
| runs-on: ubuntu-24.04 | |
| steps: | |
| - name: Checkout repo | |
| uses: actions/checkout@v6 | |
| - name: Install required dependencies | |
| run: | | |
| # rockcraft | |
| sudo snap install rockcraft --classic --edge | |
| # yq | |
| sudo snap install yq | |
| - name: Download rock package(s) | |
| uses: actions/download-artifact@v7 | |
| with: | |
| pattern: ${{ needs.build.outputs.artifact-prefix }}-* | |
| merge-multiple: true | |
| - name: Import locally | |
| run: | | |
| full_version="$(yq .version rockcraft.yaml)" | |
| sudo rockcraft.skopeo --insecure-policy copy \ | |
| "oci-archive:charmed-postgresql_${full_version}_amd64.rock" \ | |
| "docker-daemon:trivy/charmed-postgresql:test" | |
| - name: Run Trivy vulnerability scanner | |
| uses: aquasecurity/trivy-action@0.33.1 | |
| with: | |
| image-ref: "trivy/charmed-postgresql:test" | |
| format: "sarif" | |
| output: "trivy-results.sarif" | |
| severity: "HIGH,CRITICAL" | |
| - name: Upload Trivy scan results to GitHub Security tab | |
| uses: github/codeql-action/upload-sarif@v4 | |
| if: always() | |
| with: | |
| sarif_file: "trivy-results.sarif" |