Can jenkins pipeline plugin pick jenkinsfile from a custom location and start the build?
i don't want to keep jenkinsfile inside the source code. If there is any change in the source code. jenkinsfile from custom location should be picked and build should be started.
Example:/home/test/jenkinsfile
You can of-course just try to put a custom location (I wouldn't see why it can't) as long as the user has rights to read the location.
If it is a multibranch pipeline, than no. Because indexing is based the presence of a Jenkinsfile
(only branches that contain a Jenkinsfile
are indexed)
The thought behind having the logic of your build inside your repository is, that this is source controlled together with your sources. When you change something in your sources and this affects your build, than building that specific commit will have all the logic. If you move this outside your repository your build logic and your repository are very likely to get out of sync.
EDIT
You can workaround this by adding a Jenkinsfile
that will load the other file
Jenkinsfile:
load "/home/test/Jenkinsfile"
However as far as I know, directoriees are relative to the workspace. So if you have any dir("path/to/other/dir"){..}
than that will run relative to the workspace of the job, which makes your static Jenkinsfile
very confusing to read.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With