Need help to schedule jobs in Jenkins - jenkins

I have scheduled my job in jenkins as "0 0-12/3 * * 1-3". This will run monday to wednesday from 12am to 12pm for every 3 hours.
My question is, during the above interval if any build execution is PASS, then it should skip remaining scheduled interval for that week!!!
How to do this? can anyone Help me?

You could try working the other way: Schedule your job to run only once per week. Then add either the Naginator or Periodic Reincarnation plugin to your Jenkins server to restart a failed build.
If that should be more liberal (as in: don't always start the job on the first possible day of the week, but rather check if a week has elapsed since the last run), you could try the following:
Install https://wiki.jenkins.io/display/JENKINS/Run+Condition+Plugin to check for further conditions
Let your job write a file at the end of a successful run
Check through that plugin whether
the file does not exist: run the job
the file is at least one week old: run the job
else: skip the job

Related

I need to schedule a job in jenkins that runs every hour except that it should not run between 11:30pm and 4am

I need to schedule a job in jenkins that runs every hour except that it should not run between 11:30pm and 4am. What would be the cron expression?
This cron expression 0 4-23 * * 7 will run every day at the hour between 4AM and 11PM.
If you are not required to run this job at exactly when the hour starts, you can also use H 4-23 * * 7. H (for hash) is useful on Jenkins, as it will not execute all your scheduled jobs for the hour at exactly the same time, because it will try to even the load on the system (e.g. this job might run at 11.10PM).

Jenkinsfile | Declarative pipeline | Run a Job after some specified time (in background)

I have a requirement to run a destroy job (which will destroy the instances) after testing. The testing will take around 1hr. So the instances can be destroyed after that, adding some leisure time, say after 2hrs.
Jenkins file
Run job-1
Run job-2 - deploy in lower environment
Run job-3 - destroy lower environment after 2hrs of current-time
Run job-4
Run job-5 - after 3hrs
All the jobs should run one after another without wait. And there I am stuck !!
timer - will wait until the given time completes and abort :(
sleep - will wait until the given time and runs next job/whatever :(
trigger - will trigger the job but with cron functionality :(
I am ok to use trigger if my requirement can be accomplished with it.
Or any groovy code to set trigger time (set cron time [currentTime + 3hrs])!
Or
simply - I want to run a cronjob ONLY for one time [just after 3hrs of Now]
Note: I am a newbee to groovy
Use Quiet period set to 120 mins for the last job - Job-5
Groovy syntax is build job: 'Job-5',quietPeriod: 120, wait: false

why jenkins job is not running at scheduled time midnight

settings for scheduled job in jenkins
my job is not running automatically as the settings in the screenshot shows that it should run at that time. please help on this
You should choose "Build Periodically" option and give "0 0 * * *" to run the job on midnight everyday.
Refer
https://crontab.guru/every-night-at-midnight

How do I schedule jobs in Jenkins on specific time?

For every +61 minute e.g. 00:00, 01:01, 02:02, 03:03 ...
As Jenkins uses cron expression, there isn't a way to run a script every 61 minutes. You can have another options checking this already answered question:
How to set crontab every 1 hour 1 minute

Periodical build and start another job at JENKINS

I have the following scenario in JENKINS:
Job1 - Will run periodically every 10 minutes, but should stop the periodic construction when it gives "SUCCESS". Attention to this, he must build until he succeeds every 10 minutes, when he succeeds, he must activate the next job.
Job2 - Must be triggered by Job1 only once;
How to solve? Are there any plugins for this questioning?

Resources