-
Notifications
You must be signed in to change notification settings - Fork 15
Introduce target artifact staging for Python #7718
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draft
nccatoni
wants to merge
16
commits into
main
Choose a base branch
from
dd/nccatoni/target-artifact-staging-system
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from all commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
8d3d2fe
Adding buildx remote cache to the build jobs in gitlab
nccatoni bf724bc
Merge branch 'main' into nccatoni/gitlab-docker-cache
nccatoni ac93449
Merge branch 'main' into nccatoni/gitlab-docker-cache
nccatoni a615f38
Merge branch 'main' into nccatoni/gitlab-docker-cache
nccatoni 92ce5b4
Test
nccatoni 3cbb9a3
Add cache entry for lib main branch
nccatoni c9651b4
test
nccatoni e36782a
Implement target artifact staging
nccatoni 1dd6742
cleanup
nccatoni 58706f6
Simplifications
nccatoni e65a73b
Simplification for simple targets
nccatoni e0b9615
Merge remote-tracking branch 'origin/main' into nccatoni/gitlab-docke…
datadog-bits 55886cf
Split staging framework and Python migration
datadog-bits fec5367
Address artifact staging review feedback
datadog-bits 37d4053
Remove test-the-test feature decorators
datadog-bits ec64372
Automate dev and prod selector conflicts
datadog-bits File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,70 @@ | ||
| # Target artifact staging | ||
|
|
||
| Target artifact staging resolves a test target to bounded, inspectable entries in | ||
| `binaries/` before a build consumes them. The first migration covers Python; other | ||
| targets continue to use `utils/scripts/load-binary.sh` until migrated separately. | ||
|
|
||
| ## Contract | ||
|
|
||
| Each migrated target provides `utils/build/docker/<target>/artifact.py` with `Dev` | ||
| and `Prod` implementations. They declare every filename they may emit, declare | ||
| resolver inputs, and map the resolved values to text entries without performing | ||
| network or filesystem side effects themselves. | ||
|
|
||
| The shared orchestrator owns external lookups and writes the generated entries. It | ||
| also maintains `binaries/.target-artifacts-manifest.json`, which records the owner | ||
| and content hash of every generated file. Staging: | ||
|
|
||
| - verifies that previously generated entries still match their recorded hashes; | ||
| - refreshes entries previously owned by the same target; | ||
| - removes stale entries owned by that target; | ||
| - preserves entries owned by other targets; and | ||
| - refuses to overwrite unowned files, changed generated entries, symlinks, conflicting | ||
| selectors, or entries owned by another target. | ||
|
|
||
| The filenames declared by a target's `Dev` and `Prod` implementations define its | ||
| selector family. Staging rejects any manual selector in that family that the selected | ||
| environment did not emit, while allowing multiple entries emitted together to coexist. | ||
| Individual entries do not need to name their conflicts, and declaring filenames does | ||
| not resolve the inactive environment's external inputs. | ||
|
|
||
| Selectors should be bounded, such as a commit SHA, release tag, package version, or | ||
| OCI digest. If an installer must consume a mutable provider selector, the target must | ||
| also emit a bounded selection marker with `provider_fetch_entries`. | ||
|
|
||
| The `custom` environment does not resolve or create selectors because an upstream or | ||
| local artifact bundle is already the source of truth. It removes unchanged generated | ||
| selectors previously owned by the target so they cannot override that custom payload. | ||
|
|
||
| ## Commands | ||
|
|
||
| The canonical entry point is: | ||
|
|
||
| ```bash | ||
| python3 utils/scripts/stage-target-artifacts.py <target> <dev|prod|custom> | ||
| ``` | ||
|
|
||
| During migration, the existing compatibility command delegates migrated targets to | ||
| the same implementation: | ||
|
|
||
| ```bash | ||
| ./utils/scripts/load-binary.sh <target> <dev|prod|custom> | ||
| ``` | ||
|
|
||
| ## Python demonstration | ||
|
|
||
| For `python dev`, the configured `LIBRARY_TARGET_BRANCH` (default: `main`) resolves | ||
| to a commit SHA and produces `python-load-from-s3`. For `python prod`, the latest | ||
| published `ddtrace` package version produces `python-load-from-pip`. Existing Python | ||
| installer behavior consumes both files, so no installer change is needed. | ||
|
|
||
| ## Adding a target | ||
|
|
||
| 1. Add the target's `artifact.py` with `Dev` and `Prod` implementations. | ||
| 2. Reuse shared resolvers, or add a resolver with isolated unit coverage. | ||
| 3. Emit text entries only; keep payload downloads in existing build/install steps. | ||
| 4. Preserve local payload overrides and add public-contract tests for the target. | ||
| 5. Route only that target through the compatibility loader. | ||
|
|
||
| GitLab job integration and Buildx remote caching are intentionally handled in later | ||
| changes after target migrations are reviewed. |
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
Oops, something went wrong.
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The newly added
Test_LoadBinaryPython,Test_TargetArtifactStaging,Test_TargetArtifactResolvers, andTest_TargetArtifactModulesclasses have scenario decorators but no feature decorator. Repository rules require every test class to use either a specific@features.*association or@features.not_reported, so these framework tests should be explicitly marked rather than omitted from feature metadata.AGENTS.md reference: AGENTS.md:L9-L17
Useful? React with 👍 / 👎.