-
Notifications
You must be signed in to change notification settings - Fork 5
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
Add when' overload to accept a stage and treat stage result as a when condition for the enclosing context #76
Conversation
… condition for the enclosing context
… - logs indicate to refer up to when stage result.
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.
Nice and quick PR. Thanks.
Added some comments, please consider to changed. Many thanks for your contribution.
…pdate language to CONDITION STAGE
Hi @albertwoo , please see updated PR which includes changes as suggested. For the test to assert on the parent context, I simulated the scenario by setting an env var and using the env var in the condition stage. I verified that the test fails without setting the parent context, and passes when the parent context is set. I'm still not 100% clear on how the parent context structure works or is initialised, but hopefully this is correct. |
Feedback welcome as this is my first engagement with this codebase.
Closes #75
Some concerns I have:
CancellationToken.None
As we need to run the stage during the condition evaluation of
IsActive
we don't have a cancellation token, so these whenStages aren't running as part of the normal execution model.Is this an issue for you? If so, we might need to update the IsActive signature to accept a cancellation token.
Logging Output
Most of the logging logic makes a lot of assumptions about when in the execution it's being called. I've added a new
StageIndex
calledWhenStage
which allows us to log without an index. The logging result looks like:For a pipeline when the when stage fails:
For a pipeline where the whenStage passes:
When the
when'
is used at the pipeline level, the logging occurs BEFORE theRun PIPELINE
message:When the condition fails, this is especially odd as it shows the logs, then indicates that the verification failed and shows the conditions that failed, but it doesn't have access to the results of when the whenStage was first run, so I've updated the logs to refer back to the WHEN STAGE logs - the
?
is because other conditions will show with green ticks and red crosses, as their results are static:Is this ok? If there are multiple
when
stage` calls it might be a bit confusing, but hopefully the user knows to name the condition.