From edc7b1574a0faf4e047e461305694502adce8b55 Mon Sep 17 00:00:00 2001 From: Patrick Roy Date: Wed, 27 Sep 2023 14:22:59 +0100 Subject: [PATCH] test: Emit buildkite slug and build number as CW properties To make it easier to cross-reference buildkite logs to their emitted cloudwatch logs/metrics, emit buildkite slug and build number. This combination should uniquely identify logs/metrics from a build, without us having to print instance ids to stdout (which also do not uniquely identify, as the same instance could run multiple builds). Signed-off-by: Patrick Roy --- tests/framework/properties.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tests/framework/properties.py b/tests/framework/properties.py index 0b55abe68bd6..f3572c7b1bbd 100644 --- a/tests/framework/properties.py +++ b/tests/framework/properties.py @@ -7,7 +7,7 @@ """ Metadata we want to attach to tests for further analysis and troubleshooting """ - +import os import platform import re import subprocess @@ -57,6 +57,8 @@ def __init__(self): self.git_branch = run_cmd("git show -s --pretty=%D HEAD") self.git_origin_url = run_cmd("git config --get remote.origin.url") self.rust_version = run_cmd("rustc --version |awk '{print $2}'") + self.buildkite_pipeline_slug = os.environ.get("BUILDKITE_PIPELINE_SLUG") + self.buildkite_build_number = os.environ.get("BUILDKITE_BUILD_NUMBER") self.environment = self._detect_environment() if self.is_ec2: