Skip to content

solver: add compatibility-version support - #6681

Merged
tonistiigi merged 3 commits into
moby:masterfrom
tonistiigi:compat-version
Apr 27, 2026
Merged

tonistiigi merged 3 commits into
moby:masterfrom
tonistiigi:compat-version

Conversation

@tonistiigi

Copy link
Copy Markdown
Member

Add solve-wide compatibility-version support for image and oci exports, with historical goldens and release compatibility tests.

Backfill version 10 for v0.13-v0.14 git artifact behavior, keep version 20 as current, and reject unsupported zstd on v10.

@github-actions github-actions Bot added the area/dependencies Pull requests that update a dependency file label Apr 10, 2026
@tonistiigi
tonistiigi force-pushed the compat-version branch 3 times, most recently from c82db21 to 2168893 Compare April 10, 2026 07:42
Add solve-wide compatibility-version support for image and oci
exports, with historical goldens and release compatibility tests.

Backfill version 10 for v0.13-v0.14 git artifact behavior, keep
version 20 as current, and reject unsupported zstd on v10.

Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
@tonistiigi

Copy link
Copy Markdown
Member Author

@AkihiroSuda @apyrgio These were the only two cases I found starting from v0.13 :

  • Git file permission change in v0.15
  • Zstd compression change in v0.15

Are you aware of any more? If so, we can add extra coverage.

Note that this ignores changes based on the Dockerfile frontend. For these changes, we should save the version of Dockerfile frontend in provenance and to reproduce, one needs to use gateway frontend with the same dockerfile version instead.

Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
@apyrgio

apyrgio commented Apr 14, 2026

Copy link
Copy Markdown

Thanks for the heads up Tonis! I've started looking into Buildkit reproducibility since 0.19.0, and all I've found is the change in the Dockerfile frontend that you mentioned. I still have a CI test that runs nightly and builds a golden image, but it hasn't picked up any other discrepancies.

Move compatibility-releases to a single job that reuses the
integration test image flow from the main test workflow.

Add hack/test support for injecting a buildkitd binary and add a
dedicated hack/test-compatibility-releases wrapper for the release
sweep.

Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
@github-actions github-actions Bot added the area/hack building buildkit itself label Apr 15, 2026
@tonistiigi
tonistiigi marked this pull request as ready for review April 15, 2026 23:43
Comment thread source/git/source.go
defer repo.Release()

ref, err := gs.checkout(ctx, repo, g)
ref, err := gs.checkout(ctx, repo, g, compatibilityVersion)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now that the git snapshot contents depend on compatibilityVersion, I think the source cache key needs to depend on it too no?

CacheKey() and snapshotKey are still derived only from the git ref/subdir, so a solve that populates the git source cache under the current compatibility mode can be reused by a v10 solve, and vice versa iiuc. In that case we would skip this compatibility-specific checkout normalization and return the wrong tree from cache.

Maybe we can fold compatibilityVersion into the git source cache identity here (either in shaToCacheKey or in snapshotKey)?

Comment thread source/git/source.go
Comment on lines +793 to +800
compatibilityVersion := 0
if jobCtx != nil {
var err error
compatibilityVersion, err = jobCtx.CompatibilityVersion()
if err != nil {
return nil, err
}
}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think there is a second issue here beyond the persisted git snapshot key.

Seems CompatibilityVersion() errors on mixed versions, and gitSourceHandler.Snapshot() reads compatibility from the shared jobCtx.

That might be an edge case but solver active states are still keyed by the normal vertex digest, so two concurrent solves of the same git source under different compatibility versions can still merge into one active state and fail or I'm missing smth?

@tonistiigi tonistiigi Apr 21, 2026 •

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The LLB op itself should guarantee that the cache key is stable and new attributes are needed for behavior change. This is a bugfix case.

Compatibility version needs to be per build so it can be stored in provenance as a single value and used as a parameter for subsequent builds.

@tonistiigi
tonistiigi merged commit c1b5264 into moby:master Apr 27, 2026
197 of 198 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants