Skip to content

fix(unpinned-images): treat images of drop-in forks of docker/build-push-action as local - #328

Merged
jdx merged 1 commit into
mainfrom
claude/funny-hamilton-5da51e
Oct 31, 2026
Merged

jdx merged 1 commit into
mainfrom
claude/funny-hamilton-5da51e

Conversation

@jdx

@jdx jdx commented Oct 31, 2026 •

Copy link
Copy Markdown
Owner

unpinned-images now treats an image built by a drop-in replacement of docker/build-push-action as local, the same way as one built by docker/build-push-action itself. A later docker run app:ci no longer asks for a digest that the registry can't provide. Fixes #327.

The recognised build actions are now a set (buildPushActions): docker/build-push-action, useblacksmith/build-push-action, depot/build-push-action and warpbuilds/build-push-action. Their tags: are local images. An action outside the set that happens to take a tags: input still has its image reported.

Before and after

The repro from the issue, default profile, no config file:

name: repro
on: pull_request
permissions: {}
concurrency:
  group: ${{ github.workflow }}-${{ github.ref }}
  cancel-in-progress: true
jobs:
  build:
    runs-on: ubuntu-24.04
    timeout-minutes: 10
    steps:
      - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
        with:
          persist-credentials: false
      - uses: useblacksmith/build-push-action@9b0579bbec7a6cad2f171596c57e7ac1e7658850 # v2.3.0
        with:
          context: .
          load: true
          tags: app:ci
      - run: docker run --rm app:ci true

Before (main at ad5f1f1):

.github/workflows/solo.yml:20:30: image "app:ci" of "docker run" in this script is pinned by a tag, which can be moved to another image. pin it to a digest like "app:ci@sha256:{digest}" [unpinned-images]
   |
20 |       - run: docker run --rm app:ci true
   |                              ^~~~~~
exit=1

After (this branch):

exit=0
Which forks were added, and why

I added only actions whose action.yml declares the same tags, load, push and outputs inputs as docker/build-push-action, with the same descriptions:

Action Relation to docker/build-push-action Extra inputs
useblacksmith/build-push-action GitHub fork estargz
warpbuilds/build-push-action GitHub fork api-key, profile-name, timeout
depot/build-push-action separate implementation project, token, save, buildx-fallback and others

I looked for namespacelabs/nscloud-build-push-action, runs-on/build-push-action, cirruslabs/build-push-action and ubicloud/build-push-action. None of them exists or has an action.yml, so none was added. No configuration option was added, because the rule has no existing place for a list of build actions.

Tests
  • TestUnpinnedImagesInScripts covers the build-from-another-step case for each of the four actions. It also lints the issue's workflow (testdata/unpinned_images/build_push_fork.yaml) with the default profile and expects no finding.
  • A new case checks that an unknown action with a tags: input (example/not-a-build-action) still has app:ci reported.
  • With the old matching restored, the three fork cases and the repro case fail and the unknown-action case passes.
  • mise run lint passes.
  • go test -race ./... passes, except TestShellcheckConfigWithRealShellcheck. That test fails the same way on main at ad5f1f1 in my sandbox, where shellcheck can't read the test's rc file under /tmp. CI passes it on main.

The repro isn't in testdata/ok/: that harness lints with an empty config instead of the default profile, so the old code passes it too.

Not in this PR

The issue also says that built tags are collected across the whole workflow, not per job. An image built in one job hides a docker run of it in a job that never builds it. collectLocalImages does read every job of the workflow. That is a separate change to the rule's scope and is left for its own PR.

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Bug Fixes
    • Image pinning checks now recognize images built with Docker Build Push and compatible build-push actions, including when those images are loaded and used later in a workflow. This prevents built images from being incorrectly reported as unpinned, while images from unrecognized actions continue to be checked.
  • Documentation
    • Updated guidance to clarify that tags from supported build-push actions identify workflow-built images.

…ush-action as local

An image that useblacksmith/build-push-action, depot/build-push-action or
warpbuilds/build-push-action builds is local, like one of
docker/build-push-action: they take the same tags, load, push and outputs
inputs. The recognised actions are now a set.

Fixes #327

Co-authored-by: tedserbinski <57771+tedserbinski@users.noreply.github.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Oct 31, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

No actionable comments were generated in the recent review.

Recent review info
Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Central YAML (base), Organization UI (inherited)
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: fe316b16-d6e4-43cd-87ec-0f0969d2b2a8
Commits

Reviewing files that changed from the base of the PR and between ad5f1f1 and 0c77f70.

Files selected for processing: 4
  • docs/checks.md
  • rule_unpinned_images_scripts.go
  • rule_unpinned_images_scripts_test.go
  • testdata/unpinned_images/build_push_fork.yaml

Included review availability: This review used your included allowance. Your plan provides up to 2 included reviews per hour; 1 remain after this review.

