[DPE-7402] [DPE-7468] Add prometheus-exporter files #14
Workflow file for this run
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: | |
- 2-24.04/edge | |
pull_request: | |
workflow_dispatch: | |
jobs: | |
build: | |
name: Build rock | |
uses: canonical/data-platform-workflows/.github/workflows/build_rock.yaml@v32.0.0 | |
scan: | |
name: Trivy scan | |
needs: build | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: Checkout repo | |
uses: actions/checkout@v3 | |
- 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@v4 | |
with: | |
pattern: ${{ needs.build.outputs.artifact-prefix }}-* | |
merge-multiple: true | |
- name: Import locally | |
run: | | |
version="$(yq .version rockcraft.yaml)" | |
sudo rockcraft.skopeo --insecure-policy \ | |
copy \ | |
oci-archive:charmed-opensearch-dashboards_${version}_amd64.rock \ | |
docker-daemon:trivy/charmed-opensearch-dashboards:test | |
- name: Run Trivy vulnerability scanner | |
uses: aquasecurity/trivy-action@0.31.0 | |
with: | |
image-ref: 'trivy/charmed-opensearch-dashboards:test' | |
format: 'sarif' | |
output: 'trivy-results.sarif' | |
severity: 'MEDIUM,HIGH,CRITICAL' | |
- name: Upload Trivy scan results to GitHub Security tab | |
uses: github/codeql-action/upload-sarif@v3 | |
if: always() | |
with: | |
sarif_file: 'trivy-results.sarif' | |
- name: Run Trivy in GitHub SBOM mode and submit results to Dependency Graph | |
uses: aquasecurity/trivy-action@0.31.0 | |
with: | |
scan-type: 'image' | |
format: 'spdx-json' | |
output: 'dependency-results.sbom.json' | |
image-ref: 'trivy/charmed-opensearch-dashboards:test' | |
github-pat: ${{ secrets.GITHUB_TOKEN }} | |
severity: 'MEDIUM,HIGH,CRITICAL' | |
scanners: 'vuln' | |
- name: Upload trivy report as a Github artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: trivy-sbom-report | |
path: '${{ github.workspace }}/dependency-results.sbom.json' | |
retention-days: 90 |