-
-
Notifications
You must be signed in to change notification settings - Fork 116
Description
I have a Bitbucket multibranch pipeline set to discover only PR's. The orphaned item strategy is set to discard old items with both options 'Days to keep old items' and 'Max # of old items to keep' being empty. The config.xml for my top level job contains this
"com.cloudbees.hudson.plugins.folder.computed.DefaultOrphanedItemStrategy" plugin="cloudbees-folder@6.1037.v4cb_8573b_72a_a_"> true -1 -1 false
With these settings build jobs for closed PR's are never deleted. Jenkins does notice that a PR was closed because the build jobs is stricken through in this case, but not removed. The event log shows 'PREvent REMOVED' is received.
[Wed Aug 06 17:23:26 UTC 2025] Received com.cloudbees.jenkins.plugins.bitbucket.hooks.PREvent CREATED event from 104.192.140.240 ⇒ https://jenknis.mydomain.com:8080/bitbucket-scmsource-hook/notify with timestamp Wed Aug 06 17:23:21 UTC 2025 Connecting to https://bitbucket.org using xh2XVc8rjZurKMzFwS/****** (Bitbucket OAuth for multibranch pipeline) Initialized PR: https://bitbucket.org/something/other/pull-requests/3649 Looking up something/other for pull requests Checking PR-3649 from something/other and branch bugfix/SRCH-6152 'Jenkinsfile' found Met criteria Scheduled build for branch: PR-3649 1 pull requests were processed (query completed) [Wed Aug 06 17:23:27 UTC 2025] com.cloudbees.jenkins.plugins.bitbucket.hooks.PREvent CREATED event from 104.192.140.240 ⇒ https://jenknis.mydomain.com:8080/bitbucket-scmsource-hook/notify with timestamp Wed Aug 06 17:23:21 UTC 2025 processed in 1.2 sec [Wed Aug 06 17:23:30 UTC 2025] Received com.cloudbees.jenkins.plugins.bitbucket.hooks.PREvent UPDATED event from 104.192.140.240 ⇒ https://jenknis.mydomain.com:8080/bitbucket-scmsource-hook/notify with timestamp Wed Aug 06 17:23:25 UTC 2025 Connecting to https://bitbucket.org using xh2XVc8rjZurKMzFwS/****** (Bitbucket OAuth for multibranch pipeline) Initialized PR: https://bitbucket.org/something/other/pull-requests/3649 Looking up something/other for pull requests Checking PR-3649 from something/other and branch bugfix/SRCH-6152 'Jenkinsfile' found Met criteria No changes detected: PR-3649 (still at 3a74f1e5f6c9+7f94d5bea397) 1 pull requests were processed (query completed) [Wed Aug 06 17:23:31 UTC 2025] com.cloudbees.jenkins.plugins.bitbucket.hooks.PREvent UPDATED event from 104.192.140.240 ⇒ https://jenknis.mydomain.com:8080/bitbucket-scmsource-hook/notify with timestamp Wed Aug 06 17:23:25 UTC 2025 processed in 1 sec [Wed Aug 06 17:23:34 UTC 2025] Received com.cloudbees.jenkins.plugins.bitbucket.hooks.PREvent REMOVED event from 104.192.140.240 ⇒ https://jenknis.mydomain.com:8080/bitbucket-scmsource-hook/notify with timestamp Wed Aug 06 17:23:29 UTC 2025 Connecting to https://bitbucket.org using xh2XVc8rjZurKMzFwS/****** (Bitbucket OAuth for multibranch pipeline) Looking up something/other for pull requests 0 pull requests were processed [Wed Aug 06 17:23:34 UTC 2025] com.cloudbees.jenkins.plugins.bitbucket.hooks.PREvent REMOVED event from 104.192.140.240 ⇒ https://jenknis.mydomain.com:8080/bitbucket-scmsource-hook/notify with timestamp Wed Aug 06 17:23:29 UTC 2025 processed in 0.24 sec
However the jobs remain in this state forever unless i delete them manually or trigger a manual scan.
My understanding of the documentation is that with these settings the builds should be automatically removed. Am i missing something?
Best Regards
Originally reported by azhelev, imported from: Multibranch Pipeline - Orphaned Item Strategy not removing builds for closed PR's until next scan
- status: Open
- priority: Minor
- component(s): cloudbees-folder-plugin
- resolution: Unresolved
- votes: 0
- watchers: 3
- imported: 20251211-141027
Raw content of original issue
I have a Bitbucket multibranch pipeline set to discover only PR's. The orphaned item strategy is set to discard old items with both options 'Days to keep old items' and 'Max # of old items to keep' being empty. The config.xml for my top level job contains this
<orphanedItemStrategy class="com.cloudbees.hudson.plugins.folder.computed.DefaultOrphanedItemStrategy" plugin="cloudbees-folder@6.1037.v4cb_8573b_72a_a_"> <pruneDeadBranches>true</pruneDeadBranches> <daysToKeep>-1</daysToKeep> <numToKeep>-1</numToKeep> <abortBuilds>false</abortBuilds> </orphanedItemStrategy>With these settings build jobs for closed PR's are never deleted. Jenkins does notice that a PR was closed because the build jobs is stricken through in this case, but not removed. The event log shows 'PREvent REMOVED' is received.
[Wed Aug 06 17:23:26 UTC 2025] Received com.cloudbees.jenkins.plugins.bitbucket.hooks.PREvent CREATED event from 104.192.140.240 ⇒ https://jenknis.mydomain.com:8080/bitbucket-scmsource-hook/notify with timestamp Wed Aug 06 17:23:21 UTC 2025 Connecting to https://bitbucket.org using xh2XVc8rjZurKMzFwS/****** (Bitbucket OAuth for multibranch pipeline) Initialized PR: https://bitbucket.org/something/other/pull-requests/3649 Looking up something/other for pull requests Checking PR-3649 from something/other and branch bugfix/SRCH-6152 'Jenkinsfile' found Met criteria Scheduled build for branch: PR-3649 1 pull requests were processed (query completed) [Wed Aug 06 17:23:27 UTC 2025] com.cloudbees.jenkins.plugins.bitbucket.hooks.PREvent CREATED event from 104.192.140.240 ⇒ https://jenknis.mydomain.com:8080/bitbucket-scmsource-hook/notify with timestamp Wed Aug 06 17:23:21 UTC 2025 processed in 1.2 sec [Wed Aug 06 17:23:30 UTC 2025] Received com.cloudbees.jenkins.plugins.bitbucket.hooks.PREvent UPDATED event from 104.192.140.240 ⇒ https://jenknis.mydomain.com:8080/bitbucket-scmsource-hook/notify with timestamp Wed Aug 06 17:23:25 UTC 2025 Connecting to https://bitbucket.org using xh2XVc8rjZurKMzFwS/****** (Bitbucket OAuth for multibranch pipeline) Initialized PR: https://bitbucket.org/something/other/pull-requests/3649 Looking up something/other for pull requests Checking PR-3649 from something/other and branch bugfix/SRCH-6152 'Jenkinsfile' found Met criteria No changes detected: PR-3649 (still at 3a74f1e5f6c9+7f94d5bea397) 1 pull requests were processed (query completed) [Wed Aug 06 17:23:31 UTC 2025] com.cloudbees.jenkins.plugins.bitbucket.hooks.PREvent UPDATED event from 104.192.140.240 ⇒ https://jenknis.mydomain.com:8080/bitbucket-scmsource-hook/notify with timestamp Wed Aug 06 17:23:25 UTC 2025 processed in 1 sec [Wed Aug 06 17:23:34 UTC 2025] Received com.cloudbees.jenkins.plugins.bitbucket.hooks.PREvent REMOVED event from 104.192.140.240 ⇒ https://jenknis.mydomain.com:8080/bitbucket-scmsource-hook/notify with timestamp Wed Aug 06 17:23:29 UTC 2025 Connecting to https://bitbucket.org using xh2XVc8rjZurKMzFwS/****** (Bitbucket OAuth for multibranch pipeline) Looking up something/other for pull requests 0 pull requests were processed [Wed Aug 06 17:23:34 UTC 2025] com.cloudbees.jenkins.plugins.bitbucket.hooks.PREvent REMOVED event from 104.192.140.240 ⇒ https://jenknis.mydomain.com:8080/bitbucket-scmsource-hook/notify with timestamp Wed Aug 06 17:23:29 UTC 2025 processed in 0.24 secHowever the jobs remain in this state forever unless i delete them manually or trigger a manual scan. My understanding of the documentation is that with these settings the builds should be automatically removed. Am i missing something?
Best Regards
environment
Jenkins: 2.516.1<br/>
OS: Linux - 6.8.0-1032-aws ubuntu 22.04<br/>
Java: 17.0.15 - Ubuntu (OpenJDK 64-Bit Server VM)<br/>
---<br/>
amazon-ecr:1.155.v3d884c1b_dee1<br/>
ansible:524.v9fa_a_4c989224<br/>
ansicolor:1.0.6<br/>
ant:513.vde9e7b_a_0da_0f<br/>
antisamy-markup-formatter:173.v680e3a_b_69ff3<br/>
apache-httpcomponents-client-4-api:4.5.14-269.vfa_2321039a_83<br/>
apache-httpcomponents-client-5-api:5.5-150.veb_76e719855b_<br/>
asm-api:9.8-163.vb_2a_96d3f9c3c<br/>
atlassian-jira-software-cloud:2.0.15<br/>
audit-log:1.3<br/>
audit-trail:395.vce180b_359a_b_5<br/>
authentication-tokens:1.144.v5ff4a_5ec5c33<br/>
aws-credentials:248.v78a_dcfc9db_ff<br/>
aws-java-sdk:1.12.780-480.v4a_0819121a_9e<br/>
aws-java-sdk-api-gateway:1.12.780-480.v4a_0819121a_9e<br/>
aws-java-sdk-autoscaling:1.12.780-480.v4a_0819121a_9e<br/>
aws-java-sdk-cloudformation:1.12.780-480.v4a_0819121a_9e<br/>
aws-java-sdk-cloudfront:1.12.780-480.v4a_0819121a_9e<br/>
aws-java-sdk-cloudwatch:1.12.780-480.v4a_0819121a_9e<br/>
aws-java-sdk-codebuild:1.12.780-480.v4a_0819121a_9e<br/>
aws-java-sdk-codedeploy:1.12.780-480.v4a_0819121a_9e<br/>
aws-java-sdk-ec2:1.12.780-480.v4a_0819121a_9e<br/>
aws-java-sdk-ecr:1.12.780-480.v4a_0819121a_9e<br/>
aws-java-sdk-ecs:1.12.780-480.v4a_0819121a_9e<br/>
aws-java-sdk-efs:1.12.780-480.v4a_0819121a_9e<br/>
aws-java-sdk-elasticbeanstalk:1.12.780-480.v4a_0819121a_9e<br/>
aws-java-sdk-elasticloadbalancingv2:1.12.780-480.v4a_0819121a_9e<br/>
aws-java-sdk-iam:1.12.780-480.v4a_0819121a_9e<br/>
aws-java-sdk-kinesis:1.12.780-480.v4a_0819121a_9e<br/>
aws-java-sdk-lambda:1.12.780-480.v4a_0819121a_9e<br/>
aws-java-sdk-logs:1.12.780-480.v4a_0819121a_9e<br/>
aws-java-sdk-minimal:1.12.780-480.v4a_0819121a_9e<br/>
aws-java-sdk-organizations:1.12.780-480.v4a_0819121a_9e<br/>
aws-java-sdk-secretsmanager:1.12.780-480.v4a_0819121a_9e<br/>
aws-java-sdk-sns:1.12.780-480.v4a_0819121a_9e<br/>
aws-java-sdk-sqs:1.12.780-480.v4a_0819121a_9e<br/>
aws-java-sdk-ssm:1.12.780-480.v4a_0819121a_9e<br/>
aws-java-sdk2-core:2.31.63-54.vcf1e5a_c56c49<br/>
aws-java-sdk2-ec2:2.31.63-54.vcf1e5a_c56c49<br/>
aws-java-sdk2-ecr:2.31.63-54.vcf1e5a_c56c49<br/>
bitbucket-push-and-pull-request:3.2.0<br/>
blueocean:1.27.21<br/>
blueocean-autofavorite:1.2.5<br/>
blueocean-bitbucket-pipeline:1.27.21<br/>
blueocean-commons:1.27.21<br/>
blueocean-config:1.27.21<br/>
blueocean-core-js:1.27.21<br/>
blueocean-dashboard:1.27.21<br/>
blueocean-display-url:2.4.4<br/>
blueocean-events:1.27.21<br/>
blueocean-git-pipeline:1.27.21<br/>
blueocean-github-pipeline:1.27.21<br/>
blueocean-i18n:1.27.21<br/>
blueocean-jira:1.27.21<br/>
blueocean-jwt:1.27.21<br/>
blueocean-personalization:1.27.21<br/>
blueocean-pipeline-api-impl:1.27.21<br/>
blueocean-pipeline-editor:1.27.21<br/>
blueocean-pipeline-scm-api:1.27.21<br/>
blueocean-rest:1.27.21<br/>
blueocean-rest-impl:1.27.21<br/>
blueocean-web:1.27.21<br/>
bootstrap5-api:5.3.7-2<br/>
bouncycastle-api:2.30.1.81-264.v95c79c0e772c<br/>
branch-api:2.1235.v04e86c7ce54c<br/>
browserstack-integration:1.2.24<br/>
build-pipeline-plugin:2.0.2<br/>
build-timeout:1.38<br/>
build-user-vars-plugin:195.v8c35f9d5c3dc<br/>
caffeine-api:3.2.2-178.v353b_8428ed56<br/>
checks-api:373.vfe7645102093<br/>
cloudbees-bitbucket-branch-source:936.4.4<br/>
cloudbees-folder:6.1037.v4cb_8573b_72a_a_<br/>
clover:4.14.2.628.ve412b_714e733<br/>
command-launcher:123.v37cfdc92ef67<br/>
commons-collections4-api:4.5.0-8.va_d5448ef9011<br/>
commons-compress-api:1.28.0-1<br/>
commons-lang3-api:3.18.0-98.v3a_674c06072d<br/>
commons-text-api:1.14.0-194.v804a_dc3a_1b_d8<br/>
conditional-buildstep:1.5.0<br/>
credentials:1419.v2337d1ceceef<br/>
credentials-binding:702.vfe613e537e88<br/>
dashboard-view:2.537.v5132851f6ca_f<br/>
data-tables-api:2.3.2-3<br/>
display-url-api:2.217.va_6b_de84cc74b_<br/>
docker-build-publish:1.4.0<br/>
docker-commons:457.v0f62a_94f11a_3<br/>
docker-java-api:3.5.3-122.v156e51f30c0a_<br/>
docker-workflow:621.va_73f881d9232<br/>
durable-task:595.ve87b_f1318d67<br/>
ec2:1994.v250f0efb_336a_<br/>
ec2-fleet:4.0.0.502.v329a_307d2a_5d<br/>
echarts-api:6.0.0-1<br/>
eddsa-api:0.3.0.1-19.vc432d923e5ee<br/>
email-ext:1925.v1598902b_58dd<br/>
extended-read-permission:61.vf24570ff3b_e9<br/>
external-monitor-job:223.vb_fddcf42c9b_3<br/>
extra-columns:1.27<br/>
favorite:2.237.v79163ca_8b_892<br/>
font-awesome-api:7.0.0-1<br/>
git:5.7.0<br/>
git-client:6.3.0<br/>
git-parameter:444.vca_b_84d3703c2<br/>
git-server:137.ve0060b_432302<br/>
github:1.44.0<br/>
github-api:1.321-488.v9b_c0da_9533f8<br/>
github-branch-source:1834.v857721ea_74c6<br/>
gson-api:2.13.1-153.vb_3d0c48a_a_b_4a_<br/>
handy-uri-templates-2-api:2.1.8-36.v85e4cb_234a_13<br/>
htmlpublisher:427<br/>
instance-identity:203.v15e81a_1b_7a_38<br/>
ionicons-api:94.vcc3065403257<br/>
jackson2-api:2.19.2-408.v18248a_324cfe<br/>
jakarta-activation-api:2.1.3-2<br/>
jakarta-mail-api:2.1.3-2<br/>
javadoc:354.vee1a_660b_4990<br/>
javax-activation-api:1.2.0-8<br/>
javax-mail-api:1.6.2-11<br/>
jaxb:2.3.9-133.vb_ec76a_73f706<br/>
jdk-tool:83.v417146707a_3d<br/>
jenkins-design-language:1.27.21<br/>
jersey2-api:2.47-165.ve7809a_3e87e0<br/>
jira:3.18<br/>
jjwt-api:0.11.5-120.v0268cf544b_89<br/>
jnr-posix-api:3.1.20-166.v50a_50932c65b_<br/>
job-dsl:1.93<br/>
joda-time-api:2.14.0-149.v1c3ce991d1b_9<br/>
jquery:1.12.4-3<br/>
jquery3-api:3.7.1-3<br/>
jsch:0.2.16-95.v3eecb_55fa_b_78<br/>
json-api:20250517-163.v1c5da_e99c775<br/>
json-path-api:2.9.0-178.vca_b_c71881321<br/>
jsoup:1.21.1-58.vfc578e6e2610<br/>
junit:1335.v6b_a_a_e18534e1<br/>
kubernetes:4358.vcfd9c5a_0a_f51<br/>
kubernetes-client-api:7.3.1-256.v788a_0b_787114<br/>
kubernetes-credentials:203.v85b_9836a_f44b_<br/>
ldap:780.vcb_33c9a_e4332<br/>
locale:597.v7781ce70d4cf<br/>
lockable-resources:1408.vb_7d1f371781d<br/>
mailer:515.vd788654779b_1<br/>
matrix-auth:3.2.6<br/>
matrix-project:849.v0cd64ed7e531<br/>
maven-plugin:3.26<br/>
mercurial:1309.v6802b_f0efb_b_9<br/>
metrics:4.2.32-481.v75f035fdc894<br/>
mina-sshd-api-common:2.15.0-161.vb_200831a_c15b_<br/>
mina-sshd-api-core:2.15.0-161.vb_200831a_c15b_<br/>
mina-sshd-api-scp:2.15.0-161.vb_200831a_c15b_<br/>
multibranch-action-triggers:1.8.10<br/>
node-iterator-api:72.vc90e81737df1<br/>
okhttp-api:4.11.0-189.v976fa_d3379d6<br/>
oss-symbols-api:392.v27a_482d90083<br/>
pam-auth:1.12<br/>
parameterized-trigger:859.vb_e3907a_07a_16<br/>
pipeline-build-step:571.v08a_fffd4b_0ce<br/>
pipeline-github-lib:65.v203688e7727e<br/>
pipeline-graph-analysis:241.vc3d48fb_b_2582<br/>
pipeline-groovy-lib:752.vdddedf804e72<br/>
pipeline-input-step:532.v9e7466cb_4406<br/>
pipeline-milestone-step:138.v78ca_76831a_43<br/>
pipeline-model-api:2.2258.v4e96d2b_da_f9b_<br/>
pipeline-model-definition:2.2258.v4e96d2b_da_f9b_<br/>
pipeline-model-extensions:2.2258.v4e96d2b_da_f9b_<br/>
pipeline-rest-api:2.38<br/>
pipeline-stage-step:322.vecffa_99f371c<br/>
pipeline-stage-tags-metadata:2.2258.v4e96d2b_da_f9b_<br/>
pipeline-stage-view:2.38<br/>
pipeline-utility-steps:2.19.0<br/>
plain-credentials:199.v9f8e1f741799<br/>
plugin-usage-plugin:4.10<br/>
plugin-util-api:6.1.0<br/>
publish-over:0.22<br/>
publish-over-ssh:390.vb_f56e7405751<br/>
pubsub-light:1.19<br/>
resource-disposer:0.25<br/>
role-strategy:799.v5b_e7b_ecc231e<br/>
run-condition:243.v3c3f94e46a_8b_<br/>
scm-api:707.v749f968369d4<br/>
script-security:1378.vf25626395f49<br/>
slack:795.v4b_9705b_e6d47<br/>
snakeyaml-api:2.3-125.v4d77857a_b_402<br/>
sse-gateway:1.28<br/>
ssh-credentials:361.vb_f6760818e8c<br/>
ssh-slaves:3.1071.v0d059c7b_c555<br/>
sshd:3.372.v5d04a_e92d8cf<br/>
structs:353.v261ea_40a_80fb_<br/>
support-core:1744.vf4f8e8f2b_0b_5<br/>
timestamper:1.30<br/>
token-macro:477.vd4f0dc3cb_cf1<br/>
trilead-api:2.209.v0e69b_c43c245<br/>
variant:70.va_d9f17f859e0<br/>
workflow-aggregator:608.v67378e9d3db_1<br/>
workflow-api:1382.veca_a_efe062fa_<br/>
workflow-basic-steps:1079.vce64b_a_929c5a_<br/>
workflow-cps:4175.ve65b_fa_663eed<br/>
workflow-durable-task-step:1446.v3efd13441220<br/>
workflow-job:1540.v295eccc9778f<br/>
workflow-multibranch:810.v6b_6e77da_7058<br/>
workflow-scm-step:437.v05a_f66b_e5ef8<br/>
workflow-step-api:706.v518c5dcb_24c0<br/>
workflow-support:976.vb_d9493c2eb_09<br/>
ws-cleanup:0.48<br/>

