feat: encrypt S3 archives and test credentials and interruption recovery

This commit is contained in:
Chubboy Ren
2026-11-18 02:05:17 +00:00
parent 3d44e9cd0d
commit da7cc62d4e
9 changed files with 892 additions and 207 deletions
+9 -2
View File
@@ -437,9 +437,16 @@ func recoverTaskArchiveStages(dataDir string, pg *pgdb.DB) error {
stage := &taskArchiveFileStage{root: root, payload: filepath.Join(root, "payload"), journal: journal}
if err := stage.rollback(); err != nil {
errs = append(errs, err)
continue
}
if archive != nil && archive.ArchivePath != "" && !strings.HasPrefix(archive.ArchivePath, "s3://") {
_ = os.Remove(archive.ArchivePath)
// The process can exit after compression but before an upload journal or
// database location exists. Remove that temporary package only after the
// source-file rollback succeeds, for both local and remote backends.
packagePath := taskArchivePath(dataDir, journal.ArchiveID, journal.TaskID)
if err := validateArchivePath(dataDir, packagePath); err != nil {
errs = append(errs, err)
} else if err := removeLocalArchivePackage(packagePath); err != nil {
errs = append(errs, err)
}
}
return errors.Join(errs...)