Testing Gitlab Templates Merge Requests¶
Specifying a Merge Request via form variables¶
If a project wants to test using a branch/MR of this repository, go to your project's CI/CD settings page and add the variables below. All pipelines in the project will use the specified repository+branch until the variables are removed.
- KEY =
_GITLAB_TEMPLATES_REPOVALUE =issue/gitlab_templates-nnnnnnn - KEY =
_GITLAB_TEMPLATES_REFVALUE =branch name, often the format isnnnnnnn-some-text
The variables should have the following attributes:
- Type = Variable (default)
- Environment Scope = All (default)
- Protected = No
- Masked = No
- Expanded = Yes
This method of testing will only work if you have the unchanged default settings for project and ref in your .gitlab-ci.yml, as shown here:
Specifying a Merge Request in the .gitlab-ci.yml file¶
You can also test a Merge Request by changing these two lines in your .gitlab-ci.yml file:
project is set to the fork name (issue/gitlab_templates-12345) and ref is set to the branch name (12345-branch-name).
If the MR is testing assets provided by the fork (like modifications to .cspell.json, phpcs.xml.dist or symlink_project.php), you wil also need to set two additional variables _CURL_TEMPLATES_REPO and _CURL_TEMPLATES_REF to match the project and ref values:
variables:
_CURL_TEMPLATES_REPO: issue/gitlab_templates-12345
_CURL_TEMPLATES_REF: 12345-branch-name
If you have made these temporary changes and then you also want to start a manual pipeline via the UI, you will need to delete the two input variables _GITLAB_TEMPLATES_REPO and _GITLAB_TEMPLATES_REF from the form. This is because the form values take precedence over variables coded in the .gitlab-ci.yml file.