feat(core): apply parent env to atomized target#33013
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
View your CI Pipeline Execution ↗ for commit 1b0e771
☁️ Nx Cloud last updated this comment at |
✅ Deploy Preview for nx-docs ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
There was a problem hiding this comment.
Nx Cloud has identified a possible root cause for your failed CI:
The failing test "e2e-angular:e2e-ci--src/projects-linting.test.ts" encountered a package installation failure during test setup, not a failure related to the pull request's changes.
Pull Request Intent:
The PR implements functionality to propagate parent target environment variables to atomized targets. When Nx atomizes a target (splits it into individual test files like "test--path/to/file.ts"), the changes ensure that environment variables defined for the parent target (e.g., in ".test.env") are correctly applied to the atomized child targets.
The implementation adds:
- A new function "getOwnerTargetForTask()" that uses the project graph to identify the parent target for atomized tasks by checking "project.data.metadata.targetGroups"
- Updates to "getTaskSpecificEnv()" and related functions to accept and use the project graph parameter
- Logic to resolve the parent target name from atomized target names when loading environment files
Error Analysis:
The test failed with "ERR_PNPM_FETCH_404 GET http://localhost:4873/retry: Not Found - 404" during the installation of @nx/angular@22.0.0 dependencies. The package "retry" (a transitive dependency via @nx/rspack -> @rspack/dev-server -> p-retry -> retry) was not available in the local e2e test registry.
Why This Is An Environment Issue:
- The error occurs during package installation, before any Nx task execution or environment variable loading
- The local registry at localhost:4873 is missing the "retry" package, indicating an incomplete or corrupted registry state
- The code changes only affect runtime environment variable resolution for tasks, not the package installation process
- No similar failures appear in the master branch's task outputs, suggesting this is a transient registry issue
- The failure happened during test setup when running "pnpm add -D @nx/angular@22.0.0", which is completely independent of the env variable propagation logic
No Code Fix Required:
This is an infrastructure issue with the e2e test environment's local npm registry. The PR's changes to environment variable handling for atomized targets are unrelated to package resolution. The test should pass when the registry is properly populated with all required dependencies.
A code change would likely not resolve this issue, so no action was taken.
⚙️ An Nx Cloud workspace admin can disable these reviews in workspace settings.
3196300 to
edfac01
Compare
edfac01 to
b906ccb
Compare
067c164 to
bac9af2
Compare
Co-authored-by: graphite-app[bot] <96075541+graphite-app[bot]@users.noreply.github.com>
AgentEnder
left a comment
There was a problem hiding this comment.
The docs still need to be updated to reflect this, we should do it in same PR
|
@AgentEnder @FrozenPandaz can you check this PR? |
|
This pull request has already been merged/closed. If you experience issues related to these changes, please open a new issue referencing this pull request. |
Current Behavior
Env variables from the parent target are not propagated to the atomized target e.g.
.test-ci.envwill be only applied to no-optest-cibut not totest-ci--path/to/test/file.Expected Behavior
Running an atomized target will load from the parent's env files.
Related Issue(s)
Fixes #