Trigger multiple Jenkins Jobs using Jenkins CI plugin
Everyone can contribute. Help move this issue forward while earning points, leveling up and collecting rewards.
Problem to solve
For any given GitLab repository, we are unable to trigger more than 1 Jenkins Job using Jenkins CI plugin. At present, the GitLab to Jenkins CI integration allows us to trigger only one job at a time and it is tightly coupled with the repository. If we had a second Jenkins job which needs to be triggered from the same repository, it is not possible to do that.
If we try to pass multiple jobs using a separator like this job1;job2;job3
, it is not supported.
Intended users
Developers, Devops Engineers, Systems Administrators, Release Manager, Platform Engineer, Data Analyst
User experience goal
When different actions needs to trigger different Jenkins pipelines, the freedom to do it must be available. The support engineer workarounds provided are as follows, I have added my [Feedback].
Option1: Trigger a Jenkins job, that will trigger the other jobs you want. [Feedback: Thats additional Jenkins orchestration we need to build and manage] Option2: Add a webhook for each of the Jenkins job you want to trigger. [Feedback: The Jenkins CI is more secure than SSH based webhooks]
Proposal
At present, the Jenkins CI trigger is based on the Jenkins Job Name, instead it should be a combination of (Jenkins Folder Name + Branchname). In the Jenkins CI plugin (screenshot attached) in the place of Job Name, we should provide Folder Name
. In the event of a git-push, the webhook should poll the Jenkins Folder and look for the number of jobs inside it. For eg., if it finds 7 jobs, it should then identify which of the jobs are configured for a push event of that particular job and trigger all those jobs.
We need this because, one Jenkins Job can be a build job while the another one can trigger an AWS service via terraform and these are independent events which can happen from the same GitLab repository.
Further details
Benefits: Event based triggers of multiple jobs from same repository We do not have to breakdown our repository further in order to trigger separate events Not required to build additional orchestration jobs in Jenkins.
Permissions and Security
The actions are going to happen with a user who is already integrated and authenticated between GitLab and Jenkins. There should be minimal/no development effort needed related to authentication.