Hey everyone,
This is a follow up post to a discussion we had while attending the Jenkins
CI code camp in Copenhagen.
Basically we have a plugin that has to be able to set the result of a
build, and it has to be the final Judge in the overall result of the build,
our build step only runs when the overall result is SUCCESS and our plugin
should have the final-final say in the result of the proces.
We implemented it as a publisher, and I made the mistake of implementing
and overriding the method below.
@Override
public boolean needsToRunAfterFinalized() {
return true;
}
This means that we do run after after the result of the build is final, but
since our publisher itself can fail (we do Git stuff), we end up in the
situation described here:
https://issues.jenkins-ci.org/browse/JENKINS-30465
What makes this a bit tricky is that we actually programatically add our
publisher during build if it isn't present
So i thought about solutions
1. RunListeners (onCompleted(), onFinalized() - nope they're all after
the build status has been set
2. Change to Recorder, and set @Extension(ordinal = Double.MIN_VALUE) to
add it to the very end of the publisher list
3. ? Others
Solution 2 seems like a hack to me, and it does not prevent users from
switching the order of the post build steps. It's also further complicated
by the fact that we add the publisher in code during exection of our plugin.
So is there a way we can make sure we're the absolute last plugin to have a
say in the finalized result of a build?
I took a look at how this was handled in for example the GitPublisher
Plugin since it also has the option to only push on succesful builds, the
solution they choose is #2 from above, but it seems kinda fragile as this
can be moved around in the list after it has been added?
It lead to the discussion of the posibility of adding an optional 'Final
Judge' slot in the job configuration, each job could only have one of those
(having one at all would be optional)
Is my use case totally wrong here? Or is it something that could be of
interest to others?
Best regards,
Mads
[image: ____________________________________________________________]
Mads Nielsen
Consultant
[email protected]
+45 50 98 18 09 <+45%2050%2098%2018%2009>
Skype: inkspot
Praqma
www.praqma.com
DK: CPH, Aarhus, Allerod
NO: OSL
SE: STHLM
+45 36 PRAQMA <+4536772762>
<http://www.praqma.com/events/git>
--
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 [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/jenkinsci-dev/CAFariuvJZTpt68p3WzJSB0%3DspJLYumCCr1gzhzVLq0HJn%2BP4Tg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.