I am designing a Jenkins CICD pipeline at my organization and I have a following question.
I am from a devops team that controls the Jenkins pipeline for multiple development teams. I basically want to write a Jenkins file with multiple stages that can be run by multiple teams. I understand that this Jenkins file can be checked into the Gitrepo of each team and it can invoke the complete pipeline as soon as the changes are done to the code repo.
To make sure that this JenkinsFile is maintainable and for any future changes to this Jenkins file I dont have to ask all the various teams to update this file in their Gitrepo , I want to place this file at a central Gitrepo that is controlled by my team.
Is it possible to invoke this Jenkins file from different Gitrepos? Any examples?
Here is how I could do it:
My Base repo simply called a remote repo like this :
#!/usr/bin/env groovy
def jenkinsFile
stage('Loading Jenkins file') {
jenkinsFile = fileLoader.fromGit('testjenkinsstuff/cicd/testMyPipeline', 'https://github.myorg.com/user/testjenkinsstuff.git', 'master', null, '')
}
jenkinsFile.start()