Skip to content

Fix release bundle check to detect CLI-only installs#759

Merged
phinze merged 2 commits into
mainfrom
phinze/mir-1008-runner-install-skips-release-bundle-download-when-cli-only
Apr 14, 2026
Merged

Fix release bundle check to detect CLI-only installs#759
phinze merged 2 commits into
mainfrom
phinze/mir-1008-runner-install-skips-release-bundle-download-when-cli-only

Conversation

@phinze
Copy link
Copy Markdown
Contributor

@phinze phinze commented Apr 13, 2026

Found this on miren-toys-runner-2 during MIR-965 validation. When the startup script runs the bash installer first (to get the CLI on the box) and then miren runner install, the install sees /var/lib/miren/release/miren and thinks the full release bundle is already there. It's not, containerd and friends are missing, so the runner crash-loops.

The fix swaps the sentinel from the miren binary (which the CLI-only installer also drops) to the containerd binary (which only comes from the full release tarball). While I was in there, runner_install.go and server_install.go had near-identical copies of this check-download-selinux block, so I pulled it into a shared ensureReleaseBundlePresent() helper and promoted the hardcoded path strings to package-level consts.

Closes MIR-1008

The bash installer (api.miren.cloud/install) drops a CLI-only miren
binary at /var/lib/miren/release/miren. Both server install and
runner install used that path as their "is the release bundle
present?" sentinel, so they'd see the binary and skip the download.
The runner would then crash-loop on "containerd binary not found"
because the full bundle (containerd, runc, shims) was never fetched.

Switch the sentinel to the containerd binary, which only exists in
the full release tarball. Also consolidate the duplicated
check-download-selinux block into a shared ensureReleaseBundlePresent
helper and pull the scattered path literals into package-level consts.
@phinze phinze requested a review from a team as a code owner April 13, 2026 23:16
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 13, 2026

📝 Walkthrough

Walkthrough

The changes refactor release-bundle provisioning into a new helper ensureReleaseBundlePresent and introduce package constants releaseDir and releaseBinPath. RunnerInstall and ServerInstall now call ensureReleaseBundlePresent instead of performing inline checks/downloads and SELinux fixes. Systemd unit generation and local client operations were updated to reference releaseBinPath for executable paths rather than previously used hardcoded/local paths.


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

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

Inline comments:
In `@cli/commands/server_install.go`:
- Around line 226-231: The call to PerformDownloadRelease passes
DownloadReleaseOptions with Force: false which prevents replacing an existing
partial CLI-only release directory, causing full bundle downloads to fail;
change the options at the PerformDownloadRelease call site to set Force: true
(i.e., update the DownloadReleaseOptions used by PerformDownloadRelease in
server_install.go) so the existing releaseDir can be overwritten after detecting
the missing containerd sentinel, allowing the full bundle to be downloaded and
installed.
🪄 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: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 64662d4f-5649-400f-b60a-ed412110c084

📥 Commits

Reviewing files that changed from the base of the PR and between 9456ad5 and b034b9a.

📒 Files selected for processing (2)
  • cli/commands/runner_install.go
  • cli/commands/server_install.go

Comment thread cli/commands/server_install.go
When the CLI-only installer has already run, the release directory
exists (containing just the miren binary). PerformDownloadRelease
with Force: false would bail with "release directory already exists",
so the full bundle never gets fetched. Force: true is safe here
because we've already confirmed the bundle is incomplete via the
containerd sentinel check.
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: 1

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

Inline comments:
In `@cli/commands/server_install.go`:
- Around line 220-237: The SELinux fix is only applied when the release is
downloaded; ensure fixSELinuxContext(releaseBinPath) runs for existing bundles
too by moving or adding the call outside the download-only branch so it executes
regardless of whether PerformDownloadRelease was invoked; update the block that
checks sentinelPath (referencing sentinelPath, PerformDownloadRelease, and
releaseDir) to always call fixSELinuxContext(releaseBinPath) after the existence
check (and after any download path completes) so systemd can exec the binary on
enforcing SELinux hosts.
🪄 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: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: c699e652-856d-4b6b-b93a-dff4bff6746c

📥 Commits

Reviewing files that changed from the base of the PR and between b034b9a and 8e8dd56.

📒 Files selected for processing (1)
  • cli/commands/server_install.go

Comment on lines +220 to +237
if _, err := os.Stat(sentinelPath); err != nil {
if !os.IsNotExist(err) {
return fmt.Errorf("failed to inspect %s: %w", sentinelPath, err)
}
ctx.Info("Release bundle not found at %s, downloading...", releaseDir)

if err := PerformDownloadRelease(ctx, DownloadReleaseOptions{
Branch: branch,
Global: true,
Force: true,
Output: releaseDir,
}); err != nil {
return fmt.Errorf("failed to download release: %w", err)
}

ctx.Completed("Release downloaded successfully")
fixSELinuxContext(ctx, releaseBinPath)
}
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

Always re-apply the SELinux context for an existing release bundle.

Line 236 only runs fixSELinuxContext after a fresh download. If the full bundle is already present before miren server install runs, the containerd sentinel passes and this path now skips the context fix entirely, so systemd can still fail to exec /var/lib/miren/release/miren on enforcing SELinux hosts.

🔧 Proposed fix
 func ensureReleaseBundlePresent(ctx *Context, branch string) error {
 	sentinelPath := filepath.Join(releaseDir, "containerd")

 	if _, err := os.Stat(sentinelPath); err != nil {
 		if !os.IsNotExist(err) {
 			return fmt.Errorf("failed to inspect %s: %w", sentinelPath, err)
 		}
 		ctx.Info("Release bundle not found at %s, downloading...", releaseDir)

 		if err := PerformDownloadRelease(ctx, DownloadReleaseOptions{
 			Branch: branch,
 			Global: true,
 			Force:  true,
 			Output: releaseDir,
 		}); err != nil {
 			return fmt.Errorf("failed to download release: %w", err)
 		}

 		ctx.Completed("Release downloaded successfully")
-		fixSELinuxContext(ctx, releaseBinPath)
 	}
+	fixSELinuxContext(ctx, releaseBinPath)
 	return nil
 }

Based on learnings: full release artifacts are handled through cli/commands/download_release.go, separate from binary-only installs.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@cli/commands/server_install.go` around lines 220 - 237, The SELinux fix is
only applied when the release is downloaded; ensure
fixSELinuxContext(releaseBinPath) runs for existing bundles too by moving or
adding the call outside the download-only branch so it executes regardless of
whether PerformDownloadRelease was invoked; update the block that checks
sentinelPath (referencing sentinelPath, PerformDownloadRelease, and releaseDir)
to always call fixSELinuxContext(releaseBinPath) after the existence check (and
after any download path completes) so systemd can exec the binary on enforcing
SELinux hosts.

@phinze phinze merged commit 73ca59a into main Apr 14, 2026
14 checks passed
@phinze phinze deleted the phinze/mir-1008-runner-install-skips-release-bundle-download-when-cli-only branch April 14, 2026 18:19
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