Skip to content

feat: add macOS support to quickstart scripts#219

Closed
agullon wants to merge 2 commits into
microshift-io:mainfrom
agullon:macos-quickstart
Closed

feat: add macOS support to quickstart scripts#219
agullon wants to merge 2 commits into
microshift-io:mainfrom
agullon:macos-quickstart

Conversation

@agullon
Copy link
Copy Markdown
Contributor

@agullon agullon commented May 12, 2026

Adds macOS support to quickstart.sh and quickclean.sh. The same scripts now work on both Linux and macOS.

On macOS, the scripts require a rootful podman machine:

brew install podman
podman machine init --memory 4096
podman machine set --rootful
podman machine start
curl -s https://microshift-io.github.io/microshift/quickstart.sh | sudo bash

Changes:

  • quickstart.sh: detect macOS, validate rootful podman machine, run LVM setup inside the VM via podman machine ssh
  • quickclean.sh: detect macOS, clean up LVM inside the VM via podman machine ssh
  • Container name is now configurable: ./src/quickstart.sh [name]

Note: macOS CI coverage is not possible because GitHub Actions macOS runners do not support virtualization. podman machine start requires Apple's Virtualization Framework (vfkit), which is blocked on GitHub-hosted runners. The macOS code path is tested manually.

🤖 Generated with Claude Code

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 12, 2026

📝 Walkthrough

Walkthrough

This PR adds macOS support to MicroShift's quick-start and quick-clean scripts. The workflow matrix expands to include macOS runners with Podman machine initialization, scripts accept a configurable container name, and Darwin/Linux branching handles LVM disk provisioning and cleanup differently on each platform.

Changes

macOS Support for Quick-Start and Quick-Clean

Layer / File(s) Summary
GitHub Actions macOS support
.github/workflows/installers.yaml
Workflow matrix adds macos-latest runner and a setup step installs Podman via Homebrew and initializes a rootful Podman machine before running existing quick-start/clean actions.
Container name configurability
src/quickstart.sh
Scripts accept container name as first argument (default microshift-okd) and propagate it through podman run, startup health checks, failure cleanup, and final output instructions.
Platform-specific initialization
src/quickstart.sh
Startup adds macOS Podman connectivity validation and rootful-mode enforcement; Linux path enforces root execution and validates prerequisites.
Platform-specific LVM disk provisioning
src/quickstart.sh
Darwin branch provisions LVM disk and volume group inside Podman machine via podman machine ssh; Linux branch uses existing local provisioning.
Platform-specific cleanup and verification
src/quickclean.sh, .github/actions/quick-start-clean/action.yaml
Cleanup branches by OS: Darwin removes LVM inside VM and detaches backing disk; Linux cleans MicroShift data, removes RPMs, and removes LVM locally. LVM/directory verification checks gate behind non-Darwin condition.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

  • microshift-io/microshift#92: Main PR's OS-specific cleanup/verification and container-name plumbing in scripts and action directly build on PR #92's introduction of the reusable quick-start-clean composite action.
  • microshift-io/microshift#137: Both PRs modify src/quickclean.sh cleanup orchestration; main PR adds Darwin vs non-Darwin branching while retrieved PR adjusts RPM and container cleanup ordering.

Suggested reviewers

  • ggiguash
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the main change: adding macOS support to quickstart scripts. It is concise, specific, and clearly reflects the primary objective of the PR.
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.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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 and usage tips.

@agullon agullon force-pushed the macos-quickstart branch from 1d1e1a8 to b6d71a7 Compare May 12, 2026 15:36
@ggiguash
Copy link
Copy Markdown
Contributor

Does it have to be a separate script? How difficult would it be to integrate it into the existing quickstart.sh? In the worst case, we could keep macos-specific functions in a separate file and include / invoke those conditionally on macos

