We have configured 8 git repos webhook mapped to single pipeline(Jenkins).
This is a scripted pipeline(groovy).
Single pipeline gets triggered based on push/merge event happening on any of the 8 repos.
The pipeline is supposed to checkout develop
branch based on the repository that triggered the pipeline. env.BRANCH_NAME == 'develop'
says that pushed branch is develop
So, on trigger, groovy script would perform git(branch: branchName, credentialsId: credential, url: "${env.GIT_URL_1}")
Can scripted pipeline rely on env.GIT_URL_N
that can provide the information about, which repository(.git
) triggered the scripted pipeline? so that groovy script can read env.GIT_URL_N
and perform checkout on develop
branch..