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

Expand and encourage use of hash syntax in crontabs

      Jenkins supports H in crontab specification to balance load across different times of day in a predictable yet natural way, so you do not get sudden spikes of activity. Special syntaxes like @daily use this automatically. And you can use it explicitly in five-field specs for more control.

      Yet the H syntax is not widely used, and it is not powerful enough to handle e.g. jobs which should be triggered every quarter hour. The result is terrible performance on large installations where a lot of people innocently configure triggers that all go off at once.

      Suggested changes:

      1. Expand the syntax to support e.g. H/15 * * * * for a trigger to run every fifteen minutes according to hash (e.g. 3, 18, 33, and 48 minutes past the hour).
      2. Update inline help to advocate hash syntax as the normal usage, and warn that misuse of exact times can overload the system.
      3. Provide form validation that flags use of exact times as a warning and suggests the hash syntax to use instead.
      4. Supply a standalone utility function which may be run to make that transformation in bulk across a bunch of job configs.

          [JENKINS-17311] Expand and encourage use of hash syntax in crontabs

          Code changed in jenkins
          User: Jesse Glick
          Path:
          core/src/main/java/hudson/scheduler/CronTab.java
          core/src/test/java/hudson/scheduler/CronTabTest.java
          http://jenkins-ci.org/commit/jenkins/7f92a9bd1a003b81419e5b9142f2592da608eb43
          Log:
          JENKINS-17311 Improved hashify to detect manual skip idiom.


          You received this message because you are subscribed to the Google Groups "Jenkins Commits" group.
          To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-commits+unsubscribe@googlegroups.com.
          For more options, visit https://groups.google.com/groups/opt_out.

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: Jesse Glick Path: core/src/main/java/hudson/scheduler/CronTab.java core/src/test/java/hudson/scheduler/CronTabTest.java http://jenkins-ci.org/commit/jenkins/7f92a9bd1a003b81419e5b9142f2592da608eb43 Log: JENKINS-17311 Improved hashify to detect manual skip idiom. – You received this message because you are subscribed to the Google Groups "Jenkins Commits" group. To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-commits+unsubscribe@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out .

          Code changed in jenkins
          User: Kohsuke Kawaguchi
          Path:
          changelog.html
          http://jenkins-ci.org/commit/jenkins/c4760b472c8c54c874b043502a1a6892532ba07a
          Log:
          recording JENKINS-17311

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: Kohsuke Kawaguchi Path: changelog.html http://jenkins-ci.org/commit/jenkins/c4760b472c8c54c874b043502a1a6892532ba07a Log: recording JENKINS-17311

          dogfood added a comment -

          Integrated in jenkins_main_trunk #2410

          Result = SUCCESS

          dogfood added a comment - Integrated in jenkins_main_trunk #2410 Result = SUCCESS

          alex_g added a comment -

          should the ticket status set to Resolved and Resolution to Fixed? (i have seen this feature in current jenkins 1.514)
          to 4.: bulk job config changes can be done with https://wiki.jenkins-ci.org/display/JENKINS/Configuration+Slicing+Plugin ('SCM Timer Trigger Slicer'/'Timer Trigger Slicer')

          alex_g added a comment - should the ticket status set to Resolved and Resolution to Fixed? (i have seen this feature in current jenkins 1.514) to 4.: bulk job config changes can be done with https://wiki.jenkins-ci.org/display/JENKINS/Configuration+Slicing+Plugin ('SCM Timer Trigger Slicer'/'Timer Trigger Slicer')

          Jesse Glick added a comment -

          @alex_g indeed this was in 1.510. Looks like the JIRA daemon failed to mark it as resolved when it was merged, I think because Kohsuke merged it manually and so lost the FIXED comment in the pull request title.

          Regarding point #4, CronTab.hashify performs this specific function. The Configuration Slicing plugin could not do the same unless it is updated to a 1.510+ core dependency and calls this method, or copies its implementation.

          Jesse Glick added a comment - @alex_g indeed this was in 1.510. Looks like the JIRA daemon failed to mark it as resolved when it was merged, I think because Kohsuke merged it manually and so lost the FIXED comment in the pull request title. Regarding point #4, CronTab.hashify performs this specific function. The Configuration Slicing plugin could not do the same unless it is updated to a 1.510+ core dependency and calls this method, or copies its implementation.

          Jesse Glick added a comment - The commits making up this change that I can find: https://github.com/jenkinsci/jenkins/commit/7f92a9bd1a003b81419e5b9142f2592da608eb43 https://github.com/jenkinsci/jenkins/commit/67c0edd0144f0f089cf01254853566efa4cd897b https://github.com/jenkinsci/jenkins/commit/3e71c97639d0ae6e0f3513e2eee870f2729222e3 https://github.com/jenkinsci/jenkins/commit/a941338b8aba5a788979cb3e3d01608e9a547a66 https://github.com/jenkinsci/jenkins/commit/ed712a783c9ce19adaae3941f770c1d5e51c90be https://github.com/jenkinsci/jenkins/commit/4335d96bd8f5d4daa0739f8e494deaa4d7970776 https://github.com/jenkinsci/jenkins/commit/17e7d7a1e678b94d971a05fc818a855c1968f960 https://github.com/jenkinsci/jenkins/commit/8f6bfcdabc0da132a4caf8a855ea337c0858a1b5 https://github.com/jenkinsci/jenkins/commit/c4760b472c8c54c874b043502a1a6892532ba07a

          Jesse Glick added a comment - Or a bit more simply: https://github.com/jenkinsci/jenkins/commit/b41278d1abe88f8223663a02249ae714f71e94f8 amended by https://github.com/jenkinsci/jenkins/commit/7f92a9bd1a003b81419e5b9142f2592da608eb43 and https://github.com/jenkinsci/jenkins/commit/c4760b472c8c54c874b043502a1a6892532ba07a .

          Wisen Tanasa added a comment -

          I have written a script to hashify all the jobs: https://github.com/ceilfors/jenkins-scripts/blob/master/scriptler/hashifyAllScmTriggers.groovy.

          It should be available from scriptler catalog once the pull request is accepted.

          Wisen Tanasa added a comment - I have written a script to hashify all the jobs: https://github.com/ceilfors/jenkins-scripts/blob/master/scriptler/hashifyAllScmTriggers.groovy . It should be available from scriptler catalog once the pull request is accepted.

            jglick Jesse Glick
            jglick Jesse Glick
            Votes:
            3 Vote for this issue
            Watchers:
            8 Start watching this issue

              Created:
              Updated:
              Resolved: