In Jenkins, i need to limit running job execution for only one times per day
It's possible ?
My build it's just one batch command
I have one cron for execute my job with fix times and i can use URL for run my job manually too. If the job has already been executed, it must be blocked for the day
Thx for answers guys
So let assume that your job name called TestJob , Create another job called DisableEnable_TestJob.
In the DisableEnable_TestJob configure it to be triggered using Build trigger
Then you can use Job DSL plugin to disactivate a specific TestJob and then activate after the system time is midnight. Refer to this answer to see how to use it: Activate and disactivate a job using DSL plugin . You have to search only for how to wait until midnight time but that should not be an issue. Once the time is at 12:00 then you can activate the job again.
Let me now if you need any more help
Related
I have a jenkins job from triggered every minute. But, I want to stop for a specific date and time.
Freestyle Project
Configuration Triggers
I want you to help, please.
I want to configure a job in such a way that it will run when there is code checkin in GIT. The same job will run at least once in a day if there is no code check in on that day even i.e. weekend OR holiday
Set up an Git hock to trigger the job (or poll SCM for changes), see here. Then in the job configuration add a Build Trigger of type Build periodically:
I can't seem to find the best way to do that.
I have a Jenkins job I ran manually (say a job that creates a temporary file somewhere).
I want to be able to clean this up (e.g. delete the temporary file) after 2-3 hours.
I was thinking adding a Post Deploy action that will run a job with some parameters + some delay. But I can't find anything like that.
I've noticed several schedule plugins or REST API options, but nothing that as simple as "When Succesfully Building A, Build B in X minutes".
Suggestions?
Suggestions?
You could exploit the Quiet period.
job1 -> (sleep -> fake-job) -> job2
so let job1 trigger the fake-job whch has a quiet period of 7200 seconds and this fake-job will trigger your cleanup job.
You can use Parameterized Trigger Plugin (https://wiki.jenkins-ci.org/display/JENKINS/Parameterized+Trigger+Plugin).
Here you can pass predefined parameter to Project to build like sleep_time parameter and you can handle it in triggered Jenkins job. Also you can configure Trigger build on Stable / Unstable / always trigger conditions.
I hope it will be useful for you.
Is there a way to trigger a scheduled job?
I am building a pipeline of connected jobs which trigger each other once complete. I want one of the jobs to be scheduled to run at a particular time of the day. So I want to be able to essentially add to a queue to trigger at a later time.
Is that possible?
Cheers
To schedule a Jenkins job to run at a specific time, go to the job's landing page, click Configure from the left-side menu, scroll down to 'Build Triggers' section and pick 'Build Periodically'.
There you can specify the cron job formatted string to denote when and how often you'd like this first job to be scheduled for running.
If that job is not the first job in line, you can always use 'Quiet Period' option under 'Advanced Project Options' which puts in a delay in that job before the build steps actually run. You can specify the number of seconds you want that job to wait for before it actually executes.
This plugin seems to be piggybacking on the 'Quiet Period' feature though I haven't tried it myself: https://wiki.jenkins-ci.org/display/JENKINS/Schedule+Build+Plugin. You might have luck using it to your advantage.
You could use the Jenkins Workflow plugin suite (mentioned in your tag, perhaps unintentionally). It has a sleep step. If you wanted the next stage of the pipeline to run at a particular time of day, rather than after a fixed interval, you could do some simple computation with java.util.Calendar to determine the seconds between now and then.
I want to create the following flow:
I have some program which is making a REST CALL to one of my builds, it could make it any time in a day, but i don't want this my jennkins build to be executed immediately, only in a specific interval of time E.G between 3-5 AM, but only if it has been triggered by the REST Call.
Is there any plugin or a way to do it ?
The easiest way would probably be to do some PowerShell scripting and an additional job:
Create an empty dummy job (This will be the one you trigger through the REST api)
Create another job, which will be the one you actually want to execute within a specific interval of the day. Use a Cron Build Trigger
to setup when the job should execute in case of a trigger
Using the PowerShell Plugin and Run Condition Plugin, write some PowerShell code using the Jenkins REST api to fetch information about the "dummy" job. Here you will check whether the dummy job has run (triggered) or not today, and then you can decide with the Run Condition build step, if you want to proceed with the build.