Issue
I currently have GitHub connected to Jenkins and for every pull request, GitHub triggers a Jenkins job which seems to work fine. I am extending this to trigger multiple jobs, let's say on a new pull request, I have multiple JenkinsFiles which are basically running different configurations.
All the jobs are triggered correctly, but the status reported back to github is overwritten. For 1 PR I will trigger:
Job1
Job2
Job3
But I get only the status of Job3:
continuous-integration/jenkins/pr-merge
continuous-integration/jenkins/branch
I would like to see something like:
continuous-integration/jenkins/job1
continuous-integration/jenkins/job2
continuous-integration/jenkins/job3
I have already tried to set a custom commit context on the JenkinsFile of each job, but it doesnt seem to be working. Any suggestions how to solve it ?
Thank you
Solution
github
uses commit statuses to identify build results. In your case it is showing the latest one since the commit context
is the same. To show results of all jobs in github
you would have to change the commit context for each of them. This can be done via official github status API
which can be found here
Since you are using Jenkins what you want can be achieved by using existing plugin called GitHub Pull Request Builder Plugin. It implements github status API
and can set a different context for each job. The plugin repository can be found here.
According to this discussion from plugin issue page and an answer by audleman there this is what has to be done:
One Pull Request to Trigger Multiple Jobs
In the job configuration, go to:
Build Triggers -> GitHub Pull Request Builder -> Trigger Setup...
Change
Commit Status Context
to be unique for each job.
Answered By - Moro
Answer Checked By - Willingham (JavaFixing Volunteer)