From 2f606ea3e4d551128a918fc8cfb6d7a8546a95a6 Mon Sep 17 00:00:00 2001 From: Mira Ressel Date: Wed, 15 Mar 2023 12:13:31 +0100 Subject: [PATCH] inline timestamp script Some of our jobs don't check out the substrate repo. --- .gitlab-ci.yml | 5 +---- scripts/ci/gitlab/timestamp.sh | 21 --------------------- scripts/ci/gitlab/timestamp.yml | 27 +++++++++++++++++++++++++++ 3 files changed, 28 insertions(+), 25 deletions(-) delete mode 100755 scripts/ci/gitlab/timestamp.sh create mode 100644 scripts/ci/gitlab/timestamp.yml diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 5a9003739dfd1..49c291b587a1c 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -110,10 +110,6 @@ variables: before_script: - if echo "$CI_DISABLED_JOBS" | grep -xF "$CI_JOB_NAME"; then echo "The job has been cancelled in CI settings"; exit 0; fi -.timestamp: - before_script: - - source scripts/ci/gitlab/timestamp.sh - .kubernetes-env: image: "${CI_IMAGE}" before_script: @@ -316,6 +312,7 @@ include: - local: scripts/ci/gitlab/default-pipeline.yml rules: - if: $PIPELINE != "automatic-crate-publishing" + - scripts/ci/gitlab/timestamp.yml #### stage: notify diff --git a/scripts/ci/gitlab/timestamp.sh b/scripts/ci/gitlab/timestamp.sh deleted file mode 100755 index cd6caf947dad1..0000000000000 --- a/scripts/ci/gitlab/timestamp.sh +++ /dev/null @@ -1,21 +0,0 @@ -# https://gist.github.com/altaua/477285db40181ef1793bbed5bae32c6b -# based on https://gist.github.com/jstine35/e0fc0e06ec06d74bc3ebd67585bf2a1d - -s_datestamp() { - TZ=UTC - eof="" - while [[ -z "${eof}" ]]; do - IFS="" read -r line || eof=1 - printf '[%(%F %T)T] %s\n' -1 "${line}" - done -} - -cleanup() { - exec >/dev/null 2>&1 - wait "${TIMESTAMP_PID}" -} - -exec > >(s_datestamp) 2>&1 - -TIMESTAMP_PID=$! -trap cleanup EXIT diff --git a/scripts/ci/gitlab/timestamp.yml b/scripts/ci/gitlab/timestamp.yml new file mode 100644 index 0000000000000..f21d26d660854 --- /dev/null +++ b/scripts/ci/gitlab/timestamp.yml @@ -0,0 +1,27 @@ +.timestamp: + before_script: + - | + echo "Install timestamp handler" + eval ' + # https://gist.github.com/altaua/477285db40181ef1793bbed5bae32c6b + # based on https://gist.github.com/jstine35/e0fc0e06ec06d74bc3ebd67585bf2a1d + + s_datestamp() { + TZ=UTC + eof="" + while [[ -z "${eof}" ]]; do + IFS="" read -r line || eof=1 + printf "[%(%F %T)T] %s\n" -1 "${line}" + done + } + + cleanup() { + exec >/dev/null 2>&1 + wait "${TIMESTAMP_PID}" + } + + exec > >(s_datestamp) 2>&1 + + TIMESTAMP_PID=$! + trap cleanup EXIT + '