-
Notifications
You must be signed in to change notification settings - Fork 6
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
Conversation
WalkthroughThe changes in this pull request encompass updates to a GitHub Actions workflow, a package configuration file, and a Python script related to a bot's functionality. In the workflow configuration file In the The 📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Outside diff range and nitpick comments (2)
images/bot/src/bioconda_bot/comment.py (2)
60-63
: Consider enhancing error handling for image name parsingWhile the addition of '---' separator support is good, the error handling could be improved.
Consider adding logging for skipped images and explicit error messages:
elif '---' in image_name: package_name, tag = image_name.split('---', 1) else: + logger.debug(f"Skipping image {image_name}: invalid format (missing separator)") continue
64-74
: Consider refactoring platform-specific formatting to reduce duplicationThe platform-specific comment formatting contains repeated patterns that could be extracted into a helper function.
Consider this refactor:
def format_image_comment(package_name: str, tag: str, ci_platform: str, url: str = None) -> str: platform_details = { "azure": { "title": "Azure", "summary": "Images for Azure are in the LinuxArtifacts zip file above.", "command": lambda name: f"gzip -dc LinuxArtifacts/images/{name}.tar.gz \\| docker load" }, "circleci": { "title": "CircleCI", "summary": "", "command": lambda url: f'curl -L "{url}" \\| gzip -dc \\| docker load' }, "github-actions": { "title": "GitHub Actions", "summary": "Images are in the linux-64 zip file above.", "command": lambda name: f"gzip -dc images/{name}.tar.gz \\| docker load" } } details = platform_details.get(ci_platform) if not details: return "" package_link = f"[{package_name}]({url})" if url else package_name command = details["command"](url if ci_platform == "circleci" else f"{package_name}---{tag}") return ( f"{package_link} | {tag} | {details['title']} | " f"<details><summary>show</summary>{details['summary']}" f"{command}</details>\n" )Then use it like:
-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 += format_image_comment(package_name, tag, ci_platform, URL if ci_platform == "circleci" else None)This refactor:
- Reduces code duplication
- Makes it easier to add new platforms
- Centralizes the formatting logic
- Makes the code more maintainable
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
📒 Files selected for processing (3)
.github/workflows/bot.yaml
(1 hunks)images/bot/setup.cfg
(1 hunks)images/bot/src/bioconda_bot/comment.py
(1 hunks)
✅ Files skipped from review due to trivial changes (1)
- images/bot/setup.cfg
🔇 Additional comments (3)
.github/workflows/bot.yaml (2)
33-33
: LGTM! Version bump aligns with semantic versioning.
The patch version increment (1.4.0 → 1.4.1) is appropriate for fixing the bot comment functionality to include images built on GitHub Actions.
33-33
: Verify version consistency across related files.
Let's ensure this version bump is consistent with other related files.
✅ Verification successful
Version 1.4.1 appears to be unique to the bot workflow
The version 1.4.1 specified in .github/workflows/bot.yaml
is unique and not referenced in any other workflow files or configurations. The other workflows either use different version schemes or different version numbers (e.g., bioconda-recipes-issue-responder uses 1.1.1). This indicates that the version bump is isolated to the bot workflow and doesn't require consistency checks with other files.
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Description: Check version numbers in related files to ensure consistency
# Check setup.cfg version
echo "Checking setup.cfg version:"
fd -t f setup.cfg -x cat {} \; | grep -E "^version\s*="
# Check other potential version references
echo -e "\nChecking other version references:"
rg -g '!.git' "1\.4\.[0-1]" --type yaml --type python --type ini
Length of output: 324
Script:
#!/bin/bash
# Let's check for any version references in yaml files and docker related files
echo "Checking version references in yaml and docker files:"
rg "1\.4\.[0-1]" --type yaml
echo -e "\nChecking Dockerfile and docker-compose files:"
fd -e Dockerfile -e dockerfile -e "docker-compose.yml" -e "docker-compose.yaml" -x cat {}
echo -e "\nChecking other IMAGE_VERSION references in workflow files:"
fd -e yml -e yaml -p "workflows" -x cat {} | grep -i "IMAGE_VERSION:"
Length of output: 696
Script:
#!/bin/bash
# Let's try a simpler approach to find all version references in workflow files
echo "Checking all workflow files content:"
fd . .github/workflows/ -x cat {}
echo -e "\nChecking all yaml files in the repository:"
fd -e yml -e yaml -x cat {}
Length of output: 30681
images/bot/src/bioconda_bot/comment.py (1)
56-57
: LGTM: Header duplication fix
Good improvement to prevent duplicate headers by clearing the header string after first use.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @aliciaaevans!
The "please fetch artifacts" comment command stopped including images when we switched linux-64 builds to GitHub Actions. This includes those in the comment and handles the
---
workaround used because GHA artifacts can't have:
in the file name.