-
Notifications
You must be signed in to change notification settings - Fork 529
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
JENKINS-40979 add trigger cause messages #996
Conversation
…riggered * Adds trigger cause to Run detail * If there are no commits the cause is displayed in Activity and Branch message column
@@ -25,7 +28,7 @@ public TreePruner accept(Object node, Property prop) { | |||
|
|||
// for merge properties, the current restrictions on the property names should | |||
// still apply to the child TreePruner | |||
if (prop.merge) | |||
if (prop.merge && child != null) |
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.
@vivek Use of merge
in the 'Cause' @Exported(name="cause", merge = true)
caused this NPE. This check fixes it but perhaps this should go upstream?
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.
Yeah, please open a PR in stapler with this fix.
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.
Fixed jenkinsci/stapler#112
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.
👍
@michaelneale this is going to make it 1,000,000 times easier to find the correct runs of the ATH. |
@@ -158,6 +160,9 @@ public Object getValue(Property property, Object model, ExportConfig config) thr | |||
printError(model.getClass(), e); | |||
return SKIP; | |||
} | |||
} else if (model instanceof Item || model instanceof Run) { |
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.
@vivek I have skipped serialisation of Item
and Run
objects in case they are returned by a Cause
object. These are evil for performance reasons anyway. I have checked implementations in core and I can't see any that do this but I've added it to be on the safe side (who knows what plugins will 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.
Its a hack but should be fine until we find something else pulling in something else during serialization thats not item or run. We can revisit if its trouble later on.
@cliffmeyers this is the PR with the hanging tests |
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.
@i386 We could have used causeAction directly instead of wrapping in a backend abstraction, no? I guess there are many actions and we could end up duplicating wrapping them in our backend. Other than that, there are couple of minor comments and looks good.
@Exported(name = CAUSE_OF_BLOCKAGE) | ||
public abstract String getCauseOfBlockage(); | ||
|
||
@ExportedBean | ||
public static abstract class Cause { |
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.
Its a proper abstraction, perhaps should be pulled out in separate file? Also 'Blue' prefix to be consistent?
public abstract Object getCause(); | ||
|
||
@Exported(name = "_class") | ||
public abstract String get_Class(); |
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.
Why do we need this in abstraction? Stapler does it automatically, or implementations can override that behavior, no?
@@ -25,7 +28,7 @@ public TreePruner accept(Object node, Property prop) { | |||
|
|||
// for merge properties, the current restrictions on the property names should | |||
// still apply to the child TreePruner | |||
if (prop.merge) | |||
if (prop.merge && child != null) |
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.
Yeah, please open a PR in stapler with this fix.
@@ -158,6 +160,9 @@ public Object getValue(Property property, Object model, ExportConfig config) thr | |||
printError(model.getClass(), e); | |||
return SKIP; | |||
} | |||
} else if (model instanceof Item || model instanceof Run) { |
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.
Its a hack but should be fine until we find something else pulling in something else during serialization thats not item or run. We can revisit if its trouble later on.
@vivek only if you are happy with |
@i386 I meant using action mechanism, causeAction is served via actions element. Well, its now available only via tree query, which we don't have it yet. I guess, we can deal with Cause this way and handle other future actions via action mechanism. |
@i386 Sounds good 👍 |
@vivek fixed the comments about naming here. |
@cliffmeyers @tfennelly in order to merge I need to get this change to jsbuilder merged and a release made tfennelly/jenkins-js-builder#2 |
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.
LGTM 🐝
…eature/JENKINS-40979
Requires jsbuilder PR to be merged, released then bumped across all modules. |
🐝 ATH is happy |
Description
See JENKINS-40979.
Submitter checklist
Reviewer checklist
@vivek there are some Java API changes to help make this happen.