「Jenkins」- GitLab Plugin @20210223

Plug-in introduction

This plugin is a build trigger (Build Trigger) that allows Jenkins to be triggered to execute a build task when a code push or a merge request is created in GitLab.

Plugin site: https://plugins.jenkins.io/gitlab-plugin

Install plugin

Manage Jenkins => Manage Plugins => Available => GitLab Plugin

Use plugin

The plugin is configured in units of jobs, so start by creating a Job:
1) In Jenkins, create a Freestyle project type job;
2) In Job, check Build Triggers => Build when a change is pushed to GitLab. GitLab webhook URL: <WebHook URL>;
3) Click on Advanced... to expand, click Generate to generate Secret token parameters;
4) Set in GitLab's WebHooks, fill in the <WebHook URL> and Secret token information;

Other detailed configuration introduction: https://github.com/jenkinsci/gitlab-plugin

Precautions

Check out Pipline and Job DSL examples: https://wiki.jenkins.io/display/JENKINS/Violation+Comments+to+GitLab+Plugin

Compatibility: The version 1.2.1 plug-in introduces a backwards incompatible change for Pipeline. When upgrading to this version, they need to be reconfigured manually. The Freestyle project will not be affected. See the README file for details.

Check the CHANGELOG file for the change log .

Variables passed into Jenkins

In the construction, we can use the variables, you can refer to the Defined variables page.

How to get the original request data in WebHook

# 07/21/2019 There is no way to get the raw data of WebHook. Instead, consider the Generic Webhook Trigger Plugin extension.
Read json payload from gitlab webhook in Jenkins
Add the ability to parse the whole webhook JSON payload
How to read json payload from gitlab webhook in Jenkins #52

Related Links

Continuous Integration with Jenkins and GitLab

related articles

「Jenkins Plugins」- Token Macro
「Jenkins」- Publish Over ...(学习笔记)
「Jenkins Plugins」- Email Extension

references

Jenkins/Plugins/GitLab
GitHub/jenkinsci/gitlab-plugin

Guess you like

Origin blog.csdn.net/u013670453/article/details/113971946