Skip to content

Enable Alpine community and tagged edge for guest tools - #55

Merged
cursor[bot] merged 1 commit into
mainfrom
cursor/alpine-edge-repo-initial-config-3e81
Aug 7, 2026
Merged

Enable Alpine community and tagged edge for guest tools#55
cursor[bot] merged 1 commit into
mainfrom
cursor/alpine-edge-repo-initial-config-3e81

Conversation

@Narehood

@Narehood Narehood commented Aug 7, 2026

Copy link
Copy Markdown
Owner

Summary

Alpine initial config was failing to install xe-guest-utilities after upgrading to 3.24.1 because only main was effectively available. That package lives in community on stable (and also on edge/community).

Change

During Server Initial Config on Alpine, before installing XCP-NG guest tools:

  1. Enable the matching vX.Y/community repo (setup-apkrepos -c when available, otherwise uncomment/add the line)
  2. Add a tagged @edge .../edge/community overlay (safe; not untagged edge)
  3. apk update, then install xe-guest-utilities (falls back to xe-guest-utilities@edge if needed)

Why not only edge?

On Alpine 3.24, xe-guest-utilities is in v3.24/community. Enabling community is the correct primary fix; tagged @edge is included as requested for overlay access without reintroducing untagged mixed repos.

Open in Web Open in Cursor 

Summary by CodeRabbit

  • New Features

    • Added Alpine Linux support for installing and starting Xen guest utilities.
    • Automatically configures compatible stable and tagged-edge package repositories when needed.
    • Added safeguards to prevent duplicate repository entries during repeated setup runs.
  • Bug Fixes

    • Improved fallback handling when guest utilities are unavailable in the stable repository.
  • Tests

    • Added automated Alpine setup and repository validation checks, including repeat-run verification.

During initial config on Alpine, ensure the matching community repository
is enabled and add a tagged @edge community overlay so xe-guest-utilities
can install after upgrades where only main was configured.

Co-authored-by: Michael <Narehood@users.noreply.github.com>
@coderabbitai

coderabbitai Bot commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

The installer now manages Alpine repositories and installs xe-guest-utilities from stable or tagged-edge repositories. It supports sourcing without executing the main flow. New tests verify repository setup and idempotency.

Changes

Alpine guest utility installation

Layer / File(s) Summary
Alpine repositories and guest utility installation
Installers/serverSetup.sh
The installer derives the Alpine release branch, configures stable and tagged-edge community repositories, refreshes package indexes, installs xe-guest-utilities, and starts its service.
Installer execution integration
Installers/serverSetup.sh, Installers/.checksums.sha256
Sourced execution now returns before main execution. The Alpine call site uses the new helper. The recorded checksum and script version are updated.
Alpine setup validation
tests/server-setup-alpine.sh, tests/security-checks.sh
The new test checks syntax, repository entries, required content, and idempotency. The security-check sequence runs the test.

Estimated code review effort: 4 (Complex) | ~45 minutes

Sequence Diagram(s)

sequenceDiagram
  participant serverSetup.sh
  participant setup-apkrepos
  participant repositories_file
  participant apk
  participant service
  serverSetup.sh->>setup-apkrepos: Prepare Alpine repositories
  setup-apkrepos->>repositories_file: Update repository entries
  serverSetup.sh->>apk: Refresh indexes and install xe-guest-utilities
  serverSetup.sh->>service: Enable and start xe-guest-utilities
Loading

Possibly related PRs

  • Narehood/VM-Setup#26: Both changes update Installers/serverSetup.sh versioning and helper functions.
  • Narehood/VM-Setup#48: This change extends the Alpine guest-tools repository and installation logic.

Suggested reviewers: cursoragent

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the main change: enabling Alpine community and tagged edge repositories for guest tools.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch cursor/alpine-edge-repo-initial-config-3e81

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

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

