Skip to content
This repository was archived by the owner on Nov 15, 2023. It is now read-only.
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ default:
.kubernetes-env:
image: "${CI_IMAGE}"
before_script:
- source scripts/ci/gitlab/timestamp.sh
- !reference [.job-switcher, before_script]
- !reference [.prepare-env, before_script]
tags:
Expand Down Expand Up @@ -125,6 +126,7 @@ default:
.docker-env:
image: "${CI_IMAGE}"
before_script:
- source scripts/ci/gitlab/timestamp.sh
- !reference [.job-switcher, before_script]
- !reference [.prepare-env, before_script]
- !reference [.rust-info-script, script]
Expand Down
20 changes: 20 additions & 0 deletions scripts/ci/gitlab/timestamp.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Original script from: https://gist.github.com/jstine35/e0fc0e06ec06d74bc3ebd67585bf2a1d
# By @jstine35 on GitHub


s_datestamp() {
while read -r line; do
timestamp=$(date -u '+%Y-%m-%d %H:%M:%S')

# by nature BASH might run process subst twice when using >&2 pipes. This is a lazy
# way to avoid dumping two timestamps on the same line:
if [[ "$line" != \[${timestamp%% *}* ]]; then
echo "[$timestamp] $line"
else
echo "$line"
fi
done
}

exec 1> >(s_datestamp)
exec 2> >(s_datestamp)