Home > Software design >  How to decouple Jenkins CI and gitlab CI pipelines?
How to decouple Jenkins CI and gitlab CI pipelines?

Time:12-10

I've only been working with Jenkins so far. We have configured a Multibranch Pipeline job to automatically build and test software. The tasks are written in Groovy and stored as Jenkinsfile in the root directory of our git repository.

Recently, we have decided to add another mechanism to automatically generate documentation. The generation of documentation (but this could be any other task) has been realized using GitLab CI.

Both pipelines are practically independent - and both are triggered by a git commit/push. What I do not understand is: why and how is the Jenkins pipeline execution associated with the GitLab CI pipeline? In the following screenshot a new column "External" appears - representing the Jenkins pipeline job.

GitLab CI pipeline still running

That's not really a big issue. But as both pipelines should be independent - the results of the runs should not influence each other. However, it seems that when the Jenkins job fails, i.e. "External", the GitLab CI pipeline also fails:

GitLab CI pipeline failed #1

GitLab CI pipeline failed #2

Is there a way to better decouple those pipelines, i.e. let them fail or succeed individually?

CodePudding user response:

This is because the skip_pipeline_status

CodePudding user response:

why and how is the Jenkins pipeline execution associated with the GitLab CI pipeline? In the following screenshot a new column "External" appears - representing the Jenkins pipeline job.

In general, "External" statuses are created using the commit build status API -- Jenkins uses this API to report the Jenkins pipeline build status to GitLab CI.

This external status for Jenkins appears in your GitLab pipeline because you have configured your Jenkins server/project to report build statuses to GitLab or you have setup a webhook integration with Jenkins in GitLab (note these may be set at the group level or by an administrator, not necessarily the project level)

To remove this from your pipeline, you should disable any existing integration configurations and setup your Jenkins project independently of any GitLab integration. e.g. using git polling to trigger jenkins builds and remove any updateGitlabCommitStatus calls in your groovy scripts / build stages.

  • Related