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,810 points
2,953 views

4 answers to this question.

+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,110 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
• 40,460 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,110 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,530 points
241 views
0 votes
1 answer
+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,070 points
6,826 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,280 points
310 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,530 points
47 views
+13 votes
2 answers

Git management technique when there are multiple customers and need multiple customization?

Consider this - In 'extended' Git-Flow, (Git-Multi-Flow, ...READ MORE

answered Mar 26, 2018 in DevOps & Agile by DragonLord999
• 8,380 points
152 views
0 votes
1 answer