0

I am writing a number of ci scripts for jenkins pipelines. A frequently occuring pattern is

dir("path/to/stuff"){
   do_stuff()
}

I would like to 'test-run' these scripts to achieve a (very) short feedback loop. But I immediately run into the fact that this dir method is not an 'official' groovy method.

$ groovy ci/test-ci-scripts.groovy
Caught: groovy.lang.MissingMethodException: No signature of method:
  test-ci-scripts.dir() is applicable for argument types: ....

What do I need to import to get this running?

xtofl
  • 38,207
  • 10
  • 95
  • 177
  • So far the only way I found is to start Jenkins locally, perhaps in a Docker container, and run it there. After all the point of pipelines is to be able to quickly set it up in any server. – Jan Hudec Oct 08 '19 at 11:25
  • Possible duplicate of [How can I test a change made to Jenkinsfile locally?](https://stackoverflow.com/questions/36309063/how-can-i-test-a-change-made-to-jenkinsfile-locally) – Jan Hudec Oct 08 '19 at 11:25

1 Answers1

-2

just use single apostrophe's

dir('path') {
    // some block
}

works fine for me. (You can find dir in Jenkins Pipeline Snippet Generator)

Rod Kimble
  • 1,120
  • 3
  • 13
  • 37