Hi,
IIUC you try to call a step (echo) from nonCPS, this is not supported.
See https://groups.google.com/d/msg/jenkinsci-users/1BIPH5FrktE/3N02pUNDAgAJ
and more explanations here on a previous answer of mine
https://groups.google.com/d/msg/jenkinsci-users/1BIPH5FrktE/p9Ys5gJEAgAJ

HTH

2016-10-22 15:36 GMT+02:00 Sean McNamara <[email protected]>:

> Amendment below; I omitted some information...
>
> On Sat, Oct 22, 2016 at 9:33 AM, Sean McNamara <[email protected]> wrote:
> > Hello,
> >
> > I'm trying to print to the console output tab of a running pipeline
> > project from a global pipeline library. My understanding is that the
> > only way to do this is via the echo step.
> >
> > What I have is a bunch of more "sophisticated" Groovy code (such as -
> > *gasp!* - loops) that doesn't work under the CPS interpreter, so I
> > have *most* of my global pipeline library's methods annotated with
> > @NonCPS.
> >
> > However, I have a CPS-interpreted class that looks like this:
> >
> > class Stepper implements Serializable {
> > static def steps
> > static def log(o) { Stepper.steps.echo o; }
> > }
>
>
> I *also* have the following in my pipeline script, after the @Library
> and import statements:
>
> Stepper.steps = this
>
> node {
>    DriverMethods.main(param)  // Kicks off the complex code in the
> global pipeline library, passing a build parameter to it
> }
>
>
>
> >
> > When I call Stepper.log "hi" from other classes in the global pipeline
> > library (mostly from @NonCPS methods), it works fine the *first* time.
> > But every subsequent call to Stepper.log does not print to the console
> > output.
> >
> > Interestingly, the job succeeds; no exception is thrown on the JVM
> > stdout/stderr; and no complaining messages are printed to the console
> > output. It just... silently eats my echo steps.
> >
> > Am I doing something wrong, or is this by design?
> >
> > My environment is:
> >
> > Jenkins 2.19.1 running on Oracle JDK 8u112 64-bit on Windows 10
> > 64-bit. Started with java -jar jenkins.war
> >
> > Thanks,
> >
> > Sean
>
> --
> You received this message because you are subscribed to the Google Groups
> "Jenkins Users" 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-users/CAPAActdyw9-12pW%3D5%2BopeXTDOzcrtATny38thwecQaO6VA
> BRzg%40mail.gmail.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Users" 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-users/CANWgJS423GB0JTXove9NK%3D%2BzWAgpB5RHZ6S1%2BRouZ%3D18%3D0NxDQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to