Walkthrough

The unpinned-images rule now treats tags from three build-push action replacements as local images. Tests cover these actions, a fork workflow, and an unknown action. The documentation lists the added replacements.

Changes: Local image recognition

Layer / File(s) Summary
Recognize build-push actions
rule_unpinned_images_scripts.go
The local-image collector uses a shared set of four build-push action names to identify local images from tags inputs. Existing handling for metadata, bake, and load actions remains unchanged.
Test and document action recognition
rule_unpinned_images_scripts_test.go, testdata/unpinned_images/build_push_fork.yaml, docs/checks.md
Tests cover the four recognized actions, the default-profile fork workflow, and an unknown action. The fixture builds and loads app:ci before running it. The documentation lists the three added replacements.

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix · Severity of issue fixed: Low

Merge Risk: Minimal · up to 0c77f

The unpinned-images rule now treats tags built by the Blacksmith, Depot and WarpBuild build-push actions as local images, matching the existing docker/build-push-action behavior and the documentation. No blocking risk remains.

Pre-merge checks: Passed 5
Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title names the fix (treating images from drop-in forks of docker/build-push-action as local) and the affected rule (unpinned-images). The changeset adds useblacksmith, depot, and warpbuilds build…
Linked Issues check Passed Issue #327 requires useblacksmith/build-push-action images to count as local when the workflow uses the action's build inputs. The collector now recognizes that action and three named alternatives t…
Out of Scope Changes check Passed The changes stay within issue #327. The code change implements local-image recognition. The tests verify recognized actions, the issue reproduction, and the non-recognized-action boundary. The documen…
Docstring Coverage Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentat…
Full details: Title check

Explanation

The title names the fix (treating images from drop-in forks of docker/build-push-action as local) and the affected rule (unpinned-images). The changeset adds useblacksmith, depot, and warpbuilds build-push-action forks to the local-image collector, with tests and docs updates to match. The title covers the main change, though it does not mention the fixed set of four actions or the docker/build-push-action base case.

Full details: Linked Issues check

Explanation

Issue #327 requires useblacksmith/build-push-action images to count as local when the workflow uses the action's build inputs. The collector now recognizes that action and three named alternatives through buildPushActions, and it records their tags values as local images. The tests cover all four actions, the issue workflow under the default profile, and an unknown action that must still produce a finding. The related cross-job behavior is explicitly separate work and is not required for this objective.

Full details: Out of Scope Changes check

Explanation

The changes stay within issue #327. The code change implements local-image recognition. The tests verify recognized actions, the issue reproduction, and the non-recognized-action boundary. The documentation updates the rule description. No unrelated behavior or unrelated files are changed.

Full details: Docstring Coverage

Explanation

Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 1 functions across 2 files. (2 skipped: 2 unsupported.)

  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@jdx
jdx merged commit 4d0fcf6 into main Oct 31, 2026
16 checks passed
@jdx
jdx deleted the claude/funny-hamilton-5da51e branch October 31, 2026 23:21
jdx added a commit that referenced this pull request Nov 1, 2026
`unpinned-images` now reports an image in a script when the image is
built in a different job. Each job runs on its own runner, so an image
that job `build` builds and loads isn't there for job `use`: `docker run
app:ci` pulls `app:ci` from the registry. Before this change, an image
built anywhere in the workflow suppressed the finding in every job.

This is the "Related" part of #327; the first part, the drop-in forks of
`docker/build-push-action`, was #328, and this branch is on top of it.

The workflow from the issue:

```yaml
jobs:
  build:
    runs-on: ubuntu-24.04
    timeout-minutes: 10
    steps:
      - uses: actions/checkout@3d3c42e # v7
        with:
          persist-credentials: false
      - uses: docker/build-push-action@c3c9e26 # v7.4.0
        with:
          context: .
          load: true
          tags: app:ci
  use:
    runs-on: ubuntu-24.04
    timeout-minutes: 10
    steps:
      - run: docker run --rm app:ci true
```

Before (`main`):

```
$ jactionlint .github/workflows/repro.yml
$ echo $?
0
```

After:

```
$ jactionlint .github/workflows/repro.yml
.github/workflows/repro.yml:24:30: image "app:ci" of "docker run" in this script is pinned by a tag, which can be moved to another image. pin it to a digest like "app:ci@sha256:{digest}" [unpinned-images]
   |
24 |       - run: docker run --rm app:ci true
   |                              ^~~~~~
