Skip to content

[JENKINS-73863] job-dsl manipulation of polling triggers is overridden #719

@jenkins-infra-bot

Description

@jenkins-infra-bot

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'  '
  }
  
  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:

  
    "cloudbees-folder@​6.955.v81e2a_35c08d3">
      H H/4 * * *
      86400000
    
   

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

 


Originally reported by tony_k, imported from: job-dsl manipulation of polling triggers is overridden
  • status: Open
  • priority: Major
  • component(s): cloudbees-folder-plugin
  • resolution: Unresolved
  • votes: 0
  • watchers: 3
  • imported: 20251211-141027
Raw content of original issue

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

 

Metadata

Metadata

Assignees

No one assigned

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions