From 58eea1e51a84efe8531b3f2d72cfad9e74514cb7 Mon Sep 17 00:00:00 2001 From: Marc Greisen Date: Wed, 6 Oct 2021 08:00:55 -0700 Subject: [PATCH] Add a username to the resource group name created by check-pr utility. (#1314) * Add a username to the resource group name created by check-pr utility. * Use check_output --- src/utils/check-pr/check-pr.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/utils/check-pr/check-pr.py b/src/utils/check-pr/check-pr.py index 95110f04e..e583ee9b7 100755 --- a/src/utils/check-pr/check-pr.py +++ b/src/utils/check-pr/check-pr.py @@ -277,7 +277,16 @@ class Deployer: def main() -> None: - default_instance = "pr-check-%s" % uuid.uuid4().hex + # Get a name that can be added to the resource group name + # to make it easy to identify the owner + cmd = ["az", "ad", "signed-in-user", "show", "--query", "mailNickname", "-o", "tsv"] + name = subprocess.check_output(cmd, encoding="UTF-8") + + # The result from az includes a newline + # which we strip out. + name = name.strip() + + default_instance = f"pr-check-{name}-%s" % uuid.uuid4().hex parser = argparse.ArgumentParser() parser.add_argument("--instance", default=default_instance) group = parser.add_mutually_exclusive_group()