- trivy-registry-image.yml : scan image conteneur publiee (registry_package published) - trivy-repo-weekly.yml : scan lockfiles hebdo (lundi 06:00) + dispatch manuel Dormants tant que les Actions ne sont pas activees + runner enregistre.
41 lines
1.5 KiB
YAML
41 lines
1.5 KiB
YAML
---
|
|
# Trivy — scan image conteneur publiée sur le registre Gitea (git.ccado.fr)
|
|
# Déclencheur : package (type container) publié / lié au dépôt.
|
|
# NB Gitea 1.27 : l'événement registry_package ne supporte QUE `published`
|
|
# (le type `updated` n'existe pas — cf. modules/actions/workflows.go).
|
|
name: trivy-registry-image
|
|
on:
|
|
registry_package:
|
|
types: [published]
|
|
workflow_dispatch:
|
|
|
|
concurrency:
|
|
group: trivy-image-${{ gitea.ref_name }}
|
|
cancel-in-progress: true
|
|
|
|
jobs:
|
|
scan-image:
|
|
# Ne scanner que les images conteneur du registre lié à ce dépôt
|
|
if: gitea.event.package.type == 'container'
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Scan Trivy — image publiée (auth registre via GITEA_TOKEN)
|
|
uses: aquasecurity/trivy-action@v0.36.0
|
|
with:
|
|
image-ref: git.ccado.fr/${{ gitea.event.package.name }}:${{ gitea.event.package.version }}
|
|
format: table
|
|
exit-code: 1 # échoue sur HIGH/CRITICAL
|
|
severity: HIGH,CRITICAL
|
|
ignore-unfixed: true # vulns sans fix dispo = bruit
|
|
timeout: 15m
|
|
env:
|
|
TRIVY_CACHE_DIR: /tmp/.trivy
|
|
TRIVY_USERNAME: ${{ github.actor }}
|
|
TRIVY_PASSWORD: ${{ secrets.GITEA_TOKEN }}
|
|
|
|
- name: Résultat
|
|
if: failure()
|
|
run: echo "::warning::Vulnérabilités HIGH/CRITICAL détectées sur l'image ${{ gitea.event.package.name }}:${{ gitea.event.package.version }}" |