From 2e6824dfec70cff64d13ff48afd040d79034cd40 Mon Sep 17 00:00:00 2001 From: aliciaaevans Date: Tue, 2 Apr 2024 14:41:40 -0400 Subject: [PATCH] handle old builds --- images/bot/src/bioconda_bot/comment.py | 12 +++++++++--- images/bot/src/bioconda_bot/common.py | 2 +- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/images/bot/src/bioconda_bot/comment.py b/images/bot/src/bioconda_bot/comment.py index 82c0304..305962b 100644 --- a/images/bot/src/bioconda_bot/comment.py +++ b/images/bot/src/bioconda_bot/comment.py @@ -26,10 +26,11 @@ async def make_artifact_comment(session: ClientSession, pr: int, sha: str) -> None: artifactDict = await fetch_pr_sha_artifacts(session, pr, sha) - comment = "Package(s) built are ready for inspection:\n\n" - comment += "Arch | Package | Zip File / Repodata | CI | Instructions\n" - comment += "-----|---------|---------|-----|---------\n" + header = "Package(s) built are ready for inspection:\n\n" + header += "Arch | Package | Zip File / Repodata | CI | Instructions\n" + header += "-----|---------|---------|-----|---------\n" + comment = "" # Table of packages and zips for [ci_platform, artifacts] in artifactDict.items(): if ci_platform == "azure": @@ -38,6 +39,11 @@ async def make_artifact_comment(session: ClientSession, pr: int, sha: str) -> No comment += compose_circlci_comment(artifacts) elif ci_platform == "github-actions": comment += compose_gha_comment(artifacts) + if len(comment) == 0: + comment = ( "No artifacts found on the most recent builds. " + "Either the builds failed, the artifacts have been removed due to age, or the recipe was blacklisted/skipped.") + else: + comment = header + comment # Table of containers imageHeader = "***\n\nDocker image(s) built:\n\n" diff --git a/images/bot/src/bioconda_bot/common.py b/images/bot/src/bioconda_bot/common.py index d698bf9..bce8075 100644 --- a/images/bot/src/bioconda_bot/common.py +++ b/images/bot/src/bioconda_bot/common.py @@ -116,7 +116,7 @@ async def fetch_azure_zip_files(session: ClientSession, buildId: str) -> [(str, log("contacting azure %s", url) async with session.get(url) as response: # Sometimes we get a 301 error, so there are no longer artifacts available - if response.status == 301: + if response.status == 301 or response.status == 404: return artifacts res = await response.text()