jenkinsci/jenkins — pull request #1348 by daniel-beck (2014-08-02 09:14:25+00:00)
Title: [FIXED JENKINS-20307] Consider OneOffExecutors in Run.getExecutor()

This resolves the message…

> Build has been executing for null on master

…as well as possible other issues resulting from the fact that the Javadoc for `Run.getExecutor()`, implying non-`null` result while executing, is not correct for Flyweight tasks.

----

In `AbstractBuild`'s `index.jelly`, `${it.executor}` is null for `Flyweight` tasks if Flyweight support is enabled, as `Run.getExecutor()` does not search `OneOffExecutor`s.

While there is also `Run.getOneOffExecutor()` I doubt this shouldn't be transparent to the API user. So I extended this instead of replacing all `getExecutor()` calls with `getExecutor()/getOneOffExecutor()` combinations. The method `getOneOffExecutor()` was introduced in 17baab5491b846f613c2dafec3d229c40b4104c3 but it's not clear why this approach was chosen.

What might be a bit weird is that the `OneOffExecutor` is exposed to the build's API this way, but can easily be distinguished from regular executors by having a number of `-1`.