Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: bot comment should include images built on github actions #86

Merged
merged 3 commits into from
Nov 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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