Is there a way to run your entire Jenkinsfile in the context of a subdirectory of your project?
I have seen countless Stackoverflow posts suggesting that I run each sh within a dir block
dir ('sub/project/dir/') {
sh('build.sh')
}
If you have 7 different Jenkins pipelines with multiple stage's, this is a lot of copy/paste and not ideal. Is there a way to run the entire pipeline in the sub/project/dir/ directory?
I'm looking for an answer that I could maybe put in the Jenkins configuration when setting up the pipeline through the Jenkins UI
I also tried Check out to a sub-directory in Additional Behaviors, however, this will throw an error anytime you try to do anything git related saying there is no .git file. If this is the only way to achieve this, am I missing something on how to preserve the root directory's .git file?