Commit 1703383a authored by Evan Read's avatar Evan Read

Merge branch 'document-precedence-coverage-regex' into 'master'

Document precedence of coverage regex

See merge request gitlab-org/gitlab!79516
parents 026c15b3 8c665d9b
...@@ -211,15 +211,25 @@ averaged. ...@@ -211,15 +211,25 @@ averaged.
To define a coverage-parsing regular expression: To define a coverage-parsing regular expression:
- In the GitLab UI: - Using the project's `.gitlab-ci.yml`, provide a regular expression using the [`coverage`](../yaml/index.md#coverage)
keyword. Setting the regular expression this way takes precedence over the project's CI/CD settings.
- Using the Project's CI/CD settings:
- Set using the GitLab UI:
1. On the top bar, select **Menu > Projects** and find your project. 1. On the top bar, select **Menu > Projects** and find your project.
1. On the left sidebar, select **Settings > CI/CD**. 1. On the left sidebar, select **Settings > CI/CD**.
1. Expand **General pipelines**. 1. Expand **General pipelines**.
1. In the **Test coverage parsing** field, enter a regular expression. Leave blank to disable this feature. 1. In the **Test coverage parsing** field, enter a regular expression. Leave blank to disable this feature.
- Using the project's `.gitlab-ci.yml`, provide a regular expression using the [`coverage`](../yaml/index.md#coverage) - Set when [editing a project](../../api/projects.md#edit-project) or [creating a project](../../api/projects.md#create-project)
keyword. using the GitLab API with the `build_coverage_regex` attribute:
```shell
curl --request PUT --header "PRIVATE-TOKEN: <your-token>" \
--url 'https://gitlab.com/api/v4/projects/<your-project-ID>' \
--data "build_coverage_regex=<your-regular-expression>"
```
You can use <https://rubular.com> to test your regular expression. The regular expression returns the **last** You can use <https://rubular.com> to test your regular expression. The regular expression returns the **last**
match found in the output. match found in the output.
......
...@@ -1348,6 +1348,8 @@ In this example: ...@@ -1348,6 +1348,8 @@ In this example:
**Additional details**: **Additional details**:
- Coverage regular expressions set in `gitlab-ci.yml` take precedence over coverage regular expression set in the
[GitLab UI](../pipelines/settings.md#add-test-coverage-results-to-a-merge-request).
- If there is more than one matched line in the job output, the last line is used - If there is more than one matched line in the job output, the last line is used
(the first result of reverse search). (the first result of reverse search).
- If there are multiple matches in a single line, the last match is searched - If there are multiple matches in a single line, the last match is searched
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment