frontend: add build-time source filters#1061
Open
cpuguy83 wants to merge 1 commit into
Open
Conversation
a2ba2aa to
8b69774
Compare
Contributor
There was a problem hiding this comment.
Pull request overview
This PR adds build-time source filtering support via a YAML config supplied through a build context, so package/source generation can exclude globally configured paths without changing the Dalec spec.
Changes:
- Adds
SourceFilterConfig, build args, frontend loading, and source/generator filtering hooks. - Propagates filter metadata into RPM spec generation and source docs.
- Adds unit/integration coverage and user documentation for source filter behavior.
Reviewed changes
Copilot reviewed 18 out of 18 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
website/docs/sources.md |
Documents build-time source filter configuration and Buildx usage. |
test/source_test.go |
Adds integration tests for debug source and gomod filtering. |
targets/windows/handle_zip.go |
Adjusts Windows binary build source options around filtering. |
spec_test.go |
Tests YAML decoding and emptiness checks for filter config. |
source.go |
Adds filter plumbing to source fetch options and source docs. |
source_test.go |
Adds unit tests for source filter LLB behavior. |
source_inline.go |
Adjusts inline directory include/exclude paths when renamed. |
source_filter.go |
Introduces source filter config, constants, and LLB filter helpers. |
packaging/linux/rpm/template.go |
Emits source filter documentation and pip source entries in RPM specs. |
packaging/linux/rpm/template_test.go |
Updates RPM source expectations and filter documentation tests. |
packaging/linux/rpm/buildroot.go |
Passes source filter config into RPM spec generation. |
load.go |
Marks source filter build args as known arguments. |
generator_pip.go |
Applies filters to generated pip dependency cache. |
generator_gomod.go |
Applies filters to generated gomod dependency cache. |
generator_cargohome.go |
Applies filters to generated Cargo dependency cache. |
frontend/request.go |
Loads source filter config from a build context. |
frontend/gateway.go |
Wires cached source filter loading into frontend source options. |
frontend/debug/handle_sources.go |
Passes progress options while preparing debug sources. |
Comments suppressed due to low confidence (1)
packaging/linux/rpm/template.go:386
- Filter patterns are written directly into the generated RPM spec comment. If a pattern contains a newline, only the first line is prefixed with
#, so the remaining text can become active spec content; comment each line (asSourcesdoes when scanningsrc.Doc) or sanitize newlines before writing.
}
if len(keys) > 0 {
b.WriteString("\n")
9ec2c7c to
7df6aad
Compare
Add a source-options context that can provide a YAML source filter config at build time. The config currently supports global_excludes which can be used to filter out paths from all sources. Signed-off-by: Brian Goff <cpuguy83@gmail.com>
7df6aad to
efcebc9
Compare
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.
Add a source-options context that can provide a YAML source filter
config at build time. The config currently supports global_excludes
which can be used to filter out paths from all sources.