Closed Jochen-A-Fuerbacher closed 8 years ago
Note from #44
This indicates an option to fail the build if retries exceeded is useful.
It makes sense that rescheduling the build only when a timeout occurs. That cannot be achieved with naginator-plugin. However, At the same time, it 's preferred to integrate rescheduling features into one plugin.
What we really need is an operation to have naginator-plugin reschedule the build, isn't it? That requires to extend naginator-plugin to accept commandes to reschedule from other plugins and I'll work for that. Would you let me have time for that work?
Continuing this pull request is useful as you can use this feature locally or naginator-plugin might not like that extension.
@ikedam Yes, that would be nice.
I sent a pull request to naginator-plugin. https://issues.jenkins-ci.org/browse/JENKINS-29715 https://github.com/jenkinsci/naginator-plugin/pull/16
I found this feature requested long time ago: JENKINS-8947
Sorry to have kept you waiting.
Now naginator-plugin-1.16alpha-1 is availeble, which allows us trigger naginator-plugin from build-timeout plugin. The outline to integrate:
AbortAndRestartOperation
have to do is to add NaginatorScheduleAction
to the build.@Jochen-A-Fuerbacher @stefanbrausch Can you continue this development? If so, I also want you to write unittests for this new feature.
We will continue this development, but it could take a little bit time, because we have other projects at the moment with higher priority.
No problem to take a time. Thanks in advance. Please let me know if you need any help.
I implemented naginator integration in build-timeout. But I can't run unit tests of build-timeout plugin. The existing(!) tests fail. According to Maven output, it's a problem with JSP support. When I force Maven to only test my unit test, it's the same problem. I also figured out that my test fails when calling JenkinsRule. Do you have any advice?
I don't think I can help you only with that information.
Ok, I reduced my test to:
@Rule
public BuildTimeOutJenkinsRule j = new BuildTimeOutJenkinsRule();
@Test
@LocalData
public void testAbortAndRestart() throws Exception { }
where testAbortAndRestart()
doesn't contain anything.
When I force Maven to only run my "test" with -Dtest=AbortAndRestartOperationTest
, I get the following error:
Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 3.08 sec <<< FAILURE!
testAbortAndRestart(hudson.plugins.build_timeout.operations.AbortAndRestartOperationTest) Time elapsed: 2.77 sec <<< ERROR!
java.lang.NoClassDefFoundError: hudson/model/AbstractBuild$AbstractBuildExecution
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:791)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:449)
at java.net.URLClassLoader.access$100(URLClassLoader.java:71)
at java.net.URLClassLoader$1.run(URLClassLoader.java:361)
at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
at java.lang.ClassLoader.loadClass(ClassLoader.java:423)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
at java.lang.ClassLoader.loadClass(ClassLoader.java:356)
at java.lang.Class.getDeclaredMethods0(Native Method)
at java.lang.Class.privateGetDeclaredMethods(Class.java:2451)
at java.lang.Class.getDeclaredMethods(Class.java:1810)
at org.jvnet.hudson.annotation_indexer.Index$2$1.fetch(Index.java:101)
at org.jvnet.hudson.annotation_indexer.Index$2$1.hasNext(Index.java:71)
at org.jvnet.hudson.annotation_indexer.FilterIterator.fetch(FilterIterator.java:23)
at org.jvnet.hudson.annotation_indexer.FilterIterator.hasNext(FilterIterator.java:42)
at hudson.init.InitializerFinder.discoverTasks(InitializerFinder.java:70)
at hudson.init.InitializerFinder.discoverTasks(InitializerFinder.java:55)
at org.jvnet.hudson.reactor.TaskBuilder$2.discoverTasks(TaskBuilder.java:40)
at org.jvnet.hudson.reactor.Reactor.
AbstractBuild.AbstractBuildExecution
isn't available in Jenkins 1.466: https://github.com/jenkinsci/jenkins/commit/14dbcd88d37c675baf6c58682519d129e45cb221
I'm not sure what caused that dependency.
What happens if you removed LocalData
?
I suppose your current working branch is https://github.com/Jochen-A-Fuerbacher/build-timeout-plugin/tree/naginator :
WithPlugin
as naginator-plugin will be automatically installed when added to the dependency of pom.xml.LocalData
, instead, to set up a job inside a test method (using AbstractProject#getBuildersList
so on).
LocalData
and replace it later, or I can replace that after merging your code.Your trouble might be caused by the mismatch of the Jenkins versions of this plugin and of naginator plugin. If changing the target version resolves the problem, you can continue the development with that branch.
I found that the problem reproduces also in my environment and I can avoid that in the following way:
<dependency>
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>naginator</artifactId>
<version>1.16-alpha-1</version>
<optional>true</optional>
<exclusions>
<exclusion>
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>matrix-project</artifactId>
</exclusion>
</exclusions>
</dependency>
Details:
When I exclude matrix-project like you did, I get the following exception:
SEVERE: Failed Loading plugin naginator
java.io.IOException: Dependency matrix-project (1.2) doesn't exist
My workaround is, that I changed the required core in pom.xml to 1.609.3. This is the actual LTS version of Jenkins. With that change all existing tests run fine.
My workaround is, that I changed the required core in pom.xml to 1.609.3. This is the actual LTS version of Jenkins. With that change all existing tests run fine.
Ok. Please continue the development with that change.
I'll make a pull request for naginator-plugin not to depend on matrix-project plugin. It might be merged in naginator-plugin 1.16.
Though this work may be still in progress, I added some comments that make it easy for you to write and run unit tests. Please let me know if this request is ready for full reviews.
You can ignore errors from findbugs if raised in lines you didn't change. Newer Jenkins core are fully annotated with findbugs and the check gets more strict when upgrading the target version. Of course, you can fix them if you like it.
I changed the code you commented. You can do a full review of this request.
Thank you!
It's better to accept variable expressions for maxRestarts
.
Really sorry for a late request, but it will get hard to change a type of a field after making a release.
You can expand variable with build.getEnvironment(listener).expand(string);
.
Would you try that?
I changed maxRestarts
to accept variable expressions.
With the é in the name, I get encoding error when building.
Hmm...I'll have a look on that. I think I can resolve that by adding encoding instructions in pom.xml.
Thanks for the update. I added a few more comments, but I think they can be fixed easily.
Please wait for a little more time till naginator 1.16 is released. I believe we can revert the target version after that and it makes many things easier (e.g. firebug no longer claims errors).
Thank you for your comments. I changed the code you commented. Anything I should do because of the encoding problem?
Anything I should do because of the encoding problem?
Nothing to do for now. We'll revert the target Jenkins version when the new version of naginator plugin is released, and we can revert that file at that time.
I'll change the encoding of that file in another commit (It's not a good idea to do that in this request).
Sorry for having you wait for so long time! Naginator-plugin 1.16 was released. It may take some time till it's available in the update center, but should be already available in the maven repository.
Would you do followings?:
git rebase
and overwrite the pull request with git push --force
.Hello,
in the next few weeks I don't have the time to work on that plugin. But it's in my backlog and I'm looking forward to work on this as soon as possible.
Rebased and recreated #54.
Released in build-timeout 1.17.
Hi, I implemented the review requests from pull request 44 ( https://github.com/jenkinsci/build-timeout-plugin/pull/44 ).
Jochen