jenkinsci / bitbucket-branch-source-plugin

Bitbucket Branch Source Plugin
https://plugins.jenkins.io/cloudbees-bitbucket-branch-source
MIT License
217 stars 349 forks source link

Git Ref Spec option ignored for multi-branch pipelines since 871.v28d74e8b_4226 #814

Closed PayBas closed 4 months ago

PayBas commented 4 months ago

Jenkins and plugins versions report

Environment ```text Jenkins: 2.440.1 OS: Linux - 6.7.5-100.fc38.x86_64 Java: 11.0.22 - Red Hat, Inc. (OpenJDK 64-Bit Server VM) --- active-directory:2.35 allure-jenkins-plugin:2.30.3 ansicolor:1.0.4 antisamy-markup-formatter:162.v0e6ec0fcfcf6 apache-httpcomponents-client-4-api:4.5.14-208.v438351942757 audit-trail:361.v82cde86c784e authentication-tokens:1.53.v1c90fd9191a_b_ blueocean:1.27.11 blueocean-autofavorite:1.2.5 blueocean-bitbucket-pipeline:1.27.11 blueocean-commons:1.27.11 blueocean-config:1.27.11 blueocean-core-js:1.27.11 blueocean-dashboard:1.27.11 blueocean-display-url:2.4.2 blueocean-events:1.27.11 blueocean-git-pipeline:1.27.11 blueocean-github-pipeline:1.27.11 blueocean-i18n:1.27.11 blueocean-jira:1.27.11 blueocean-jwt:1.27.11 blueocean-personalization:1.27.11 blueocean-pipeline-api-impl:1.27.11 blueocean-pipeline-editor:1.27.11 blueocean-pipeline-scm-api:1.27.11 blueocean-rest:1.27.11 blueocean-rest-impl:1.27.11 blueocean-web:1.27.11 bootstrap5-api:5.3.2-3 bouncycastle-api:2.30.1.77-225.v26ea_c9455fd9 branch-api:2.1148.vce12cfcdf090 build-failure-analyzer:2.5.0 build-monitor-plugin:1.14-826.vb_a_c11536174d caffeine-api:3.1.8-133.v17b_1ff2e0599 checks-api:2.0.2 cloudbees-bitbucket-branch-source:866.vdea_7dcd3008e cloudbees-disk-usage-simple:203.v3f46a_7462b_1a_ cloudbees-folder:6.901.vb_4c7a_da_75da_3 command-launcher:107.v773860566e2e commons-lang3-api:3.13.0-62.v7d18e55f51e2 commons-text-api:1.11.0-95.v22a_d30ee5d36 credentials:1319.v7eb_51b_3a_c97b_ credentials-binding:657.v2b_19db_7d6e6d custom-folder-icon:2.12 dark-theme:416.v535839b_c4e88 data-tables-api:1.13.8-2 dependency-check-jenkins-plugin:5.4.6 display-url-api:2.200.vb_9327d658781 docker-commons:439.va_3cb_0a_6a_fb_29 docker-workflow:572.v950f58993843 durable-task:550.v0930093c4b_a_6 echarts-api:5.4.3-2 email-ext:2.104 extended-read-permission:53.v6499940139e5 favorite:2.208.v91d65b_7792a_c font-awesome-api:6.5.1-2 git:5.2.1 git-client:4.6.0 git-server:114.v068a_c7cc2574 github:1.38.0 github-api:1.318-461.v7a_c09c9fa_d63 github-branch-source:1772.va_69eda_d018d4 groovy:457.v99900cb_85593 gson-api:2.10.1-15.v0d99f670e0a_7 handy-uri-templates-2-api:2.1.8-30.v7e777411b_148 htmlpublisher:1.32 http_request:1.18 instance-identity:185.v303dc7c645f9 ionicons-api:56.v1b_1c8c49374e jackson2-api:2.16.1-373.ve709c6871598 jakarta-activation-api:2.0.1-3 jakarta-mail-api:2.0.1-3 javadoc:243.vb_b_503b_b_45537 javax-activation-api:1.2.0-6 javax-mail-api:1.6.2-9 jaxb:2.3.9-1 jdk-tool:73.vddf737284550 jenkins-design-language:1.27.11 jersey2-api:2.41-133.va_03323b_a_1396 jira:3.12 jjwt-api:0.11.5-77.v646c772fddb_0 jobConfigHistory:1229.v3039470161a_d joda-time-api:2.12.7-29.v5a_b_e3a_82269a_ jquery3-api:3.7.1-1 jsch:0.2.16-86.v42e010d9484b_ json-path-api:2.9.0-33.v2527142f2e1d junit:1259.v65ffcef24a_88 kubernetes:4186.v1d804571d5d4 kubernetes-client-api:6.10.0-240.v57880ce8b_0b_2 kubernetes-credentials:0.11 lockable-resources:1243.v346d600eea_24 logstash:2.5.0218.v0a_ff8fefc12b_ mailer:463.vedf8358e006b_ matrix-auth:3.2.1 matrix-project:822.824.v14451b_c0fd42 metrics:4.2.21-449.v6960d7c54c69 mina-sshd-api-common:2.12.0-90.v9f7fb_9fa_3d3b_ mina-sshd-api-core:2.12.0-90.v9f7fb_9fa_3d3b_ nexus-jenkins-plugin:3.19.1-01 okhttp-api:4.11.0-172.vda_da_1feeb_c6e openshift-client:1.1.0.424.v829cb_ccf8798 pipeline-build-step:540.vb_e8849e1a_b_d8 pipeline-graph-analysis:202.va_d268e64deb_3 pipeline-groovy-lib:704.vc58b_8890a_384 pipeline-input-step:491.vb_07d21da_1a_fb_ pipeline-milestone-step:111.v449306f708b_7 pipeline-model-api:2.2175.v76a_fff0a_2618 pipeline-model-definition:2.2175.v76a_fff0a_2618 pipeline-model-extensions:2.2175.v76a_fff0a_2618 pipeline-rest-api:2.34 pipeline-stage-step:305.ve96d0205c1c6 pipeline-stage-tags-metadata:2.2175.v76a_fff0a_2618 pipeline-stage-view:2.34 pipeline-utility-steps:2.16.2 plain-credentials:143.v1b_df8b_d3b_e48 plugin-util-api:3.8.0 prometheus:2.5.1 prometheus-lockable-resources:1.0.0 pubsub-light:1.18 resource-disposer:0.23 scm-api:683.vb_16722fb_b_80b_ script-security:1326.vdb_c154de8669 simple-theme-plugin:176.v39740c03a_a_f5 snakeyaml-api:2.2-111.vc6598e30cc65 sonar:2.17.2 sse-gateway:1.26 ssh-agent:346.vda_a_c4f2c8e50 ssh-credentials:308.ve4497b_ccd8f4 sshd:3.322.v159e91f6a_550 structs:337.v1b_04ea_4df7c8 testcafe:1.0 theme-manager:215.vc1ff18d67920 timestamper:1.26 token-macro:400.v35420b_922dcb_ trilead-api:2.133.vfb_8a_7b_9c5dd1 variant:60.v7290fc0eb_b_cd workflow-aggregator:596.v8c21c963d92d workflow-api:1291.v51fd2a_625da_7 workflow-basic-steps:1042.ve7b_140c4a_e0c workflow-cps:3867.v535458ce43fd workflow-durable-task-step:1331.vc8c2fed35334 workflow-job:1400.v7fd111b_ec82f workflow-multibranch:773.vc4fe1378f1d5 workflow-scm-step:415.v434365564324 workflow-step-api:657.v03b_e8115821b_ workflow-support:865.v43e78cc44e0d ws-cleanup:0.45 ```

What Operating System are you using (both controller, and any agents involved in the problem)?

Fedora 38 for master. Docker jnlp agents (Fedora 38 base-image).

Reproduction steps

  1. Create multi-branch pipeline
  2. Add "Bitbucket" source
  3. Configure repository
    1. "Honor refspec on initial clone"
    2. "Specify ref specs": +refs/heads/develop:refs/remotes/@{remote}/develop

Expected Results

Cloning the remote Git repository
Honoring refspec on initial clone
Cloning repository ssh://git@bitbucket.corp.internal:7999/XPX/xapp.git
 > git init /home/jenkins/agent/workspace/xapp_release_v6563 # timeout=10
Using reference repository: /tmp/tooling-cache/xapp.git
Fetching upstream changes from ssh://git@bitbucket.corp.internal:7999/XPX/xapp.git
 > git --version # 'git version 2.43.0'
using GIT_SSH to set credentials Build_XPX-acc (Build_XPX:ssh-private-key)
[INFO] Currently running in a labeled security context
 > /usr/bin/chcon --type=ssh_home_t /home/jenkins/agent/workspace/xapp_release_v6563@tmp/jenkins-gitclient-ssh5175698557869819697.key
Verifying host key using manually-configured host key entries

# HERE
 > git fetch --tags --force --progress -- ssh://git@bitbucket.corp.internal:7999/XPX/xapp.git +refs/heads/release/v6563:refs/remotes/origin/release/v6563 +refs/heads/develop:refs/remotes/origin/develop # timeout=10

