Repository navigation
Conversation
A filtered read from a Directory- or GitRef-backed workspace is a copy of the selected files, but it is identified by its recipe over the workspace root, so two roots that differ only outside the selection give different keys to everything built on it. A Git root's identity is its commit, so CI that loads a workspace from a Git ref gets new keys for all work on every commit, even for parts of the repository that did not change. Host reads already carry the content digest of their sync. The test reads the same selection from two roots that differ elsewhere, and from one where the selection changed, through include and exclude filters with and without a subpath, on Directory- and GitRef-backed workspaces. It also checks that a subpath read without a filter is left as it was: it keeps its name and still reaches its root through a link. Signed-off-by: Erik Sipsma <[email protected]>
A filtered read from a Directory- or GitRef-backed workspace (include, exclude or gitignore) was identified only by its recipe over the workspace root. A Git root's identity is its commit, so on a workspace loaded from a Git ref, as CI loads it, every filtered read and everything built on it got a new key on every commit, even where the files it selects were unchanged. Host reads were not affected: host.directory carries the content digest of its sync. A filtered read is already a copy of the selected files into a fresh directory, so it can reach nothing but those files: give it their content hash, as module context directories get after filtering. A subpath read without a filter is a view into the root, which can still reach the root's files through .. or a symlink, so this change leaves it as it was and adds no content digest to it. No read changes what it returns. Signed-off-by: Erik Sipsma <[email protected]>
Contributor
Author
|
Moved to #14829: a branch on this repository, so that CI runs. Native CI doesn't run on PRs from forks. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changed and why
A filtered read from a workspace loaded from a Git ref, or created with
Directory.asWorkspace, is identified only by its recipe over the workspace root. For example,ws.directory("/", include: [...]).host.directoryalready carries the content digest of what it synced.This change gives a filtered read the content hash of the files it selects.
resolveRootfsFromDirectory(core/schema/workspace.go), the filtered branch now evaluates its copy and teaches itGetContentHashFromDirectorythroughWithContentDigest. Module context directories already get the same treatment after filtering.No read returns anything different. The only effects are cache identity, and evaluating and hashing the filtered copy when the read is made.
Who benefits
Every workspace loaded from a Git ref or made with
Directory.asWorkspace. That includes CI that runsdaggeragainstgithub.com/<org>/<repo>@<sha>.Tests
New test:
TestWorkspace/TestFilteredReadsAreContentKeyed(core/integration/workspace_content_keyed_test.go).Runs:
TestDirectorysuite: 191 passed. https://dagger.cloud/dagger/traces/d3f3722ef010e9899a6fa5b7905e0bbcTestFilteredReadsAreContentKeyed,TestDirectoryBackedSyntheticWorkspaceUsesSourceContent,TestGitRefBackedSyntheticWorkspaceUsesSelectedRef,TestValueBackedWorkspaceLoadsModulesFromTree). https://dagger.cloud/dagger/traces/adaabbf10f1e0106dba5845c2073d015Lint
dagger check golangci-lint:lint-all, with the pinned lint module and golangci-lint v2.14.0. 0 issues at the base commit and 0 at this change, so 0 new.Cache model
Nothing under
dagql/changes. This adds one caller of the existing content-digest teaching path. The cache model indagql/tla/CacheLifecycle.tlatreats equivalence classes as a static partition and leaves runtime teaching out of scope, so it needs no change.dagger --env dev check tla-check:quickpasses all 18 configurations: https://dagger.cloud/dagger/traces/0757f34ddc4223af1e9c37f6c43765ccMeasured effect
golangci-lint/lint-allon dagger/dagger, run against a commit that changes onlyengine/after a run of its parent commit, on a fresh engine with a remote cache, with the workspace loaded from a Git ref:The five lints of Go modules the commit didn't touch keep their keys, and their lookups hit. Wall time doesn't move in this measurement:
The effect on per-package Go builds across commits is still being measured.
Not in this change