-
Bug
-
Resolution: Not A Defect
-
Minor
-
None
I'm finding this metric to be slightly unreliable. It seems to flip between SUCCESS and ?. For the oridinal I seem to only ever get 0 or 5.
I'm not sure 100% sure, but the unreliable data seems to come from pipeline builds, running something from a cmd script for example seems ok.
Key part of the code appears to be:
// Build is not finished when running with pipelines. Set build status as unknown and ordinal // as something not predefined String result; int ordinal; Result buildResult = build.getResult(); if (buildResult == null) { result = "?"; ordinal = 5; } else { result = buildResult.toString(); ordinal = buildResult.ordinal; }
Inside jenkinsci.plugins.influxdb.generators.JenkinsBasePointGenerator.
Does it mean we cannot get reliable metrics on a pipeline based job?
Hi richardcole,
All this is explained in the plugin documentation.
But as a short explanation the reason for that is that pipelines don't have a "post" section as freestyle jobs have. Yes, post closure is available in the declarative form, but deep down it's still not the actual post-build, it's just a decorator. This means that the variables that are set after the build has run (such as currentBuild.result) don't have a value during pipeline jobs. Which in turn means that you have to assign those yourself if you want to use the data in pipelines, meaning something like this: