put ci log span magic strings in a dedicated script

This commit is contained in:
trinity-1686a 2022-12-05 18:41:23 +01:00
parent 6846b7d247
commit 18a12d3feb
2 changed files with 15 additions and 2 deletions

View File

@ -215,7 +215,7 @@ integration-shadow:
image: debian:11-slim
script:
- ./maint/preserve -u
- echo -e "\e[0Ksection_start:`date +%s`:shadow_install_deps[collapsed=true]\r\e[0KInstalling shadow and tgen"
- ./maint/ci_log_span start "shadow_install_deps[collapsed=true]" "Installing shadow and tgen"
# We're going to install binaries to $HOME/.local/bin
- 'export PATH=$HOME/.local/bin:$PATH'
@ -270,7 +270,7 @@ integration-shadow:
- hash -r
- DEBIAN_FRONTEND=noninteractive apt-get install -y tshark
- echo -e "\e[0Ksection_end:`date +%s`:shadow_install_deps\r\e[0K"
- ./maint/ci_log_span end "shadow_install_deps"
# Run tests
- pushd tests/shadow

13
maint/ci_log_span Executable file
View File

@ -0,0 +1,13 @@
#!/bin/bash
# usage: $0 <start|end> <section_identifier+config> "<human section name>"
# eg: $0 start 'my_section[collapsed=true]' "My collapsed section"
#
# See also: https://docs.gitlab.com/ee/ci/jobs/#custom-collapsible-sections
set -euo pipefail
if [ "$1" = start ]; then
echo -e "\e[0Ksection_start:$(date +%s):$2\r\e[0K$3"
else
echo -e "\e[0Ksection_end:$(date +%s):$2\r\e[0K"
fi