How can I run a Jenkinsfile from a particular folder?

+5 votes

I am new to Jenkins. I am trying to run a Freestyle Jenkins project in which I want to execute a Jenkinsfile from a particular folder. Now, when I run the project the Jenkinsfile is not detected. Path to my Jenkinsfile: /pipelinescript/Jenkinsfile

Mar 26, 2018 in Jenkins by DareDev
• 6,520 points
732 views

4 answers to this question.

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.
+2 votes

Consider the below points: The Freestyle project of Jenkins has some trouble calling Jenkinsfile. I would suggest you to select a Pipeline job to use the Jenkinsfile. Here, just give the path to the Jenkinsfile. Consider the below screenshot: 

enter image description here

I will also suggest you to check out the below link: 

https://getintodevops.com/blog/building-your-first-docker-image-with-jenkins-2-guide-for-developers

answered Mar 26, 2018 by anonymous
+1 vote

To load a jenkins file from a custom location, you have to do like this by adding this line to the script.

load "/<custom path here>/Jenkinsfile"
answered Oct 11, 2018 by lina
• 8,100 points
+1 vote

Try mentioning absolute path to your jenkins file instead of /pipelinescript/Jenkinsfile. Hope this helps as it worked for me.

answered Oct 16, 2018 by Kalgi
• 35,640 points
+1 vote

Try loading using the following syntax

"/<custom path here>/Jenkinsfile"

As when you don't use the "/" before the path it selects the current workspace and loads from it. If you want to select a custom location add the entire path with a slash prefix. 

answered Oct 16, 2018 by lina
• 8,100 points

Related Questions In Jenkins

0 votes
1 answer

I’m facing a login error when I try to run Jenkins on Docker. How do I solve this?

You have to open the /var/log/jenkins/jenkins.log file to ...READ MORE

answered Jul 24, 2018 in Jenkins by Sophie may
• 9,050 points
91 views
+4 votes
7 answers

How to set the pipeline name and description for a Jenkinsfile?

You can rename pipeline jobs in jenkins ...READ MORE

answered Oct 11, 2018 in Jenkins by Hannah
• 14,040 points
3,927 views
0 votes
1 answer

How can I create global macros and templates in jenkins job builder?

you can append the path to the ...READ MORE

answered Apr 2, 2018 in Jenkins by ajs3033
• 7,000 points
186 views
0 votes
1 answer

How can I exchange jobs between 2 different Jenkins instances?

java -jar jenkins-cli.jar -s http://server get-job myjob ...READ MORE

answered Jul 6, 2018 in Jenkins by Sophie may
• 9,050 points
22 views
+13 votes
2 answers
0 votes
1 answer

© 2018 Brain4ce Education Solutions Pvt. Ltd. All rights Reserved.
"PMP®","PMI®", "PMI-ACP®" and "PMBOK®" are registered marks of the Project Management Institute, Inc. MongoDB®, Mongo and the leaf logo are the registered trademarks of MongoDB, Inc.