>
> > Do you mean the StepContextParameter 
>
> No, what I said: 
>
> http://javadoc.jenkins.io/plugin/workflow-step-api/org/jenkinsci/plugins/workflow/steps/StepContext.html#onSuccess-java.lang.Object-
>  
>

Works great!
 

> > I did notice it wasn't working with the 2.3 version that I 
> > upped to. 
>
> I am not aware of any such bug. 
>
This was from my confusion of StepContextParameter with StepContext. In 
reading about Step operations, it looks like you should be able to add 
something like the following to the Step class.

 @StepContextParameter
        private transient Run<?, ?> run;

Instead of the old version of needing to add the following to each method.
            Run<?, ?>run = getContext().get(Run.class);
When I do this, the StepContextPareter bits that seem to be null. So I was 
wondering if there was a minimum version of the workflow-step-api needed to 
make it work.


This all seems to be going well, but there's one last issue where I could 
really use advice. Currently in the start() I'm creating a new thread and 
running the http poll process inside. This works fine as start() can then 
finish off with the return false, and the thread can then finish off with 
getContext().onSuccess(results);

new Thread("saltAPI") {

                @Override

                public void run() {

                    try {

                        callRun(token, saltFunc, netapi);


The problem comes in how to handle the onResume(). Since the reference to 
the thread has been lost, I'm not able to reattach to it if the Jenkins 
master restarts. Is there a Jenkins'y way of somehow launching a subprocess 
or something in start() that can be resumed in the onResume()? 
Otherwise, I can write a file to the workspace containing the job ID being 
polled, and the onResume() can kick off a new poll process for that ID. But 
that could leave multiple polling threads running, which seems suboptimal.


Thank you very much!

-- 
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/0b9de36e-4c02-477f-8615-d4f807168548%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to