Hi all,
It’s been a long time since I last posted a question here but I’m back! :D
Anyway, I’m currently trying some stuff with Jenkins and I’ve started creating a small project. I have an issue where I have 3 repositories (Jenkinsfile, script and some additional libraries) which I want to include in my pipeline.
I’m using SCM and my Jenkinsfile is in one of the repositories.
So far all my attempts have failed. Here is what I have:
node {
stage 'prepare'
checkout scm
and I am defining the Jenkinsfile repo in the job configuration.
So what I would like to do is check out all three repositories, then use the Jenkinsfile to use the rest.
Anyone has any suggestions?
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.
Hi @brendRos,
I think in your case the RelativeTargetDirectory plugin of the GitSCM class should help. You can read more about it here:
Relative Target Directory
Or here
Jenkins Documentation
When you open the Jenkins Documentation(above link) select - $class: ‘GitSCM’ and then inside you’ll be able to find $class: ‘RelativeTargetDirectory’
Here is an example of how to use it
Please remember to change the relativeTargetDir - subdirectory2 in this case to the one you want.
Additionally, in userRemoteConfigs: [[url: ‘repo2.git’]]] add your actual git repo.
Regards, KFSys
Hi @brendRos,
I’m starting a new thread/answer just because the previous one became too long and it might be confusing to read afterwards.
I’m going to try and answer to both question in a single code block. The code block will include both a better readable syntax and how to post multiple Git Repositories to be checked out: