Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-37907

Include abililty to hook branch deletion.

    XMLWordPrintable

Details

    Description

      Being able to have arbitrary run on branch deletion would allow cleanup of external artifacts that might be created by a pipeline (setting up staging environments for example).

      Attachments

        Issue Links

          Activity

            michaelneale Michael Neale added a comment -

            tmc not sure what this is asking for. Do you mean recieve the webhook from github so that it can clean things up as soon as they are removed? Or something else ?

            (a something else I have wanted is for agents to cleanup workspaces ASAP after deletion to save disk, not sure if that is what you are thinking about?)

            michaelneale Michael Neale added a comment - tmc not sure what this is asking for. Do you mean recieve the webhook from github so that it can clean things up as soon as they are removed? Or something else ? (a something else I have wanted is for agents to cleanup workspaces ASAP after deletion to save disk, not sure if that is what you are thinking about?)
            tmc Travis Cline added a comment -

            michaelneale - in my use case i have jobs creating external running environments and removing them on branch deletion is desirable.

            tmc Travis Cline added a comment - michaelneale - in my use case i have jobs creating external running environments and removing them on branch deletion is desirable.

            The GitHub Org Folders plugin is being tombstoned.

            The functionality provided by the GitHub Org Folders plugin has been significantly refactored and migrated to the GitHub Branch Source plugin.

            Please verify if this issue is an issue with GitHub Branch Source 2.0.0-beta-1 (available from the experimental update center now or 2.0.0 (available in early January 2017)

            stephenconnolly Stephen Connolly added a comment - The GitHub Org Folders plugin is being tombstoned. The functionality provided by the GitHub Org Folders plugin has been significantly refactored and migrated to the GitHub Branch Source plugin. Please verify if this issue is an issue with GitHub Branch Source 2.0.0-beta-1 (available from the experimental update center now or 2.0.0 (available in early January 2017)

            With GitHub Branch Source 2.0.0-beta-1 (or newer) the branch being deleted (or no longer being recognised as a project - e.g. removing Jenkinsfile) will mark the branch as a Dead Branch, which can then either be manually deleted or will be deleted on the next index (as the branch retention policy is implicit to only get applied on each index and also otherwise things like "close PR -> reopen PR -> trigger rebuild" would destroy the PR build history)

            stephenconnolly Stephen Connolly added a comment - With GitHub Branch Source 2.0.0-beta-1 (or newer) the branch being deleted (or no longer being recognised as a project - e.g. removing Jenkinsfile) will mark the branch as a Dead Branch, which can then either be manually deleted or will be deleted on the next index (as the branch retention policy is implicit to only get applied on each index and also otherwise things like "close PR -> reopen PR -> trigger rebuild" would destroy the PR build history)

            I just want to bump this up--it would be super useful to be able to hook in cleanup jobs when branches are deleted. Even if it's on a per-organization basis.

            In my case I'd like to set up branch deployments for QA and tear them down again when a branch is deleted. I can make the creation steps idempotent, but not having a trigger for deletion stuff makes this significantly harder.

            pnovotnak Peter Novotnak added a comment - I just want to bump this up--it would be super useful to be able to hook in cleanup jobs when branches are deleted. Even if it's on a per-organization basis. In my case I'd like to set up branch deployments for QA and tear them down again when a branch is deleted. I can make the creation steps idempotent, but not having a trigger for deletion stuff makes this significantly harder.
            michaelneale Michael Neale added a comment - - edited

            There is a listener for job deletion - probably from that you could work out that it was actually a branch deletion happening (ie filter the events down to branches being deleted... probably)

            (remember at some level branches are just jobs in a folder, underneath it all)

            michaelneale Michael Neale added a comment - - edited There is a listener for job deletion - probably from that you could work out that it was actually a branch deletion happening (ie filter the events down to branches being deleted... probably) (remember at some level branches are just jobs in a folder, underneath it all)

            I too am looking for the ability to do cleanup of deploy environments after a pull-request is merged. I'd be fine with a configuration option in jenkins that simply allows the build to be triggered on closes, and then in the Jenkinsfile if I could introspect the cause of the build, I could do something differently based on if it's a push (ie: PR/branch updated), or close event (branch merged, deleted, etc).

            I'd also be fine with a being able to specify a callbackĀ on a "branch close" event hook/event.

            chancez Chance Zibolski added a comment - I too am looking for the ability to do cleanup of deploy environments after a pull-request is merged. I'd be fine with a configuration option in jenkins that simply allows the build to be triggered on closes, and then in the Jenkinsfile if I could introspect the cause of the build, I could do something differently based on if it's a push (ie: PR/branch updated), or close event (branch merged, deleted, etc). I'd also be fine with a being able to specify a callbackĀ on a "branch close" event hook/event.
            aytuncbeken Aytunc BEKEN added a comment -

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

            aytuncbeken Aytunc BEKEN added a comment - Long time passed but if anyone still requires this feature can user the plugin MultiBranch Action Triggers https://github.com/jenkinsci/multibranch-action-triggers-plugin

            People

              kohsuke Kohsuke Kawaguchi
              tmc Travis Cline
              Votes:
              0 Vote for this issue
              Watchers:
              15 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: