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

Add HA Yellow image to RPi Imager index update action #3731

Merged
merged 2 commits into from
Dec 11, 2024

Conversation

sairon
Copy link
Member

@sairon sairon commented Dec 10, 2024

Update the action to also bump HA Yellow image added in home-assistant/version#402.

Summary by CodeRabbit

  • New Features
    • Expanded version bump functionality to include support for the "HA Yellow" hardware target in the RPi Imager workflow.

Update the action to also bump HA Yellow image added in
home-assistant/version#402.
@sairon sairon added the build Build and CI related issues label Dec 10, 2024
@sairon sairon requested a review from agners December 10, 2024 15:29
Copy link

coderabbitai bot commented Dec 10, 2024

📝 Walkthrough
📝 Walkthrough

Walkthrough

The changes involve an update to the GitHub Actions workflow for bumping the version of Home Assistant OS in the RPi Imager. A new function call to bump_entry has been added to handle version bumps for an additional hardware target, "Yellow". The input validation and overall workflow structure remain unchanged, preserving the existing logic while extending functionality to support this new target.

Changes

File Path Change Summary
.github/actions/bump-rpi-imager-version/action.yml Added a call to bump_entry for the "yellow" hardware target, including relevant parameters.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant GitHub Actions
    participant Version Repository

    User->>GitHub Actions: Trigger version bump
    GitHub Actions->>Version Repository: Clone repository
    GitHub Actions->>Version Repository: Validate input
    GitHub Actions->>Version Repository: Bump version for "yellow"
    GitHub Actions->>Version Repository: Commit changes
    GitHub Actions->>Version Repository: Push changes
    GitHub Actions->>User: Complete version bump
Loading

📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between 9ce833e and f22a8ed.

📒 Files selected for processing (1)
  • .github/actions/bump-rpi-imager-version/action.yml (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • .github/actions/bump-rpi-imager-version/action.yml

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?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

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)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR. (Experiment)
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai or @coderabbitai title anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Outside diff range and nitpick comments (1)
.github/actions/bump-rpi-imager-version/action.yml (1)

86-86: Consider adding error handling for the new hardware target

While the integration looks correct, consider adding specific error handling for the HA Yellow image. This could help diagnose issues if the image is missing or follows a different pattern.

         bump_entry /tmp/version/rpi-imager-haos.json "$INPUTS_VERSION" "${{ steps.validate-input.outputs.date }}" "rpi5-64" "RPi 5"
+        # HA Yellow might follow a different pattern or be missing in some releases
+        if ! curl --output /dev/null --silent --head --fail "https://github.com/home-assistant/operating-system/releases/download/${INPUTS_VERSION}/haos_yellow-${INPUTS_VERSION}.img.xz"; then
+          echo "::warning::HA Yellow image not found for version ${INPUTS_VERSION}, skipping..."
+        else
         bump_entry /tmp/version/rpi-imager-haos.json "$INPUTS_VERSION" "${{ steps.validate-input.outputs.date }}" "yellow" "HA Yellow"
+        fi
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between 2b30e2b and 9ce833e.

📒 Files selected for processing (1)
  • .github/actions/bump-rpi-imager-version/action.yml (1 hunks)
🔇 Additional comments (1)
.github/actions/bump-rpi-imager-version/action.yml (1)

86-86: Overall changes look good!

The addition of HA Yellow to the RPi Imager index update action is well-integrated and follows the established patterns. The changes are minimal and maintain the existing workflow structure.

@@ -83,6 +83,7 @@ runs:
bump_entry /tmp/version/rpi-imager-haos.json "$INPUTS_VERSION" "${{ steps.validate-input.outputs.date }}" "rpi3-64" "RPi 3"
bump_entry /tmp/version/rpi-imager-haos.json "$INPUTS_VERSION" "${{ steps.validate-input.outputs.date }}" "rpi4-64" "RPi 4/400"
bump_entry /tmp/version/rpi-imager-haos.json "$INPUTS_VERSION" "${{ steps.validate-input.outputs.date }}" "rpi5-64" "RPi 5"
bump_entry /tmp/version/rpi-imager-haos.json "$INPUTS_VERSION" "${{ steps.validate-input.outputs.date }}" "yellow" "HA Yellow"
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codebase verification

⚠️ The JSON structure needs to be updated before adding HA Yellow entry

The verification reveals two critical issues:

  • There is no existing HA Yellow entry in the JSON file that matches the expected pattern for HAOS images
  • The current Yellow-related entry points to a different URL pattern (yellow-installer-*) from a different repository

The bump_entry function assumes:

  1. An existing entry to update
  2. URLs following the pattern haos_${image_id}-${version}.img.xz from the operating-system repository

Before this change can work:

  1. A base entry for HA Yellow needs to be added to the JSON file first
  2. The entry should follow the same structure as other HAOS entries
  3. The URL should point to the operating-system repository releases
🔗 Analysis chain

Verify the HA Yellow image URL pattern and JSON structure

The new hardware target has been added correctly, following the same pattern as other entries. However, let's verify two important assumptions:

  1. The image URL pattern haos_yellow-${version}.img.xz matches the actual release artifacts
  2. The JSON file contains an existing entry for HA Yellow that can be updated
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify HA Yellow image URL pattern and JSON structure

# Check if the latest release has the expected HA Yellow image pattern
gh api repos/home-assistant/operating-system/releases/latest | jq -r '.assets[].name' | grep -E 'haos_yellow-.*\.img\.xz'

# Check if the JSON file has an entry for HA Yellow
curl -s https://raw.githubusercontent.com/home-assistant/version/master/rpi-imager-haos.json | \
  jq '.os_list[] | select(.name | contains("HA Yellow"))'

Length of output: 300


Script:

#!/bin/bash
# Let's verify the JSON structure more thoroughly by checking its content
# and ensuring it has the expected fields for other entries

curl -s https://raw.githubusercontent.com/home-assistant/version/master/rpi-imager-haos.json | \
  jq -r '.os_list[] | "\(.name): \(.url)"'

# Also check the structure of an existing entry to ensure we match it
curl -s https://raw.githubusercontent.com/home-assistant/version/master/rpi-imager-haos.json | \
  jq '.os_list[] | select(.name | contains("Raspberry Pi"))' | head -n 1

Length of output: 864

@agners agners merged commit 434b837 into dev Dec 11, 2024
3 checks passed
@agners agners deleted the rpi-imager-yellow-image branch December 11, 2024 16:01
This was referenced Dec 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
build Build and CI related issues cla-signed
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants