Skip to content

quickstart: preflight-check podman and jq before execution#215

Open
mmahut wants to merge 1 commit intomicroshift-io:mainfrom
mmahut:main
Open

quickstart: preflight-check podman and jq before execution#215
mmahut wants to merge 1 commit intomicroshift-io:mainfrom
mmahut:main

Conversation

@mmahut
Copy link
Copy Markdown

@mmahut mmahut commented Apr 18, 2026

Add check_prerequisites() to fail fast with actionable install instructions when podman version is outdated (<4.0) or jq is missing, rather than hitting a cryptic command-not-found mid-run. Package manager detection covers dnf, apt-get, and zypper.

Summary by CodeRabbit

  • Chores
    • Added automatic validation of required system tools at startup.
    • Enforced a minimum Podman major version of 5 before container operations.
    • Gated resolution of the "latest" release tag on availability of curl and jq.
    • Provides clear error messages and exits immediately if required tools are missing or below minimum versions.

@mmahut mmahut requested a review from a team as a code owner April 18, 2026 19:47
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 18, 2026

📝 Walkthrough

Walkthrough

Added host prerequisite checks to src/quickstart.sh: introduced PODMAN_VMAJOR=5, check_prerequisites() and check_podman_version(); script now verifies required tools and enforces Podman major version >=5, and only validates curl/jq when resolving the GitHub “latest” tag.

Changes

Cohort / File(s) Summary
Quickstart script updates
src/quickstart.sh
Added PODMAN_VMAJOR=5, check_prerequisites() and check_podman_version(); invoked check_prerequisites podman and check_podman_version after root check; check_prerequisites curl jq now called only when resolving the “latest” release tag. Early-fail behavior for missing/unsupported host tools introduced.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

🚥 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
Title check ✅ Passed The title accurately describes the main change: adding preflight checks for podman and jq before execution in the quickstart script.
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.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

✏️ 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.

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

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@src/quickstart.sh`:
- Around line 38-51: The unconditional check for jq (and missing check for curl)
should be gated to the same condition used when fetching the remote latest-tag:
wrap or move the dependency checks so they run only when [[ "${IMAGE}" !=
localhost/* ]] && [ "${TAG}" == "latest" ]; add a curl availability check
(command -v curl &>/dev/null) alongside jq and emit the same user-friendly
install hints if either is missing; update the quickstart.sh block that
currently tests jq to be executed only under that IMAGE/TAG condition so local
or pinned-tag runs do not fail unnecessarily.
- Around line 28-35: Validate podman presence and robustly parse its version
into podman_version using a regex (e.g., extract first X.Y.Z numeric sequence
from `podman --version`) instead of assuming field 3, then compare full semantic
versions (not only podman_major) against "4.0.0" using a reliable comparator
(e.g., a small version_compare function that uses sort -V or compares numeric
fields) to decide failure; update the error message to include the detected
version and a short note that the script requires ≥4.0.0 because it relies on
features used later (e.g., `podman run --replace`), and keep the variable names
podman_version and podman_major (if still used) to locate the change.
🪄 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: 7f56f021-c472-42b3-a872-c243a6cfa8e7

📥 Commits

Reviewing files that changed from the base of the PR and between f915e4c and 6e82d4b.

📒 Files selected for processing (1)
  • src/quickstart.sh

Comment thread src/quickstart.sh
Comment thread src/quickstart.sh Outdated
Comment thread src/quickstart.sh
Comment thread src/quickstart.sh
Comment thread src/quickstart.sh Outdated
@ggiguash ggiguash self-assigned this Apr 19, 2026
Add check_prerequisites() to fail fast with actionable install
instructions when podman (or an outdated version <5) or jq is
missing, rather than hitting a cryptic command-not-found mid-run.
Package manager detection covers dnf, apt-get, and zypper.
@mmahut
Copy link
Copy Markdown
Author

mmahut commented Apr 22, 2026

@ggiguash thank you for great feedback, PR rebased.

Comment thread src/quickstart.sh

LVM_DISK="/var/lib/microshift-okd/lvmdisk.image"
VG_NAME="myvg1"
PODMAN_VMAJOR=5
Copy link
Copy Markdown
Contributor

@ggiguash ggiguash Apr 23, 2026

Choose a reason for hiding this comment

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

@mmahut , I was wrong about the Podman version. Looks like Ubuntu still provides 4.9.z, so we should relax the major version check to 4.

On the positive side, the checks work great :). - see this log.

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