@cursor
cursor Bot marked this pull request as ready for review August 7, 2026 16:15
@cursor
cursor Bot merged commit 6c26ff0 into main Aug 7, 2026
2 of 3 checks passed
@cursor
cursor Bot deleted the cursor/alpine-edge-repo-initial-config-3e81 branch August 7, 2026 16:17

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@Installers/serverSetup.sh`:
- Around line 391-392: Update update_repos to propagate the exit status from apk
update: only set PKG_MANAGER_UPDATED to "true" and return success when the
command succeeds, and return a nonzero status on failure so the existing
update_repos || return 1 path stops installation.
- Around line 366-369: Update the `main_line` processing before constructing
`edge_line` so any existing repository tag is removed while retaining the
repository URL. Ensure `edge_base` contains only the normalized `/alpine` URL,
allowing `edge_line` to produce a single `@edge` tag followed by the community
repository path.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 20b8c1ad-6256-4e44-b47c-337cd87a119f

📥 Commits

Reviewing files that changed from the base of the PR and between d345025 and 72e6498.

📒 Files selected for processing (4)
  • Installers/.checksums.sha256
  • Installers/serverSetup.sh
  • tests/security-checks.sh
  • tests/server-setup-alpine.sh

Comment thread Installers/serverSetup.sh
Comment on lines +366 to +369
main_line=$(grep -E "^[[:space:]]*[^#].*/alpine/v${branch_escaped}/main(/|[[:space:]]|$)" "$repos" | head -n1 || true)
if [[ -n "$main_line" ]]; then
edge_base=$(printf '%s\n' "$main_line" | sed -E "s|^[[:space:]]*||; s|/alpine/v${branch_escaped}/main.*|/alpine|")
edge_line="@edge ${edge_base}/edge/community"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

branch_escaped='3\.24'
main_line='`@stable` https://dl-cdn.alpinelinux.org/alpine/v3.24/main'
edge_base=$(printf '%s\n' "$main_line" |
  sed -E "s|^[[:space:]]*||; s|/alpine/v${branch_escaped}/main.*|/alpine|")

printf '`@edge` %s/edge/community\n' "$edge_base"
# Current output contains a second tag: "`@edge` `@stable` https://..."

Repository: Narehood/VM-Setup

Length of output: 222


🏁 Script executed:

#!/bin/bash
set -euo pipefail

printf '--- Installers/serverSetup.sh outline matching repo-related context ---\n'
ast-grep outline Installers/serverSetup.sh --match repo --view expanded || true

printf '\n--- Relevant lines 340-385 ---\n'
sed -n '340,385p' Installers/serverSetup.sh | nl -ba -v340

printf '\n--- Search for repository tag handling nearby ---\n'
rg -n "@(stable|testing|edge)|set_repository|repos|/alpine/v|edge/community|edge_base" Installers/serverSetup.sh

Repository: Narehood/VM-Setup

Length of output: 246


🏁 Script executed:

#!/bin/bash
set -euo pipefail

# Read-only behavioral probe for the current construction and the proposed fix.
branch_escaped='3\.24'

current_edge_base() {
  printf '%s\n' "$1" | sed -E "s|^[[:space:]]*||; s|/alpine/v${branch_escaped}/main.*|/alpine|";
}

proposed_edge_base() {
  printf '%s\n' "$1" | sed -_E "s|^[[:space:]]*||; s|^@[^[:space:]]+[[:space:]]+||; s|/alpine/v${branch_escaped}/main.*|/alpine|";
}

for main_line in \
  '`@stable` https://dl-cdn.alpinelinux.org/alpine/v3.24/main' \
  'https://dl-cdn.alpinelinux.org/alpine/v3.24/main'
do
  current="$(printf '`@edge` %s/edge/community\n' "$(current_edge_base "$main_line")")"
  proposed="$(printf '`@edge` %s/edge/community\n' "$(proposed_edge_base "$main_line")")"
  echo "input: $main_line"
  echo "current: $current"
  echo "proposed: $proposed"
  echo "---"
done

Repository: Narehood/VM-Setup

Length of output: 4661


Remove an existing repository tag before building edge_line.

If the main repository line has a tag, such as @stable https://…/v3.24/main, keep the URL instead of preserving that tag. Otherwise this writes @edge @stable https://…/edge/community, which is not a valid repository URL.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@Installers/serverSetup.sh` around lines 366 - 369, Update the `main_line`
processing before constructing `edge_line` so any existing repository tag is
removed while retaining the repository URL. Ensure `edge_base` contains only the
normalized `/alpine` URL, allowing `edge_line` to produce a single `@edge` tag
followed by the community repository path.

Comment thread Installers/serverSetup.sh
Comment on lines +391 to +392
PKG_MANAGER_UPDATED="false"
update_repos || return 1

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🩺 Stability & Availability | 🟠 Major | ⚡ Quick win

Propagate apk update failures.

update_repos ignores the exit status from apk update at Line 154. It then sets PKG_MANAGER_UPDATED="true" and returns success. Therefore, Line 392 can continue with stale package indexes after an update failure.

Proposed fix
 if [[ "$OS" == "alpine" ]]; then
-    apk update >/dev/null 2>&1
+    apk update >/dev/null 2>&1 || return 1
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@Installers/serverSetup.sh` around lines 391 - 392, Update update_repos to
propagate the exit status from apk update: only set PKG_MANAGER_UPDATED to
"true" and return success when the command succeeds, and return a nonzero status
on failure so the existing update_repos || return 1 path stops installation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants