Am I being overly ambitious and just need to resign myself to the fact that
I need to block the entire Jenkins job when a resource is locked by another
job, and not just block the individual build step?
I've discovered that ResourceActivity is close to what I require, the
problem is that once the build is underway I cannot update the resouce that
I am trying to lock.
Ideally in the perform(AbstractBuild<?, ?> build, Launcher launcher,
BuildListener listener) method I would:
1. Set the resource that I want to lock to reserve its place in the queue
2. Notify Jenkins that it needs to update the resource locks for this
build - ie Jenkins would call getResourceList() again
3. Check if any other jobs already have the resource locked and sit
waiting wait unit the locked resource is available again before proceeding
public class SelectApplicationBuilder extends Builder implements
ResourceActivity {
...
@Override
public boolean perform(AbstractBuild<?, ?> build, Launcher launcher,
BuildListener listener) throws IOException {
...
}
@Override
public ResourceList getResourceList() {
System.out.println("==================BuildMaster Application
Resource " + this.applicationId);
ResourceList list = new ResourceList();
Resource r = new Resource("BuildMaster Application " +
this.applicationId
);
list.w(r);
return list;
}
// ResourceActivity
@Override
public String getDisplayName() {
return "BuildMaster Application Resource";
}
}
--
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/51d87e72-75ea-453c-a573-571abc43711c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.