From 0eee57638ea562784e12dc922ba957ecec8cd913 Mon Sep 17 00:00:00 2001 From: alvicsam Date: Tue, 3 Jan 2023 09:51:58 +0100 Subject: [PATCH 1/4] [DO NOT MERGE] add timestamp to ci --- .gitlab-ci.yml | 2 ++ scripts/ci/gitlab/timestamp.sh | 20 ++++++++++++++++++++ 2 files changed, 22 insertions(+) create mode 100755 scripts/ci/gitlab/timestamp.sh diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index a0b1464bae23e..785fcc8c1cf30 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -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: @@ -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] diff --git a/scripts/ci/gitlab/timestamp.sh b/scripts/ci/gitlab/timestamp.sh new file mode 100755 index 0000000000000..6f2edc21b374f --- /dev/null +++ b/scripts/ci/gitlab/timestamp.sh @@ -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) From 6e98593a838e55d69357726f654c5bf58b330090 Mon Sep 17 00:00:00 2001 From: alvicsam Date: Tue, 3 Jan 2023 10:30:57 +0100 Subject: [PATCH 2/4] add condition for timestamp --- .gitlab-ci.yml | 8 ++++++-- scripts/ci/gitlab/pipeline/test.yml | 1 + 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 785fcc8c1cf30..9ed4ea643a3c0 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -94,10 +94,14 @@ default: 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: + - if ! [ -z ${TIMESTAMP_DISABLED} ]; then source scripts/ci/gitlab/timestamp.sh; fi + .kubernetes-env: image: "${CI_IMAGE}" before_script: - - source scripts/ci/gitlab/timestamp.sh + - !reference [.timestamp, before_script] - !reference [.job-switcher, before_script] - !reference [.prepare-env, before_script] tags: @@ -126,7 +130,7 @@ default: .docker-env: image: "${CI_IMAGE}" before_script: - - source scripts/ci/gitlab/timestamp.sh + - !reference [.timestamp, before_script] - !reference [.job-switcher, before_script] - !reference [.prepare-env, before_script] - !reference [.rust-info-script, script] diff --git a/scripts/ci/gitlab/pipeline/test.yml b/scripts/ci/gitlab/pipeline/test.yml index a468a7b04caeb..0ab61837dca6f 100644 --- a/scripts/ci/gitlab/pipeline/test.yml +++ b/scripts/ci/gitlab/pipeline/test.yml @@ -308,6 +308,7 @@ test-linux-stable-int: WASM_BUILD_RUSTFLAGS: "-Cdebug-assertions=y -Dwarnings" # Ensure we run the UI tests. RUN_UI_TESTS: 1 + TIMESTAMP_DISABLED: "true" script: - rusty-cachier snapshot create - WASM_BUILD_NO_COLOR=1 From 726ab7b4c362bee8d52cee183b8f0800f2fa3d2c Mon Sep 17 00:00:00 2001 From: alvicsam Date: Tue, 3 Jan 2023 12:26:54 +0100 Subject: [PATCH 3/4] fix condition --- .gitlab-ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 9ed4ea643a3c0..a1fe474b639d0 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -96,7 +96,7 @@ default: .timestamp: before_script: - - if ! [ -z ${TIMESTAMP_DISABLED} ]; then source scripts/ci/gitlab/timestamp.sh; fi + - if [ -z ${TIMESTAMP_DISABLED} ]; then source scripts/ci/gitlab/timestamp.sh; fi .kubernetes-env: image: "${CI_IMAGE}" From 2ebf322a7007077d9d9a2f1d0e1642a0a94f3a4e Mon Sep 17 00:00:00 2001 From: alvicsam Date: Thu, 12 Jan 2023 17:30:14 +0100 Subject: [PATCH 4/4] disable timestamp --- scripts/ci/gitlab/pipeline/publish.yml | 1 + scripts/ci/gitlab/pipeline/test.yml | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/scripts/ci/gitlab/pipeline/publish.yml b/scripts/ci/gitlab/pipeline/publish.yml index d1a7514d1707b..33eff5c2f95f6 100644 --- a/scripts/ci/gitlab/pipeline/publish.yml +++ b/scripts/ci/gitlab/pipeline/publish.yml @@ -11,6 +11,7 @@ GIT_STRATEGY: none DOCKERFILE: $PRODUCT.Dockerfile IMAGE_NAME: docker.io/$IMAGE_PATH + TIMESTAMP_DISABLED: "true" before_script: - !reference [.kubernetes-env, before_script] - cd ./artifacts/$PRODUCT/ diff --git a/scripts/ci/gitlab/pipeline/test.yml b/scripts/ci/gitlab/pipeline/test.yml index 0ab61837dca6f..d58cbe0b8a5de 100644 --- a/scripts/ci/gitlab/pipeline/test.yml +++ b/scripts/ci/gitlab/pipeline/test.yml @@ -308,7 +308,7 @@ test-linux-stable-int: WASM_BUILD_RUSTFLAGS: "-Cdebug-assertions=y -Dwarnings" # Ensure we run the UI tests. RUN_UI_TESTS: 1 - TIMESTAMP_DISABLED: "true" + # TIMESTAMP_DISABLED: "true" script: - rusty-cachier snapshot create - WASM_BUILD_NO_COLOR=1