-
Notifications
You must be signed in to change notification settings - Fork 35
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-2 part of JENKINS-29649 + Fixed JENKINS-37623, JENKINS-38149 #14
Conversation
…grating AbstractBuild -> Run to better support Jenkins 2 workflow jobs.
👍 thanks @anenviousguest will need a few days, as I'm going through a few other plug-ins and pull requests to cut more releases. Feel free to update the pull request in the meantime. |
hi @kinow |
hi Bruno @kinow |
Ack :-) Promise that as soon as I'm done with https://github.com/jenkinsci/tap-plugin/tree/performance-fix for the performance issues. Normally I make little progress, and proceed with other issues. But this time I really want to fix these performance issues. Once it's done, will continue merging the other PR's and working on issues. Yours will be the first PR that I will look into, and with RERO motto in mind, we might have it released shortly after the PR has been merged. Sorry for the delay |
b906d7f
to
6cde4f7
Compare
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.
Generally the code should address the issue. There are several improvement areas, minor fixes are required.
I would also recommend to bump major version of the plugin since there are incompatible changes.
CC @olofk, whose issue will be likely solved by this pull request
@@ -20,7 +20,7 @@ | |||
<parent> | |||
<groupId>org.jenkins-ci.plugins</groupId> | |||
<artifactId>plugin</artifactId> | |||
<version>1.580.3</version><!-- which version of Jenkins is this plugin | |||
<version>1.637</version><!-- which version of Jenkins is this plugin |
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.
🐜 for selecting non-LTS version.
What was the reason for it?
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.
addressed.
@@ -47,26 +50,31 @@ | |||
* @since 0.1 | |||
*/ | |||
public class TapTestResultAction | |||
extends AbstractTestResultAction<AbstractTestResultAction<?>> | |||
implements StaplerProxy, SimpleBuildStep.LastBuildAction { | |||
implements StaplerProxy, SimpleBuildStep.LastBuildAction, HealthReportingAction, RunAction2 { |
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.
Removal of AbstractTestResultAction inheritance smells like a compatibility issue, but seems it's reasonable in this case
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.
was exactly causing the issue, please see "Why it happens (JENKINS-29649 part)" in the description above.
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.
Yes, I understand why this change is required. The problem is that...
- The class cannot be longer casted to AbstractTestResultAction
- Usage of non-implemented methods from AbstractTestResultAction will cause LinkageError. E.g.
findPreviousCorresponding()
So I would vouch for keeping AbstractTestResultAction inheritance. If you update JUnit plugin dependency to the latest version (1.18), you may see it's interfaces have been adapted to make this class compatible with Pipeline Plugin
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.
hi @oleg-nenashev ,
I've just tested, and upgrading to junit-plugin 1.18 doesn't fix JENKINS-29649 in this plugin.
Everything described in the "why it happens..." at the very beginning of this PR is still relevant to version 1.18.
That is, when a build contains multiple test result actions derived from AbstractTestResultAction
, the return value of TestResultProjectAction.getLastTestResultAction
, as seen here may depend on the order in which actions were saved, because it searches for actions of a base class.
Consequently, here and here wrong action might be used to draw the graph.
|
||
public transient Run<?,?> run; | ||
@Deprecated | ||
public transient AbstractBuild<?,?> owner; |
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.
Well, the binary compatibility is broken in any case
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? these have already been there, just inherited from AbstractTestResultAction
. Now that it was removed from inheritance hierarchy, i placed these fields right here.
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.
see above
/** | ||
* @param owner | ||
* @param r |
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 changes param name to the invalid one.
Having of param declarations without description is also a bad practice. Javadoc linter in Java8 will grumble about that.
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.
addressed
@Override | ||
@Exported(visibility = 2) | ||
public int getTotalCount() { |
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.
Binary compat as well
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 guess it's a diff display issue. The lines highlighted were in the unused descendant class.
getTotalCount
is still there in TapTestResultAction
* | ||
* @return associated TAP test result action object | ||
*/ | ||
private TapTestResultAction getTestResultActionDiverged() { |
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 practice: CheckForNull annotation
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.
addressed
The PR also addresses JENKINS-38149 |
@oleg-nenashev thanks for reviewing this. I'll try to accomodate changes where it deems reasonable. |
* Addressing wrong parameter name in Javadoc. * @checkfornull usage. * Depending on LTS parent version in pom.xml
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.
@oleg-nenashev Thanks for review.
I guess i've addressed all the points, please see comments.
In particular, i think binary compatibility is preserved.
@Override | ||
@Exported(visibility = 2) | ||
public int getTotalCount() { |
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 guess it's a diff display issue. The lines highlighted were in the unused descendant class.
getTotalCount
is still there in TapTestResultAction
* | ||
* @return associated TAP test result action object | ||
*/ | ||
private TapTestResultAction getTestResultActionDiverged() { |
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.
addressed
@@ -47,26 +50,31 @@ | |||
* @since 0.1 | |||
*/ | |||
public class TapTestResultAction | |||
extends AbstractTestResultAction<AbstractTestResultAction<?>> | |||
implements StaplerProxy, SimpleBuildStep.LastBuildAction { | |||
implements StaplerProxy, SimpleBuildStep.LastBuildAction, HealthReportingAction, RunAction2 { |
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.
was exactly causing the issue, please see "Why it happens (JENKINS-29649 part)" in the description above.
|
||
public transient Run<?,?> run; | ||
@Deprecated | ||
public transient AbstractBuild<?,?> owner; |
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? these have already been there, just inherited from AbstractTestResultAction
. Now that it was removed from inheritance hierarchy, i placed these fields right here.
/** | ||
* @param owner | ||
* @param r |
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.
addressed
@@ -20,7 +20,7 @@ | |||
<parent> | |||
<groupId>org.jenkins-ci.plugins</groupId> | |||
<artifactId>plugin</artifactId> | |||
<version>1.580.3</version><!-- which version of Jenkins is this plugin | |||
<version>1.637</version><!-- which version of Jenkins is this plugin |
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.
addressed.
@kinow @oleg-nenashev does that look better now? Thanks. |
@anenviousguest Provided feedback. I think that the inheritance from |
@oleg-nenashev thanks! See my reply in the above thread. |
Well, we need to think about potential solutions. Now particular Jenkins features may stop working for TAP Plugin (e.g. aggregation of downstream test results in Freestyle jobs). P.S: We've tested the change on a Pipeline-only instance, and the plugin is working as we need with this patch. |
Will try to catch up with the review/comments this weekend :) |
I'm struggling to find any immediate elegant solution to work around this check in junit-plugin. I have no idea if JUnit plugin was meant to provide a base API for test-alike plugins, but if it was, it's probably better to think of fixing the check on its side, in a long term. |
Yes, I should have read the text carefully from the beginning. The JUnit Issue
JUnit plugin has been decoupled from the Jenkins core at some point. So yes, it's actually a kind of API plugin for all test results then just a JUnit plugin.
It is a case. How to solve it?Well, it should be solved on the JUnit plugin level. Just because of that: https://github.com/search?q=org%3Ajenkinsci+%22extends+AbstractTestResultAction%22&type=Code I would just ignore this issue by now. I'll see if I can fix it on the JUnit plugin side by merging results in the plot (or by filtering them) |
I guess i know what type of fix it might be on junit-plugin side. Should I just submit a PR there and if it's merged, revise this one? Thanks. |
@anenviousguest Up to you. I think we can go forward with this PR even without waiting for JUnit stuff to be integrated and released |
Any news here? A fix would be deeply appreciated… |
@alappe lurking in the discussion between @oleg-nenashev and @anenviousguest :-) happy to review/merge whenever they confirm it's ready |
I think it's ready. The fix is required on the JUnit plugin. Merge of this PR does not increase the technical debt |
Can we release after merging it @oleg-nenashev ? Or would it be necessary to wait for a merge and release in JUnit plugin first? |
no need in waiting for JUnit plugin IMHO. Just 🚢 🇮🇹 :) |
Any updates on this pull request? I'm encountering JENKINS-38149 and would love to have it resolved... :) |
Sorry @mkhan446 got a bit busy with active-choices-plugin, had to digress for a while, but also want to get this merged and released soon. Just give me a few more days and I will sort out and prepare a release to the experimental update center, so others can test it. |
@oleg-nenashev : thanks! |
… from different plugin. Discussion thread with @oleg-nenashev: * jenkinsci/tap-plugin#14 (comment) * jenkinsci/tap-plugin#14 (comment)
Merged. Merge conflicts fixed manually, and all tests passed after that as well. Re-read the issue history, and the only concern is regarding previous behavior that may change after this change. Will push to experimental update center in a few minutes for now, and will play with the new plug-in before cutting a release, likely by the mid or end of December. Any feedback from the version in the experimental update center will definitely help! Thanks @anenviousguest and @oleg-nenashev ! |
@kinow please also amend jenkinsci/pipeline-plugin#403 to indicate the status of the release (fix version). |
Hi @kinow
Thanks for merging #13. Turns out there was missing part there, namely the fix for Jenkins 2 workflow jobs. Would appreciate if you could review it.
Also i put in here the fix for JENKINS-37623 , as the it and the change above modify same file.
TL;DR
For Jenkins 2 workflow jobs, it might happen that JUnit and TAP publishers wrongly use TAP-only (or JUnit-only) results to draw their graphs. Added test case to detect that.
Also, when build history contained runs which failed before any TAP results were published,
NullPointerException
was occurring during the tooltip generation. The graph was still rendered, but the image map was missing.Why it happens (JENKINS-29649 part)
In JUnit's code inside
TestResultProjectAction
, they try to fetch last test result action of specific type before drawing a plot:As one may see here: https://github.com/jenkinsci/junit-plugin/blob/master/src/main/java/hudson/tasks/test/TestResultProjectAction.java#L93 - the action they search for is supposed to be inherited from
AbstractTestResultAction
.And because
TapTestResultAction
is also derived fromAbstractTestResultAction
, it may (depending on the action order) be unexpectedly used to plot JUnit graphs, too. Vice versa might also be the case.This PR's content
TapTestResultAction
from JUnit and migrated it and its surroundings to use genericRun
instead ofAbstractProject
.InjectedTest
which performs basic lint checks on *.jelly files. Had to add Jelly escaping directive to make this test happy.