On Thu, May 03, 2018 at 02:27:32PM -0400, Jesse Glick wrote:
> Well, at least for `sh` steps you can identify the command line (in
> most cases) via `ArgumentsAction`.

Thanks for the hint. I would prefer to have proper IDs for correlation, but if
nothing else works this will probably have to do.

> Note that my suggestion about defining environment variables in a
> custom block-scoped step may not fit your needs since the environment
> variables need to be defined before the body starts, so you could not
> include timing information about this step itself.

Yes this is the case. Unfortunately currently it is not possible to create the
timer in a non-started state.

> From my (again, weak) understanding of your goals, it might work
> better to use the `STAGE_NAME` environment variable from inside
> external processes to see where you are in the build, which can then
> be mapped back to build metadata via the flow graph. Or scripts could
> be amended slightly to just use `withEnv` to specify some arbitrary
> ID, accessible of course to external processes via environment,
> correlatable to the flow graph via `ArgumentsAction`.

It would have to be a custom step, because the environment variable has to be
computed by the library. But otherwise, this is what I have currently.

> I suppose we could also amend `DefaultStepContext.get` to include a
> special variable bound to the current `FlowNode.id`;

This is actually currently implemented in `CpsStepContext`,
and exposed via the generic `StepContext.get`.
It includes the complete FlowNode.
This is currently used by my mentioned custom step.

> and/or more
> generally introduce an `ExtensionPoint` similar to
> `EnvironmentExpander` but accepting a `StepContext` argument (to be
> called from a new overload of `getEffectiveEnvironment`), so you could
> bind such a variable yourself. The latter would be an Enhancement with
> `api` label in `workflow-step-api-plugin` + `workflow-support-plugin`.

I assume it should be similar to `EnvironmentContributor`, right?

Something like this would be great.

If this feature has a chance of being merged I would like to take a stab at
implementing it.
Should I open a proper ticket to discuss the details or are concrete prototypes
preferred?

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-dev/20180504072209.GA9643%40fralrnd0033.fra.amadeus.net.
For more options, visit https://groups.google.com/d/optout.

Reply via email to