AAP-12516 Put node-level upstream artifacts at higher precedence than WorkflowJob.extra_vars#16379
AAP-12516 Put node-level upstream artifacts at higher precedence than WorkflowJob.extra_vars#16379AlanCoding wants to merge 3 commits intoansible:develfrom
WorkflowJob.extra_vars#16379Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughModifies the precedence ordering of extra variables in workflow job node initialization, applying workflow template special variables before ancestor artifacts so that upstream artifacts override template variables. Includes new test data and an integration test to validate the precedence behavior across nested workflows. Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~22 minutes 🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@awx/main/tests/live/tests/test_nested_workflow_artifacts.py`:
- Line 4: Remove the unused import by deleting the reference to
unified_job_stdout from the import line in the test file (currently importing
from awx.main.tests.live.tests.conftest); keep wait_for_job but remove
unified_job_stdout so the import reads only the used symbol and eliminate the
unused dependency in test_nested_workflow_artifacts.py.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 5705702f-fad1-4e3a-bfff-0a004aab85d1
📒 Files selected for processing (3)
awx/main/models/workflow.pyawx/main/tests/data/projects/debug/set_stats.ymlawx/main/tests/live/tests/test_nested_workflow_artifacts.py
|
|
Think I prefer the other approach. |



SUMMARY
The live test here should contain a faithful reproducer of the bug, which is kind of hard.
Resource setup:
artifactsandancestor_artifacts)extra_vars)artifactsandancestor_artifacts)In this real mega-function of
get_job_kwargs, variables coming from theWorkflowJobare truly handled separately from the upstream (path dependent) artifacts from nodes within the same workflow.The issue with the prior implementation, which was new as of the feature of artifact-passing-in-nested-workflows, #12223, is that a user would reasonably expect that the upstream node within the inner workflow would come at higher precedence than the upstream node in the outer workflow.
Otherwise it's usually correct that extra_vars should come at higher precedence than artifacts. However, artifacts are truly "closer" to the point of execution. I think that's a good argument, but this is still slightly opinionated when you consider that there's a single workflow case here.
extra_varssetting "var1"It's important to write this out. I think I'm ok with the "set_stats" value winning. But could be arguable. With the current design & models, there is no way to distinguish these two cases.
ISSUE TYPE
COMPONENT NAME
Note
Medium Risk
Changes variable precedence when launching jobs from workflow nodes, which can alter runtime behavior for existing nested workflows that relied on the previous
extra_vars/artifact merge order.Overview
Fixes nested workflow variable precedence so upstream node artifacts (
set_statsviaancestor_artifacts) overrideWorkflowJob.extra_varswhen constructing downstream jobextra_vars, preventing outer-workflow artifacts from incorrectly winning inside child workflows.Adds a new live regression test (plus a small
set_stats.ymlplaybook) that builds an outer+inner workflow chain and asserts inner workflow artifacts override outer ones while non-conflicting artifacts still propagate.Written by Cursor Bugbot for commit 0dcc6c7. This will update automatically on new commits. Configure here.
Summary by CodeRabbit
Bug Fixes
Tests