$ echo $?
1
```

An image that a step of the same job builds, tags or loads is still not
reported.

<details>
<summary>Changes and validation</summary>

- `collectLocalImages` reads only the steps of the current job, and the
local-image state is reset in `VisitJobPre` instead of
`VisitWorkflowPre`. A composite action is a single synthesized job, so
all of its steps still count.
- `localUnknown` is per job too. A `docker load`, `docker compose`,
`docker/bake-action`, `docker/load-action`, buildah or kaniko in another
job puts nothing on this job's runner. To use an image from another job,
the job loads it from an artifact (`docker load`), and that load counts.
- A literal tag that one job pushes (`docker push ghcr.io/o/app:ci`) and
another job runs is now reported. That run pulls a mutable tag from the
registry, which a concurrent run can move.
- `TestUnpinnedImagesLocalImagesUseTheShellOfTheirJob` (from #211)
pinned the old cross-job behaviour. It now checks the job's shell
(`defaults.run.shell: bash` on Windows) within a single job, and expects
the cross-job image to be reported.
- New tests in `rule_unpinned_images_scripts_test.go` cover an image of
another job built by `docker/build-push-action`, by `docker build`,
tagged by `docker tag`, and after `docker load` or `docker/bake-action`
in the other job. All of them are reported. A further test covers the
same image built in two jobs: only the job that doesn't build it is
reported.
- `docs/checks.md`: the "Images in scripts" bullets now say "the same
job", plus a sentence on images of other jobs.
- `mise run lint` passes. `mise run test`: every package passes except
`TestShellcheckConfigWithRealShellcheck`, which also fails on `main` in
this sandbox (shellcheck can't read `/tmp`) and passes in CI. On a
loaded machine the root package hit the 10-minute `-race` timeout, so I
reran it with `-race -timeout 30m`, and it passes (692s).

</details>


🤖 Generated with [Claude Code](https://claude.com/claude-code)


<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

<!-- coderabbit-ai-generated:v1 -->

## Summary by CodeRabbit

* **Bug Fixes**
* Unpinned image checks now treat images built or loaded in another job
as external, so they can be reported even if another job created them.
* Images built, tagged, or loaded within the current job remain exempt
from findings.
* **Tests**
* Added coverage for images shared across jobs and for images created
and used within the same job.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->

Co-authored-by: tedserbinski <57771+tedserbinski@users.noreply.github.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
jdx added a commit that referenced this pull request Nov 5, 2026
🤖 I have created a release *beep* *boop*
---


## [2.5.0](v2.4.0...v2.5.0)
(2026-11-04)


### Features

* **run:** add jactionlint run --list
([#316](#316))
([f1f877e](f1f877e))
* **run:** add the OS sandbox that steps run in (Landlock, seccomp,
Seatbelt) ([#319](#319))
([443b4c1](443b4c1))
* **run:** container jobs, services, Docker actions, --container,
--parallel, --dry-run
([#323](#323))
([27dae22](27dae22))
* **run:** evaluate workflow expressions in jactionlint run --list
([#317](#317))
([f4267f7](f4267f7))
* **run:** local actions cache, --net=proxy and jactionlint cache
([#322](#322))
([b51ca88](b51ca88))
* **run:** run actions and reusable workflows
([#321](#321))
([782e8f9](782e8f9))
* **run:** run workflow steps in the sandbox
([#320](#320))
([65614de](65614de))
* **unreachable-required-check:** report required checks that never
report ([#331](#331))
([a4f08e3](a4f08e3))


### Bug Fixes

* **dependabot-syntax:** support apm package ecosystem
([#333](#333))
([c7eafd3](c7eafd3))
* **unpinned-images:** only count images built in the same job
([#329](#329))
([a09969d](a09969d))
* **unpinned-images:** treat images of drop-in forks of
docker/build-push-action as local
([#328](#328))
([4d0fcf6](4d0fcf6))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

<!-- CURSOR_SUMMARY -->
---

> [!NOTE]
> **Low Risk**
> Mechanical release and regenerated metadata/version pins; no
application logic changes in this diff.
> 
> **Overview**
> **Release 2.5.0** bumps the project version from **2.4.0** to
**2.5.0** everywhere release-please manages: manifest, GitHub Action
default, pre-commit Docker hook, docs site version, and CI/hooks
examples.
> 
> **CHANGELOG.md** gains the **2.5.0** section (notably the expanded
**`jactionlint run`** work, **unreachable-required-check**, Dependabot
**apm** support, and **unpinned-images** fixes described there).
> 
> **Embedded linter data** is refreshed: **`event_payloads.go`** updates
the pinned OpenAPI checksum comment; **`popular_actions.go`** and
**`popular_actions.json`** add newer **`dawidd6/*`** tags, extra
**`actions/setup-dotnet@v6`** and Pulumi inputs, and matching Node
runtime entries.
> 
> <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit
622e287. Bugbot is set up for automated
code reviews on this repo. Configure
[here](https://www.cursor.com/dashboard/bugbot).</sup>
<!-- /CURSOR_SUMMARY -->

---------

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

unpinned-images: an image built by useblacksmith/build-push-action is not treated as local

1 participant