Skip to content

Conversation

@sairon
Copy link
Member

@sairon sairon commented Aug 20, 2025

Add list of hassio components from version.json that are built-in in the data partition to the GH step summary. For landingpage, get the latest stable release at the time of the build, as it's what should be published as homeassistant:landingpage by that time.

Closes #4242

Summary by CodeRabbit

  • New Features
    • Build summary now includes a “Built-in OS components” section with a two-column table (Container | Version).
    • Displays the selected release channel and the resolved channel option.
    • Automatically lists versions for Supervisor and Landing Page with links to their release tags.
    • Iterates over core plugins (DNS, Audio, CLI, Multicast, Observer), adding versioned entries with release links.
    • Existing “Artifacts” section remains unchanged.

Add list of hassio components from version.json that are built-in in the data
partition to the GH step summary. For landingpage, get the latest stable
release at the time of the build, as it's what should be published as
homeassistant:landingpage by that time.

Closes #4242
@sairon sairon requested a review from agners August 20, 2025 19:37
@sairon sairon added the build Build and CI related issues label Aug 20, 2025
@coderabbitai
Copy link

coderabbitai bot commented Aug 20, 2025

📝 Walkthrough

Walkthrough

Extends the GitHub Actions OS build workflow to generate a “Built-in OS components” section in the job summary, extracting versions for Supervisor, core plugins, and landing page from version.json and GitHub API, and presenting them in a two-column table with links. The existing “Artifacts” section remains unchanged.

Changes

Cohort / File(s) Summary
CI workflow: Build summary enhancement
.github/workflows/build.yaml
Adds step summary generation for “Built-in OS components”; reads hassio_channel and hassio_channel_option; parses output/build/hassio-*/version.json for Supervisor and plugins (dns, audio, cli, multicast, observer); queries GitHub API for landingpage latest tag; renders a Container/Version table with release links; preserves existing “Artifacts” section.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  participant Dev as Developer
  participant GH as GitHub Actions (Build Workflow)
  participant FS as Workspace FS
  participant API as GitHub API

  Dev->>GH: Push/dispatch build
  GH->>FS: Build OS artifacts
  GH->>FS: Read output/build/hassio-*/version.json
  GH->>GH: Resolve hassio_channel + hassio_channel_option
  GH->>GH: Prepare "Built-in OS components" table
  GH->>GH: Add Supervisor + plugin versions from version.json
  GH->>API: GET latest landingpage release tag
  API-->>GH: Return tag (e.g., vX.Y.Z)
  GH->>GH: Add landingpage row with link
  GH->>GH: Append existing "Artifacts" section
  GH-->>Dev: Publish job summary
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Assessment against linked issues

