Skip to content

Publish image to GHCR on push and (scheduled) trivy #49

Publish image to GHCR on push and (scheduled) trivy

Publish image to GHCR on push and (scheduled) trivy #49

name: "Publish image to GHCR on push and (scheduled) trivy"
# All triggers have to be in one file, so that the trivy results can be compared to identify introduced vulnerabilities
# See DBP-340
on:
push:
schedule:
- cron: '0 2 * * *'
concurrency:
group: dbildungs-iam-keycloak-${{ github.event_name }}-${{ github.ref_name }}
cancel-in-progress: true
jobs:
build_image_on_push:
name: "Publish image and scan with trivy"
if: ${{ github.event_name == 'push' }}
permissions:
packages: write
security-events: write
contents: read
uses: dBildungsplattform/dbp-github-workflows/.github/workflows/[email protected]
with:
image_name: "dbildungs-iam"
run_trivy_scan: true
tag_generation: ${{ github.ref_name == 'main' && 'commit_hash' || 'ticket_from_branch' }}
add_latest_tag: ${{ github.ref_name == 'main' }}
container_registry: "ghcr.io"
fail_on_vulnerabilites: true
report_location: "Dockerfile"
scheduled_trivy_scan:
name: "Scheduled trivy scan of latest image"
if: ${{ github.event_name == 'schedule' }}
permissions:
packages: read
security-events: write
uses: dBildungsplattform/dbp-github-workflows/.github/workflows/[email protected]
with:
image_ref: 'ghcr.io/${{ github.repository_owner }}/dbildungs-iam:latest'
fail_on_vulnerabilites: false
report_location: "Dockerfile"