Hello. Is there a way to update the last stable build # for a project? At
Etsy we use a plugin <https://github.com/etsy/jenkins-master-project> where
a parent (master) job spawns sub-jobs, and you can click a link to retry a
sub-job, thus mutating the parent job's result from red to green if the
sub-job passes on a retry. When that happens, I'd like to update the last
stable build # for the parent job.
It looks like the symlink cache for "lastStableBuild" prevents this,
because no matter how many times I
call Permalink.LAST_STABLE_BUILD.resolve(), it will find the *previous*
last stable build, check that apply() returns true (it still does), and
return that build.
To put it another way, I think I'd like to call
PeepholePermalink.updateCache(), but that method's protected. My
super-hacky way of accessing it is to use a trivial subclass:
private static final class HackyUpdateablePermalink extends
PeepholePermalink {
public String getDisplayName() {
return Permalink.LAST_STABLE_BUILD.getDisplayName();
}
public String getId() {
return Permalink.LAST_STABLE_BUILD.getId();
}
public boolean apply(Run<?, ?> run) {
return ((PeepholePermalink) Permalink.LAST_STABLE_BUILD).apply(run);
}
public void doUpdate(Job<?,?> job, Run<?,?> run) {
updateCache(job, run);
}
}
...and in our plugin, when a sub-job completes, we call doUpdate() on an
instance of this class. Yikes.
Any thoughts on a better way?
Thanks,
Yash
--
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].
For more options, visit https://groups.google.com/d/optout.