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

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

XMLWordPrintable

    • 1.8.3

      colored textMultiBranch 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>
      

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

              Created:
              Updated:
              Resolved: