Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[it tests] Upload logs as buildkite artifact even on failure #1838

Merged
merged 2 commits into from
May 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
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
11 changes: 8 additions & 3 deletions .buildkite/it/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@ set -eo pipefail

source .buildkite/retry.sh

function upload_logs {
echo "--- Upload artifacts"
buildkite-agent artifact upload "${RALLY_HOME}/.rally/logs/*.log"
}

Comment on lines +7 to +11
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this go somewhere common, like .buildkite/retry.sh? It relies on $RALLY_HOME being set, so it could be fragile, is why I didn't just go ahead and do it.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd say it is ok where it is. If we wanted in a seperate file, having it in something like utils.sh or upload.sh might be better, but seems a little overkill in this case. It's only a few lines

export TERM=dumb
export LC_ALL=en_US.UTF-8
export TZ=Etc/UTC
Expand Down Expand Up @@ -44,8 +49,8 @@ export LC_ALL=en_US.UTF-8
source .venv/bin/activate

pip install nox
nox -s "it-${PYTHON_VERSION}"

echo "--- Upload artifacts"
trap upload_logs ERR
nox -s "it-${PYTHON_VERSION}"

buildkite-agent artifact upload "${RALLY_HOME}/.rally/logs/*.log"
upload_logs
9 changes: 9 additions & 0 deletions .buildkite/it/run_serverless.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@ set -eo pipefail

source .buildkite/retry.sh

function upload_logs {
echo "--- Upload artifacts"
buildkite-agent artifact upload "${RALLY_HOME}/.rally/logs/*.log"
}

export TERM=dumb
export LC_ALL=en_US.UTF-8
export TZ=Etc/UTC
Expand Down Expand Up @@ -38,6 +43,8 @@ export THESPLOG_FILE_MAXSIZE=${THESPLOG_FILE_MAXSIZE:-204800}
# adjust the default log level from WARNING
export THESPLOG_THRESHOLD="INFO"

trap upload_logs ERR

case $TEST_NAME in
"user")
nox -s it_serverless
Expand All @@ -50,3 +57,5 @@ case $TEST_NAME in
exit 1
;;
esac

upload_logs
Loading