-
-
Notifications
You must be signed in to change notification settings - Fork 35
[JENKINS-27317] Add support for MatrixAggregatable on ProxyPublisher #26
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
base: master
Are you sure you want to change the base?
Conversation
|
Thank you for a pull request! Please check this document for how the Jenkins project handles pull requests |
|
Thanks! |
|
I will see if I can add some unit tests |
|
Is it possible for me to change the commit for this Pull Request, without having to make a new Pull Request? I need to change my email address in the commit. Edit: I was able to change both author and committer email address. Looks like the Pull Request is still valid. |
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.
At risk of nit-picky ... use tabs for consistency with files. Cheers.
|
I have tried this fix on a running Jenkins instance and it fails. I have a template project containing a groovy script in Postbuild within a flexible publish. The matrix parent is running this postbuild before starting all the configurations, and fails with a NullPointerException. I have made ProxyPublisher implement MatrixAggregatable, but not ProxyBuilder. java.lang.NullPointerException
at hudson.plugins.templateproject.ProxyMatrixAggregator.startBuild(ProxyMatrixAggregator.java:27)
at org.jenkins_ci.plugins.flexible_publish.strategy.FailAtEndExecutionStrategy.matrixAggregationStartBuild(FailAtEndExecutionStrategy.java:95)
at org.jenkins_ci.plugins.flexible_publish.ConditionalMatrixAggregator.startBuild(ConditionalMatrixAggregator.java:76)
at org.jenkins_ci.plugins.flexible_publish.FlexibleMatrixAggregator.startBuild(FlexibleMatrixAggregator.java:62)
at hudson.plugins.templateproject.ProxyMatrixAggregator.startBuild(ProxyMatrixAggregator.java:27)
at hudson.plugins.templateproject.ProxyMatrixAggregator.startBuild(ProxyMatrixAggregator.java:27)
at hudson.matrix.DefaultMatrixExecutionStrategyImpl.notifyStartBuild(DefaultMatrixExecutionStrategyImpl.java:212)
at hudson.matrix.DefaultMatrixExecutionStrategyImpl.run(DefaultMatrixExecutionStrategyImpl.java:127)
at hudson.matrix.MatrixBuild$MatrixBuildExecution.doRun(MatrixBuild.java:352)
at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:537)
at hudson.model.Run.execute(Run.java:1741)
at hudson.matrix.MatrixBuild.run(MatrixBuild.java:301)
at hudson.model.ResourceController.execute(ResourceController.java:98)
at hudson.model.Executor.run(Executor.java:410)
ERROR: Failed to evaluate groovy script.
java.lang.NullPointerException
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.tag(CliGitAPIImpl.java:1206)
at hudson.plugins.git.GitAPI.tag(GitAPI.java:274)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
ERROR: [flexible-publish] aggregation with hudson.plugins.templateproject.ProxyMatrixAggregator@388d65af is aborted due to exception
java.lang.NullPointerException
at hudson.plugins.templateproject.ProxyMatrixAggregator.endBuild(ProxyMatrixAggregator.java:53)
at org.jenkins_ci.plugins.flexible_publish.strategy.FailAtEndExecutionStrategy.matrixAggregationEndBuild(FailAtEndExecutionStrategy.java:132)
at org.jenkins_ci.plugins.flexible_publish.ConditionalMatrixAggregator.endBuild(ConditionalMatrixAggregator.java:87)
at org.jenkins_ci.plugins.flexible_publish.FlexibleMatrixAggregator.endBuild(FlexibleMatrixAggregator.java:103)
at hudson.plugins.templateproject.ProxyMatrixAggregator.endBuild(ProxyMatrixAggregator.java:53)
at hudson.plugins.templateproject.ProxyMatrixAggregator.endBuild(ProxyMatrixAggregator.java:53)
at hudson.matrix.MatrixBuild$MatrixBuildExecution.post2(MatrixBuild.java:402)
at hudson.model.AbstractBuild$AbstractBuildExecution.post(AbstractBuild.java:671)
at hudson.model.Run.execute(Run.java:1766)
at hudson.matrix.MatrixBuild.run(MatrixBuild.java:301)
at hudson.model.ResourceController.execute(ResourceController.java:98)
at hudson.model.Executor.run(Executor.java:410) |
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 sounds that you need a null check here.
|
You are suggesting a nullcheck on publisherAggregator before I add it to the list? |
|
Sure. |
|
But should not matrix parent run the postbuild actions after running each configurations? It looks like here it attempted to run them before the configurations. If i add a Groovy postbuild directly to a multi-configuration project and set "Run also for matrix parent", then that script is executed on matrix parent after each configurations have finished. |
|
Aggegations consist of three phases:
Refer to the javadoc for details. |
|
Shouldn't in that case the MatrixAggregator for ProxyPublish only implement endBuild(), since that is when the publishers should run on matrix parent. |
|
I have made some changes to the implementation. Taken some inspiration from ScriptPlugin https://github.com/JoelJ/ScriptPlugin |
|
-1 There's no reason to prevent And you should not use |
|
Perhaps I do misunderstand aggregations. The purpose for this fix was in my understanding to allow for executing publishers from template project on matrix parent after each configurations. I added MatrixAggregatable aslo for ProxyBuilder. Will avoid amend and force from now on. |
|
My first submitted fix for a Jenkins project did not go so well. Another problem has arisen. FATAL: cannot change build result while in COMPLETED
java.lang.IllegalStateException: cannot change build result while in COMPLETED
at hudson.model.Run.setResult(Run.java:459)
at org.jenkins_ci.plugins.run_condition.BuildStepRunner.setResult(BuildStepRunner.java:64)
at org.jenkins_ci.plugins.run_condition.BuildStepRunner.access$200(BuildStepRunner.java:46)
at org.jenkins_ci.plugins.run_condition.BuildStepRunner$Fail.conditionalRun(BuildStepRunner.java:151)
at org.jenkins_ci.plugins.run_condition.BuildStepRunner.perform(BuildStepRunner.java:105)
at org.jenkins_ci.plugins.flexible_publish.strategy.FailFastExecutionStrategy.matrixAggregationEndRun(FailFastExecutionStrategy.java:85)
at org.jenkins_ci.plugins.flexible_publish.ConditionalMatrixAggregator.endRun(ConditionalMatrixAggregator.java:82)
at org.jenkins_ci.plugins.flexible_publish.FlexibleMatrixAggregator.endRun(FlexibleMatrixAggregator.java:83)
at hudson.plugins.templateproject.ProxyMatrixAggregator.endRun(ProxyMatrixAggregator.java:50)
at hudson.matrix.DefaultMatrixExecutionStrategyImpl.notifyEndBuild(DefaultMatrixExecutionStrategyImpl.java:220)
at hudson.matrix.DefaultMatrixExecutionStrategyImpl.run(DefaultMatrixExecutionStrategyImpl.java:163)
at hudson.matrix.MatrixBuild$MatrixBuildExecution.doRun(MatrixBuild.java:352)
at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:537)
at hudson.model.Run.execute(Run.java:1741)
at hudson.matrix.MatrixBuild.run(MatrixBuild.java:301)
at hudson.model.ResourceController.execute(ResourceController.java:98)
at hudson.model.Executor.run(Executor.java:410) |
|
Any luck? |
No description provided.