Skip to content

core: pin latest container and Git releases - #13754

Merged
tiborvass merged 6 commits into
mainfrom
codex/git-latest-release-pinning
Aug 26, 2026
Merged

tiborvass merged 6 commits into
mainfrom
codex/git-latest-release-pinning

Conversation

@tiborvass

@tiborvass tiborvass commented Jul 28, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Implement #13464 by adding package-manager-style latest-release selection
for Git repositories, module installations, and OCI images.

A latest release is selected once and pinned in dagger.lock. Normal
operations reuse the pin; dagger update refreshes it.

Release selection

For Git:

  • GitRepository.latest selects the greatest eligible release tag
  • unversioned module sources use the same selection
  • monorepo modules prefer tags scoped to their module subdirectory
  • selection falls back to remote HEAD when no release tag exists
  • prereleases can be included explicitly
  • equivalent normalized tags are rejected as ambiguous

For OCI images:

  • a bare reference such as alpine selects the greatest eligible release tag
  • an explicit tag such as alpine:latest or alpine:3.22 remains exact
  • selection falls back to the literal latest tag when no release exists
  • prereleases can be included explicitly
  • registry authentication and transport settings are preserved

Release comparison accepts common spellings such as v1.2.3, 1.2, and
24.04. Git rejects equivalent tags such as v1.2, 1.2.0, and
v1.2.0 as ambiguous, while OCI preserves the conventional meaning of
incomplete image tags.

The bare-image behavior is version-gated so older API clients continue to
interpret alpine as alpine:latest.

Lockfile format

This introduces the v2 lockfile format with four core resolver operations:

Operation Required inputs Value
git-latest repository selected Git ref
git-sha repository, ref commit SHA
oci-latest bare image repository selected image tag
oci-sha tagged image reference OCI digest

Optional inputs are stored as named key-value pairs. They include:

  • includePrereleases for latest-release selection
  • tagPrefix for monorepo Git modules
  • protocol and insecureSkipTLSVerify for OCI registries

Values are always single strings. Container pins use the root OCI descriptor
digest and are therefore platform-independent.

Version 1 lockfiles are not supported by this implementation and produce an
explicit error.

Updating

dagger update refreshes existing entries in dependency order:

  1. Refresh git-latest and oci-latest selections.
  2. Refresh the corresponding git-sha and oci-sha entries.
  3. Refresh other exact Git refs and OCI tags.

If an existing refs/tags/... Git tag resolves to a different commit,
dagger update emits a warning containing the previous and current SHAs.

Module dependency declarations are orthogonal to workspace lock updates.
dagger update only refreshes dagger.lock; it does not change versions or
pins declared in dagger-module.toml.

To advance a declared module dependency, use
dagger module deps update <name>. That command bypasses workspace lock reads
and writes so it can update the dependency declaration. Normal module loading
continues to use the workspace lock.

Repository updates

This PR also opts Dagger's default BusyBox and Markdownlint images into
latest-release selection and updates the repository lockfile accordingly.

How to test

Run the focused unit tests:

go test ./core ./core/workspace ./core/schema \
  ./engine/server/resolver ./util/lockfile

Run the lockfile integration tests against the development engine:

dagger api call engine-dev test \
  --pkg ./core/integration \
  --run='TestLockfile'

For a manual Git test:

  1. Create a repository with a v0.1.0 tag.
  2. Install it as an unversioned module.
  3. Run a Dagger command to populate dagger.lock.
  4. Add and push a v0.2.0 tag.
  5. Confirm normal commands continue using v0.1.0.
  6. Run dagger update.
  7. Confirm git-latest selects v0.2.0 and git-sha contains its commit.
  8. Confirm dagger-module.toml is unchanged.

For a manual OCI test, use both forms:

{
  container {
    release: from(address: "busybox") {
      imageRef
    }
    explicitLatest: from(address: "busybox:latest") {
      imageRef
    }
  }
}

After running the query, dagger.lock should contain:

  • oci-latest and oci-sha entries for busybox
  • only an oci-sha entry for busybox:latest

Running the same query should reuse those pins. Running dagger update
should refresh the selected tag and digests.

@tiborvass
tiborvass force-pushed the codex/git-latest-release-pinning branch 2 times, most recently from 32f987f to 9e74e0f Compare July 28, 2026 17:00
@tiborvass tiborvass added this to the v1.0.0 milestone Jul 30, 2026
@tiborvass
tiborvass force-pushed the codex/git-latest-release-pinning branch from 9e74e0f to 02fac36 Compare August 3, 2026 15:41
@tiborvass
tiborvass marked this pull request as ready for review August 3, 2026 15:41
@tiborvass
tiborvass requested review from a team as code owners August 3, 2026 15:41
@grouville
grouville self-requested a review August 3, 2026 16:13

@sipsma sipsma left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Codex identified these issues and drafted the comments; Erik reviewed and approved them for submission.

Comment thread core/schema/container.go Resolved
Comment thread core/integration/lockfile_test.go Resolved
Comment thread core/lockfile_update.go Resolved
@grouville
grouville force-pushed the codex/git-latest-release-pinning branch from 02fac36 to 784b89a Compare August 7, 2026 00:09
@grouville
grouville requested a review from sipsma August 7, 2026 00:42
Comment thread docs/docs-graphql/schema.graphqls Resolved
@grouville
grouville force-pushed the codex/git-latest-release-pinning branch from 0d2f79e to 9273210 Compare August 10, 2026 21:55
@grouville
grouville requested a review from vito August 10, 2026 21:59
@grouville

Copy link
Copy Markdown
Member

cc @vito ready for review once again 🙏

@grouville
grouville requested review from TomChv and eunomie August 10, 2026 23:32
@tiborvass
tiborvass force-pushed the codex/git-latest-release-pinning branch 2 times, most recently from 50f352c to 7b00c71 Compare August 14, 2026 16:40
@tiborvass
tiborvass force-pushed the codex/git-latest-release-pinning branch 6 times, most recently from 2833741 to 54fa6e9 Compare August 25, 2026 12:25
@tiborvass
tiborvass force-pushed the codex/git-latest-release-pinning branch 2 times, most recently from 5656ddd to 7f1bfa7 Compare August 25, 2026 14:51
@marcosnils marcosnils removed this from the v1.0.0 milestone Aug 25, 2026
@tiborvass
tiborvass force-pushed the codex/git-latest-release-pinning branch 3 times, most recently from 59af030 to afc3a8a Compare August 25, 2026 17:48
@tiborvass
tiborvass force-pushed the codex/git-latest-release-pinning branch 6 times, most recently from af8e23c to 26395e5 Compare August 26, 2026 13:51
Parse release tags with optional v prefixes, one to three numeric
components, and leading zeroes. Ignore prereleases when selecting
the greatest version.

Prefer complete spellings for exact incomplete aliases. When
equivalent candidates remain, accept Git aliases only when they
resolve to the same SHA, then prefer less padding, complete
components, no build metadata, and a v prefix. Reject different or
unavailable targets as ambiguous.

Support monorepo tag prefixes before repository-wide tags and
HEAD. Fall back to the literal latest OCI tag when no release
exists.

List registry tags with authentication, bounded pagination, and
response validation.

Signed-off-by: Tibor Vass <[email protected]>
Represent mutable selections and immutable resolutions with
git-latest, git-sha, oci-latest, and oci-sha operations. Keep
required inputs positional, named options explicit, and results
string-valued. Reject v1 lockfiles instead of migrating them.

Expose GitRepository.latest and use it for unversioned module
sources. Select releases for bare OCI addresses while keeping
explicit tags and refs exact. Gate both behaviors at beta.11.

Store root OCI digests without platform identity. Make dagger
update refresh selections before their immutable resolutions and
surface a warning when an existing Git tag changes commits.

Reject unknown lock options with actionable errors.

Signed-off-by: Tibor Vass <[email protected]>
Resolve explicit module dependency updates without reading from or
writing to the consuming workspace lockfile. Preserve the declared
source selector while refreshing or replacing its TOML pin.

Pass existing module configuration pins directly through Git
resolution so stale workspace entries cannot override them during
normal module loading.

Signed-off-by: Tibor Vass <[email protected]>
Use bare BusyBox and markdownlint image references so their
default image selections use latest-release locking. Keep
explicitly configured markdownlint versions exact.

Refresh the beta.10-compatible dagger.lock and add dagger.lock2 in
the new four-operation format for branch-engine bootstrap.

Signed-off-by: Tibor Vass <[email protected]>
Regenerate SDK clients and API references for
GitRepository.latest and bare OCI release selection. Refresh
generated docs module bindings after the main-branch changes.

Signed-off-by: Tibor Vass <[email protected]>
@tiborvass
tiborvass force-pushed the codex/git-latest-release-pinning branch from 26395e5 to 6980887 Compare August 26, 2026 18:34
The snapshot test module was merged without its generated Go client, so
Go linting cannot resolve its internal Dagger package. Remove the unused
module to restore linting.

Signed-off-by: Tibor Vass <[email protected]>
@tiborvass
tiborvass merged commit 350ee57 into main Aug 26, 2026
89 checks passed
@tiborvass
tiborvass deleted the codex/git-latest-release-pinning branch August 26, 2026 21:03
eunomie added a commit to dagger/python-sdk that referenced this pull request Aug 27, 2026
beta.11 rewrites the workspace lockfile format: `git.ref` and `container.from`
entries become the `git-latest`/`git-sha`/`oci-sha` operations
`dagger/dagger#13754` introduced, results are plain strings, and OCI digests
drop their platform identity. Locks in the old shape are rejected rather than
migrated, so the lock is rewritten by hand and then normalized with
`dagger update`, which refreshed the `ghcr.io/astral-sh/uv:python3.14-alpine`
digest upstream had retagged. Both git pins are unchanged.

Regenerating `runtime` picks up the schema this engine actually serves:
`Workspace.withDirectory` is new, `GitRepository.latestVersion` is now
`GitRepository.latest`, and `Workspace.withNewDirectory` documents that it
replaces.

Signed-off-by: Yves Brissaud <[email protected]>
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.

6 participants