← All insightsAutomation

Automating Trivy from scratch

CodeWizard Academy · 25 March 2026 · 3 min read · Intermediate

Anything you do to Trivy twice should be automated. This walks the path from a manual install to a repeatable, pipeline-driven setup.

1. Install it reproducibly

bash
brew install trivy   # or: docker run aquasec/trivy
trivy --version

2. Describe the desired state

Config file to fail only on HIGH/CRITICAL and ignore unfixed CVEs.

yaml
# trivy.yaml
severity:
  - HIGH
  - CRITICAL
vulnerability:
  ignore-unfixed: true
exit-code: 1

3. Run it from CI

Fail the build on fixable high/critical CVEs.

yaml
- uses: aquasecurity/trivy-action@0.24.0
  with:
    image-ref: ghcr.io/${{ github.repository }}:${{ github.sha }}
    severity: HIGH,CRITICAL
    ignore-unfixed: true
    exit-code: 1

Want senior help putting Trivy to work - or a team bootcamp on it? CodeWizard runs Israel's largest DevOps community and embeds named senior engineers with a transparent hours log. Book a free consult or explore the Academy.

Like where this is going?

Get hands-on help from the engineers who write these posts.

Book a free consult