fix(pipeline): allow mid-task spel evaluation to reference prior stage outputs #3220
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.
Closes spinnaker/spinnaker#4932
chore(pipeline): add buildExecutionContext test to ContextParameterProcessorSpec
Adds test to demonstrate that currently, the context returned by
ContextParameterProcessor.buildExecutionContext
, when used as the context forContextParameterProcessor.process
, does not allow for the evaluation of variables that refer to the outputs of a prior stage.fix(pipeline): allow mid-task SpEL evaluation to reference prior stage outputs
Changes
ContextParameterProcessor.buildExecutionContext
to returnStageContext
, which extends aForwardingMap
in order to overrideget
to search the stage's ancestors' outputs if a given key does not exist on the delegate object. Uses theMap
previously returned by this method as the delegate. Removes theincludeStageContext
argument since all existing consumers want stage context included. UpdatesExpressionAware
interface to use updatedbuildExecutionContext
per todo.To do: Investigate whether tasks like
ExpressionPreconditionTask
even need to explicitly take another pass at expression evaluation, since presumably any resolvable variables were evaluated in theStartTaskHandler
. I think only if the task itself fetches an artifact that may contain SpEL should we need another evaluation pass?