2

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

  • 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? – Bruce Becker Jan 9 at 9:50
  • No, I doesn't connect to any webhook – Jman91 Jan 10 at 10:35
0

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.