From 770efe2eb8abec05afaccc33854bc7081424184b Mon Sep 17 00:00:00 2001 From: Pablo Bendersky Date: Thu, 30 Jun 2016 15:06:54 -0300 Subject: [PATCH] Updated readme with instructions to fetch MRs from origin. --- README.md | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/README.md b/README.md index e849c15d0..0f8b2cd7a 100644 --- a/README.md +++ b/README.md @@ -71,6 +71,7 @@ To enable this functionality, a user should be set up on GitLab, with GitLab 'De ## Jenkins Job Configuration ### Git configuration for Freestyle jobs +#### GitLab < 8.1 1. In the *Source Code Management* section: 1. Click *Git* 2. Enter your *Repository URL* (e.g.: ``git@your.gitlab.server:group/repo_name.git``) @@ -88,6 +89,22 @@ To enable this functionality, a user should be set up on GitLab, with GitLab 'De * Set *Name of the repository" to ``origin`` * Set *Branch to merge* as ``${gitlabTargetBranch}`` +#### GitLab >= 8.1 +1. In the *Source Code Management* section: + 1. Click *Git* + 2. Enter your *Repository URL* (e.g.: ``git@your.gitlab.server:group/repo_name.git``) + * In the Advanced settings, set its *Name* to ``origin`` and its *refspec* to ``+refs/heads/*:refs/remotes/origin/* +refs/merge-requests/*/head:refs/remotes/origin/merge-requests/*`` + 3. To be able to merge from forked repositories:
**Note:** this requires [configuring communication to the GitLab server](#configuring-access-to-gitlab) + * Add a second repository with: + * *URL*: Your *Repository URL* as in the previous step (e.g.: ``git@your.gitlab.server:group/repo_name.git``) + 4. In *Branch Specifier* enter: + * ``merge-requests/${gitlabMergeRequestIid}`` + 5. In *Additional Behaviours*: + * Click the *Add* drop-down button. + * Select *Merge before build* from the drop-down. + * Set *Name of the repository" to ``origin`` + * Set *Branch to merge* as ``${gitlabTargetBranch}`` + **Note:** Since version **1.2.0** the *gitlab-plugin* sets the gitlab hook values through *environment variables* instead of *build parameters*. To set default values, consult [EnvInject Plugin](https://wiki.jenkins-ci.org/display/JENKINS/EnvInject+Plugin). ### Git configuration for Pipeline/Workflow jobs