2
0

gitlab-ci-section 1.1 KB

1234567891011121314151617181920212223242526272829
  1. # Copyright (c) 2024 Linaro Ltd
  2. # SPDX-License-Identifier: GPL-2.0-or-later
  3. # gitlab-ci-section: This is a shell script fragment which defines
  4. # functions section_start and section_end which will emit marker lines
  5. # that GitLab will interpret as the beginning or end of a "collapsible
  6. # section" in a CI job log. See
  7. # https://docs.gitlab.com/ee/ci/yaml/script.html#expand-and-collapse-job-log-sections
  8. #
  9. # This is intended to be sourced in the before_script section of
  10. # a CI config; the section_start and section_end functions will
  11. # then be available for use in the before_script and script sections.
  12. # Section names are [-_.A-Za-z0-9] and the section_start pairs with
  13. # a section_end with the same section name.
  14. # The description can be any printable text without newlines; this is
  15. # what will appear in the log.
  16. # Usage:
  17. # section_start section_name "Description of the section"
  18. section_start () {
  19. printf "section_start:%s:%s\r\e[0K%s\n" "$(date +%s)" "$1" "$2"
  20. }
  21. # Usage:
  22. # section_end section_name
  23. section_end () {
  24. printf "section_end:%s:%s\r\e[0K\n" "$(date +%s)" "$1"
  25. }