I have a multi repo job and want to check out in one pipeline 2 branches (
1 from each repo )
>From repo A I Poll for a feature* and then I want to attempt to build repo
B with that same feature* or fallback to develop branch.
In the GUI job version I was using checkout to specific local branch with
** which populated the GIT_LOCAL_BRANCH env variable. and hence repo B had
alternative strategy checkout with
GIT_LOCAL_BRANCH or develop.
Calling the env,GIT_LOCAL_BRANCH always returns null .
I read online that this variable is only accessed/works for a multi-branch
pipeline ?
Is there no other way to get the git branch that was just checked out
from the first repo in order to pass it down ?
Below is the jenkinsfile.
node {
stage ('Stage CheckOut 1'){
//Repo A ( has Polling )
checkout([$class: 'GitSCM', branches: [[name: '*/feature**']],
doGenerateSubmoduleConfigurations: false, extensions: [[$class:
'RelativeTargetDirectory', relativeTargetDir: 'android'],
[$class:'LocalBranch', localBranch: '**']],
submoduleCfg: [], userRemoteConfigs:
[[credentialsId: '', url:
'https://github.com/....git']]])
//Checking if similar branch name as repo A exists in repo B
def b = resolveScm source: [$class: 'GitSCMSource', credentialsId: '',
id: '_', remote: 'https://github.com/.....git', traits: [[$class:
'jenkins.plugins.git.traits.BranchDiscoveryTrait']]],
targets: [env. GIT_LOCAL_BRANCH, 'develop']
checkout b
}
}
--
You received this message because you are subscribed to the Google Groups
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/jenkinsci-users/3acc03fe-1893-4070-9523-60e0f0176521%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.