Issue Type: Bug Bug
Assignee: wolfs
Components: groovy-postbuild-plugin
Created: 20/Nov/14 12:04 PM
Description:

Hi we upgraded our Jenkins version today from 1.574 to the latest 1.590.

We had a job which ran a groovy postbuild script that would mark a trigger job as failed if any of the downstream jobs from the trigger failed.

This worked on the previous version we were using, but now we are getting:

ERROR: Failed to evaluate groovy script.
java.lang.IllegalStateException: cannot change build result while in COMPLETED
	at hudson.model.Run.setResult(Run.java:458)
	at hudson.model.Run$setResult.call(Unknown Source)
	at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:42)
	at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:108)
	at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:116)
	at Script1.run(Script1.groovy:9)
	at groovy.lang.GroovyShell.evaluate(GroovyShell.java:580)
	at groovy.lang.GroovyShell.evaluate(GroovyShell.java:618)
	at groovy.lang.GroovyShell.evaluate(GroovyShell.java:589)
	at org.jvnet.hudson.plugins.groovypostbuild.GroovyPostbuildRecorder.perform(GroovyPostbuildRecorder.java:312)
	at hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:20)
	at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:770)
	at hudson.model.AbstractBuild$AbstractBuildExecution.performAllBuildSteps(AbstractBuild.java:734)
	at hudson.model.Build$BuildExecution.post2(Build.java:183)
	at hudson.model.AbstractBuild$AbstractBuildExecution.post(AbstractBuild.java:683)
	at hudson.model.Run.execute(Run.java:1784)
	at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
	at hudson.model.ResourceController.execute(ResourceController.java:89)
	at hudson.model.Executor.run(Executor.java:240)
Build step 'Groovy Postbuild' changed build result to FAILURE
Build step 'Groovy Postbuild' marked build as failure

The script looks like this:

import jenkins.model.Jenkins
import hudson.model.*

def fawTriggerTest = Jenkins.instance.getItem('faw-trigger-tests')
def buildNumber = manager.build.buildVariables.VERSION_NUMBER as int
def build = fawTriggerTest.getBuildByNumber(buildNumber)
manager.listener.logger.println  "faw-trigger-test $buildNumber currently is ${build.result}"
manager.listener.logger.println "About to mark $buildNumber as failed"
build.setResult(Result.FAILURE)
manager.listener.logger.println  "faw-trigger-test $buildNumber is now ${build.result}"

We've looked at the API and see that we are not allowed to change status of a COMPLETED job. Is this a new update seeing as this worked previously?

If we are no longer allowed to do this, is there a way we can mark another job as a failure once it is in a completed state.

P.S. We havent updated the Groovy PostBuild plugin due to a warning on the updates page which is quite off putting.

Environment: Jenkins ver 1.590
Groovy Postbuild 1.10
Project: Jenkins
Priority: Blocker Blocker
Reporter: Find Watch
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators.
For more information on JIRA, see: http://www.atlassian.com/software/jira

--
You received this message because you are subscribed to the Google Groups "Jenkins Issues" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to