Is there anyway/plugin we can trigger a build only at particular time and should not be able to trigger any other time? - jenkins

I have created my job and want to trigger build daily at 11am and in any other time I should not be able to trigger it.

You can Go to “Build Triggers” section in jenkins and under that Check “Poll SCM”, here you can create cron jon for your pipeline trigger.
For you query you can give somethind like below in the Poll SCM schedule box:
0 11 * * *
Jenkins used a cron expression, and the different fields are:
MINUTES Minutes in one hour (0-59)
HOURS Hours in one day (0-23)
DAYMONTH Day in a month (1-31)
MONTH Month in a year (1-12)
DAYWEEK Day of the week (0-7) where 0 and 7 are sunday
For more info please visit here

To add on the given answer , you can also add a simple bash script to check the time and exit or do the same in the jenkins pipeline

Related

Cron that runs on first Sunday after the first Friday of the month has passed

We work on a product whose software development team applies patch on every 1st Friday of the month. We have written some tests that we run on the Sunday after the patch is applied. So to automate the same on Jenkins, we would need a cron that runs on 1st Sunday after the 1st Friday of the month has passed.
Right now we just update our Jenkins each month considering dates, but can we automate this?
Thanks
Naively, one would suppose that 0 3 1-7 * fri would be "3am on the Friday that falls inside the first week of each month", and then we could use the similar logic to construct 0 3 3-9 * sun, for the Sunday that follows two days after such a Friday.
Unfortunately, this does not work, because day of week and day of month are taken as a disjunction by the cron specification; which means, the above would trigger not on the Sunday following the first Friday in a month, but on every Sunday, and also every day from 3rd to 9th.
Due to this twist in cron spec, what you ask is not possible by cron alone. The easiest way to untangle this is to separate the two requirements, ask the cron to track one of them, and manually test the other: either use 0 3 3-9 * * and then manually test in your script whether the day is Sunday and exit without performing your task if it is not, or use 0 3 * * sun and manually make sure the date is between 3rd and 9th.

Schedule a Jenkins job for future date

I have to schedule a Jenkins job which runs every Day of the week, every Month in a year , every Day in a month but after a specific date.
I have used the below cron expression but it will trigger the job only on 1:00 pm for sept month only.
0 13 * 8 *
I need to schedule it from Sept,01,2018 onward everyday at 1:00pm.
If You want to trigger in future use: Schedule Build Plugin
0 0 13 1 1/1 ? *
For more information you can visit www.cronmaker.com
Thanks,
Sunny

Jenkins schedule JOBS based on week

How do I schedule dependent jobs in Jenkins. I cant schedule it as 1st week , 2nd week or 3rd week to maintain the number of runs. We want the schedule weekly.
Job1 to run on week1
Job2 to run on week2
Job3 to run on week3
Again,
Job1 to run on week4
Job2 to run on week5
Job3 to run on week6.
And the schedule goes on ..
How do I script this in Jenkins "Build Periodically".
Thanks in advance.
I don't think you could do this with a cron expression. I think the best you could do is setup a weekly job and then use logic to execute the appropriate build.
You could either use a pipeline job, the conditional build step plugin, or if you really need them to be entirely separate jobs, build a pipeline job that runs weekly, decides which job to run, and then kicks off the appropriate job using the "build" step. You have much more powerful logic available to you this way, instead of just a cron expression.
This is the format to schedule jobs Weekly and Monthly
MINUTE (0-59), HOUR (0-23), DAY (1-31), MONTH (1-12), DAY OF THE WEEK (0-6)
Weekday daily build twice a day, at lunchtime 12:00 and midnight 00:00, Sunday to Thursday: 00 0,12 * * 0-4
Every first of every month between 2:00 a.m. - 02:30 a.m.: H(0,30) 02 01 * *

Jenkins auto build is not working

This is ramesh,
I tried to build my .net application using jenkins, my source is reside at in github. I can get build, when using manual build option in jenkins. But auto build is not working, when i give commit on github.
Thanks
Your question is not clear. What are you Build triggers?
Here's what I use:
Jenkins uses something called corn expressions
MINUTES Minutes in one hour (0-59)
HOURS Hours in one day (0-23)
DAYMONTH Day in a month (1-31)
MONTH Month in a year (1-12)
DAYWEEK Day of the week (0-7) where 0 and 7 are Sunday
* */23 * * * == one day

Jenkins polled repository once then never again, though 1 minute interval is set

I've set up a Jenkins job and set the poll interval at 1 minute (I used this syntax 0 * * * *).
Looking in the Polling log I can see its reported that a poll call was made as soon as I saved the changes to the job.
But not over 10 minutes later it hasn't made any other polls.
Any suggestions how I can proceed determining the problem?
You're looking for "* * * * *".
Jenkins gives a warning since every minute can be a bit excessive, but your version control server shouldn't have any problems handling the load.
Your cron syntax is set to poll once per hour, at zero minutes past the hour. From the Jenkins help text:
This field follows the syntax of cron (with minor differences). Specifically, each line consists of 5 fields separated by TAB or whitespace:
MINUTE HOUR DOM MONTH DOW
MINUTE Minutes within the hour (0-59)
HOUR The hour of the day (0-23)
DOM The day of the month (1-31)
MONTH The month (1-12)
DOW The day of the week (0-7) where 0 and 7 are Sunday.

Resources