diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-02-18 12:09:24 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-02-18 12:09:24 +0300 |
commit | 4720b569f0fcbb47e9f1a60e95172ae63b6f065a (patch) | |
tree | 5c6bcecbca227e608753a57a9aad19ccfe0567b6 /doc/ci/pipelines.md | |
parent | cefe554b7ce2d0b52f9de855be832a47c2bc24ab (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'doc/ci/pipelines.md')
-rw-r--r-- | doc/ci/pipelines.md | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/doc/ci/pipelines.md b/doc/ci/pipelines.md index 2bf5592885b..896097ccd3a 100644 --- a/doc/ci/pipelines.md +++ b/doc/ci/pipelines.md @@ -166,6 +166,43 @@ In the following example: ![Collapsible sections](img/collapsible_log_v12_6.png) +#### Custom collapsible sections + +You can create collapsible sections in job logs by manually outputting special codes +that GitLab will use to determine what sections to collapse: + +- Section start marker: `section_start:UNIX_TIMESTAMP:SECTION_NAME\r\e[0K` + `TEXT_OF_SECTION_HEADER` +- Section end marker: `section_end:UNIX_TIMESTAMP:SECTION_NAME\r\e[0K` + +You must add these codes to the script section of the CI configuration. For example, +using `echo`: + +```yaml +job1: + script: + - echo -e "section_start:`date +%s`:my_first_section\r\e[0KHeader of the 1st collapsible section" + - echo 'this line should be hidden when collapsed' + - echo -e "section_end:`date +%s`:my_first_section\r\e[0K" +``` + +In the example above: + +- `date +%s`: The Unix timestamp (for example `1560896352`). +- `my_first_section`: The name given to the section. +- `\r\e[0K`: Prevents the section markers from displaying in the rendered (colored) + job log, but they are displayed in the raw job log. To see them, in the top right + of the job log, click **{doc-text}** (**Show complete raw**). + - `\r`: carriage return. + - `\e[0K`: clear line ANSI escape code. + +Sample raw job log: + +```plaintext +section_start:1560896352:my_first_section\r\e[0KHeader of the 1st collapsible section +this line should be hidden when collapsed +section_end:1560896353:my_first_section\r\e[0K +``` + ## Configuring pipelines Pipelines, and their component jobs and stages, are defined in the [`.gitlab-ci.yml`](yaml/README.md) file for each project. |