|
19 | 19 | PLAN_NAME_RE = re.compile(r"\[(\w+) (\d+)\]")
|
20 | 20 | CONFIG_GROUP_ID = 95
|
21 | 21 | TESTRAIL_FX_DESK_PRJ = 17
|
| 22 | +TC_EXECUTION_TEMPLATE = "https://firefox-ci-tc.services.mozilla.com/tasks/%TASK_ID%/runs/%RUN_ID%/logs/public/logs/live.log" |
| 23 | + |
| 24 | + |
| 25 | +def get_execution_link() -> str: |
| 26 | + """Using environment variables, get the link to the test execution""" |
| 27 | + link = "" |
| 28 | + if "TASKCLUSTER_PROXY_URL" in os.environ: |
| 29 | + link = TC_EXECUTION_TEMPLATE |
| 30 | + for item in ["RUN_ID", "TASK_ID"]: |
| 31 | + link = link.replace(f"%{item}%", os.environ.get(item)) |
| 32 | + return link |
| 33 | + |
| 34 | + |
| 35 | +def replace_link_in_description(description, os_name) -> str: |
| 36 | + """Add or replace a test execution link in the test run description""" |
| 37 | + logging.warning(f"Modifying plan description for %{os_name}%") |
| 38 | + if os_name not in description: |
| 39 | + # TODO: remove following conditional when links for GHA resolved |
| 40 | + if os_name == "Linux": |
| 41 | + return f"{description}\n[{os_name} execution link]({get_execution_link()})" |
| 42 | + else: |
| 43 | + link = get_execution_link() |
| 44 | + if link in description: |
| 45 | + return description |
| 46 | + lines = description.split("\n") |
| 47 | + for i, line in enumerate(lines): |
| 48 | + if os_name in line: |
| 49 | + lines[i] = ( |
| 50 | + f"{description}\n[{os_name} execution link]({get_execution_link()})" |
| 51 | + ) |
| 52 | + return description |
22 | 53 |
|
23 | 54 |
|
24 | 55 | def get_plan_title(version_str: str, channel: str) -> str:
|
@@ -321,6 +352,12 @@ def organize_l10n_entries(
|
321 | 352 | if len(site_entries) != 1:
|
322 | 353 | logging.info("Suite entries are broken somehow")
|
323 | 354 |
|
| 355 | + # Add execution link to plan description |
| 356 | + |
| 357 | + os_name = config.split(" ")[0] |
| 358 | + description = replace_link_in_description(expected_plan["description"], os_name) |
| 359 | + testrail_session.update_plan(plan_id, description=description) |
| 360 | + |
324 | 361 | # There should only be one entry per site per plan
|
325 | 362 | # Check that this entry has a run with the correct config
|
326 | 363 | # And if not, make that run
|
|
0 commit comments