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

job-dsl manipulation of polling triggers is overridden

XMLWordPrintable

      using jenkins job dsl (job-dsl:1.89) in conjunction with cloudbees-folders (cloudbees-folder:6.955.v81e2a_35c08d3) and jenkins LTS (2.462.3) to run a script to create an organizationFolder and set it's polling interval to 5m, which seems to work as script is run, but then seems to be overwritten after the dsl to revert polling to a default of 1d...

      we have tried the formal syntax and the configure syntax with the same result:

      organizationFolder {
      //... 
        triggers {
          periodicFolderTrigger {
            interval('5m')
          }
        }
      //...  
      }
      

       

      and 

      organizationFolder {
      //...
        configure {
          it / 'triggers' << 'com.cloudbees.hudson.plugins.folder.computed.PeriodicFolderTrigger' {
            spec '* * * * *'
            interval 300000
          }
        }
      //...
      }

      dumping the raw groovy.util.Node objects after with the following routine shows that the config took at that level

      def _print(node, msg='', indent=0) {
        if (!indent) {
          println "print ${msg}..."
        }
        
        def tab = ''  for (i=0; i<indent; i++) {
          tab += '  '
        }
        
        def children = node.children()
        def hasValue = (children.size() == 1) && !(children[0] instanceof groovy.util.Node)
        def value = hasValue ? " (${children[0]})" : ''
        println "${tab}${node.name()}${value}"
        if (!hasValue) {
          children.each {
            _print(it, msg, indent + 1)
          }
        }
      } 

      output:

        triggers
          com.cloudbees.hudson.plugins.folder.computed.PeriodicFolderTrigger
            spec (* * * * *)
            interval (300000) 

      but then when dumping resultant config.xml, it looks like:

        <triggers>
          <com.cloudbees.hudson.plugins.folder.computed.PeriodicFolderTrigger plugin="cloudbees-folder@6.955.v81e2a_35c08d3">
            <spec>H H/4 * * *</spec>
            <interval>86400000</interval>
          </com.cloudbees.hudson.plugins.folder.computed.PeriodicFolderTrigger>
        </triggers> 

      this actually works with an older version of plugins and corresponding plugin versions

      jenkins LTS (2.426.3)

      job-dsl:1.87

      cloudbees-folder:6.858.v898218f3609d

      i tried running on the more recent LTS version combo while back versioning to job-dsl:1.87, but it the trigger config still got forced to 1d, so seems like it points to a recent version of the cloudbees-folder plugin

       

            Unassigned Unassigned
            tony_k tony kerz
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: