Answers: <p>Jenkins itself isn't very good at using external data sources to drive dynamic job scheduling.  The reason for this is that job configuration, including scheduling, is built statically, either manually via the web UI, or with code via a Pipeline script which is run at job execution time.  Even if the Pipeline script builds the job configuration in a dynamic way, the configuration itself will be locked in until the next job execution.</p>
  
  <p>The easiest way to have flexible build schedules is use an external source to drive your builds.  The hook mentioned in the comments would be ideal, but it sounds like that is not possible for you.  Another idea would be to have a cron job on your database server that runs once a day, grabs the build time from the database, and schedules the build for that time.  I'm sure this isn't a great solution, but it's just an example.</p>
  
Answers: CC BY-SA 4.0
Answers: 2020-01-13T17:24:41.650Z
Answers: 2020-01-13T17:24:41.650Z
Answers: jayhendren
Body: <p>I have a situation where there is a database in which a table consists of scheduled time to build. This schedule time to build may vary from day to day. Say for example,</p>
  
  <pre><code>Today the entry in db is 09/01/2020 5:00 PM 
  Tomorrow the entry can be 10/01/2020 4:00 PM
  </code></pre>
  
  <p>So, based on the above table, I need to schedule a Jenkins job today at 5:00 PM and tomorrow at 4:00 PM Is there any possibility in Jenkins to configure the build based on the above table entries.</p>
  
  <p>Thanks in advance</p>
  
Comments: CC BY-SA 4.0
Comments: 2020-01-09T09:50:26.693Z
Comments: Perhaps the easiest thing may be to trigger the job using an incoming webhook. Does your database connect to anything that could send such a webhook, like a messaging system, etc?
Comments: Bruce Becker
Comments: CC BY-SA 4.0
Comments: 2020-01-10T10:35:40.803Z
Comments: No, I doesn't connect to any webhook
Comments: Jman91
Tags: <jenkins>
Title: How to schedule a Jenkins Job dynamically based on the time value in database
UserDisplayName: Jman91
ThreadText: # How to schedule a Jenkins Job dynamically based on the time value in database
  
  (Asked by: username_0 on 2020-01-09)
  
  I have a situation where there is a database in which a table consists of scheduled time to build. This schedule time to build may vary from day to day. Say for example,
  
  ```
  Today the entry in db is 09/01/2020 5:00 PM 
  Tomorrow the entry can be 10/01/2020 4:00 PM
  
  ```
  
  So, based on the above table, I need to schedule a Jenkins job today at 5:00 PM and tomorrow at 4:00 PM Is there any possibility in Jenkins to configure the build based on the above table entries.
  
  Thanks in advance
  
  **Tags:** jenkins
  
  > **Comments:**
  > **username_1**: Perhaps the easiest thing may be to trigger the job using an incoming webhook. Does your database connect to anything that could send such a webhook, like a messaging system, etc?  
  > **username_0**: No, I doesn't connect to any webhook  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_2 on 2020-01-13. Score: 1
  
  Jenkins itself isn't very good at using external data sources to drive dynamic job scheduling. The reason for this is that job configuration, including scheduling, is built statically, either manually via the web UI, or with code via a Pipeline script which is run at job execution time. Even if the Pipeline script builds the job configuration in a dynamic way, the configuration itself will be locked in until the next job execution.
  
  The easiest way to have flexible build schedules is use an external source to drive your builds. The hook mentioned in the comments would be ideal, but it sounds like that is not possible for you. Another idea would be to have a cron job on your database server that runs once a day, grabs the build time from the database, and schedules the build for that time. I'm sure this isn't a great solution, but it's just an example.
  
  
  ---
  
  