Skip to content

Commit

Permalink
Merge pull request #86 from bioconda/bot-artifacts-gha-images
Browse files Browse the repository at this point in the history
fix: bot comment should include images built on github actions
  • Loading branch information
aliciaaevans authored Nov 19, 2024
2 parents d0c22db + 75b2552 commit 7b022b1
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 12 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/bot.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ jobs:
options: --privileged
env:
IMAGE_NAME: bot
IMAGE_VERSION: '1.4.0'
IMAGE_VERSION: '1.4.1'

steps:
- uses: actions/checkout@v4
Expand Down
2 changes: 1 addition & 1 deletion images/bot/setup.cfg
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[metadata]
name = bioconda-bot
version = 0.0.5
version = 0.0.6

[options]
python_requires = >=3.8
Expand Down
28 changes: 18 additions & 10 deletions images/bot/src/bioconda_bot/comment.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,22 +49,30 @@ async def make_artifact_comment(session: ClientSession, pr: int, sha: str) -> No
imageHeader = "***\n\nDocker image(s) built:\n\n"
imageHeader += "Package | Tag | CI | Install with `docker`\n"
imageHeader += "---------|---------|-----|---------\n"

for [ci_platform, artifacts] in artifactDict.items():
for URL, artifact in artifacts:
if artifact.endswith(".tar.gz"):
image_name = artifact.split("/").pop()[: -len(".tar.gz")]
if ':' in image_name:
package_name, tag = image_name.split(':', 1)
comment += imageHeader
imageHeader = "" # only add the header for the first image
if ci_platform == "azure":
comment += f"{package_name} | {tag} | Azure | "
comment += "<details><summary>show</summary>Images for Azure are in the LinuxArtifacts zip file above."
comment += f"`gzip -dc LinuxArtifacts/images/{image_name}.tar.gz \\| docker load`</details>\n"
elif ci_platform == "circleci":
comment += f"[{package_name}]({URL}) | {tag} | CircleCI | "
comment += f'<details><summary>show</summary>`curl -L "{URL}" \\| gzip -dc \\| docker load`</details>\n'
elif '---' in image_name:
package_name, tag = image_name.split('---', 1)
else:
log(f"Skipping image {image_name}: missing separator")
continue
comment += imageHeader
imageHeader = "" # only add the header for the first image
if ci_platform == "azure":
comment += f"{package_name} | {tag} | Azure | "
comment += "<details><summary>show</summary>Images for Azure are in the LinuxArtifacts zip file above."
comment += f"`gzip -dc LinuxArtifacts/images/{image_name}.tar.gz \\| docker load`</details>\n"
elif ci_platform == "circleci":
comment += f"[{package_name}]({URL}) | {tag} | CircleCI | "
comment += f'<details><summary>show</summary>`curl -L "{URL}" \\| gzip -dc \\| docker load`</details>\n'
elif ci_platform == "github-actions":
comment += f"{package_name} | {tag} | GitHub Actions | "
comment += "<details><summary>show</summary>Images are in the linux-64 zip file above."
comment += f"`gzip -dc images/{image_name}.tar.gz \\| docker load`</details>\n"
comment += "\n\n"

await send_comment(session, pr, comment)
Expand Down

0 comments on commit 7b022b1

Please sign in to comment.