How can I run a groovy script within a pipeline step

I have a freestyle job running a system groovy script in a build step.
What could be the syntax to do the same within a pipeline ?

1 comment

  • 0
    Denys Digtiar

    Grooby plugin provides this feature. It doesn't currently support the Jenkins Pipeline natively. The improvement is tracked in JENKINS-26635.

    That said, subject to Script Security every Pipeline can access the Jenkins internal types. Since it is being executed on the master, to some extent you can achieve the same result as with "System Groovy script" build step. Keep in mind the Best Practices for Scalable Pipeline Code though.

Please sign in to leave a comment.