Gitlab merge request builder plugin configuration note

Source: Internet
Author: User
Tags ssl certificate

When contributing code to some open-source projectsgithubLast submittedpull requestOr when the submitted branch code is updated,jenkinsThe code is automatically executed.mergeWhen I ran the unit test, I read two words in my mind:NB!

At that time, I thought to myself, when I had to make such a big thing. WithgitlabThis idea is getting stronger and stronger as we gradually use it at work. I searched for Jenkins last weekend and found that Jenkins hasmerge requestPlug-in: gitlab merge request builder plugin

At that time, it was hard to remember, and began to look at the instructions for step-by-step configuration. The configuration is divided into two parts:

Part 1: Install plug-ins and basic settings
  • First install the plug-in. The Jenkins version must be later1.563Fortunately, Jenkins is easy to upgrade.System ManagementThere is a big Upgrade button on the interface, and you can upgrade it1.570.

  • InSystem Management->Plugin Management->Optional plug-insFound inGitlab Merge Request BuilderInstall and restart Jenkins. The official documentation emphasizes the need.Restart Jenkins.

  • After restarting, enterSystem Management->System settingsInside, you can find moreGitlab Merge Request BuilderConfiguration items

    1. Gitlab Host URLEnter the gitlab service address, suchhttp://192.168.0.1

    2. Jenkins UsernameEnter the Jenkins username in the project. Here, you need to create an account for Jenkins in gitlab, which is the same as that of other team members so that Jenkins can speak in the project.

    3. Jenkins API TokenIt is a permission Verification Code of Jenkins's account in getlab. This code can be entered after you log on to gitlab using the Jenkins accountAccount editingInterfaceAccountTab, which is calledPrivate token

    4. Crontab lineIt mainly configures how often Jenkins checksmerge requestThe default value is*/5 * * * *That is, once every 5 minutes, but it is recommended to change JenkinsH/5 * * * *It seems that the concurrency can be improved. I recommend*/5ChangedH/5It seems that no problem has been found so far.

    5. Enable build triggered messageWhen the plug-in is activatedmerge requestThe interface sends a message that Jenkins has started to work, but I feel that it is still useful for debugging. It is a bit cool to use normally.

    6. Default success message,Default unstable messageAndDefault failure messageThe three configurations are a success message template and two failed message templates. The dry words are not clear, so you can add an emoji in the template, for example:smiley:Or:broken_heart:

    7. Ignore SSL Certificate ErrorsIgnore as the name implieshttpsCertificate error. This option is useful for assuming gitlab private servers in the LAN!

  • Do not forget to clickSaveButton

Part 2: create a task
  • You can create a task at the beginning of the process. ClickNewCreate a new task and select the Task Type you need. Because I am a Maven project, I choseBuild a maven2/3 Project, Fill inProject nameClickOKGo to the task details page

  • The official document says that if you installGitHub pluginInGitHub ProjectEnter your project in the columnGitlabBut I didn't install this plug-in, so I skipped it.

  • FindSource code managementColumn and selectGit, Starting from here

    • Entered according to the generalRepository URLAndCredentialsClickAdvanced...Button inNameEnterorigin
    • To supportforkedBranch submittedmerge requestsYou need to add another source. ClickAdd RepositoryAnd thenRepository URLSet content${gitlabSourceRepository},CredentialsSame as the primary source,Advanced...InNameSet${gitlabSourceName}
    • FindBranch Specifier, Change the content${gitlabSourceName}/${gitlabSourceBranch}
    • FindAdditional BehavioursClick to writeAddDrop-down list of words, selectMerge before build
    • InMerge before buildBlock, SetName of repositoryIsorigin, SetBranch to merge toIs${gitlabTargetBranch}
    • There is a prompt in the official document to ensure thatPrune stale remote-tracking branchesNot added
  • FindBuild a triggerTopic

    • SetGitlab Merge Requests BuilderCheck
    • InGitlab Project PathEnter the project path in the format similaryour_group/your_projectYou can open your project's home page in git if you don't know how to configure the repository, and see the URL for reference.http://git.tld/your_group/your_projectDo not enter the whole URL.your_group/your_projectThis part.
    • The official document also mentionsTarget Branch RegexIt seems to be an option that can act as a branch whitelist. If this parameter is not specified, allmerge requestCan trigger this task. But I don't know why I didn't find this option here, So I skipped it.
  • Here followmerge requestThe configuration is complete, and other compilation options of the project are configured. For exampleGoals and optionsEntered inclean test -UIn this way, the build is only executed to complete the test, so as to check its quality before merging the code.

  • Do not forget to click after all configurations are complete.SaveButton.

Now, all configurations are complete. Next, you can try to createmerge requestLet's see if it's easy.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.