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?
Related
I have some jobs which trigger each other after they finish, but in some cases, the last test3 job isn't started, and I have no error message/ideas on why?
Most of the time the build test2 writes "Triggering a new build of test3" and in some cases, it's not there? It doesn't matter if the job test2 failed or passed, and there isn't any pattern when it doesn't trigger the last job. Does anyone have some ideas on what to look at, because I'm a little lost?
All runs are triggered on: Jenkins 2.332.3
Settings:
Builds:
What can make a job not trigger the next one?
I have two Jenkins jobs - JobA and JobB. I will trigger JobA. Now I want to run the JobB periodically every 5 minutes until JobA is running. So if JobA runs for say 30 mins, jobB will get triggered after each 5 mins and in total it will run for 6 times. Kindly help if this can be achieved in Jenkins.
Thanks,
Sourabh
If I understand correctly, you want to keep jobB running every 5 mins till jobA is completed.
You can create an upstream job, jobC which will poll/check status of jobA and if it is running, will trigger jobB. If jobA is not running, jobC should fail, not triggering jobB.
You can schedule jobC to be triggered on every 5 mins.
OR,
You can just trigger jobB and first validate the status of jobA. If jobA is not running, fail jobB else complete the execution.
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
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
I have one pipeline build called, for example UAT. This build is scheduled every 3 minutes. And another build called DEV. DEV is scheduled every minute. The task is: to run UAT only if the last DEV execution was SUCCESS. If not - skip the execution. And run it after other 3 minutes with the same condition.
How can I achieve that ?
Don't schedule your UAT job as a separate job but instead trigger the launch once your first DEV pipeline finishes with success.
As you are using pipelines you actually have 2 solutions :
1)
Don't call another job but just call a Groovy function to integrate the DEV part, such as :
node() {
stage "UAT"
// Your existing UAT pipeline content here
stage "DEV"
git 'http://urlToYourGit/projectContainingYourDevScript'
pipeline = load 'functions.groovy'
pipeline.dev()
}
2) Just call a second Jenkins job with this kind of line :
node() {
stage "UAT"
// Your existing UAT pipeline content here
build job: "dev-job"
}
With these 2 solutions you can configure your first job to run every minute and it will trigger the second part/job only if the first one finishes with success (otherwise Jenkins will just fail the build as it would normally do).