Unable to chage the build status in a Recorder

48 views
Skip to first unread message

Greg Allen

unread,
Nov 3, 2015, 11:07:02 AM11/3/15
to jenkin...@googlegroups.com
I have implemented a Recorder and am attempting to set the build status from it. However, when I do I get the following exception:

java.lang.IllegalStateException: cannot change build result while in POST_PRODUCTION
	at hudson.model.Run.setResult(Run.java:458)
	at com.redhat.jenkins.plugins.ci.CIPolarionExporter.perform(CIPolarionExporter.java:355)
	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.cleanUp(Build.java:192)
	at hudson.model.Run.execute(Run.java:1805)
	at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
	at hudson.model.ResourceController.execute(ResourceController.java:89)
	at hudson.model.Executor.run(Executor.java:240)

My class extends Recorder and according to what I have read in a Recorder it is possible to modify the build status (unlike a Notifier):

/**
 * {@link Recorder} is a kind of {@link Publisher} that collects statistics from the build,
 * and can mark builds as unstable/failure. This marking ensures that builds are marked accordingly
 * before notifications are sent via {@link Notifier}s. Otherwise, if the build is marked failed
 * after some notifications are sent, inconsistency ensues.
 */

My Jenkins version is 1.596.1, and the parent pom in my maven project where I build the plugin is 1.596.1 as well.

I feel like I am missing something obvious here, but I'm not seeing it.

Can anyone help?

Thanks,

-- Greg

Kanstantsin Shautsou

unread,
Nov 3, 2015, 11:19:03 AM11/3/15
to Jenkins Developers
Could you provide link to code (CIPolarionExporter.java)?

Greg Allen

unread,
Nov 3, 2015, 11:25:14 AM11/3/15
to jenkin...@googlegroups.com
Unfortunately this repo is on an internal server.  I've attached the file though so you can see it.

-- Greg



On 11/03/2015 11:19 AM, Kanstantsin Shautsou wrote:
Could you provide link to code (CIPolarionExporter.java)?

On Tuesday, November 3, 2015 at 7:07:02 PM UTC+3, Greg Allen wrote:
I have implemented a Recorder and am attempting to set the build status from it. However, when I do I get the following exception:


My class extends Recorder and according to what I have read in a Recorder it is possible to modify the build status (unlike a Notifier):

/**
 * {@link Recorder} is a kind of {@link Publisher} that collects statistics from the build,
 * and can mark builds as unstable/failure. This marking ensures that builds are marked accordingly
 * before notifications are sent via {@link Notifier}s. Otherwise, if the build is marked failed
 * after some notifications are sent, inconsistency ensues.
 */

My Jenkins version is 1.596.1, and the parent pom in my maven project where I build the plugin is 1.596.1 as well.

I feel like I am missing something obvious here, but I'm not seeing it.

Can anyone help?

Thanks,

-- Greg
--
You received this message because you are subscribed to the Google Groups "Jenkins Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-de...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-dev/0c073901-0221-437d-abf0-e00d0b345449%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

CIPolarionExporter.java

Kanstantsin Shautsou

unread,
Nov 3, 2015, 11:28:05 AM11/3/15
to jenkin...@googlegroups.com
Could you cut internal code and keep skeleton (methods, class inheritance, build monitor)?
You received this message because you are subscribed to a topic in the Google Groups "Jenkins Developers" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/jenkinsci-dev/aoaeU6nHaIU/unsubscribe.
To unsubscribe from this group and all its topics, send an email to jenkinsci-de...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-dev/5638DFE4.7050705%40redhat.com.

For more options, visit https://groups.google.com/d/optout.
<CIPolarionExporter.java>

Greg Allen

unread,
Nov 3, 2015, 11:43:14 AM11/3/15
to jenkin...@googlegroups.com
I attached the entire file you requested to my last response. Is there something else you are looking for? 

On 11/03/2015 11:27 AM, Kanstantsin Shautsou wrote:
Could you cut internal code and keep skeleton (methods, class inheritance, build monitor)?
On Nov 3, 2015, at 19:25, Greg Allen <gal...@redhat.com> wrote:

Unfortunately this repo is on an internal server.  I've attached the file though so you can see it.

-- Greg


On 11/03/2015 11:19 AM, Kanstantsin Shautsou wrote:
Could you provide link to code (CIPolarionExporter.java)?

On Tuesday, November 3, 2015 at 7:07:02 PM UTC+3, Greg Allen wrote:
I have implemented a Recorder and am attempting to set the build status from it. However, when I do I get the following exception:

java.lan
g.IllegalStat!
 eException
: cannot change build result while in POST_PRODUCTION
	at hudson.model.Run.setResult(Run.java:458)

Kanstantsin Shautsou

unread,
Nov 3, 2015, 11:51:39 AM11/3/15
to Jenkins Developers
Sorry, missed attach, looking at it

Kanstantsin Shautsou

unread,
Nov 3, 2015, 12:05:00 PM11/3/15
to Jenkins Developers
First idea - try run on other core versions, older/newer. POST_PRODUCTION state for recorder looks wrong.
Try add build.isBuilding() and isInProgress() state print as first step in perform.

Daniel Beck

unread,
Nov 3, 2015, 12:20:45 PM11/3/15
to jenkin...@googlegroups.com

On 03.11.2015, at 17:06, Greg Allen <gal...@redhat.com> wrote:

> I have implemented a Recorder and am attempting to set the build status from it. However, when I do I get the following exception:

Your publisher returns 'true' in needsToRunAfterFinalized(), which is why it gets run during cleanup, after the build result has been determined. See the Javadoc for Publisher#needsToRunAfterFinalized().

Kanstantsin Shautsou

unread,
Nov 3, 2015, 12:26:19 PM11/3/15
to jenkin...@googlegroups.com
It has no @Override , yes it seems right answer.
> --
> You received this message because you are subscribed to a topic in the Google Groups "Jenkins Developers" group.
> To unsubscribe from this topic, visit https://groups.google.com/d/topic/jenkinsci-dev/aoaeU6nHaIU/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to jenkinsci-de...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-dev/57954910-2851-4DE3-9C01-898C6B1E5C1D%40beckweb.net.

Greg Allen

unread,
Nov 3, 2015, 12:28:53 PM11/3/15
to jenkin...@googlegroups.com
I was running an older core and still had this problem. That's one reason I upgraded to 1.591.1.

Here's the result for isBuilding:

Nov 03, 2015 5:24:57 PM com.redhat.jenkins.plugins.ci.CIPolarionExporter perform
INFO: build.isBuilding = false

I am unable to call isInProgress.

-- Greg


On 11/03/2015 12:05 PM, Kanstantsin Shautsou wrote:
First idea - try run on other core versions, older/newer. POST_PRODUCTION state for recorder looks wrong.
Try add build.isBuilding() and isInProgress() state print as first step in perform.

On Tuesday, November 3, 2015 at 7:51:39 PM UTC+3, Kanstantsin Shautsou wrote:
Sorry, missed attach, looking at it

On Tuesday, November 3, 2015 at 7:43:14 PM UTC+3, Greg Allen wrote:
I attached the entire file you requested to my last response. Is there something else you are looking for? 

On 11/03/2015 11:27 AM, Kanstantsin Shautsou wrote:
Could you cut internal code and keep skeleton (methods, class inheritance, build monitor)?
On Nov 3, 2015, at 19:25, Greg Allen <gal...@redhat.com> wrote:

Unfortunately this repo is on an internal server.  I've attached the file though so you can see it.

-- Greg


On 11/03/2015 11:19 AM, Kanstantsin Shautsou wrote:
Could you provide link to code (CIPolarionExporter.java)?

On Tuesday, November 3, 2015 at 7:07:02 PM UTC+3, Greg Allen wrote:
I have implemented a Recorder and am attempting to set the build status from it. However, when I do I get the following exception:

Greg Allen

unread,
Nov 3, 2015, 12:34:26 PM11/3/15
to jenkin...@googlegroups.com
That did it. Thanks Daniel (and also Kanstantsin)!

-- Greg
Reply all
Reply to author
Forward
0 new messages