diff --git a/internal/k8s/job_helpers_test.go b/internal/k8s/job_helpers_test.go index 20eafb3..b0fe509 100644 --- a/internal/k8s/job_helpers_test.go +++ b/internal/k8s/job_helpers_test.go @@ -82,7 +82,7 @@ func TestJobNameBackupCommandAndResticEnvCoverRemainingBranches(t *testing.T) { Dedupe: &dedupe, KeepLast: &keepLast, }) - if !strings.Contains(cmd, "restic unlock") || !strings.Contains(cmd, "restic init") || !strings.Contains(cmd, "--tag dedupe=off") || !strings.Contains(cmd, "--keep-last 3") { + if !strings.Contains(cmd, "restic unlock") || !strings.Contains(cmd, "restic cat config") || !strings.Contains(cmd, "restic rebuild-index") || !strings.Contains(cmd, "restic init") || !strings.Contains(cmd, "--tag dedupe=off") || !strings.Contains(cmd, "--keep-last 3") { t.Fatalf("expected backup command to include bootstrap/dedupe/keep-last logic, got %q", cmd) } if !strings.Contains(cmd, "--exclude *.tmp") || !strings.Contains(cmd, "--tag nightly") || !strings.Contains(cmd, "--tag prod") { diff --git a/internal/k8s/job_manifests.go b/internal/k8s/job_manifests.go index 5a3019c..1f01868 100644 --- a/internal/k8s/job_manifests.go +++ b/internal/k8s/job_manifests.go @@ -230,7 +230,7 @@ func backupCommand(cfg *config.Config, req api.BackupRequest) string { cmd = fmt.Sprintf("%s && %s", cmd, forget) } - bootstrap := "restic unlock >/dev/null 2>&1 || true; restic snapshots >/dev/null 2>&1 || restic init" + bootstrap := "restic unlock >/dev/null 2>&1 || true; restic cat config >/dev/null 2>&1 || restic init; restic snapshots >/dev/null 2>&1 || restic rebuild-index" return "set -euo pipefail; " + bootstrap + "; " + cmd }