Skip to content

🐞 Git-remote workspace (-W <remote>@<sha>) re-runs execs on every commit even when the mounted Workspace.directory is identical #14903

Closed

Description

@yasyf

What is the issue?

When the workspace is a git remote (-W github.com/<org>/<repo>@<sha>), an exec that mounts Workspace.directory content re-runs on every new commit, even when the mounted directory is byte-identical between the two commits. The same function run from a local checkout of the same commits hits the cache as expected.

For CI this means every push is effectively a cold run when the trigger uses the -W <remote>@<sha> form, which is the natural shape for running checks on a pushed commit.

Shape of the function

container = goRuntime(ws)
  .withMountedCache(...)                      # two cache volumes
  .withMountedDirectory("/src", ws.directory("/", include: ["some/dir/**"], gitignore: true))
  .withExec(["bash", "some/dir/build.sh", "/out"])

Steps

  1. Make three commits that each change only README.md, which is outside the include list.
  2. Run dagger -W github.com/<org>/<repo>@<sha> -c '<fn> | digest' at the first commit, twice.
  3. Run it at the next commit.

Observed

  • Same sha twice: identical digest, and withExec is CACHED both times.
  • Next README-only sha: Workspace.directory ... DONE [0.0s], then withExec bash some/dir/build.sh /out DONE [3.8s]. It re-ran.
  • The mounted input is byte-identical across those commits: ws.directory(...).digest returns the same digest at both shas.

Control

From a local checkout in one fixed directory (git checkout --detach <sha>, no -W), the same function at the next README-only commit is a cache hit: check DONE [0.5s].

Expected

An exec whose inputs are content-identical should hit the cache regardless of which commit of a git-remote workspace it was evaluated from.

Dagger version

v1.0.0-beta.21 (CLI and self-hosted engine, tcp://)

Notes

The exec's cache key seems to pick up something per-commit from the remote workspace's identity, such as the ref or the snapshot it came from, beyond the mounted directory's content digest. We worked around it by running from a fixed local checkout, and can share traces if useful.

Activity

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions