[JIRA] (JENKINS-40606) Add ability to perform actions on branch removal

2 views
Skip to first unread message

grzegorz.poznachowski@gmail.com (JIRA)

unread,
Dec 21, 2016, 10:39:01 AM12/21/16
to jenkinsc...@googlegroups.com
Grzegorz Poznachowski created an issue
 
Jenkins / New Feature JENKINS-40606
Add ability to perform actions on branch removal
Issue Type: New Feature New Feature
Assignee: Unassigned
Components: workflow-multibranch-plugin
Created: 2016/Dec/21 3:38 PM
Priority: Minor Minor
Reporter: Grzegorz Poznachowski

This is similar request to https://issues.jenkins-ci.org/browse/JENKINS-37907, but for workflow-multibranch-plugin.

Rationale:
Team is using short term feature branches and for each of them SonarQube analysis is executed. SonarQube treats branch builds as separate SonarQube projects. I would like to have a possibility to hook in when branch is being deleted and call SonarQube API to delete this branch-specific project.

Add Comment Add Comment
 
This message was sent by Atlassian JIRA (v7.1.7#71011-sha1:2526d7c)
Atlassian logo

jglick@cloudbees.com (JIRA)

unread,
Feb 6, 2017, 2:20:02 PM2/6/17
to jenkinsc...@googlegroups.com
Jesse Glick commented on New Feature JENKINS-40606
 
Re: Add ability to perform actions on branch removal

Use ItemListener.onDeleted from a plugin. I suppose you are asking for some sort of “userspace” hook, like a shell script or something, which you could configure perhaps as a JobProperty. If so, this would better be moved to plugin-proposals.

Seems like a straight-up duplicate of JENKINS-37907, which seems to have been closed improperly.

grzegorz.poznachowski@gmail.com (JIRA)

unread,
Feb 6, 2017, 3:34:01 PM2/6/17
to jenkinsc...@googlegroups.com

I assume that would require writing a separate Jenkins plugin for that (like here)? Or, could I use it in Jenkinsfile?

grzegorz.poznachowski@gmail.com (JIRA)

unread,
Feb 6, 2017, 3:36:01 PM2/6/17
to jenkinsc...@googlegroups.com
I assume that would require writing a separate Jenkins plugin for that (like [here|https://github.com/jenkinsci/jenkins/blob/master/core/src/main/java/hudson/model/listeners/ItemListener.java])? Or, could I use it in Jenkinsfile? And yes, I was asking if there is any posibility to achieve that (i.e. via script) beside coding a dedicated plugin.

jglick@cloudbees.com (JIRA)

unread,
Feb 15, 2017, 2:19:01 PM2/15/17
to jenkinsc...@googlegroups.com
Jesse Glick updated an issue
 

could I use it in Jenkinsfile?

No, because this is outside a build context.

Change By: Jesse Glick
Component/s: plugin-proposals
Component/s: workflow-multibranch-plugin
Labels: multibranch

g.sironi@elifesciences.org (JIRA)

unread,
Nov 6, 2018, 10:20:04 AM11/6/18
to jenkinsc...@googlegroups.com
Giorgio Sironi commented on New Feature JENKINS-40606
 
Re: Add ability to perform actions on branch removal

I have an idea for a workaround for this that I want to try out: write a Groovy script that is executed periodically as part of a pipeline (through the Jenkins CLI to get the necessary permissions) and scans the deleted pull requests/branches that are in the grace period in which they have not been deleted yet from the Jenkins multiproject folder.

If I can get that list, it would be easy to then idempotently run cleanup jobs. They won't run as soon as the pull request/branch is gone, but the frequency of this cleanup can be tuned.

I use a similar approach to clean up old agents:

https://github.com/elifesciences/elife-alfred-formula/blob/master/jenkinsfiles/ec2-plugin-nodes-retirement.groovy

although here it's more difficult to understand the API to traverse and whether it's possible to list all of these.

This message was sent by Atlassian Jira (v7.11.2#711002-sha1:fdc329d)

jglick@cloudbees.com (JIRA)

unread,
Nov 6, 2018, 12:07:04 PM11/6/18
to jenkinsc...@googlegroups.com

Something along the lines of JENKINS-37220 could be useful for this sort of specialized use case.

aytuncbeken.ab@gmail.com (JIRA)

unread,
Sep 6, 2019, 7:55:03 AM9/6/19
to jenkinsc...@googlegroups.com

Long time passed but if anyone still requires this feature can use the plugin MultiBranch Action Triggers
https://github.com/jenkinsci/multibranch-action-triggers-plugin

Reply all
Reply to author
Forward
0 new messages