@agullon agullon force-pushed the macos-quickstart branch 5 times, most recently from 1a6148b to b4b4a3a Compare May 13, 2026 07:19
Comment thread README.md Outdated
Comment thread README.md Outdated
@agullon agullon force-pushed the macos-quickstart branch 13 times, most recently from 1f0fd68 to d0cacc3 Compare May 13, 2026 09:24
@agullon agullon changed the title feat: add macOS quickstart script feat: add macOS support to quickstart.sh May 13, 2026
Comment thread README.md Outdated
Comment thread src/quickstart.sh Outdated
@agullon agullon force-pushed the macos-quickstart branch from d0cacc3 to da17dc8 Compare May 13, 2026 09:58
Comment thread src/quickstart.sh Outdated
@agullon agullon force-pushed the macos-quickstart branch 2 times, most recently from 800aa7c to d95851c Compare May 13, 2026 10:21
@agullon agullon force-pushed the macos-quickstart branch 3 times, most recently from 355c0f7 to ed7e192 Compare May 13, 2026 10:45
@agullon agullon marked this pull request as ready for review May 13, 2026 10:49
@agullon agullon requested a review from a team as a code owner May 13, 2026 10:49
@agullon agullon marked this pull request as draft May 13, 2026 10:49
Comment thread .github/workflows/installers.yaml Outdated
podman machine set --rootful
podman machine start

- name: Run the quick start script
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.

Can we reuse the existing ./.github/actions/quick-start-clean action?

@agullon agullon force-pushed the macos-quickstart branch 4 times, most recently from 3dcb65c to e96ba70 Compare May 13, 2026 13:07
agullon added 2 commits May 13, 2026 15:13
quickstart.sh now detects macOS and handles podman machine validation
(rootful mode required) and LVM setup via `podman machine ssh`. The
pre-built image is pulled from GHCR, same as Linux.

Also adds macOS to the installers CI workflow matrix.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

pre-commit.check-secrets: ENABLED
Usage: ./src/quickstart.sh [container-name]
Defaults to 'microshift-okd' when no argument is provided.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

pre-commit.check-secrets: ENABLED
@agullon agullon force-pushed the macos-quickstart branch from e96ba70 to 9d1b589 Compare May 13, 2026 13:14
@agullon agullon marked this pull request as ready for review May 13, 2026 13:20
@agullon agullon changed the title feat: add macOS support to quickstart.sh feat: add macOS support to quickstart scripts May 13, 2026
Copy link
Copy Markdown

@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: 3

♻️ Duplicate comments (3)
.github/actions/quick-start-clean/action.yaml (2)

34-34: ⚠️ Potential issue | 🟠 Major

Hardcoded container name.

The health check assumes microshift-okd, but quickstart.sh now accepts a custom container name via argument.

🤖 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 @.github/actions/quick-start-clean/action.yaml at line 34, Replace the
hardcoded container identifier in the health-check command (the line starting
with state=$(sudo podman exec -i microshift-okd ...) ) with the actual container
variable used by the quickstart script (e.g., use the same container/name
argument or env var that quickstart.sh exposes such as CONTAINER_NAME or
$CONTAINER) so the podman exec targets the user-specified instance; ensure the
action reads that variable (falling back to the previous default
"microshift-okd" if unset) and use it in the systemctl call.

51-52: ⚠️ Potential issue | 🟠 Major

Hardcoded container name.

Cleanup verification assumes microshift-okd, which won't work if quickstart was run with a custom container name.

