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

Unable to trigger job on deletion of branch when configured with job DSL.

    XMLWordPrintable

    Details

    • Similar Issues:
    • Released As:
      1.8.3

      Description

      MultiBranch pipeline configured with job dsl , fails to trigger job on branch deletion with the multibranch-action-trigger-plugin, however with manual configuration it seems to be working fine intermittently. 

      Job dsl

      def job_path = "${new File(__FILE__).parent}"
      def jenkinsfile = job_path + "/Jenkinsfile" 
      
      configFiles { 
       customConfig 
      { 
        id('feat_deploy') 
        name('feat_deploy') 
        comment('Used in the Deploy-Feature multibranch job.')  
        content(readFileFromWorkspace(jenkinsfile)) 
       } 
      } 
      multibranchPipelineJob('Deploy-Feature') {
       branchSources {
        git {
         id('123454321') 
         remote('git@github.com:xyz/abc.git') 
         credentialsId('git-ssh-key') 
         includes('feat/*') 
       } 
      } 
      orphanedItemStrategy { 
       discardOldItems { 
       daysToKeep(0) 
       numToKeep(0) 
      } 
      } 
      factory { 
      pipelineBranchDefaultsProjectFactory { 
       scriptId('feat_deploy') 
       useSandbox(true) 
       } 
      } 
      properties{
       pipelineTriggerProperty { 
        createActionJobsToTrigger('')
        deleteActionJobsToTrigger('Remove-Feature')
       } 
      } 
      triggers{
       periodicFolderTrigger { 
       interval('5m') }
       }
      }
      

       

      Failed to send event to listener warning in logs sometime.

      2020-03-20 10:59:33.205+0000 [id=82129] WARNING h.model.listeners.ItemListener#forAll: failed to send event to listener of class org.jenkinsci.plugins.workflow.multibranch.ExtendedWorkflowMultiBranchProject$ItemListenerImpl java.lang.NullPointerException at org.jenkinsci.plugins.workflow.multibranch.PipelineTriggerProperty.convertToPattern(PipelineTriggerProperty.java:527) at org.jenkinsci.plugins.workflow.multibranch.PipelineTriggerProperty.checkExcludeFilter(PipelineTriggerProperty.java:522) at org.jenkinsci.plugins.workflow.multibranch.PipelineTriggerProperty.triggerActionJobs(PipelineTriggerProperty.java:466) at org.jenkinsci.plugins.workflow.multibranch.PipelineTriggerProperty.triggerCreateActionJobs(PipelineTriggerProperty.java:486) at org.jenkinsci.plugins.workflow.multibranch.ExtendedWorkflowMultiBranchProject$ItemListenerImpl.onCreated(ExtendedWorkflowMultiBranchProject.java:29) at hudson.model.listeners.ItemListener$2.apply(ItemListener.java:218) at hudson.model.listeners.ItemListener$2.apply(ItemListener.java:216) at hudson.model.listeners.ItemListener.forAll(ItemListener.java:178) at hudson.model.listeners.ItemListener.fireOnCreated(ItemListener.java:216) at com.cloudbees.hudson.plugins.folder.computed.ComputedFolder$FullReindexChildObserver.created(ComputedFolder.java:936) at jenkins.branch.MultiBranchProject$SCMHeadObserverImpl.observeNew(MultiBranchProject.java:2083) at jenkins.branch.MultiBranchProject$SCMHeadObserverImpl.observe(MultiBranchProject.java:1991) at jenkins.scm.api.trait.SCMSourceRequest.process(SCMSourceRequest.java:357) at jenkins.plugins.git.AbstractGitSCMSource$8.discoverBranches(AbstractGitSCMSource.java:677) at jenkins.plugins.git.AbstractGitSCMSource$8.run(AbstractGitSCMSource.java:581) at jenkins.plugins.git.AbstractGitSCMSource$8.run(AbstractGitSCMSource.java:561) at jenkins.plugins.git.AbstractGitSCMSource.doRetrieve(AbstractGitSCMSource.java:372) at jenkins.plugins.git.AbstractGitSCMSource.retrieve(AbstractGitSCMSource.java:561) at jenkins.scm.api.SCMSource._retrieve(SCMSource.java:373) at jenkins.scm.api.SCMSource.fetch(SCMSource.java:283) at jenkins.branch.MultiBranchProject.computeChildren(MultiBranchProject.java:641) at com.cloudbees.hudson.plugins.folder.computed.ComputedFolder.updateChildren(ComputedFolder.java:277) at com.cloudbees.hudson.plugins.folder.computed.FolderComputation.run(FolderComputation.java:164) at jenkins.branch.MultiBranchProject$BranchIndexing.run(MultiBranchProject.java:1032) at hudson.model.ResourceController.execute(ResourceController.java:97) at hudson.model.Executor.run(Executor.java:427)

       Job XML Config property section.

      <properties><org.jenkinsci.plugins.workflow.multibranch.PipelineTriggerProperty plugin="multibranch-action-triggers@1.8"><createActionJobsToTrigger/><deleteActionJobsToTrigger>ECIM-Remove-Feature</deleteActionJobsToTrigger><quitePeriod>0</quitePeriod><additionalParameters/></org.jenkinsci.plugins.workflow.multibranch.PipelineTriggerProperty></properties>
      

        Attachments

          Activity

          Hide
          aytuncbeken Aytunc BEKEN added a comment -

          Fixed with 1.8.1 release. Please let me know if it is solved on your side.

          Thanks

          Show
          aytuncbeken Aytunc BEKEN added a comment - Fixed with 1.8.1 release. Please let me know if it is solved on your side. Thanks
          Hide
          shadycuz Levi Blaney added a comment - - edited

          Aytunc BEKEN,

          Thanks for patching that so quickly. The error is now gone from the logs but still we don't see the job being triggered. 

          The logs now have a warning. 

          2020-04-01 16:48:28.803+0000 [id=6070]  WARNING o.j.p.w.m.PipelineTriggerProperty#triggerActionJobs: [MultiBranch Action Triggers Plugin] feat%2Ffusionpub_timeout not included by the Include Filter
          2020-04-01 16:48:28.804+0000 [id=6070]  WARNING o.j.p.w.m.PipelineTriggerProperty#triggerActionJobs: [MultiBranch Action Triggers Plugin] feat%2Ffusionpub_timeout not included by the Include Filter
          2020-04-01 16:48:28.804+0000 [id=6070]  WARNING o.j.p.w.m.PipelineTriggerProperty#triggerActionJobs: [MultiBranch Action Triggers Plugin] feat%2Ffusionpub_timeout not included by the Include Filter
          2020-04-01 16:48:28.804+0000 [id=6070]  WARNING o.j.p.w.m.PipelineTriggerProperty#triggerActionJobs: [MultiBranch Action Triggers Plugin] feat%2Ffusionpub_timeout not included by the Include Filter
          2020-04-01 16:48:28.812+0000 [id=6098]  INFO    j.b.WorkspaceLocatorImpl$Deleter$CleanupTask#run: deleting obsolete workspace /var/jenkins_home/workspace/y-Feature_feat_fusionpub_timeout@libs on master
          

          As you can see in my co-workers post we don't specify an include filter in the DSL, but it is in the Jenkins GUI. Maybe defaulted somehow?

          It should catch everything? Our branches are prefixed with fix/ and feat/ which the multiple pipeline job URL encodes it? Is that messing up the filter? I could try specifying the include filter in the DSL if you think that would help? 

          This setup used to work but did break sometime around December? We felt we did something so didn't report the issue. We really enjoy the plugin, it's what makes the multipipeline job usable for us. 

          Thanks

          EDIT: Just noticed our job XML is missing the * even though the GUI shows it? Let me add it to DSL.

          Show
          shadycuz Levi Blaney added a comment - - edited Aytunc BEKEN , Thanks for patching that so quickly. The error is now gone from the logs but still we don't see the job being triggered.  The logs now have a warning.  2020-04-01 16:48:28.803+0000 [id=6070] WARNING o.j.p.w.m.PipelineTriggerProperty#triggerActionJobs: [MultiBranch Action Triggers Plugin] feat%2Ffusionpub_timeout not included by the Include Filter 2020-04-01 16:48:28.804+0000 [id=6070] WARNING o.j.p.w.m.PipelineTriggerProperty#triggerActionJobs: [MultiBranch Action Triggers Plugin] feat%2Ffusionpub_timeout not included by the Include Filter 2020-04-01 16:48:28.804+0000 [id=6070] WARNING o.j.p.w.m.PipelineTriggerProperty#triggerActionJobs: [MultiBranch Action Triggers Plugin] feat%2Ffusionpub_timeout not included by the Include Filter 2020-04-01 16:48:28.804+0000 [id=6070] WARNING o.j.p.w.m.PipelineTriggerProperty#triggerActionJobs: [MultiBranch Action Triggers Plugin] feat%2Ffusionpub_timeout not included by the Include Filter 2020-04-01 16:48:28.812+0000 [id=6098] INFO j.b.WorkspaceLocatorImpl$Deleter$CleanupTask#run: deleting obsolete workspace / var /jenkins_home/workspace/y-Feature_feat_fusionpub_timeout@libs on master As you can see in my co-workers post we don't specify an include filter in the DSL, but it is in the Jenkins GUI. Maybe defaulted somehow? It should catch everything? Our branches are prefixed with fix/ and feat/ which the multiple pipeline job URL encodes it? Is that messing up the filter? I could try specifying the include filter in the DSL if you think that would help?  This setup used to work but did break sometime around December? We felt we did something so didn't report the issue. We really enjoy the plugin, it's what makes the multipipeline job usable for us.  Thanks EDIT: Just noticed our job XML is missing the * even though the GUI shows it? Let me add it to DSL.
          Hide
          shadycuz Levi Blaney added a comment -

          Adding the include filter to our JobDSL did put it in the config.xml and the plugin is now working perfectly Aytunc BEKEN, I will ping Neha Singh and have her close this issue =) 

          Thanks!

          Show
          shadycuz Levi Blaney added a comment - Adding the include filter to our JobDSL did put it in the config.xml and the plugin is now working perfectly Aytunc BEKEN , I will ping Neha Singh and have her close this issue =)  Thanks!
          Hide
          aytuncbeken Aytunc BEKEN added a comment - - edited

          Levi Blaney Thanks for the feedback and detailed explanation. You are right, * character comes from the UI not defined in the code. I think this is the reason why It was failing with JOB dsl. I will check this situation for other variables in the plugin to prevent future possible error.

          Thanks.

          Show
          aytuncbeken Aytunc BEKEN added a comment - - edited Levi Blaney Thanks for the feedback and detailed explanation. You are right, * character comes from the UI not defined in the code. I think this is the reason why It was failing with JOB dsl. I will check this situation for other variables in the plugin to prevent future possible error. Thanks.

            People

            Assignee:
            aytuncbeken Aytunc BEKEN
            Reporter:
            neha_23 Neha Singh
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: