Hi Jesse, 

Thanks for the suggestion. I went through the docs and implementing Step 
would certainly work well for my use case.

I am trying to understand  how I can leverage SimpleBuildWrapper to be able 
to work in different job types. I assume that I need another class to 
implement the BuildWrapper extension point. In that case, I would end up 
having something like this
step ([$class: "MyStepClass"...]  // This performs some action and has the 
return values (name-value pairs)

withMyWrapperClass() { // I need this wrapper to inject those return values 
from the previous step into the block.
    
    // I can call my step here and have another wrapper block too.
}

I need to send some data from MyStepClass instance to following 
MyWrapperClass  instance so that it can inject that data into the block's 
environment. I am tending towards  doing this through an intermediate 
action created by MyStepClass instance. But if I keep adding actions from 
my step class to the build, then it is possible that an outer wrapper picks 
up an action from an inner step.  Same issue will persist if I update just 
a single action or replace it. 

Please let me know if I understood your suggestion properly regarding 
SimpleBuildWrapper and whether the approach is correct.

On Thursday, November 12, 2020 at 11:49:07 PM UTC+5:30 Jesse Glick wrote:

> On Thu, Nov 12, 2020 at 6:08 AM Lakshmi Narasimhan
> <[email protected]> wrote:
> > My issue is that the step does not return a map or any value. I am 
> referring to the "step" metastep.
>
> No, you cannot return values if you use `SimpleBuildStep`. You can
> extend `Step` directly (Pipeline-specific). But it may be better to
> extend `SimpleBuildWrapper` and define environment variables within
> its block; this will work in freestyle, Scripted Pipeline, _and_
> Declarative Pipeline (without `script` blocks).
>

-- 
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/4874d62e-e6c5-4c40-a00e-e53dbc7cfb50n%40googlegroups.com.

Reply via email to