feat(source-files): add custom origin type for mock-based source generation#261
Open
Tonisal-byte wants to merge 2 commits into
Open
feat(source-files): add custom origin type for mock-based source generation#261Tonisal-byte wants to merge 2 commits into
Tonisal-byte wants to merge 2 commits into
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Adds a new origin.type = "custom" mode for source-files entries, enabling azldev to generate a source artifact by running a user-provided script inside a fresh mock chroot and then packaging /azldev-gen/output as a deterministic archive.
Changes:
- Extend project config/schema to support
origin.type = "custom"plusscriptandmock-packages, with validation. - Add a new file-source provider that runs the script in mock and archives its output deterministically.
- Extend the mock runner API (
CmdInChroot) to optionally pipe output directly to the user and update call sites.
Reviewed changes
Copilot reviewed 15 out of 15 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| schemas/azldev.schema.json | Adds custom origin enum + script/mock-packages fields to the JSON schema. |
| scenario/snapshots/TestSnapshotsContainer_config_generate-schema_stdout_1.snap | Updates schema snapshot output for the new fields. |
| scenario/snapshots/TestSnapshots_config_generate-schema_stdout_1.snap | Updates schema snapshot output for the new fields. |
| internal/rpm/mock/mock.go | Adds pipeOutput support to Runner.CmdInChroot for real-time output passthrough. |
| internal/rpm/mock/mock_test.go | Updates tests for the new CmdInChroot signature. |
| internal/providers/sourceproviders/sourcemanager.go | Introduces FileSourceProvider dispatch, ErrNotFound, and custom-origin handling/fallback behavior. |
| internal/providers/sourceproviders/customsourceprovider.go | Implements custom-origin source generation via mock + deterministic archiving. |
| internal/providers/sourceproviders/customsourceprovider_internal_test.go | Adds unit tests for custom provider helpers and validation behavior. |
| internal/projectconfig/configfile.go | Adds validation rules for custom origin (script, mock-packages, and rejecting uri). |
| internal/projectconfig/configfile_test.go | Adds validation test coverage for the new custom-origin rules. |
| internal/projectconfig/component.go | Adds OriginTypeCustom, script, mock-packages, and HashInclude behavior for fingerprinting. |
| internal/buildenv/mockroot.go | Updates CmdInChroot call to pass pipeOutput=false. |
| internal/app/azldev/core/sources/mockprocessor.go | Updates CmdInChroot call to pass pipeOutput=false. |
| internal/app/azldev/cmds/component/preparesources.go | Refactors preparer option assembly; notes custom origin is auto-enabled when mock-config exists. |
| internal/app/azldev/cmds/advanced/mock.go | Updates CmdInChroot call to pass pipeOutput=false. |
1b56d46 to
24c1de2
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.
Introduces a new
origin.type = "custom"for component source-files entries. Instead of downloading a pre-built artifact, azldev runs a user-supplied shell script inside a fresh mock chroot and packages the output directory as a deterministic archive.Example:
Script contract: the script must write all desired archive contents to
/azldev-gen/output/. azldev mounts the script read-only at /azldev-gen/script/ and the output directory read-write at /azldev-gen/output/, then packages the output into the declared filename using CreateDeterministicArchive.Example: