diff options
| author | Can Eldem <celdem@gitlab.com> | 2020-07-08 09:37:18 +0000 |
|---|---|---|
| committer | Can Eldem <celdem@gitlab.com> | 2020-07-08 09:37:18 +0000 |
| commit | 0f77bca39010defa06867a0d4d96d943c71bb9db (patch) | |
| tree | f38d5854ffd86b891158c25657aeab9dc7250932 | |
| parent | d33e5dc65900b86252b23f439131a4cbb1707d67 (diff) | |
| parent | 9f7ae443783447a208a0315a4f83e26e8291216d (diff) | |
Merge branch 'collapse-install-sections' into 'master'
Add collapsible sections to get timing info for each section
See merge request gitlab-org/security-products/license-management!183
| -rw-r--r-- | config/install.sh | 16 | ||||
| -rw-r--r-- | lib/license/management/shell.rb | 4 |
2 files changed, 12 insertions, 8 deletions
diff --git a/config/install.sh b/config/install.sh index ed107c9..2868c94 100644 --- a/config/install.sh +++ b/config/install.sh @@ -3,7 +3,7 @@ set -euo pipefail export DEBIAN_FRONTEND=noninteractive -echo ["$(date "+%H:%M:%S")"] "==> Installing packages…" +echo -e "section_start:$(date +%s):install_packages\r\e[0K==> Installing packages…" apt-get clean apt-get update -q apt-get install -y --no-install-recommends \ @@ -73,18 +73,20 @@ apt-get install -y --no-install-recommends \ zlib1g \ zlib1g-dev \ zstd +echo -e "section_end:$(date +%s):install_packages\r\e[0K" +echo -e "section_start:$(date +%s):install_dotnet\r\e[0K==> Installing dotnet/mono…" wget -qO- https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor > /etc/apt/trusted.gpg.d/microsoft.asc.gpg wget -q -O /etc/apt/sources.list.d/microsoft-prod.list https://packages.microsoft.com/config/debian/10/prod.list apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF echo "deb https://download.mono-project.com/repo/debian stable-buster main" | tee /etc/apt/sources.list.d/mono-official-stable.list -echo ["$(date "+%H:%M:%S")"] "==> Installing dotnet/mono…" apt-get update -q apt-get install -y --no-install-recommends dotnet-sdk-3.1 mono-complete & curl -o /usr/local/bin/nuget.exe https://dist.nuget.org/win-x86-commandline/latest/nuget.exe & +echo -e "section_end:$(date +%s):install_dotnet\r\e[0K" -echo ["$(date "+%H:%M:%S")"] "==> Installing asdf…" +echo -e "section_start:$(date +%s):install_asdf\r\e[0K==> Installing asdf…" mkdir -p "$ASDF_DATA_DIR" git clone https://github.com/asdf-vm/asdf.git "$ASDF_DATA_DIR" cd "$ASDF_DATA_DIR" @@ -107,8 +109,9 @@ for version in $(asdf list python); do pip download -d "$HOME/.config/virtualenv/app-data" pip-licenses pip setuptools wheel done wait +echo -e "section_end:$(date +%s):install_asdf\r\e[0K" -echo ["$(date "+%H:%M:%S")"] "==> Beginning cleanup…" +echo -e "section_start:$(date +%s):cleanup\r\e[0K==> Beginning cleanup…" rm -fr /tmp mkdir -p /tmp chmod 777 /tmp @@ -165,8 +168,9 @@ rm -fr "$ASDF_DATA_DIR/docs" \ /var/lib/apt/lists/* \ /var/lib/systemd/* \ /var/log/* +echo -e "section_end:$(date +%s):cleanup\r\e[0K" -echo ["$(date "+%H:%M:%S")"] "==> Starting compression…" +echo -e "section_start:$(date +%s):compress_files\r\e[0K==> Starting compression…" zstd_command="/usr/bin/zstd -19 -T0" cd /opt tar --use-compress-program "$zstd_command" -cf /opt/asdf.tar.zst asdf & @@ -190,4 +194,4 @@ rm -fr \ /usr/lib/mono \ /usr/lib/rustlib \ /usr/share/dotnet -echo ["$(date "+%H:%M:%S")"] "==> Done" +echo -e "section_end:$(date +%s):compress_files\r\e[0K" diff --git a/lib/license/management/shell.rb b/lib/license/management/shell.rb index b24d24e..2bdd95a 100644 --- a/lib/license/management/shell.rb +++ b/lib/license/management/shell.rb @@ -89,10 +89,10 @@ module License def collapsible_section(header) id = header.downcase.gsub(/[[:space:]]/, '_').gsub(/[^0-9a-z ]/i, '_') - logger.debug("section_start:#{Time.now.to_i}:#{id}\r\e[0K#{header}") + logger.debug("\nsection_start:#{Time.now.to_i}:#{id}\r\e[0K#{header}") yield ensure - logger.debug("section_end:#{Time.now.to_i}:#{id}\r\e[0K") + logger.debug("\nsection_end:#{Time.now.to_i}:#{id}\r\e[0K") end end end |