Avoid second fetch
Checking out Revision 25d3eca912f2616cffce92adff04b9b5de423f00 (release/v6563)
Enabling Git LFS pull
 > git config remote.origin.url ssh://git@bitbucket.corp.internal:7999/XPX/xapp.git # timeout=10
 > git config --add remote.origin.fetch +refs/heads/release/v6563:refs/remotes/origin/release/v6563 # timeout=10

# HERE
 > git config --add remote.origin.fetch +refs/heads/develop:refs/remotes/origin/develop # timeout=10

 > git config core.sparsecheckout # timeout=10
 > git checkout -f 25d3eca912f2616cffce92adff04b9b5de423f00 # timeout=10
 > git config --get remote.origin.url # timeout=10
using GIT_SSH to set credentials Build_XPX-acc (Build_XPX:ssh-private-key)
[INFO] Currently running in a labeled security context
 > /usr/bin/chcon --type=ssh_home_t /home/jenkins/agent/workspace/xapp_release_v6563@tmp/jenkins-gitclient-ssh16084747330154492211.key
Verifying host key using manually-configured host key entries
 > git lfs pull origin # timeout=10
Commit message: "Pull request #9758: Feature/HHXPXDEV-67977 maven daemon voor build20 script als optie faciliteren"

Actual Results

Cloning the remote Git repository
Honoring refspec on initial clone
Cloning repository ssh://git@bitbucket.corp.internal:7999/XPX/xapp.git
 > git init /home/jenkins/agent/workspace/xapp_release_v6563 # timeout=10
Using reference repository: /tmp/tooling-cache/xapp.git
Fetching upstream changes from ssh://git@bitbucket.corp.internal:7999/XPX/xapp.git
 > git --version # 'git version 2.43.0'
using GIT_SSH to set credentials Build_XPX-acc (Build_XPX:ssh-private-key)
[INFO] Currently running in a labeled security context
 > /usr/bin/chcon --type=ssh_home_t /home/jenkins/agent/workspace/xapp_release_v6563@tmp/jenkins-gitclient-ssh1574869156701293500.key
Verifying host key using manually-configured host key entries

# MISSING seconf +refs/...
 > git fetch --tags --force --progress -- ssh://git@bitbucket.corp.internal:7999/XPX/xapp.git +refs/heads/release/v6563:refs/remotes/origin/release/v6563 # timeout=10

Avoid second fetch
Checking out Revision 25d3eca912f2616cffce92adff04b9b5de423f00 (release/v6563)
Enabling Git LFS pull
 > git config remote.origin.url ssh://git@bitbucket.corp.internal:7999/XPX/xapp.git # timeout=10
 > git config --add remote.origin.fetch +refs/heads/release/v6563:refs/remotes/origin/release/v6563 # timeout=10

# MISSING second config --add ...

 > git config core.sparsecheckout # timeout=10
 > git checkout -f 25d3eca912f2616cffce92adff04b9b5de423f00 # timeout=10
 > git config --get remote.origin.url # timeout=10
using GIT_SSH to set credentials Build_XPX-acc (Build_XPX:ssh-private-key)
[INFO] Currently running in a labeled security context
 > /usr/bin/chcon --type=ssh_home_t /home/jenkins/agent/workspace/xapp_release_v6563@tmp/jenkins-gitclient-ssh12532975452038093963.key
Verifying host key using manually-configured host key entries
 > git lfs pull origin # timeout=10
Commit message: "Pull request #9758: Feature/HHXPXDEV-67977 maven daemon voor build20 script als optie faciliteren"

Anything else?

Reverting to 866.vdea_7dcd3008e fixed the issue.

Are you interested in contributing a fix?

No response

lifeofguenter commented 4 months ago

@andrey-fomin potentially 👀