From 24b834c01d212ee8a9a75842a9a79d7508e9d1b6 Mon Sep 17 00:00:00 2001 From: "W. Trevor King" Date: Tue, 29 Jun 2021 10:48:58 -0700 Subject: [PATCH] ci-operator/step-registry/gather/aws-console: UTF-8 for output MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit In recent CI, we have failed console gathers like [1]: Gathering console logs for i-026ba0637214cd027 'ascii' codec can't encode character '\u2026' in position 14093: ordinal not in range(128) Failed to gather console logs This is descended from d060927050 (gather/aws-console: Make log gathering non-fatal, 2021-04-14, #17735). But we want to gather these logs, not silently fail to gather the logs. This commit restores our old "fail the step when we fail to gather" behavior, and sets PYTHONIOENCODING [2] to ask for UTF-8 instead of ASCII output. [1]: https://gcsweb-ci.apps.ci.l2s4.p1.openshiftapps.com/gcs/origin-ci-test/logs/periodic-ci-openshift-[…]e2e-aws-serial/gather-aws-console/build-log.txt [2]: https://docs.python.org/3/using/cmdline.html#envvar-PYTHONIOENCODING --- .../gather/aws-console/gather-aws-console-commands.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ci-operator/step-registry/gather/aws-console/gather-aws-console-commands.sh b/ci-operator/step-registry/gather/aws-console/gather-aws-console-commands.sh index d8a62eab6024..d97deeeb59cc 100755 --- a/ci-operator/step-registry/gather/aws-console/gather-aws-console-commands.sh +++ b/ci-operator/step-registry/gather/aws-console/gather-aws-console-commands.sh @@ -35,5 +35,6 @@ REGION="$(jq -r .aws.region "${SHARED_DIR}/metadata.json")" cat "${TMPDIR}/node-provider-IDs.txt" | sort | uniq | while read -r INSTANCE_ID do echo "Gathering console logs for ${INSTANCE_ID}" - aws --region "${REGION}" ec2 get-console-output --instance-id "${INSTANCE_ID}" --output text > "${ARTIFACT_DIR}/${INSTANCE_ID}" || echo "Failed to gather console logs" + PYTHONIOENCODING=UTF-8:backslashreplace aws --region "${REGION}" ec2 get-console-output --instance-id "${INSTANCE_ID}" --output text > "${ARTIFACT_DIR}/${INSTANCE_ID}" & + wait "$!" done