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

Expand and encourage use of hash syntax in crontabs

    Details

    • Similar Issues:

      Description

      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.

        Attachments

          Issue Links

            Activity

            Hide
            scm_issue_link 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.

            Show
            scm_issue_link 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 .
            Hide
            scm_issue_link 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

            Show
            scm_issue_link 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
            Hide
            dogfood dogfood added a comment -

            Integrated in jenkins_main_trunk #2410

            Result = SUCCESS

            Show
            dogfood dogfood added a comment - Integrated in jenkins_main_trunk #2410 Result = SUCCESS
            Hide
            alex_g 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')

            Show
            alex_g 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')
            Hide
            jglick 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.

            Show
            jglick 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.
            Show
            jglick 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
            Show
            jglick 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 .
            Hide
            ceilfors 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.

            Show
            ceilfors 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.

              People

              • Assignee:
                jglick Jesse Glick
                Reporter:
                jglick Jesse Glick
              • Votes:
                3 Vote for this issue
                Watchers:
                9 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: