On Mon, Feb 4, 2019 at 4:49 AM Carles Capdevila Tejada
<
capde...@gmail.com> wrote:
> I thought that pipeline code is always executed in the master
“Pipeline code” is too broad an expression to be meaningful. The
bodies of specific API methods, such as `StepExecution.start` or
`SimpleBuildStep.perform`, are indeed run on the master. But if you
use `Callable` / `FileCallable` then you are requesting the body to
potentially be run on an agent. And `ConsoleLogFilter`s /
`TaskListenerDecorator`s may be run on agents.
> unless inside of a node() step
Running “inside” a `node` block has no effect on where code runs,
except insofar as code which _might_ run on an agent _could not_ even
start if you were not inside a `node` block. (Typically seen by the
engine refusing to run a step, throwing
`MissingContextVariableException`.) The `node` block merely offers a
contextual `FilePath`, `Computer`, etc. for any code which might ask
for it via `StepContext.get`.
> In the mentioned execution the step is called outside of a node() step, like so:
>
> logFileFilter () {
> node (nodeLabel) {
> ...
>
> So shouldn't it be executed on the master?
No, because the `sh` step inside `node` remotes a `TaskListener` to an
agent whose serial state includes your `ConsoleLogFilter`.