Hi ,
I need to create a build with parameter job in which i need to ask for 2 branches from different repository , I am using declarative pipeline script for it and the stranger is that it is working in one case and not working for other.
CASE 1 (which is working):
parameters{
gitParameter branchFilter: ‘origin/(.)’, defaultValue: ‘master’, name: ‘BRANCH’, quickFilterEnabled: true, type: ‘PT_BRANCH’, *useRepository: '.www-wordpress.git’
gitParameter branchFilter: 'origin/(.)’, defaultValue: ‘main’, name: ‘BRANCH_INFRA’, quickFilterEnabled: true, type: ‘PT_BRANCH’, *useRepository: '.infra.git’
}
stages {
stage(‘getting Branches’) {
steps {
git branch: “${params.BRANCH}”, credentialsId: ‘abc’, url: 'git@github.com:abc/www-wordpress.git’
git branch: “${params.BRANCH_INFRA}”, credentialsId: ‘abc’, url: 'git@github.com:abc/infra.git’
}
}
CASE 2 (not working)
Now if I can the repo to :
1)git@github.com:abc/now-gg-game-dev-console-frontend.git
2)git@github.com:abc/now-gg-game-dev-console-adminui.git
then it only shows branches for the first branch parameter that is declare if use frontend repo first then it shows branches of first repo and shows error for second and vice versa
images attached:
code used:
parameters{
gitParameter branchFilter: ‘origin/(.*)’, defaultValue: ‘master’, name: ‘BRANCH_FRONTEND’, quickFilterEnabled: true, type: ‘PT_BRANCH’, useRepository: ‘.now-gg-game-dev-console-frontend.git’
gitParameter branchFilter: 'origin/(.)’, defaultValue: ‘master’, name: ‘BRANCH_BACKEND’, quickFilterEnabled: true, type: ‘PT_BRANCH’, useRepository: ‘.*now-gg-game-dev-console-adminui.git’
}
stages {
stage('getting Branches') {
steps {
git branch: "${params.BRANCH_FRONTEND}", credentialsId: 'abc', url: 'git@github.com:abc/now-gg-game-dev-console-frontend.git'
git branch: "${params. BRANCH_BACKEND}", credentialsId: 'abc', url: 'git@github.com:abc/now-gg-game-dev-console-adminui.git'
}
}
Your help will be appreciated