bitbucket-branch-source-plugin
bitbucket-branch-source-plugin copied to clipboard
Branch names starting with "origin/" cannot checkout in certain cases
Jenkins and plugins versions report
Environment
Jenkins: 2.319.3
Bitbucket Branch Source Plugin: 751.vda_24678a_f781
What Operating System are you using (both controller, and any agents involved in the problem)?
Controller OS: N/A Agent OS: Ubuntu Bionic
Reproduction steps
- Create a Jenkinsfile with an explicit Checkout stage and call
checkout scm
in it. - Add another explicit Checkout stage and call
checkout([
$class: 'GitSCM',
branches: scm.branches,
doGenerateSubmoduleConfigurations: false,
extensions: [
[$class: 'SubmoduleOption',
disableSubmodules: false,
parentCredentials: true,
recursiveSubmodules: true,
],
[$class: 'GitLFSPull']
],
submoduleCfg: [],
userRemoteConfigs: scm.userRemoteConfigs
])
- Create a branch and name it with an
origin/
prefix likeorigin/branch_name
. - Commit the above example, which should trigger a pipeline with your new branch.
Expected Results
- A pipeline should be triggered.
- The default checkout should fetch the Jenkinsfile.
- The explicit
checkout scm
step should checkout the default project SCM configuration in the Multibranch config - The additional explicit checkout, which I use to checkout the git submodules should inherit the default checkout settings and override only the submodule settings.
Actual Results
- OK
- OK
- OK
- Fails to checkout:
Warning: JENKINS-30600: special launcher org.jenkinsci.plugins.docker.workflow.WithContainerStep$Decorator$1@b97fe27; decorates RemoteLauncher[hudson.remoting.Channel@324be2ed:JNLP4-connect connection from 10.255.0.5/10.255.0.5:57932] will be ignored (a typical symptom is the Git executable not being run inside a designated container)
Cloning the remote Git repository
Cloning repository ssh://git@BITBUCKET_SERVER:7999/NAMESPACE/PROJECT.git
> /usr/bin/git init /var/jenkins/workspace/in_origin_feature_ignore-this-pr # timeout=10
Fetching upstream changes from ssh://git@BITBUCKET_SERVER:7999/NAMESPACE/PROJECT.git
> /usr/bin/git --version # timeout=10
> git --version # 'git version 2.17.1'
using GIT_SSH to set credentials ivs1hi ssh private key
> /usr/bin/git fetch --tags --progress -- ssh://git@BITBUCKET_SERVER:7999/NAMESPACE/PROJECT.git +refs/heads/*:refs/remotes/origin/* # timeout=10
Avoid second fetch
> /usr/bin/git config remote.origin.url ssh://git@BITBUCKET_SERVER:7999/NAMESPACE/PROJECT.git # timeout=10
> /usr/bin/git config --add remote.origin.fetch +refs/heads/*:refs/remotes/origin/* # timeout=10
> /usr/bin/git rev-parse refs/remotes/origin/feature/ignore-this-pr^{commit} # timeout=10
> /usr/bin/git rev-parse origin/feature/ignore-this-pr^{commit} # timeout=10
Couldn't find any revision to build. Verify the repository and branch configuration for this job.
Anything else?
If the branch name doesn't start with origin/
, this issue doesn't happen and the checkout with the submodules succeeds.
I didn't find any relevant options that could handle this case, which is why I'm assuming that this is a bug/corner case and I thought to report it here.