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

Configuration of action triggers in an Organization folder

    • 1.8.5

      Recently, we have been able to setup handling of infrastructure teardowns by using the Pipeline Delete Event in this plugin with a multi-branch project. Unfortunately, now that we are looking to switch to an organization folder for automatic multi-branch project initialization, we have lost the ability to configure this plugin for child multi-branch projects.

      Specifically, the GitHub Organization project does not have options for action triggers, and the child multi-branch projects that it creates do not allow us to further configure actions independently.

      Could this feature be added?

       

      As a side issue, due to automating this across many repositories, it might be useful for the action triggers to be programmatically determined somehow (perhaps within the Jenkinsfile itself) rather than statically configured. Or if not possible, maybe allow running against a branch of the repository that triggered the action?

          [JENKINS-61949] Configuration of action triggers in an Organization folder

          Aytunc BEKEN added a comment -

          Interesting, my tests were okay, I will investigate.
          Could you please share below info ? Thanks.

          Jenkins Version
          GitGub Organization Plugin Version

          Aytunc BEKEN added a comment - Interesting, my tests were okay, I will investigate. Could you please share below info ? Thanks. Jenkins Version GitGub Organization Plugin Version

          Alan Wong added a comment - - edited

          I believe the standalone organization plugin is deprecated in favor of the branch source plugin:

          • Jenkins Version: CloudBees Core Managed Master 2.204.2.2-rolling
          • GitHub Branch Source Plugin:  2.6.0

           

          Alan Wong added a comment - - edited I believe the standalone organization plugin is deprecated in favor of the branch source plugin: Jenkins Version : CloudBees Core Managed Master 2.204.2.2-rolling GitHub Branch Source Plugin :  2.6.0  

          Aytunc BEKEN added a comment -

          Hi,

          I fixed the issue with GitHub Organization Folder. Also tested with real repositories in GitHub.
          This fix is released with 1.8.4 version.

          I will be glad if you can provide feedback.
          Thanks.

          Aytunc BEKEN added a comment - Hi, I fixed the issue with GitHub Organization Folder. Also tested with real repositories in GitHub. This fix is released with 1.8.4 version. I will be glad if you can provide feedback. Thanks.

          Alan Wong added a comment - - edited

          I did some testing and found the following things:

          • When testing, I used a single repository and hard coded the Pipeline Delete Event (for the org) to be the "sandbox-delete" branch of this same repository. I created and deleted a new branch called "sandbox-delete-test". Once I had verified that the branch is marked for deletion in Jenkins, I ran "Scan Repository Now" to force the event, and both the scan and the delete appear to be deadlocked permanently.
            • Note that I did also try adding the "sandbox-delete" branch to the ignored line (along with master and develop) but it still locks. I was able to use this pattern without issue within a regular multi-branch build with the delete trigger.
          • Using a job outside of the org for a delete event worked fine. I will probably use this pattern in production (using a job outside of the org to call the job inside of the org so that the repository can be in charge of how its own delete happens).
          • Updating the values of the action triggers in the organization did not update any existing repositories in the organization. So if I set the delete event to "job1" and let the repository scan finish, updating the event to "job2" did not change the event in the existing repository. It was still "job1" (even after another scan).
            • I tested this also with other options (specifically "Days to keep old items" and it propagated correctly.

          Alan Wong added a comment - - edited I did some testing and found the following things: When testing, I used a single repository and hard coded the Pipeline Delete Event (for the org) to be the "sandbox-delete" branch of this same repository. I created and deleted a new branch called "sandbox-delete-test". Once I had verified that the branch is marked for deletion in Jenkins, I ran "Scan Repository Now" to force the event, and both the scan and the delete appear to be deadlocked permanently. Note that I did also try adding the "sandbox-delete" branch to the ignored line (along with master and develop) but it still locks. I was able to use this pattern without issue within a regular multi-branch build with the delete trigger. Using a job outside of the org for a delete event worked fine. I will probably use this pattern in production (using a job outside of the org to call the job inside of the org so that the repository can be in charge of how its own delete happens). Updating the values of the action triggers in the organization did not update any existing repositories in the organization. So if I set the delete event to "job1" and let the repository scan finish, updating the event to "job2" did not change the event in the existing repository. It was still "job1" (even after another scan). I tested this also with other options (specifically "Days to keep old items" and it propagated correctly.

          Aytunc BEKEN added a comment -

          Thanks for the feedback! My comments are below.

          1- I will try to generate same situation. However defining trigger job in the same repository which creates the same job, is always risky. I am not sure if I can find a solution for that.
          3- Fixed the issue, sorry for the inconvenience. I will comment to this issue with the release number.

          Aytunc BEKEN added a comment - Thanks for the feedback! My comments are below. 1- I will try to generate same situation. However defining trigger job in the same repository which creates the same job, is always risky. I am not sure if I can find a solution for that. 3- Fixed the issue, sorry for the inconvenience. I will comment to this issue with the release number.

          Aytunc BEKEN added a comment -

          Release with version 1.8.5

          Aytunc BEKEN added a comment - Release with version 1.8.5

          Alan Wong added a comment -

          Thank you so much for the update.

          I just tried 1.8.5 on our sandbox Jenkins and it works perfectly (updating the delete job parameter at the org level propagated correctly). For allowing a repo to handle its own deletions, I'm now using the following Jenkinsfile:

          pipeline {
              agent any
              stages {
                  stage('Delete') {
                      steps {
                          script {
                              if (env.SOURCE_PROJECT_FULL_NAME?.trim()) {
                                  build job: env.SOURCE_PROJECT_FULL_NAME.replaceAll(/\/[^\/]+$/, '/branch-name'), parameters: [
                                      string(name: 'SOURCE_PROJECT_NAME', value: env.SOURCE_PROJECT_NAME),
                                      string(name: 'SOURCE_PROJECT_FULL_NAME', value: env.SOURCE_PROJECT_FULL_NAME)
                                  ]
                              }
                          }
                      }
                  }
              }
          }
          
          

          I was able to setup a preliminary test which worked fine, with no dead locks so far.

           

          Alan Wong added a comment - Thank you so much for the update. I just tried 1.8.5 on our sandbox Jenkins and it works perfectly (updating the delete job parameter at the org level propagated correctly). For allowing a repo to handle its own deletions, I'm now using the following Jenkinsfile: pipeline { agent any stages { stage( 'Delete' ) { steps { script { if (env.SOURCE_PROJECT_FULL_NAME?.trim()) { build job: env.SOURCE_PROJECT_FULL_NAME.replaceAll(/\/[^\/]+$/, '/branch-name' ), parameters: [ string(name: 'SOURCE_PROJECT_NAME' , value: env.SOURCE_PROJECT_NAME), string(name: 'SOURCE_PROJECT_FULL_NAME' , value: env.SOURCE_PROJECT_FULL_NAME) ] } } } } } } I was able to setup a preliminary test which worked fine, with no dead locks so far.  

          Aytunc BEKEN added a comment -

          You are welcome!

          Thanks for sharing the job. Nice implementation. I think you should publish this, probably lots of people will look for a similar solution.

          If you do not have any objections, I will close the ticket soon.

          Aytunc BEKEN added a comment - You are welcome! Thanks for sharing the job. Nice implementation. I think you should publish this, probably lots of people will look for a similar solution. If you do not have any objections, I will close the ticket soon.

          Alan Wong added a comment -

          No objections here. Thank you.

          Alan Wong added a comment - No objections here. Thank you.

          Aytunc BEKEN added a comment -

          Thank you! for your contribution and all your efforts.

          Aytunc BEKEN added a comment - Thank you! for your contribution and all your efforts.

            aytuncbeken Aytunc BEKEN
            awong4travelers Alan Wong
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: