Skip to content

Fail folder restores when restic restore exits non-zero - #1289

Open
sarankumar1325 wants to merge 1 commit into
k8up-io:masterfrom
sarankumar1325:fix/folder-restore-exit-code
Open

sarankumar1325 wants to merge 1 commit into
k8up-io:masterfrom
sarankumar1325:fix/folder-restore-exit-code

Conversation

@sarankumar1325

Copy link
Copy Markdown

Summary

  • folderRestore in restic/cli/restore.go ran restic restore and then returned nil no matter what. A failed or partial folder restore (for example restic failing to chmod files owned by another uid) was reported as Completed=True/Succeeded, the Job completed, k8up_jobs_failed_counter did not move, and the restore webhook was still sent.
  • It now returns cmd.FatalError, the same as the other restic wrappers (backup.go, check.go, init.go, prune.go, snapshots.go, unlock.go). Restore() already skips the webhook and passes the error on when this is set.
  • Added restic/cli/restore_test.go. It runs Restore() against a small fake restic script: a successful restore returns nil and sends the webhook, and a restore that exits 1 returns an error and sends no webhook. The failure case fails on master and passes with this change.

Tests: go test ./restic/..., go vet ./restic/cli/, golangci-lint run ./restic/cli/ (0 issues).

Fixes #1263

I wrote this with help from an AI coding assistant, and I reviewed and tested the change.

Checklist

For Code changes

  • Categorize the PR by setting a good title and adding one of the labels:
    bug, enhancement, documentation, change, breaking, dependency
    as they show up in the changelog (suggested: bug; I can't set labels from a fork)
  • PR contains the label area:operator (needs a maintainer, I can't set labels from a fork)
  • Commits are signed off
  • Link this PR to related issues
  • I have not made any changes in the charts/ directory.

folderRestore ran restic restore and always returned nil, so a failed or
partial restore was reported as Succeeded and still sent the webhook.
Return the command's FatalError like the other restic wrappers do.

Fixes k8up-io#1263

Signed-off-by: sarankumar1325 <120080287+sarankumar1325@users.noreply.github.com>
@sarankumar1325
sarankumar1325 requested a review from a team as a code owner October 29, 2026 13:54
@sarankumar1325
sarankumar1325 requested review from TheBigLee and arska and removed request for a team October 29, 2026 13:54

This branch has not been deployed

No deployments
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.

Folder restore reports Succeeded when restic restore fails

1 participant