Hi,
Any idea how can I add support for InterruptedException to my plugin?
I have a builder plugin that zips some files from the workspace and then uploads them on a remote server.
The flow is basically like this:
---
public void perform(@Nonnull Run<?, ?> build, @Nonnull FilePath workspace,
@Nonnull Launcher launcher, @Nonnull TaskListener listener) throws IOException {
launcher.getChannel().call(deployCallable);
}
---
deployCallable is an instance of a inner class described bellow:
---
private static class DeployCallable extends MasterToSlaveCallable<Boolean, InterruptedException> { // So it works in master/slave setup
private static final long serialVersionUID = 1L;
public Boolean call() throws InterruptedException {
for folder in path {
zip(folder);
}
for zip in zipFiles {
upload(zip); // Using Apache HTTP Client
}
}
}
---
The problem is that that if I click cancel on the job it still runs until by build step is finished and all files are zipped and uploaded and only then it marks the build as aborted.
Is there any way to check from my plugin if the job was aborted and just stop wherever I am in the build?
Let's say I just created the zips and user clicks on cancel, how do I stop here and not also upload all zips?
Thank you.