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

Schedule Jenkins job using Jenkins Rest API

    Details

    • Similar Issues:

      Description

      I have a Jenkins job which is scheduled for a specific time. I want to modify that timing programmatically.
      I tried to modify the build by installing Schedule Build plugin and modify it using http://jenkins_url/job/jobname/build?delay=3344sec. But this will put the job in quiet period which holds the java thread. I'm looking to modify the Schedule entry without putting it to quiet period.

        Attachments

          Activity

          Hide
          halkeye Gavin Mogan added a comment -

          Can you update this ticket with a use case. "Because I want it" is a bad reason to add new features.

           

          Can you use the cron trigger?

          https://jenkins.io/doc/book/pipeline/syntax/#triggers

           

          When you say "holds the java thread" what do you mean? that it takes up an executor/node on the sidebar?

          Show
          halkeye Gavin Mogan added a comment - Can you update this ticket with a use case. "Because I want it" is a bad reason to add new features.   Can you use the cron trigger? https://jenkins.io/doc/book/pipeline/syntax/#triggers   When you say "holds the java thread" what do you mean? that it takes up an executor/node on the sidebar?
          Hide
          ianw Ian Williams added a comment -

          (not the OP, but my interpretation; may be misinterpreting something)
          Build periodically/Schedule Job (ie: cron) works fine as an ongoing solution, if you wan to repeatedly run the job on a schedule. At the other end of the spectrum you have "Build Now". We have a number of scenarios where we want to build not now, but later today.

          It's essentially the difference between using UNIX cron and at, or running a command immediately.

          It is not convenient to change the configuration of the job so it can run later, then undo the change once run. Also, unless you have Job Configure, that option is not available to you. It should be available to users who have only Job | Build.

          Show
          ianw Ian Williams added a comment - (not the OP, but my interpretation; may be misinterpreting something) Build periodically/Schedule Job (ie: cron) works fine as an ongoing solution, if you wan to repeatedly run the job on a schedule. At the other end of the spectrum you have "Build Now". We have a number of scenarios where we want to build not now, but later today. It's essentially the difference between using UNIX cron and at , or running a command immediately. It is not convenient to change the configuration of the job so it can run later, then undo the change once run. Also, unless you have Job Configure, that option is not available to you. It should be available to users who have only Job | Build.
          Hide
          prasanna2104 Prasanna Rengarajan added a comment -

          Hi Gavin Mogan,

          From External Application, we want to update the cron entry or override the schedule timing of a jenkins job. We are trying to create a jenkins job (called Job A) which will update or override the schedule timing of another Jenkins Job(called Job B)

          Show
          prasanna2104 Prasanna Rengarajan added a comment - Hi Gavin Mogan , From External Application, we want to update the cron entry or override the schedule timing of a jenkins job. We are trying to create a jenkins job (called Job A) which will update or override the schedule timing of another Jenkins Job(called Job B)
          Hide
          ianw Ian Williams added a comment -

          One other scenario .. we have scheduled job that runs but depends on an independent system's maintenance activities to have completed. On the rare occasion that does not complete in time, would be nice to.have a post-build action to retry after an interval. Right now, we must manually trigger when discovered.

          Show
          ianw Ian Williams added a comment - One other scenario .. we have scheduled job that runs but depends on an independent system's maintenance activities to have completed. On the rare occasion that does not complete in time, would be nice to.have a post-build action to retry after an interval. Right now, we must manually trigger when discovered.
          Hide
          ianw Ian Williams added a comment - - edited

          I was just investigating a separate issue regarding plugins and came across: naginator plugin.

          This plugin allows you to automatically reschedule a build after a build failure.

          This can be useful in several cases, including:
          The build is dependent upon external resources, that were temporarily unavailable (DB down, network down, website down, etc).

          I wonder if that is the same expected behaviour? I will be investigating if it suits my needs.

          Show
          ianw Ian Williams added a comment - - edited I was just investigating a separate issue regarding plugins and came across: naginator plugin . This plugin allows you to automatically reschedule a build after a build failure. This can be useful in several cases, including: The build is dependent upon external resources, that were temporarily unavailable (DB down, network down, website down, etc). I wonder if that is the same expected behaviour? I will be investigating if it suits my needs.

            People

            • Assignee:
              pingunaut Martin Spielmann
              Reporter:
              prasanna2104 Prasanna Rengarajan
            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated: