Skip to content

Scan

Scan #1981

Workflow file for this run

---
name: Scan
on:
push:
branches:
- develop
- develop-1.9
paths:
- ".github/workflows/scan.yml"
- "Dockerfile"
pull_request:
branches:
- develop
- develop-1.9
paths:
- ".github/workflows/scan.yml"
- "Dockerfile"
schedule:
- cron: '0 0 * * *'
env:
IMAGE_NAME: ghcr.io/opendatacube/ows
permissions: {}
# When a PR is updated, cancel the jobs from the previous version. Merges
# do not define head_ref, so use run_id to never cancel those jobs.
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
jobs:
cve-scanner:
timeout-minutes: 15
runs-on: ubuntu-latest
if: github.event_name != 'release'
permissions:
security-events: write
steps:
- name: Checkout git
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
with:
fetch-depth: 0
- name: Get and log unstable git tag
run: |
set -ex
UNSTABLE_TAG=$(git describe --tags)
echo "UNSTABLE_TAG=$UNSTABLE_TAG" >> $GITHUB_ENV
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@e468171a9de216ec08956ac3ada2f0791b6bd435 # v3.11.1
- name: Get Git commit timestamps
run: |
TIMESTAMP=$(git log -1 --pretty=%ct pyproject.toml uv.lock datacube_ows)
echo "TIMESTAMP=$TIMESTAMP" >> $GITHUB_ENV
- name: Build Docker
uses: docker/build-push-action@263435318d21b8e681c14492fe198d362a7d2c83 # v6.18.0
with:
file: Dockerfile
context: .
tags: ${{ env.IMAGE_NAME }}:${{ env.UNSTABLE_TAG }}
load: true
cache-from: type=gha
cache-to: type=gha,mode=max
env:
SOURCE_DATE_EPOCH: ${{ env.TIMESTAMP }}
- name: Run vulnerability scanner
uses: aquasecurity/trivy-action@f9424c10c36e288d5fa79bd3dfd1aeb2d6eae808 # 0.33.0
with:
image-ref: "${{ env.IMAGE_NAME }}:${{ env.UNSTABLE_TAG }}"
format: "sarif"
output: 'trivy-results.sarif'
# exit-code: "1"
severity: "CRITICAL,HIGH"
- name: Upload Trivy scan results to GitHub Security tab
uses: github/codeql-action/upload-sarif@f1f6e5f6af878fb37288ce1c627459e94dbf7d01 # v3.29.5
with:
sarif_file: 'trivy-results.sarif'