On Wed, May 16, 2018 at 4:05 PM, Denis Richtárik <denis.richta...@gmail.com> wrote: > It needs to run ((JCloudsComputer) newSlave.toComputer()).deleteSlave(); as > it is in public void stop method. But probably somewhere else? Should I > extend something else than SynchronousNonBlockingStepExecution?
`stop` will not be called at all typically, and I do not think you meant for this to be a synchronous step: it looks quite likely to take more than a trivial amount of time to run, and you need to do cleanup, meaning that you want a block-scoped step which can do some work (ideally asynchronously), then invoke its body, then do more work when the body exits. It is possible, though not simple, to write something very much like what you are attempting; while I do not vouch for every detail, you can look at https://github.com/jenkinsci/docker-plugin/blob/554bbf8ab937611b17c2c20e9318dace5de3540f/src/main/java/io/jenkins/docker/pipeline/DockerNodeStepExecution.java#L54-L170 If this is a common use case, we could perhaps extract the difficult boilerplate into some kind of utility in `workflow-durable-task-step`. Much easier would be to avoid writing a Pipeline step at all, just implementing `Cloud`, so that a plain old `node` block (perhaps with some label expression) could be used. -- 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 jenkinsci-dev+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-dev/CANfRfr0XS9wi4PB7t8wHRrdQp2YDMMeKnbs5yMqBQGMh6iz%3DqA%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.