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

periodic trigger always results in 1 minute

    Details

    • Similar Issues:

      Description

      No matter the value passed in to a periodic trigger, it results in a period of 1 minute. (also noted in JENKINS-54877)

      I suspect the hard-coded cron spec here is the culprit: https://github.com/jenkinsci/job-dsl-plugin/blob/45052e1545c4c30496cfdda1943a1d7eac998ccc/job-dsl-core/src/main/groovy/javaposse/jobdsl/dsl/helpers/triggers/MultibranchWorkflowTriggerContext.groovy#L20

      Note that the trigger class itself actually does some comparison of the values to generate a roughly right cron spec: https://github.com/jenkinsci/cloudbees-folder-plugin/blob/master/src/main/java/com/cloudbees/hudson/plugins/folder/computed/PeriodicFolderTrigger.java

        Attachments

          Issue Links

            Activity

            Hide
            daspilker Daniel Spilker added a comment -

            Ha, good catch!

            I will enable Dynamic DSL for computed folder triggers with the next release. Then the following will work:

            organizationFolder('example') {
              triggers {
                periodicFolderTrigger {
                  interval('5m') // or '2h', '7d', '5000ms', '60s'
                }
              }
            }
            

            I will deprecate the existing periodic method in favor of the Dynamic DSL. I do not want to add any logic to Job DSL to compute the cron string nor should a user have to specify both, the cron string and the interval.

            Show
            daspilker Daniel Spilker added a comment - Ha, good catch! I will enable Dynamic DSL for computed folder triggers with the next release. Then the following will work: organizationFolder( 'example' ) { triggers { periodicFolderTrigger { interval( '5m' ) // or '2h' , '7d' , '5000ms' , '60s' } } } I will deprecate the existing periodic method in favor of the Dynamic DSL. I do not want to add any logic to Job DSL to compute the cron string nor should a user have to specify both, the cron string and the interval.
            Hide
            gpaciga Gregory Paciga added a comment -

            Daniel Spilker sorry to bother but did this get documented anywhere? Took me ages to find this ticket to figure out what to set `interval` to to get it to work. The JobDSL API explorer only tells me that it expects a string, but not what format.

            Show
            gpaciga Gregory Paciga added a comment - Daniel Spilker sorry to bother but did this get documented anywhere? Took me ages to find this ticket to figure out what to set `interval` to to get it to work. The JobDSL API explorer only tells me that it expects a string, but not what format.
            Hide
            daspilker Daniel Spilker added a comment -

            The Job DSL syntax is generated from runtime information provided by the plugin, in this case the Folders plugin. The plugin needs to provide a HTML file which will be shown in the API viewer. In this case the Folders plugin needs to provide com/cloudbees/hudson/plugins/folder/computed/PeriodicFolderTrigger/help-interval.html. Can you file a pull request for the Folders plugin to add the file with the relevant documentation?

            Show
            daspilker Daniel Spilker added a comment - The Job DSL syntax is generated from runtime information provided by the plugin, in this case the Folders plugin. The plugin needs to provide a HTML file which will be shown in the API viewer. In this case the Folders plugin needs to provide com/cloudbees/hudson/plugins/folder/computed/PeriodicFolderTrigger/help-interval.html. Can you file a pull request for the Folders plugin to add the file with the relevant documentation?

              People

              • Assignee:
                gpaciga Gregory Paciga
                Reporter:
                seadub Chris Williams
              • Votes:
                0 Vote for this issue
                Watchers:
                4 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: