Commit 62541929 authored by ale's avatar ale

Set the dataset_source tag on restic backups

parent c93018f2
Pipeline #4753 failed with stages
in 4 minutes and 48 seconds
......@@ -156,7 +156,7 @@ func (r *resticRepository) Prepare(ctx context.Context, rctx RuntimeContext, bac
}
func resticBackupTags(backup *Backup, ds *Dataset) string {
return fmt.Sprintf("--tag dataset_id=%s --tag backup_id=%s", ds.ID, backup.ID)
return fmt.Sprintf("--tag dataset_id=%s --tag backup_id=%s --tag dataset_source=%s", ds.ID, backup.ID, ds.Source)
}
func (r *resticRepository) cacheArgs(ds *Dataset) string {
......@@ -181,6 +181,11 @@ func (r *resticRepository) BackupCmd(backup *Backup, ds *Dataset, inputFile stri
}
func (r *resticRepository) getSnapshotID(ctx context.Context, rctx RuntimeContext, backup *Backup, ds *Dataset) (string, error) {
if ds.SnapshotID != "" {
return ds.SnapshotID, nil
}
// Legacy compatibility: query restic using the dataset ID.
data, err := rctx.Shell().Output(ctx, fmt.Sprintf(
"%s snapshots --no-cache --no-lock --json %s",
r.resticCmd(),
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment