Listener when an branch is deleted

21 views
Skip to first unread message

Valentin Delaye (jonesbusy)

unread,
Jun 19, 2025, 10:50:44 AM6/19/25
to Jenkins Developers
Hi,

I maintain https://github.com/jenkinsci/artifactory-artifact-manager-plugin which is an Artifact Manager for Artifactory.

It implement "ItemListener" and responsible to delete archived artifacts on Artifactory when an item is deleted https://github.com/jenkinsci/artifactory-artifact-manager-plugin/blob/main/src/main/java/io/jenkins/plugins/artifactory_artifacts/ArtifactoryArtifactManager.java#L412-L432

I works well for build and when deleting a mutlibranch but data is kept forever when a branch is deleted (for example via UI when it's disabled).

By checking logs the onDeleted() is just not called.

Is it expected behavior? Is there any missing listener somewhere?

I'm using the cloudbees-bitbucket-branch-source as branch. I'm not sure about other implementation (But I guess it should be on branch-api?)

Thanks for your hints!

Jesse Glick

unread,
Jun 20, 2025, 1:35:01 PM6/20/25
to jenkin...@googlegroups.com
On Thu, Jun 19, 2025 at 10:51 AM Valentin Delaye (jonesbusy) <jone...@gmail.com> wrote:
…when a branch is deleted (for example via UI when it's disabled).


By checking logs the onDeleted() is just not called.

Is it expected behavior?

No, I do not think so.

I'm not sure about other implementation (But I guess it should be on branch-api?)

Yes, that is what should be calling `Job.delete` and thus firing notifications.

FWIW `artifact-manager-s3` deliberately declines to ever delete artifacts (only permits this via a system property), because
  •  A key advantage of using an external artifact management system is that you can freely configure job/build retention strategies in Jenkins to aggressively reclaim space in `$JENKINS_HOME` without worrying about losing actual data.
  • Granting the controller permissions to delete things is a security risk from the perspective of auditability.
Instead it expects that you have configured some sort of expiry policy at the S3 level. Perhaps the same can be configured in Artifactory.
Reply all
Reply to author
Forward
0 new messages