On Tue, Jan 14, 2020 at 10:26 AM Andreas Sieferlinger
<
psdsief...@gmail.com> wrote:
> The problem in this context is that due to the agents being ephemeral they are deleted immediately after they stop, and with that also this log is gone.
> So the idea was to add some basic output (eg the TaskID) in the actual build log for easier debugging for users.
Reminds me of:
https://github.com/jenkinsci/kubernetes-plugin/pull/497
In general, diagnostics for ephemeral agents are not great. If you use
for example the `dockerNode` step, then the Jenkins queue is bypassed
and the agent log is just streamed into the owning build log. I do not
think there is a simple way for `Computer` (etc.) implementation to
inject this into the log for a user of the general `node` step or
freestyle builds, though. The best I can come up with (Pipeline only)
is to implement
https://javadoc.jenkins.io/plugin/workflow-api/org/jenkinsci/plugins/workflow/flow/StepListener.html
then check whether it is `node` (`ExecutorStep`) being run, and if the
context says that the `Computer` is yours, ask the context for the
`TaskListener` and copy the `Computer.getLogText` so far. Ideally
there would be a real API for a computer to print some information
when a build starts using an executor on it; or some flag indicating
that it is ephemeral and single-use so that the code using the
executor (e.g., `ExecutorStepExecution`) could decide to stream the
agent log.