Abort Move/Copy/Promote operation

Article ID:360033317512
2 minute readKnowledge base


My Move/Copy/Promote operations seems to have hung. It’s been running for hours and I cannot abort it.


The operation can be aborted by the following groovy script. Notice that <job or folder name> needs to be replaced with the full name of the item being moved, copied or promoted. Then in the script console of the controller, run:

use(groovy.time.TimeCategory) {
    def delay = 1.hour
            .each { computer ->
                computer.getAllExecutors().findAll { it.isBusy() }.each { exec ->
                    if (exec.elapsedTime > delay.toMilliseconds()) {
                      if(exec.currentExecutable instanceof com.cloudbees.opscenter.replication.ItemReplicationRecord
                         && exec.currentExecutable.source.fullName=="<job or folder name>") {
                            println " * Aborting ${exec.currentExecutable} that spent ${exec.elapsedTime}ms building..."
//                            exec.interrupt(hudson.model.Result.ABORTED, new jenkins.model.CauseOfInterruption() {
//                                @Override
//                                String getShortDescription() {
//                                    return "Build was suspended for too long. See Jenkins administrators"
//                                }
//                            })

Once you are confident that the script would abort the correct M/C/P operation, uncomment the 6 commented lines and re-run the script to actually abort the operation.

You may need to re-enable the job which was being acted on.