Skip to content

Commit

Permalink
ci: Fix extract last 2K chars of logs
Browse files Browse the repository at this point in the history
Signed-off-by: Oliver Koenig <okoenig@nvidia.com>

ci(notifications): Fix extract of last 2K chars

Signed-off-by: Oliver Koenig <okoenig@nvidia.com>
  • Loading branch information
ko3n1g committed Jun 12, 2024
1 parent 3c29fef commit 363c8c1
Showing 1 changed file with 2 additions and 20 deletions.
22 changes: 2 additions & 20 deletions .github/workflows/_test_template.yml
Original file line number Diff line number Diff line change
Expand Up @@ -63,26 +63,8 @@ jobs:
) 2> >(tee err.log)
EXIT_CODE=$?
# Slack only allows 3000 chars per block.
# Since a block contains information about other
# metdata than the log, we prune the log to 2000
# chars.
min() {
if (( $1 > $2 )); then
echo $2
else
echo $1
fi
}
log=$(cat err.log)
MAX_LENGTH=$(echo $log | wc -m)
MAX_LENGTH=$(min $MAX_LENGTH 2000)
MAX_LENGTH=$(( $MAX_LENGTH - 1 ))
log=$(echo "${log: -${MAX_LENGTH}}" | base64 -w 0)
echo "log=$log" | tee -a "$GITHUB_OUTPUT"
echo "log=$(tail -c 2000 err.log | base64 -w 0)" >> "$GITHUB_OUTPUT"
exit $EXIT_CODE
Expand Down

0 comments on commit 363c8c1

Please sign in to comment.