Objective Addressed Explanation
Include version information for Supervisor, plugins, and landing page in OS build context [#4242]
Present versions with links for traceability [#4242]
Store version information alongside the release (persistence beyond job summary) [#4242] Only job summary changes are evident; unclear if data is persisted with release assets or notes.

Tip

🔌 Remote MCP (Model Context Protocol) integration is now available!

Pro plan users can now connect to remote MCP servers from the Integrations page. Connect with popular remote MCPs such as Notion and Linear to add more context to your reviews and chats.

✨ Finishing Touches
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch os-components-summary

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ 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.
    • 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.
  • 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 the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

CodeRabbit Commands (Invoked using PR/Issue comments)

Type @coderabbitai help to get the list of available commands.

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

Status, Documentation and Community

  • Visit our Status Page to check the current availability of CodeRabbit.
  • 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.

@sairon
Copy link
Member Author

sairon commented Aug 20, 2025

Here's an example of the rendered output:
image

It has a minor flaw that for the dev channel, the links don't work, as they don't point to actual GH releases. However, that's IMO rather a cosmetic issue and adjusting code for that would add unnecessary complexity.

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: 0

🧹 Nitpick comments (4)
.github/workflows/build.yaml (4)

342-342: Use resolved channel instead of input to avoid empty value on release runs

On release-triggered runs, inputs.hassio_channel is unset and renders as an empty string in the summary. Use the resolved channel from prepare outputs for a consistent, user-facing value.

Apply this diff:

-          echo "Release channel: ${{ inputs.hassio_channel }} (${{ needs.prepare.outputs.hassio_channel_option }})" >> $GITHUB_STEP_SUMMARY
+          echo "Release channel: ${{ needs.prepare.outputs.channel }} (${{ needs.prepare.outputs.hassio_channel_option }})" >> $GITHUB_STEP_SUMMARY

345-352: Harden version discovery: single-match selection, null-safe jq, quoting, and graceful fallbacks

  • The glob output/build/hassio-*/version.json could match multiple files; jq would print multiple lines, breaking the table.
  • Missing keys in version.json produce null; those links become .../tag/null.
  • Unquoted variables risk word-splitting if versions ever contain unexpected characters.
  • Provide “N/A”/“unknown” fallbacks so the step remains informative when a value isn’t available.

Apply this diff to make the section robust:

-          supervisor_version=$(jq -r ".supervisor" output/build/hassio-*/version.json)
-          landingpage_version=$(curl -fsSL https://api.github.com/repos/home-assistant/landingpage/releases/latest | jq -r '.tag_name')
-          echo "| supervisor | [${supervisor_version}](https://github.com/home-assistant/supervisor/releases/tag/${supervisor_version}) |" >> $GITHUB_STEP_SUMMARY
-          echo "| landingpage | [${landingpage_version}](https://github.com/home-assistant/landingpage/releases/tag/${landingpage_version}) |" >> $GITHUB_STEP_SUMMARY
-          for plugin in dns audio cli multicast observer; do
-            version=$(jq -r ".${plugin}" output/build/hassio-*/version.json)
-            echo "| plugin-${plugin} | [${version}](https://github.com/home-assistant/plugin-${plugin}/releases/tag/${version}) |" >> $GITHUB_STEP_SUMMARY
-          done
+          shopt -s nullglob
+          files=(output/build/hassio-*/version.json)
+          if [ ${#files[@]} -eq 0 ]; then
+            echo "::warning::No version.json found under output/build/hassio-*/. Skipping Built-in OS components section."
+          else
+            vfile="${files[0]}"
+            supervisor_version="$(jq -r '.supervisor // empty' "$vfile")"
+            if [ -n "$supervisor_version" ]; then
+              echo "| supervisor | [${supervisor_version}](https://github.com/home-assistant/supervisor/releases/tag/${supervisor_version}) |" >> "$GITHUB_STEP_SUMMARY"
+            else
+              echo "| supervisor | N/A |" >> "$GITHUB_STEP_SUMMARY"
+            fi
+
+            # Latest stable landingpage release (API call hardened; see next comment for auth headers)
+            landingpage_version="$(curl -fsSL -H "Authorization: Bearer ${{ github.token }}" -H "Accept: application/vnd.github+json" -H "X-GitHub-Api-Version: 2022-11-28" https://api.github.com/repos/home-assistant/landingpage/releases/latest | jq -r '.tag_name // empty')"
+            if [ -n "$landingpage_version" ]; then
+              echo "| landingpage | [${landingpage_version}](https://github.com/home-assistant/landingpage/releases/tag/${landingpage_version}) |" >> "$GITHUB_STEP_SUMMARY"
+            else
+              echo "| landingpage | unknown |" >> "$GITHUB_STEP_SUMMARY"
+            fi
+
+            for plugin in dns audio cli multicast observer; do
+              version="$(jq -r --arg p "$plugin" '.[$p] // empty' "$vfile")"
+              if [ -n "$version" ]; then
+                echo "| plugin-${plugin} | [${version}](https://github.com/home-assistant/plugin-${plugin}/releases/tag/${version}) |" >> "$GITHUB_STEP_SUMMARY"
+              else
+                echo "| plugin-${plugin} | N/A |" >> "$GITHUB_STEP_SUMMARY"
+              fi
+            done
+          fi

346-346: Authenticate GitHub API request and add headers to avoid rate limits and enhance reliability

Unauthenticated curl to the GitHub API is limited (60 req/h per IP) and can intermittently fail under parallel matrix builds or forks. Add Authorization, Accept, and X-GitHub-Api-Version headers and handle empty responses gracefully.

The previous comment’s diff already shows the change, but if you prefer a minimal patch here:

-          landingpage_version=$(curl -fsSL https://api.github.com/repos/home-assistant/landingpage/releases/latest | jq -r '.tag_name')
+          landingpage_version=$(curl -fsSL \
+            -H "Authorization: Bearer ${{ github.token }}" \
+            -H "Accept: application/vnd.github+json" \
+            -H "X-GitHub-Api-Version: 2022-11-28" \
+            https://api.github.com/repos/home-assistant/landingpage/releases/latest | jq -r '.tag_name // empty')

349-352: Future-proof plugin listing against new components

Hard-coding the plugin list risks drift if a new built-in plugin is added to version.json. Option: derive plugins dynamically and exclude known non-plugin keys.

Example tweak (replace the static for plugin in … loop):

-          for plugin in dns audio cli multicast observer; do
-            version=$(jq -r ".${plugin}" output/build/hassio-*/version.json)
+          # Discover plugins from version.json; exclude supervisor (and any other non-plugin keys if present)
+          for plugin in $(jq -r 'keys[] | select(. != "supervisor")' "$vfile"); do
+            version="$(jq -r --arg p "$plugin" '.[$p] // empty' "$vfile")"
             echo "| plugin-${plugin} | [${version}](https://github.com/home-assistant/plugin-${plugin}/releases/tag/${version}) |" >> $GITHUB_STEP_SUMMARY
           done

If version.json contains extra non-plugin fields, add them to the select() exclusion.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
Cache: Disabled due to data retention organization setting
Knowledge Base: Disabled due to data retention organization setting

💡 Knowledge Base configuration:

  • MCP integration is disabled by default for public repositories
  • Jira integration is disabled by default for public repositories
  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between effe4d3 and 09a4545.

📒 Files selected for processing (1)
  • .github/workflows/build.yaml (1 hunks)

Copy link
Member

@agners agners left a comment

Choose a reason for hiding this comment

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

Nice! LGTM!

@sairon sairon merged commit 45985ad into dev Aug 20, 2025
3 checks passed
@sairon sairon deleted the os-components-summary branch August 20, 2025 22:22
@github-actions github-actions bot locked and limited conversation to collaborators Aug 28, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

build Build and CI related issues cla-signed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add version information of pre-installed Home Assistant components to OS build/release

3 participants