0

Several tutorials I'm referencing to learn about Jenkins Pipeline scripting guide one to create Jenkins Pipeline jobs as follows:

  1. Click New Item in the left pane.
    enter image description here
  2. Click Pipeline and enter an item name.
    enter image description here
  3. Fill out the little Pipeline textbox with your script.
    enter image description here

Question: where does this script physically reside? I don't see anywhere to save a filename -- am I creating foo.sh or /path/to/bar.py or /somewhere/../else/baz.pl? What is the filename and realpath of the script that I type out in that tiny little text box?

Question: is it possible to control the name/location of the Pipeline script that I type in that textbox? E.g. can this script be something version-controlled in some git repo? And specifically, when this job has no build triggers. I can't help but feel that anonymous script edited in that tiny little text box might be limiting for larger and more complicated scripts.

Sorry for the multiple questions; I've tried to limit them and keep their scope all related.

1

The good news, is that you absolutely don't have to use that little box to manage your pipeline script.

Jenkins also allows you to source your Jenkinsfile from an SCM repository like GitHub, and will even let you automagically import branches as separate jobs with separate Jenkinsfiles per branch using multibranch pipelines.

Pipeline scripts are in a language known as Groovy, not Perl or sh or similar. The definitive guides to Groovy are (of course) the Jenkins reference guide and the Groovy reference guide.

1
  • Thank you! Seems so obvious now...I think I was confused because the choices that appear when you choose Pipeline script from SCM looked nearly identical to something elsewhere related to the source code of the project issuing a generic webhook...I probably did an awful job explaining that, but thank you: this makes sense now, where previously it didn't.
    – StoneThrow
    May 14 at 4:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.