On Monday, February 1, 2016 at 7:29:12 AM UTC-5, Antonio Muñiz wrote:
>
> > I do not know how to make the workspace an optional 
> @StepContextParameter 
>
> You need to define a custom step, as Jesse told before. 
>
>
I have done that. The code is:
    public static final class Execution extends 
AbstractSynchronousNonBlockingStepExecution<ResponseContentSupplier> {
        @Inject
        private transient HttpRequestStep step;
        @StepContextParameter
        private transient Run run;
        @StepContextParameter
        private transient TaskListener listener;
        @Override
        protected ResponseContentSupplier run() throws Exception {
            HttpRequest httpRequest = new HttpRequest(step.url);
            // ... not shown: use setters to configure httpRequest.
            ResponseContentSupplier response = httpRequest.
performHttpRequest(run, listener);
            return response;
        }
        private static final long serialVersionUID = 1L;
    }


My question is: how do I make the workspace optional? If I declare:
@StepContextParameter private transient FilePath workspace;

then the workspace is required, not optional. Is it possible to make it 
optional?

 

> > In Pipeline, the request will return the response as an object with 
> @WhiteListed methods 
>
> You can not return anything from a `SimpleBuildStep` implementation, 
> so this does not seems to be an option. 
>
>
I have implemented the custom step using an  
AbstractSynchronousNonBlockingStepExecution.

Thanks,
Martin

-- 
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 jenkinsci-dev+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-dev/88c2286b-4a9b-4ae1-9697-ddfff976d1ed%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to