/** * Gets the current {@link Computer} that the build is running. This method only works when called * during a build, such as by {@link Publisher}, {@link BuildWrapper}, etc. */ public static Computer currentComputer() { Executor e = Executor.currentExecutor(); // If no executor then must be on master node return e != null ? e.getOwner() : Jenkins.getInstance().toComputer(); }