Jenkins CI - Promote Corresponding Downstream Jobs - jenkins

I am currently using the Promoted Builds Plugin to promote jobs into QA, Test, Production, etc. This plugin is really great for promoting a single job. However I am looking for a way to promote the parent job and have that job promote the rest of the downstream jobs with the corresponding build.
Here is an example. Lets say I have 3 jobs that are all triggered from an upstream job:
Job 1 - Build 200 - Parent job kicks off job 2 upon successful build
Job 2 - Build 400 - Job 2 kicks off job 3 upon successful build
Job 3 - Build 300 - Job 3 builds after job 2 is successful
After this is done I want to be able to promote job 1 build 200 and have that job also promote job2 build 400 and job 3 build 300 since these are the artifacts that were built together in the downstream relationship.
This can be easily done by actually building the jobs and automatically promoting them, but I do not want to build as the artifacts have already been created.
Any help is much appreciated!

Related

Triger to build pipeline job after successful another 5 jobs

How to trigger build pipeline job in Jenkins after some successful builds of another 5 jobs? I tried to use Build trigger but it work only for one successful build job, but not for all five of them.

How to add multiple Jenkins jobs as a build parameters in single Jenkins job

->I have around 20 jobs which needs to be deployed parallel
I want to trigger these 20 jobs from single jenkins job.
I need to use those 20 jobs as build parameters in single jenkins job so i can choose which job to deploy.
Can someone help me with this requirement if there is any plugin or workaround?
I tried below options:
Active choices plugin and build flow plugin are not compatible with the current jenkins version 1.642 which i am using.
Multijob project can only deploy all jobs at once parallel but doesn't give any option/condition to run particular job.
Currently i am working on multijob phase project jenkins
I am trying to use some conditions in Multijob phase project but jobs not triggered as expected, If someone knows using conditions in multijob phase please lemme know
Thank you

Jenkins trigger a job only after one has completed and avoid parallel execution of jobs

I have two jobs in Jenkins: Job A that gets triggered on a commit and job B. Technically job B is triggered only after job A has been completed as job B is mentioned as a downstream of job A in the post build actions, but imagine this scenario:
Job A has been triggered by one commit and is running while the job B is still running from previous commit of job A, this is causing potential failures and complexity as both are running in parallel.
What is the best way to prevent both of them running in parallel?
These are the plugins I saw on jenkins wiki:
Build Blocker Plugin
Multijob Plugin
Still wanted to know the best course of action.
You can use the Multijob plugin for this and then both sub jobs will be wrapped in one job that is triggered by a commit.
You can avoid parallel execution of that job (in case of 2 commits in short time, the 1st commit will trigger the job, the 2nd will be 'pending')

When a jenkins Job runs then its Upstream projects jobs will build automatically or we need to run upstream projects job separately then this job?

When a jenkins Job runs then its Upstream projects jobs(dependent projects jobs) will build automatically or we need to run upstream projects job separatly then this job ?.
When a job runs then its Downstream Projects jobs runs automatically or not ?
I have 4 jobs
Job-2,Job-3 depends on Job-1 .
Job-4 depends on job-1,Job-2,Job-3 .
note: job-1,job-2,job-3 java projects and job-4 web project.
I need JOB-4 as war then which job shall i run and How i configure jobs upstream ,downstream
The build flows from upstream to downstream. When you build a project it will trigger all downstream builds, but will not trigger upstream builds. So we say that a downstream project depends on an upstream project.
When you are configuring a build in Jenkins this will be very obvious. When you define job1, in the post build actions section you can tell it to Build other projects and select job2. Jenkins will automatically determine that job1 is upstream and job2 is downstream.
Even though job4 depends on all three other projects you should set it up so that only one project builds at a time. For you, Job1 -> Job2 -> Job3 -> Job4. This would mean that each project has at most one upstream project and one downstream project.
If you really want to make Job2 and Job3 run at the same time, but want to ensure that Job4 is called only once and only after both other jobs are finished, then you should look into the Build Flow Plugin which is designed to do exactly that.

Trigger Jenkins Job after Artifactory Upload

I have two Jenkins jobs.
Job 1: Uploads build to artifactory
Job 2: Downloads build from artifactory and does some stuff with it
Right now, Job 1 triggers Job 2 using the Parameterized Build Plugin (Job 2 is shared amongst many teams at my company, so I don't want to change it too much - it's a parameterized job that takes an artifactory URL)
The problem is, it seems like the artifact doesn't always finish uploading to artifactory before Job 2 is triggered. Sometimes Job 2 gets a 404 when it tries to download the artifact. Is there some way to 1) prevent triggering Job 2 until the artifact has uploaded? or 2) pass the artifact directly from Job 1 to Job 2 w/out needing to do an upload and a download? (the former would be preferable, since option 2 would require changing Job 2)
Regarding your option 1, you can use the Naginator plugin to reschedule a job 2 if it fails.
Regarding the option 2, you can use the Copy Artifact plugin. It will allow the job 2 to copy the artifacts from the job 1.
Personally, I prefer the option 1. Artifactory is the right place to store binaries :)
There is a 3rd solution by using the quiet period setting on the job 2 to delay the start (Jenkins: build one job after another with some delay).

Resources