-
Notifications
You must be signed in to change notification settings - Fork 254
[JENKINS-64508] Add extension point for globally defined when conditions #409
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
Conversation
abayer
commented
Dec 22, 2020
- JENKINS issue(s):
- JENKINS-64508
- Description:
- Adds a new extension point and parse/transformation logic for globally defined when conditions that will be evaluated for every stage run on the controller when configured.
- Also get the debug pretty printing for post-AST transformation to actually do something kinda useful again.
- Documentation changes:
- n/a - no user-facing changes
- Users/aliases to notify:
- ...
Also get the debug pretty printing for post-AST transformation to actually do something kinda useful again. Signed-off-by: Andrew Bayer <andrew.bayer@gmail.com>
b7a6bf0
to
599c3f0
Compare
Signed-off-by: Andrew Bayer <andrew.bayer@gmail.com>
neat |
/* | ||
* The MIT License | ||
* | ||
* Copyright (c) 2021, CloudBees, Inc. |
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.
already 2021? nice.
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.
I’m being proactive since I don’t expect this to merge this year. =)
int result = super.hashCode(); | ||
result = 31 * result + (getStageName() != null ? getStageName().hashCode() : 0); | ||
result = 31 * result + (getStage() != null ? getStage().hashCode() : 0); | ||
return 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.
Use Objects.hashCode
instead?
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.
Huh, smart!
Signed-off-by: Andrew Bayer <andrew.bayer@gmail.com>
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.
It looks like this doesn't include any syntax changes. Is that correct?
* When container generated when adding invisible global when conditions to a stage, containing the new conditions and | ||
* any explicitly defined ones. When created with existing conditions, the existing when container is stored for use as | ||
* well. This is used as a marker to avoid validation, JSON/Groovy generation, etc for the generated container. |
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.
This needs clarification. Maybe at least use Javadoc code
markers to indicate when you are talking about when
and when you are not.
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.
Will do.
@@ -321,7 +321,7 @@ class ModelParser implements Parser { | |||
|
|||
// Lazily evaluate prettyPrint(...) - i.e., only if AST_DEBUG_LOGGING is true. | |||
astDebugLog { | |||
"Transformed runtime AST:\n${ -> prettyPrint(pipelineBlock.whole.arguments)}" | |||
"Transformed runtime AST:\n${ -> prettyPrint(src)}" |
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.
Perhaps you could add a test where astDebugLog is enabled to protect it from future breakage?
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.
Good idea - I'll see what I can do.
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.
This is impressively difficult to really test - it needs a ModuleNode
passed to it, specifically one that's been generated by RuntimeASTTransformer
from a SourceUnit
and a parsed ModelASTPipelineDef
so that it'll actually look like the real thing. Lemme think on this...
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.
...doesn't help that for some reason I can't run tests from intellij right now. heh.
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.
woo, got it.
@bitwiseman - yup, no syntax changes of any kind. |
Signed-off-by: Andrew Bayer <andrew.bayer@gmail.com>
Thanks, @bitwiseman! |