Commit 16481dea authored by Andrew Fontaine's avatar Andrew Fontaine

Merge branch 'eread/refactor-test-coverage-results-pipelines-content' into 'master'

Improve deprecation notice of test coverage results in pipeline settings

See merge request gitlab-org/gitlab!82549
parents 7a848e04 dbc1a430
...@@ -94,7 +94,7 @@ ...@@ -94,7 +94,7 @@
.input-group-text / .input-group-text /
%p.form-text.text-muted %p.form-text.text-muted
= html_escape(_('The regular expression used to find test coverage output in the job log. For example, use %{regex} for Simplecov (Ruby). Leave blank to disable.')) % { regex: '<code>\(\d+.\d+%\)</code>'.html_safe } = html_escape(_('The regular expression used to find test coverage output in the job log. For example, use %{regex} for Simplecov (Ruby). Leave blank to disable.')) % { regex: '<code>\(\d+.\d+%\)</code>'.html_safe }
= link_to sprite_icon('question-o'), help_page_path('ci/pipelines/settings', anchor: 'add-test-coverage-results-to-a-merge-request-deprecated'), target: '_blank', rel: 'noopener noreferrer' = link_to sprite_icon('question-o'), help_page_path('ci/pipelines/settings', anchor: 'add-test-coverage-results-using-project-settings-deprecated'), target: '_blank', rel: 'noopener noreferrer'
= f.submit _('Save changes'), class: "btn gl-button btn-confirm", data: { qa_selector: 'save_general_pipelines_changes_button' } = f.submit _('Save changes'), class: "btn gl-button btn-confirm", data: { qa_selector: 'save_general_pipelines_changes_button' }
......
...@@ -195,13 +195,7 @@ Jobs that exceed the timeout are marked as failed. ...@@ -195,13 +195,7 @@ Jobs that exceed the timeout are marked as failed.
You can override this value [for individual runners](../runners/configure_runners.md#set-maximum-job-timeout-for-a-runner). You can override this value [for individual runners](../runners/configure_runners.md#set-maximum-job-timeout-for-a-runner).
## Add test coverage results to a merge request (DEPRECATED) ## Merge request test coverage results
> [Deprecated](https://gitlab.com/gitlab-org/gitlab/-/issues/17633) in GitLab 14.9. Replaced by [`coverage` keyword](../yaml/index.md#coverage).
WARNING:
This feature is in its end-of-life process. It is [deprecated](https://gitlab.com/gitlab-org/gitlab/-/issues/17633)
for use in GitLab 14.9, and is planned for [removal](https://gitlab.com/gitlab-org/gitlab/-/issues/17633) in GitLab 15.0.
If you use test coverage in your code, you can use a regular expression to If you use test coverage in your code, you can use a regular expression to
find coverage results in the job log. You can then include these results find coverage results in the job log. You can then include these results
...@@ -215,27 +209,38 @@ averaged. ...@@ -215,27 +209,38 @@ averaged.
![Build status coverage](img/pipelines_test_coverage_build.png) ![Build status coverage](img/pipelines_test_coverage_build.png)
To define a coverage-parsing regular expression: ### Add test coverage results using `coverage` keyword
To add test coverage results to a merge request using the project's `.gitlab-ci.yml` file, provide a regular expression
using the [`coverage`](../yaml/index.md#coverage) keyword.
Setting the regular expression this way takes precedence over project settings.
- Using the project's `.gitlab-ci.yml`, provide a regular expression using the [`coverage`](../yaml/index.md#coverage) ### Add test coverage results using project settings (DEPRECATED)
keyword. Setting the regular expression this way takes precedence over the project's CI/CD settings.
- Using the Project's CI/CD settings: > [Deprecated](https://gitlab.com/gitlab-org/gitlab/-/issues/17633) in GitLab 14.9. Replaced by [`coverage` keyword](../yaml/index.md#coverage).
- Set using the GitLab UI:
WARNING:
This feature is in its end-of-life process. It is [deprecated](https://gitlab.com/gitlab-org/gitlab/-/issues/17633)
for use in GitLab 14.9, and is planned for [removal](https://gitlab.com/gitlab-org/gitlab/-/issues/17633) in GitLab 15.0.
You can add test coverage results to merge requests using the Project's CI/CD settings:
1. On the top bar, select **Menu > Projects** and find your project. - Set using the GitLab UI:
1. On the left sidebar, select **Settings > CI/CD**.
1. Expand **General pipelines**.
1. In the **Test coverage parsing** field, enter a regular expression. Leave blank to disable this feature.
- Set when [editing a project](../../api/projects.md#edit-project) or [creating a project](../../api/projects.md#create-project) 1. On the top bar, select **Menu > Projects** and find your project.
using the GitLab API with the `build_coverage_regex` attribute: 1. On the left sidebar, select **Settings > CI/CD**.
1. Expand **General pipelines**.
1. In the **Test coverage parsing** field, enter a regular expression. Leave blank to disable this feature.
```shell - Set when [editing a project](../../api/projects.md#edit-project) or [creating a project](../../api/projects.md#create-project)
curl --request PUT --header "PRIVATE-TOKEN: <your-token>" \ using the GitLab API with the `build_coverage_regex` attribute:
--url 'https://gitlab.com/api/v4/projects/<your-project-ID>' \
--data "build_coverage_regex=<your-regular-expression>" ```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.
...@@ -372,9 +377,8 @@ https://gitlab.example.com/<namespace>/<project>/badges/<branch>/pipeline.svg?ig ...@@ -372,9 +377,8 @@ https://gitlab.example.com/<namespace>/<project>/badges/<branch>/pipeline.svg?ig
### Test coverage report badge ### Test coverage report badge
You can define the regular expression for the [coverage report](#add-test-coverage-results-to-a-merge-request-deprecated) You can define the regular expression for the [coverage report](#merge-request-test-coverage-results) that each job log
that each job log is matched against. This means that each job in the is matched against. This means that each job in the pipeline can have the test coverage percentage value defined.
pipeline can have the test coverage percentage value defined.
To access the test coverage badge, use the following link: To access the test coverage badge, use the following link:
......
...@@ -1349,7 +1349,7 @@ In this example: ...@@ -1349,7 +1349,7 @@ In this example:
**Additional details**: **Additional details**:
- Coverage regular expressions set in `gitlab-ci.yml` take precedence over coverage regular expression set in the - 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-deprecated). [GitLab UI](../pipelines/settings.md#add-test-coverage-results-using-project-settings-deprecated).
- 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
......
...@@ -52,7 +52,12 @@ from any job in any stage in the pipeline. The coverage displays for each line: ...@@ -52,7 +52,12 @@ from any job in any stage in the pipeline. The coverage displays for each line:
Hovering over the coverage bar provides further information, such as the number Hovering over the coverage bar provides further information, such as the number
of times the line was checked by tests. of times the line was checked by tests.
Uploading a test coverage report does not enable [test coverage results in Merge Requests](../../../ci/pipelines/settings.md#add-test-coverage-results-to-a-merge-request-deprecated) or [code coverage history](../../../ci/pipelines/settings.md#view-code-coverage-history). You must configure these separately. Uploading a test coverage report does not enable:
- [Test coverage results in merge requests](../../../ci/pipelines/settings.md#merge-request-test-coverage-results).
- [Code coverage history](../../../ci/pipelines/settings.md#view-code-coverage-history).
You must configure these separately.
### Limits ### Limits
......
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