jenkinsci/bitbucket-branch-source-plugin

Branch not deleted when submitting pull request

christopo opened this issue · 2 comments

Jenkins and plugins versions report

Environment
Jenkins: 2.319.3
OS: Linux - 5.4.0-91-generic
---
ace-editor:1.1
analysis-model-api:10.9.3
ansicolor:1.0.1
ant:1.13
antisamy-markup-formatter:2.7
apache-httpcomponents-client-4-api:4.5.13-1.0
atlassian-jira-software-cloud:1.4.5
authentication-tokens:1.4
authorize-project:1.4.0
basic-branch-build-strategies:1.3.2
bitbucket-filter-project-trait:1.0
blueocean-autofavorite:1.2.5
blueocean-bitbucket-pipeline:1.25.3
blueocean-commons:1.25.3
blueocean-config:1.25.3
blueocean-core-js:1.25.3
blueocean-dashboard:1.25.3
blueocean-display-url:2.4.1
blueocean-events:1.25.3
blueocean-git-pipeline:1.25.3
blueocean-github-pipeline:1.25.3
blueocean-i18n:1.25.3
blueocean-jira:1.25.3
blueocean-jwt:1.25.3
blueocean-personalization:1.25.3
blueocean-pipeline-api-impl:1.25.3
blueocean-pipeline-editor:1.25.3
blueocean-pipeline-scm-api:1.25.3
blueocean-rest:1.25.3
blueocean-rest-impl:1.25.3
blueocean-web:1.25.3
bootstrap4-api:4.6.0-3
bootstrap5-api:5.1.3-6
bouncycastle-api:2.25
branch-api:2.7.0
build-timeout:1.20
caffeine-api:2.9.2-29.v717aac953ff3
checks-api:1.7.2
cloudbees-bitbucket-branch-source:757.vddedc5f2589a_
cloudbees-disk-usage-simple:0.10
cloudbees-folder:6.708.ve61636eb_65a_5
cobertura:1.17
code-coverage-api:2.0.4
command-launcher:1.6
configuration-as-code:1414.v878271fc496f
credentials:1074.v60e6c29b_b_44b_
credentials-binding:1.27.1
dashboard-view:2.18
data-tables-api:1.11.4-3
display-url-api:2.3.5
docker-commons:1.19
docker-workflow:1.28
dtkit-api:3.0.0
durable-task:493.v195aefbb0ff2
echarts-api:5.3.0-2
email-ext:2.87
emailext-template:1.4
envinject-api:1.180.v98d833b_27470
extended-read-permission:3.2
favorite:2.4.0
font-awesome-api:6.0.0-1
forensics-api:1.8.1
generic-webhook-trigger:1.83
git:4.10.3
git-client:3.11.0
git-server:1.10
github:1.34.3
github-api:1.301-378.v9807bd746da5
github-branch-source:2.11.4
global-slack-notifier:1.5
gradle:1.38
handlebars:3.0.8
handy-uri-templates-2-api:2.1.8-1.0
htmlpublisher:1.29
jackson2-api:2.13.1-246.va8a9f3eaf46a
javax-activation-api:1.2.0-2
javax-mail-api:1.6.2-5
jaxb:2.3.0.1
jdk-tool:1.5
jenkins-design-language:1.25.3
jira:3.7
jjwt-api:0.11.2-9.c8b45b8bb173
jnr-posix-api:3.1.7-2
jquery-detached:1.2.1
jquery3-api:3.6.0-2
jsch:0.1.55.2
junit:1.54
kubernetes:3546.v6103d89542d6
kubernetes-cli:1.10.3
kubernetes-client-api:5.11.2-182.v0f1cf4c5904e
kubernetes-credentials:0.9.0
ldap:2.8
lockable-resources:2.14
mailer:408.vd726a_1130320
mapdb-api:1.0.9.0
matrix-auth:3.1
matrix-project:1.20
mercurial:2.16
metrics:4.1.6.1
momentjs:1.1.1
okhttp-api:4.9.3-105.vb96869f8ac3a
pam-auth:1.7
parameterized-scheduler:1.0
pipeline-aggregator-view:1.11
pipeline-build-step:2.16
pipeline-github-lib:36.v4c01db_ca_ed16
pipeline-graph-analysis:188.v3a01e7973f2c
pipeline-input-step:446.vf27b_0b_83500e
pipeline-milestone-step:100.v60a_03cd446e1
pipeline-model-api:1.9.3
pipeline-model-definition:1.9.3
pipeline-model-extensions:1.9.3
pipeline-rest-api:2.23
pipeline-stage-step:291.vf0a8a7aeeb50
pipeline-stage-tags-metadata:1.9.3
pipeline-stage-view:2.23
pipeline-utility-steps:2.12.0
plain-credentials:1.8
plugin-util-api:2.14.0
popper-api:1.16.1-2
popper2-api:2.11.2-1
preSCMbuildstep:0.3
prism-api:1.26.0-2
prometheus:2.0.11
publish-over:0.22
pubsub-light:1.16
resource-disposer:0.17
role-strategy:3.2.0
scm-api:595.vd5a_df5eb_0e39
script-security:1138.v8e727069a_025
simple-theme-plugin:103.va_161d09c38c7
slack:602.v0da_f7458945d
snakeyaml-api:1.29.1
sonar:2.14
sse-gateway:1.25
ssh-agent:1.24.1
ssh-credentials:1.19
ssh-slaves:1.806.v2253cedd3295
ssh-steps:2.0.0
sshd:3.1.0
structs:308.v852b473a2b8c
subversion:2.15.2
timestamper:1.17
token-macro:280.v97a_82642793c
trilead-api:1.0.13
variant:1.4
warnings-ng:9.11.1
windows-slaves:1.8
workflow-aggregator:2.7
workflow-api:1138.v619fd5201b_2f
workflow-basic-steps:2.24
workflow-cps:2660.vb_c0412dc4e6d
workflow-cps-global-lib:564.ve62a_4eb_b_e039
workflow-durable-task-step:1121.va_65b_d2701486
workflow-job:1145.v7f2433caa07f
workflow-multibranch:711.vdfef37cda_816
workflow-scm-step:2.13
workflow-step-api:622.vb_8e7c15b_c95a_
workflow-support:813.vb_d7c3d2984a_0
ws-cleanup:0.40
xunit:3.0.5

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

Ubuntu 20.04.3 LTS

Reproduction steps

  1. Configure Bitbucket Team Project in Jenkins for Bitbucket Cloud
  2. Set discover branch strategy to; "Exclude branches that are also filled as PRs"

image

  1. Scan Folder: all projects are fetched
  2. Create branch: branch is added to Jenkins
  3. Do some commits: branch build is triggered
  4. Raise a pull request in bitbucket cloud for the branch

Expected Results

  • the creation of pull request should disable the branch build (striketrough) like in the example below

image

Actual Results

  • the branch build remains active

When checking the scanning log, it seems that the PR can be associated to the branch.

[Thu Mar 10 10:04:23 UTC 2022] Received com.cloudbees.jenkins.plugins.bitbucket.hooks.PullRequestHookProcessor$HeadEvent CREATED event from xxx.xxx.xxx.xxx ⇒ https://jenkins-url:8080/bitbucket-scmsource-hook/notify with timestamp Thu Mar 10 10:04:18 UTC 2022
Connecting to https://bitbucket.org/ using <id>
Repository type: Git
Looking up project for branches
Checking branch feature/bla from project
Checking branch feature/pull-request-comment from project
Checking branch master from project

  3 branches were processed
Looking up project for pull requests
Checking PR-21 from project and branch feature/bla
      ‘Jenkinsfile’ found
    Met criteria
Scheduled build for branch: PR-21

  1 pull requests were processed (query completed)
[Thu Mar 10 10:04:25 UTC 2022] com.cloudbees.jenkins.plugins.bitbucket.hooks.PullRequestHookProcessor$HeadEvent CREATED event from xxx.xxx.xxx.xxx ⇒ https://jenkins-url:8080/bitbucket-scmsource-hook/notify with timestamp Thu Mar 10 10:04:18 UTC 2022 processed in 1.3 sec

When manually running Scan Multibranch Pipeline Now, the branch is removed/striketrough (as expected).

Anything else?

I believe this was working correctly in the past.

Is there some further option needed to enforce this behavior?

I just noticed that the build branch is automatically disabled (striketrough) once I update the branch (after the pull request was raised).

Hence the question, is this expected? I would actually expect the branch disabling directly after raising the PR.

closing as duplicate of #539 - this never worked for me reliably, but still keeping open for anyone who wants to give it a jab :)