Jenkins build promotion: How do I schedule a build promotion? - jenkins

Is it possible to schedule a build promotion?

The only way I can think of is to create a second upstream job, lets call it the 'Scheduled Promotion Job'
In the Scheduled Promotion job create a promotion which has the promote immediately once the build completes, and schedule it's build to run according to the schedule you want the downstream job to be promoted by.
In the actual downstream build tell it to promote when the following upstream promotions are promoted, and enter the job name of the Scheduled Promotion Job.
To put it another way, tell your build to watch up upstream job for promptions, and put the schedule in the upstream job.
I just tried this with some test projects on my test jenkins server and it worked a treat.

Related

How to prioritize the JOB NOTIFICATION plugin to run first in post build actions

I have a setup in my job config. I just want to execute some downstream jobs after job notification plugin invoked from POST Build actions. But downstream jobs always trigger first and followed by job notification plugin is invoked.
Is there any way to run first job notification plugin and followed by downstream job execution?
You can use the Flexible Publish from Jenkins. It maintains the order of execution of post-build actions and also allows you to use a publisher more than once in a build.
https://plugins.jenkins.io/flexible-publish
https://wiki.jenkins.io/display/JENKINS/Flexible+Publish+Plugin

How to trigger Jenkins downstream job from script but not manually through Jenskins?

From Jenkins plugin (ie. Delivery Pipeline, Parameterized Trigger), we could setup a pipeline which contains multiple jobs in sequence, for instance: Build -> Unit Test -> Deploy To DEV.
Now, for each pipeline, we want to stop after "Unit Test" because we need to wait for someone to approve the deployment before it can go on (We use JIRA as the tracking system for this).
Say when, someone approves the deployment ticket in JIRA, we already setup a post action to fire and trigger a job in Jenkins, say "Deploy To Dev" in this case. However, this job will run independently outside the pipeline.
Is there a way, we can trigger the down stream job from script within an instance of a pipeline so it can carry over all the parameters from upstream and shown as part of the pipeline?
Thx

Jenkins Delete build if not promoted

I am using promoted build plugin. When jobA is promoted, jobB is triggered.
I want to get rid of delayed approval.
So, my requirement is to delete jobA's latest build or all the builds automatically after certain triggered time if jobA is not promoted
you can't do it juste with promoted build plugîn but you can use an other job who receive the job url and build id in parameters to execute a http request or curl request using the jenkins cli to delete the specific build

Run jenkins job without triggering downstream jobs

I have a jenkins job with a couple of downstream jobs which are triggered upon the job finishing correctly.
There are times when I want to run the initial job without triggering the downstream jobs. Is this possible?
It sounds like the conditional build step plugin might be of help. You can configure it to trigger other jobs based on various conditions, like so:
Here, the conditional build step has been configured to run downstream-job if foo.txt exists in the current workspace.

How to trigger two job from single job in Jenkins

I have one main Job on Jenkins.
I also created two jobs:
One job for scm changes build
One for Scheduled Build
In both job I gave the same configuration file as well as workspace.
I just give the name of job different.
Now from the main job through script I'm triggering SCM changes build which is success.
Again from the main job through script I am triggering Scheduled Build which is success.
When both trigger is started from main job, as same time that is SCM changes and scheduled build.
I am getting error due to in both job I gave the same workspace.
How to decide through script from main job when Scheduled build is over then start SCM change build?
Trigger the SCM change build from the scheduled build instead of the main job, using the "Trigger / call builds on other projects" option in the main job's build steps.

Resources