Best way to get scripts from remote repository

Hi everyone.
I have 10 multibranch pipelines for different projects configured on my Jenkins instance where, in each project repository, I created a pipeline folder with the Jenkinsfile and some batch scripts.
I want to remove this folder from those repos, so the developers can’t change those files, and create a single repo with one folder per project with the files needed to run the pipeline.
I’ve found the Remote Jenkinsfile Provider that lets me import the Jenkinsfile from a remote repo when running the pipeline but I can’t import the other files automatically so I would need to create a step to clone the pipelines’ repo and run the files from there. This solution works but it would also clone all the Jenkinsfiles and scripts for the other projects.

Is there a better way?

Thank you very much.

Hello @mvas and welcome to this community. :wave:

Yes, there should be a better way to achieve your goal of centralizing Jenkinsfile and other pipeline scripts while avoiding the need to clone unnecessary files for each project. You could use Jenkins Shared Libraries to accomplish this.

Jenkins Shared Libraries allow you to define reusable pipeline code and functions that can be shared across multiple projects or pipelines. By setting up a Shared Library, you can have a centralized location for your Jenkinsfile and other common pipeline scripts, making it easier to manage and maintain them.

1 Like

Thanks for your help!