Defining jenkinsfile script path when creating pipeline
Solution 1
From Jenkins site,
In the Script Path field, specify the location (and name) of your Jenkinsfile. This location is the one that Jenkins checks out/clones the repository containing your Jenkinsfile, which should match that of the repository’s file structure. The default value of this field assumes that your Jenkinsfile is named "Jenkinsfile" and is located at the root of the repository.
Jenkinsfile should be committed to SCM and put the relative path of the Jenkinsfile in SCM repository root. Careful on the name(Jenkinsfile or JenkinsFile)!
Solution 2
The Script Path is the relative location of your Jenkinsfile in the git repository (OR in the agent's workspace directory). so if the Jenkinsfile lives in /git-repository/your-project/folder1 then the Script Path should be: folder1/Jenkinsfile
Solution 3
In this case , you can keep your jenkins file into the existing workspace location
<<Jenkins-Installation-Dir>>/workspace/<<Job-Name>>
Comments
-
dhrDatt over 1 year
I want to checkout my repository from github.I create a pipeline and chose Here are the steps that I followed
- Click on new item on jenkins main page
- Entered name and chose pipeline form list
- Under Pipeline I chose definition as Pipeline script from SCM
- Chose SCM as GIT
- Under Repository entered the Repository Url with the credentials
- Under Branches to build entered by branch as */my_branch_here
Now the jenkisfile does not belong in the root directory.Is there a way to naviagate to the directory using jenkins UI
-
Snowcrash about 2 yearsWhere is the documentation for this? Looking at plugins.jenkins.io/git I don't see any reference to
scriptPath
(as used in the Job DSL).
-
dhrDatt over 5 yearsI still get this error java.io.FileNotFoundException.What is usually the jenkins installation directory.I tried using C:/Program Files (x86)/Jenkins
-
Balakrishnan over 5 yearsJenkins installation directory means where you installed the current jenkins. Hope you installed jenkins in your windows machine. You may keep jenkins-file in this location and try to execute "C:/Program Files (x86)/Jenkins/Workspace/<<YOur Job Name>>"
-
dhrDatt over 5 yearsIs there a way to refresh the workspace.I cannot see the file in the folder
-
Balakrishnan over 5 yearsIt won't be available intiially, you have to create and put the JenkinsFile in that location. Else you have to commit the same file in GIT repo. so next time if you are running the job it will take the file from your project repo.
-
dhrDatt over 5 yearsStil doesn't work.I tried creating the file directly also tried pushing to the git repository.I can only get it to work when it is in the root folder