🤖 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 @.github/actions/quick-start-clean/action.yaml around lines 51 - 52, The
cleanup check uses a hardcoded container/image name in the podman commands
("sudo podman ps -a | grep microshift-okd && exit 1" and "sudo podman image
exists microshift-okd && exit 1"), which breaks when quickstart was run with a
custom name; change these to reference a configurable variable (e.g.,
CONTAINER_NAME or an action input) with a sensible default and use that variable
in both the podman ps/grep and podman image exists checks so the cleanup
verifies the actual container/image name used at runtime.
src/quickclean.sh (1)

15-15: ⚠️ Potential issue | 🟠 Major

Hardcoded container name.

This script assumes the container is named microshift-okd, but quickstart.sh now accepts a custom name. Users who run quickstart with a custom name won't be able to clean up.

🤖 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 `@src/quickclean.sh` at line 15, The script hardcodes the container name
"microshift-okd" (seen in the image_ref assignment using podman inspect), so
change it to use a configurable container name (e.g., read from an environment
variable or CLI arg) and fall back to "microshift-okd" if unset; update the
image_ref command and any other occurrences of the literal "microshift-okd" in
the script to use that variable (e.g., QUICKSTART_CONTAINER_NAME or
CONTAINER_NAME) so quickclean works for custom quickstart names.
🤖 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 `@src/quickstart.sh`:
- Line 9: The quickstart script defines a configurable CONTAINER_NAME variable
but quickclean.sh still hardcodes "microshift-okd", so custom names won't be
cleaned; fix by making quickclean.sh accept the container name (e.g., read an
argument $1 or environment variable) and update quickstart.sh to either export
CONTAINER_NAME before invoking quickclean.sh or pass CONTAINER_NAME as the
argument when calling quickclean.sh; specifically change quickclean.sh to use
the same symbol (CONTAINER_NAME) instead of the literal and ensure quickstart.sh
uses the same mechanism (export CONTAINER_NAME or pass it) so both scripts
reference the same container identifier.
- Around line 219-222: Make the displayed podman commands platform-aware by
introducing an EXEC_PREFIX determined from uname and uid (e.g., if uname -s ==
"Darwin" and id -u != 0 then EXEC_PREFIX="" else EXEC_PREFIX="sudo "), then use
that EXEC_PREFIX variable when emitting the podman/kubectl examples (replace the
hardcoded "sudo " in the lines that echo the podman exec and kubectl get pods
commands), referencing the existing CONTAINER_NAME variable so outputs become
"${EXEC_PREFIX}podman exec -it ${CONTAINER_NAME} /bin/bash -l" and
"${EXEC_PREFIX}podman exec -it ${CONTAINER_NAME} kubectl get pods -A".
- Line 177: The variable local_rootful is intended to be function-scoped but is
declared without the local keyword; update the assignment to declare it as a
local variable (e.g., use local local_rootful when assigning the result of
podman machine inspect --format '{{.Rootful}}' 2>/dev/null || echo "false") so
it doesn't leak into the global environment; locate the assignment of
local_rootful in src/quickstart.sh and prepend the local keyword to the variable
declaration.

---

Duplicate comments:
In @.github/actions/quick-start-clean/action.yaml:
- Line 34: Replace the hardcoded container identifier in the health-check
command (the line starting with state=$(sudo podman exec -i microshift-okd ...)
) with the actual container variable used by the quickstart script (e.g., use
the same container/name argument or env var that quickstart.sh exposes such as
CONTAINER_NAME or $CONTAINER) so the podman exec targets the user-specified
instance; ensure the action reads that variable (falling back to the previous
default "microshift-okd" if unset) and use it in the systemctl call.
- Around line 51-52: The cleanup check uses a hardcoded container/image name in
the podman commands ("sudo podman ps -a | grep microshift-okd && exit 1" and
"sudo podman image exists microshift-okd && exit 1"), which breaks when
quickstart was run with a custom name; change these to reference a configurable
variable (e.g., CONTAINER_NAME or an action input) with a sensible default and
use that variable in both the podman ps/grep and podman image exists checks so
the cleanup verifies the actual container/image name used at runtime.

In `@src/quickclean.sh`:
- Line 15: The script hardcodes the container name "microshift-okd" (seen in the
image_ref assignment using podman inspect), so change it to use a configurable
container name (e.g., read from an environment variable or CLI arg) and fall
back to "microshift-okd" if unset; update the image_ref command and any other
occurrences of the literal "microshift-okd" in the script to use that variable
(e.g., QUICKSTART_CONTAINER_NAME or CONTAINER_NAME) so quickclean works for
custom quickstart names.
🪄 Autofix (Beta)

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: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 53982915-c345-40f8-aa4b-cd725711b36d

📥 Commits

Reviewing files that changed from the base of the PR and between bde3c43 and 9d1b589.

📒 Files selected for processing (4)
  • .github/actions/quick-start-clean/action.yaml
  • .github/workflows/installers.yaml
  • src/quickclean.sh
  • src/quickstart.sh

Comment thread src/quickstart.sh
IMAGE=${IMAGE:-"ghcr.io/${OWNER}/${REPO}"}
TAG=${TAG:-latest}

CONTAINER_NAME="${1:-microshift-okd}"
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major | 🏗️ Heavy lift

Container name mismatch with cleanup script.

quickclean.sh hardcodes microshift-okd on line 15, so custom container names passed to this script won't be cleaned up.

🔧 Options to fix
  1. Pass the container name to quickclean.sh as an argument (requires updating both scripts and the workflow action)
  2. Use an environment variable to share the container name
  3. Remove the configurable container name feature if it's not needed
🤖 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 `@src/quickstart.sh` at line 9, The quickstart script defines a configurable
CONTAINER_NAME variable but quickclean.sh still hardcodes "microshift-okd", so
custom names won't be cleaned; fix by making quickclean.sh accept the container
name (e.g., read an argument $1 or environment variable) and update
quickstart.sh to either export CONTAINER_NAME before invoking quickclean.sh or
pass CONTAINER_NAME as the argument when calling quickclean.sh; specifically
change quickclean.sh to use the same symbol (CONTAINER_NAME) instead of the
literal and ensure quickstart.sh uses the same mechanism (export CONTAINER_NAME
or pass it) so both scripts reference the same container identifier.

Comment thread src/quickstart.sh
fi

if [ "$(id -u)" -ne 0 ]; then
local_rootful="$(podman machine inspect --format '{{.Rootful}}' 2>/dev/null || echo "false")"
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Missing local declaration.

The variable name suggests local scope but it's not declared with the local keyword.

🔧 Proposed fix
-    local_rootful="$(podman machine inspect --format '{{.Rootful}}' 2>/dev/null || echo "false")"
+    local local_rootful
+    local_rootful="$(podman machine inspect --format '{{.Rootful}}' 2>/dev/null || echo "false")"
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
local_rootful="$(podman machine inspect --format '{{.Rootful}}' 2>/dev/null || echo "false")"
local local_rootful
local_rootful="$(podman machine inspect --format '{{.Rootful}}' 2>/dev/null || echo "false")"
🤖 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 `@src/quickstart.sh` at line 177, The variable local_rootful is intended to be
function-scoped but is declared without the local keyword; update the assignment
to declare it as a local variable (e.g., use local local_rootful when assigning
the result of podman machine inspect --format '{{.Rootful}}' 2>/dev/null || echo
"false") so it doesn't leak into the global environment; locate the assignment
of local_rootful in src/quickstart.sh and prepend the local keyword to the
variable declaration.

Comment thread src/quickstart.sh
Comment on lines +219 to +222
echo " - sudo podman exec -it ${CONTAINER_NAME} /bin/bash -l"
echo
echo "To verify that MicroShift pods are up and running, run the following command:"
echo " - sudo podman exec -it microshift-okd kubectl get pods -A"
echo " - sudo podman exec -it ${CONTAINER_NAME} kubectl get pods -A"
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion | 🟠 Major | ⚡ Quick win

Instructions should be platform-aware.

On macOS, when not running as root, users don't need sudo for podman commands. The Darwin initialization (lines 166-183) allows non-root execution, but these instructions always show sudo.

🔧 Suggested approach

Conditionally emit instructions based on platform and execution context:

if [[ "$(uname -s)" == "Darwin" ]] && [ "$(id -u)" -ne 0 ]; then
    EXEC_PREFIX=""
else
    EXEC_PREFIX="sudo "
fi

echo "To access the container, run the following command:"
echo " - ${EXEC_PREFIX}podman exec -it ${CONTAINER_NAME} /bin/bash -l"
🤖 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 `@src/quickstart.sh` around lines 219 - 222, Make the displayed podman commands
platform-aware by introducing an EXEC_PREFIX determined from uname and uid
(e.g., if uname -s == "Darwin" and id -u != 0 then EXEC_PREFIX="" else
EXEC_PREFIX="sudo "), then use that EXEC_PREFIX variable when emitting the
podman/kubectl examples (replace the hardcoded "sudo " in the lines that echo
the podman exec and kubectl get pods commands), referencing the existing
CONTAINER_NAME variable so outputs become "${EXEC_PREFIX}podman exec -it
${CONTAINER_NAME} /bin/bash -l" and "${EXEC_PREFIX}podman exec -it
${CONTAINER_NAME} kubectl get pods -A".

@agullon
Copy link
Copy Markdown
Contributor Author

agullon commented May 13, 2026

closed in favor of #220

@agullon agullon closed this May 13, 2026
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