Skip to content

fix(ci): retry the Trivy download of the image scan steps #4229

Closed

Description

@dan-petty

Problem

The six image scan steps of .github/workflows/ci.yml and release.yml use aquasecurity/trivy-action v0.36.0. The action calls aquasecurity/setup-trivy v0.2.6 unless skip-setup-trivy is true. setup-trivy restores a cached binary, and on a cache miss it runs contrib/install.sh from the Trivy repository. That script downloads the release archive from GitHub with no retry option in the action. A GitHub outage with HTTP 5xx answers on a cache miss fails the scan step (the outage of #4215 and #4216; #4223 fixes the other release downloads).

Expected

Every image scan step gets Trivy from a download that retries on a 5xx answer and on a connect failure, and that checks the pinned SHA-256 of tools.lock. Candidate: install Trivy with devops install-tools --tool trivy --only-missing before the scan, and set skip-setup-trivy: true. The image jobs have no uv today, so the job also needs the step that sets it up, or the scan uses another pinned source.

Acceptance criteria

  • A test fails for each aquasecurity/trivy-action step that lets the action download Trivy. Command: uv run devops ci test tests/invariants/test_workflow_contracts.py.
  • test_every_trivy_scan_runs_the_trivy_tools_lock_pins still proves that CI scans with the Trivy version of tools.lock.

Existing tool considered

Related

Proposed design

Problem statement

The six image scan steps of ci.yml and release.yml let aquasecurity/trivy-action download Trivy through setup-trivy. On a cache miss that download has no retry, so a GitHub 5xx answer fails the scan step. The steps must get Trivy from devops install-tools, which retries after #4223 and checks the SHA-256 of tools.lock.

Acceptance criteria

Requirement: The action never downloads Trivy

Every aquasecurity/trivy-action step in .github/workflows SHALL set the input skip-setup-trivy to "true".

Scenario: A scan step lacks skip-setup-trivy

  • WHEN The contract test reads a trivy-action step with no skip-setup-trivy input, or with a value other than "true".
  • THEN The test fails and names the file, the job and the step.

Requirement: Trivy is installed before each scan

Each job that runs trivy-action SHALL run uv run devops install-tools --tool trivy --only-missing and add $HOME/.local/bin to GITHUB_PATH in a step before the scan step.

Scenario: A job scans with no install step

  • WHEN The contract test reads a job whose scan step has no earlier Trivy install step.
  • THEN The test fails and names the file and the job.

Requirement: The install step runs under the same condition as the scan

Each Trivy install step and toolchain step SHALL carry the same if condition as the scan step of its job, so that a skipped scan also skips the install.

Scenario: An install step runs when its scan is skipped

  • WHEN The contract test reads a job whose scan step has an if and whose install step has a different if.
  • THEN The test fails and names the file and the job.

Requirement: The job holds the tools to run the installer

Each job that installs Trivy SHALL check out the repository and set up the uv toolchain with ./.github/actions/setup-toolchain before the install step.

Scenario: An image job has no uv setup

  • WHEN The contract test reads a job whose install step comes before the checkout or before the toolchain setup step.
  • THEN The test fails and names the file and the job.

Requirement: CI scans with the Trivy version of tools.lock

The contract test SHALL keep the check that every scan step names the Trivy version that tools.lock pins, which the install step installs.

Scenario: The pinned version stays the scan version

  • WHEN The test reads the version input of each of the six scan steps.
  • THEN test_every_trivy_scan_runs_the_trivy_tools_lock_pins passes for the six steps and fails when one version differs from the tools.lock version.

Existing Tool Considered

Covered by existing project code and an existing action input. devops install-tools --tool trivy --only-missing already runs in the static job of ci.yml, it checks the SHA-256 of tools.lock, and it retries after #4223. The skip-setup-trivy input of trivy-action v0.36.0 turns off the setup-trivy download; the archived change of #4223 read it in the action.yaml. No check of alternatives has run. The change adds workflow steps and a changed contract test, and builds no new tool. Cost: one pull request, about 30k tokens and under one hour.

Key questions

  • Which source gives Trivy to the six scan steps?: Use devops install-tools --tool trivy --only-missing and set skip-setup-trivy to "true". The static job already uses this install, and it checks the SHA-256 of tools.lock. (best practice) [sources: .github/workflows/ci.yml, tests/invariants/test_workflow_contracts.py]
    • Chosen: devops install-tools plus skip-setup-trivy. It reuses the pinned and checked installer that the project already runs, and it gets retries from fix(ci): retry the GitHub release downloads #4223.
    • Rejected: Keep setup-trivy and retry the scan step. The retry would run the whole scan again, and the download keeps no SHA-256 check from tools.lock.
    • Rejected: Download the archive with curl --retry in each job. It adds code that duplicates install-tools and needs its own SHA-256 pin.
  • Does the trivy-action v0.36.0 have an input that skips the download?: Yes. The input is skip-setup-trivy. Unless it is true, the action calls setup-trivy v0.2.6, which restores a cache and on a miss runs contrib/install.sh. The action has no retry input. [sources: openspec/changes/archive/2026-11-09-4223-retry-the-download-of-a-release/proposal.md]
  • How do the image jobs get uv?: Add ./.github/actions/setup-toolchain after the checkout in each job that scans. Use a cache-suffix for each job and set save-uv-cache to "false", as the other jobs do. In ci.yml give the setup and install steps the same if as the scan step (image_changes for three jobs, the crawl4ai filter for the third-party job). (best practice) [sources: .github/workflows/ci.yml]
    • Chosen: Use ./.github/actions/setup-toolchain. Every other job that runs uv run devops uses it, and the contract tests already read its use.
    • Rejected: Install uv with a separate action. It adds a second way to get uv and a new pinned action.
  • Does the change need fix(ci): retry the GitHub release downloads #4223 first?: No. The change of fix(ci): retry the GitHub release downloads #4223 is archived in the repository, so install-tools already retries. No dependency is left. [sources: openspec/changes/archive/2026-11-09-4223-retry-the-download-of-a-release/proposal.md]
  • Does the version input of trivy-action still matter when skip-setup-trivy is true?: Keep the version input on each scan step, equal to the tools.lock version. The input is harmless if the action ignores it, and the existing contract test keeps it equal to tools.lock. The installed version comes from tools.lock through install-tools. (best practice) [sources: tests/invariants/test_workflow_contracts.py:462, CHANGELOG.md]
    • Chosen: Keep the version input equal to the tools.lock pin. The existing test stays valid, and the scanned version cannot drift.
    • Rejected: Remove the version input. It changes the existing contract test and risks a different default if the action reads the input.

Fit

Fits in one pull request.

Suspected block

None.

Dependencies

None.

Alternatives check of 2026-11-10: none.
Tool: none found.

Activity

  1. added
    source/agent
    type/bug
    scope/ci
    status/new
    value/medium
    effort/medium
    on Nov 9, 2026
  2. dan-petty commented on Nov 9, 2026

    @dan-petty
    OwnerAuthor

    Intake placed this item to the backlog: intake puts every new item in the backlog. A person plans the milestones.

    • Type: type/bug. The fix prefix of the title gives the type.
    • Scope: scope/ci. The (ci) scope of the title gives the scope.
    • Priority: P2-Medium. CI reliability fix that reduces repeated failures during outages but does not block all development.
    • Value: Medium. Prevents repeated CI scan failures during GitHub outages, saving rerun time.
    • Effort: Medium. Requires workflow changes, a uv setup step, and an invariant test.
    • Related: fix(ci): retry the GitHub release downloads #4223, which asks for a different change. Both address GitHub release download failures during outages, but the candidate fixes the action-internal Trivy download while #4223 fixes direct workflow downloads.
  3. added
    priority/p2-medium
    on Nov 9, 2026
  4. devops-cli-service commented on Nov 9, 2026

    @devops-cli-service
    Contributor

    Refine cannot set this item to Ready at c034509 while the items below stay open. The next refine round looks at the item again when they close, or when a person replies in a comment or edits the body.

  5. added
    status/ready
    and removed
    status/new
    on Nov 9, 2026
  6. devops-cli-service commented on Nov 9, 2026

    @devops-cli-service
    Contributor

    Status set to Ready at 1700648 (see proposed design in issue body).

  7. devops-cli-service commented on Nov 10, 2026

    @devops-cli-service
    Contributor

    Alternatives check: none

    Reason: The searches surfaced only the Trivy setup path the workflow already uses (aquasecurity/setup-trivy, which restores a cache and then runs the non-retrying install script) and generic GitHub-release installers such as taiki-e/install-action, which verifies upstream SHA-256 checksums but installs only the tools in its own manifest (unlisted tools fall back to cargo-binstall) and reads no tools.lock. No open, maintained tool installs Trivy with a retry on 5xx/connect failures and the project's tools.lock SHA-256 pin, so the need stays with the repository's own devops install-tools plus the existing skip-setup-trivy input.

    Tool: none found

    Lacks:

    • Verification of the SHA-256 pins in the project's tools.lock (installers verify upstream checksums only)
    • A retry of the Trivy release download on HTTP 5xx answers and connect failures
    • Trivy support in the manifest-driven installer; unlisted tools fall back to cargo-binstall

    Tools considered:

    Searches run:

    • GitHub Action install Trivy binary with retry and checksum verification, results: 5
    • taiki-e/install-action trivy supported tools, results: 5
    • aquasecurity setup-trivy skip-setup-trivy cache miss install.sh, results: 5
    • trivy install action retry download release archive, results: 5
    • mise aquasecurity trivy install, results: 5
    • taiki-e install-action, results: 5
    • aquasecurity/setup-trivy github action README retry, results: 5
    • taiki-e/install-action github README supported tools checksum, results: 5
    • install-action trivy aquasecurity tool, results: 5
    • aqua declarative CLI version manager checksum GitHub releases action, results: 5

    Sources:

    Checked on 2026-11-10. A person decides what this means for the item. The check changes no label and closes no issue.

  8. added
    status/in-progress
    and removed
    status/ready
    on Nov 18, 2026
  9. added a commit that references this issue on Nov 18, 2026
    5785d1c
  10. added
    status/in-review
    and removed
    status/in-progress
    on Nov 18, 2026
  11. removed
    status/in-review
    on Nov 18, 2026
  12. devops-cli-service commented on Nov 18, 2026

    @devops-cli-service
    Contributor

    Live since 2026-11-18 17:16 UTC

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    effort/mediumpriority/p2-mediumscope/cisource/agenttype/bugvalue/medium

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions