Skip to content
This repository was archived by the owner on Nov 15, 2023. It is now read-only.

Commit 30fd889

Browse files
author
Mira Ressel
committed
timestamp gitlab ci job outputs
Based on previous work by @alvicsam in #13047.
1 parent 39510ec commit 30fd889

File tree

4 files changed

+27
-0
lines changed

4 files changed

+27
-0
lines changed

.gitlab-ci.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,9 +110,14 @@ variables:
110110
before_script:
111111
- if echo "$CI_DISABLED_JOBS" | grep -xF "$CI_JOB_NAME"; then echo "The job has been cancelled in CI settings"; exit 0; fi
112112

113+
.timestamp:
114+
before_script:
115+
- if [[ -z "${TIMESTAMP_DISABLED}" ]]; then source scripts/ci/gitlab/timestamp.sh; fi
116+
113117
.kubernetes-env:
114118
image: "${CI_IMAGE}"
115119
before_script:
120+
- !reference [.timestamp, before_script]
116121
- !reference [.job-switcher, before_script]
117122
- !reference [.prepare-env, before_script]
118123
tags:
@@ -141,6 +146,7 @@ variables:
141146
.docker-env:
142147
image: "${CI_IMAGE}"
143148
before_script:
149+
- !reference [.timestamp, before_script]
144150
- !reference [.job-switcher, before_script]
145151
- !reference [.prepare-env, before_script]
146152
- !reference [.rust-info-script, script]

scripts/ci/gitlab/pipeline/publish.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
GIT_STRATEGY: none
1111
DOCKERFILE: $PRODUCT.Dockerfile
1212
IMAGE_NAME: docker.io/$IMAGE_PATH
13+
TIMESTAMP_DISABLED: 1
1314
before_script:
1415
- !reference [.kubernetes-env, before_script]
1516
- cd ./artifacts/$PRODUCT/

scripts/ci/gitlab/pipeline/test.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -327,6 +327,7 @@ test-linux-stable-int:
327327
WASM_BUILD_RUSTFLAGS: "-Cdebug-assertions=y -Dwarnings"
328328
# Ensure we run the UI tests.
329329
RUN_UI_TESTS: 1
330+
#TIMESTAMP_DISABLED: 1
330331
script:
331332
- rusty-cachier snapshot create
332333
- WASM_BUILD_NO_COLOR=1

scripts/ci/gitlab/timestamp.sh

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# https://gist.github.com/altaua/477285db40181ef1793bbed5bae32c6b
2+
# based on https://gist.github.com/jstine35/e0fc0e06ec06d74bc3ebd67585bf2a1d
3+
# edited to use just a single process substitution
4+
# and print the last line of output even if it isn't \n-terminated
5+
6+
s_datestamp() {
7+
8+
eof=""
9+
while [[ -z "${eof}" ]]; do
10+
11+
IFS="" read -r line || eof=1
12+
timestamp=$(date -u '+%Y-%m-%d %H:%M:%S')
13+
14+
printf '[%s] %s\n' "${timestamp}" "${line}"
15+
16+
done
17+
}
18+
19+
exec > >(s_datestamp) 2>&1

0 commit comments

Comments
 (0)