8812 Commits

Author SHA1 Message Date
Michael Eischer
aacd6a47e3 refactor to use constructor functions to create cobra commands
This allows getting rid of the global options variables
2025-02-07 18:56:45 +01:00
Michael Eischer
dc9b6378f3 move cli flags into AddFlags on option structs 2025-02-06 22:10:41 +01:00
Michael Eischer
da47967316
Merge pull request #5194 from darkdragon-001/json-check
Json check
2025-02-05 22:15:10 +01:00
Dark Dragon
49a411f7ac Print JSON summary in all error cases 2025-02-05 22:08:06 +01:00
Dark Dragon
7cc1aa0cd4 Add check summary 2025-02-05 22:08:06 +01:00
Dark Dragon
a58a8f2ce0 Add JSON output to check command 2025-02-05 22:08:05 +01:00
Dark Dragon
79d435efb1 Use printer.NewCounter() instead of newTerminalProgressMax()
where possible (max is unknown).
2025-02-05 22:07:47 +01:00
Michael Eischer
9cdf91b406
Merge pull request #5235 from MichaelEischer/refactor-ls-sorting
Refactor ls sorting
2025-02-05 20:44:08 +01:00
Winfried Plappert
4104a8e6a5
Issue: 4942: cmd_rewrite: add snapshot summary data to an existing snapshot. (#5185)
Co-authored-by: Michael Eischer <michael.eischer@fau.de>
2025-02-05 20:40:20 +01:00
Michael Eischer
6cc06e0812 ls: add missing error handling 2025-02-03 22:15:59 +01:00
Michael Eischer
c32613a624 ls: extract comparator 2025-02-03 22:15:59 +01:00
Michael Eischer
1807627dda ls: refactor sorting into sortedPrinter struct 2025-02-03 22:15:59 +01:00
Michael Eischer
993eb112cd ls: deduplicate sorting test 2025-02-03 22:15:54 +01:00
Michael Eischer
36d8916354 ls: use numeric based enum for SortMode 2025-02-03 22:11:46 +01:00
Winfried Plappert
060a44202f
ls: sort output by size, atime, ctime, mtime, time(=mtime), extension (#5182)
Enhancement: create ability to sort output of restic ls -l by
name, size, atime, ctime, mtime, time(=mtime), X(=extension), extension

---------

Co-authored-by: Michael Eischer <michael.eischer@fau.de>
2025-02-03 22:07:04 +01:00
Michael Eischer
d79681b987
Merge pull request #5223 from restic/dependabot/go_modules/google.golang.org/api-0.219.0
build(deps): bump google.golang.org/api from 0.204.0 to 0.219.0
2025-02-03 21:32:15 +01:00
dependabot[bot]
90e2c419e4
build(deps): bump google.golang.org/api from 0.204.0 to 0.219.0
Bumps [google.golang.org/api](https://github.com/googleapis/google-api-go-client) from 0.204.0 to 0.219.0.
- [Release notes](https://github.com/googleapis/google-api-go-client/releases)
- [Changelog](https://github.com/googleapis/google-api-go-client/blob/main/CHANGES.md)
- [Commits](https://github.com/googleapis/google-api-go-client/compare/v0.204.0...v0.219.0)

---
updated-dependencies:
- dependency-name: google.golang.org/api
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-02-03 20:16:08 +00:00
Michael Eischer
7ab5bb6df4
Merge pull request #5232 from MichaelEischer/bump-go-version
Bump minimum go version to 1.22
2025-02-03 21:14:57 +01:00
Michael Eischer
efd2ec086f
Merge pull request #5179 from zmanda/fix-gh-5140-forget-reports-incorrect-number-of-files-deleted
forget: report count of deleted files correctly
2025-02-02 20:14:15 +01:00
Srigovind Nayak
8d970e36cf
tests: add unit test to check the progress counter for forget/prune 2025-02-02 20:18:56 +05:30
Srigovind Nayak
58f58a995d
parallel: increment progress bar before report function which may absorb the error
* sometimes, the report function may absorb the error and return nil, in those cases the bar.Add(1) method would execute even if the file deletion had failed
2025-02-02 19:45:36 +05:30
Michael Eischer
d71ddfb89b bump minimum go version to 1.22 2025-02-02 15:05:47 +01:00
Gilbert Gilb's
536ebefff4
feat(backends/s3): add warmup support before repacks and restores (#5173)
* feat(backends/s3): add warmup support before repacks and restores

This commit introduces basic support for transitioning pack files stored
in cold storage to hot storage on S3 and S3-compatible providers.

To prevent unexpected behavior for existing users, the feature is gated
behind new flags:

- `s3.enable-restore`: opt-in flag (defaults to false)
- `s3.restore-days`: number of days for the restored objects to remain
  in hot storage (defaults to `7`)
- `s3.restore-timeout`: maximum time to wait for a single restoration
  (default to `1 day`)
- `s3.restore-tier`: retrieval tier at which the restore will be
  processed. (default to `Standard`)

As restoration times can be lengthy, this implementation preemptively
restores selected packs to prevent incessant restore-delays during
downloads. This is slightly sub-optimal as we could process packs
out-of-order (as soon as they're transitioned), but this would really
add too much complexity for a marginal gain in speed.

To maintain simplicity and prevent resources exhautions with lots of
packs, no new concurrency mechanisms or goroutines were added. This just
hooks gracefully into the existing routines.

**Limitations:**

- Tests against the backend were not written due to the lack of cold
  storage class support in MinIO. Testing was done manually on
  Scaleway's S3-compatible object storage. If necessary, we could
  explore testing with LocalStack or mocks, though this requires further
  discussion.
- Currently, this feature only warms up before restores and repacks
  (prune/copy), as those are the two main use-cases I came across.
  Support for other commands may be added in future iterations, as long
  as affected packs can be calculated in advance.
- The feature is gated behind a new alpha `s3-restore` feature flag to
  make it explicit that the feature is still wet behind the ears.
- There is no explicit user notification for ongoing pack restorations.
  While I think it is not necessary because of the opt-in flag, showing
  some notice may improve usability (but would probably require major
  refactoring in the progress bar which I didn't want to start). Another
  possibility would be to add a flag to send restores requests and fail
  early.

See https://github.com/restic/restic/issues/3202

* ui: warn user when files are warming up from cold storage

* refactor: remove the PacksWarmer struct

It's easier to handle multiple handles in the backend directly, and it
may open the door to reducing the number of requests made to the backend
in the future.
2025-02-01 18:26:27 +00:00
Michael Eischer
9566e2db4a
Merge pull request #5222 from MichaelEischer/docs-edit-links
doc: add edit on github link
2025-02-01 18:37:05 +01:00
Michael Eischer
7829728182
Merge pull request #5225 from restic/dependabot/go_modules/github.com/Azure/azure-sdk-for-go/sdk/storage/azblob-1.6.0
build(deps): bump github.com/Azure/azure-sdk-for-go/sdk/storage/azblob from 1.5.0 to 1.6.0
2025-02-01 17:03:33 +01:00
Michael Eischer
72b343fe5a
Merge pull request #5228 from greatroar/cleanup
ui/termstatus: Remove unused bytes.Buffer
2025-02-01 16:58:54 +01:00
Michael Eischer
9c8c59c889
Merge pull request #5226 from restic/dependabot/go_modules/github.com/spf13/pflag-1.0.6
build(deps): bump github.com/spf13/pflag from 1.0.5 to 1.0.6
2025-02-01 16:57:10 +01:00
dependabot[bot]
c4d988faf8
build(deps): bump github.com/Azure/azure-sdk-for-go/sdk/storage/azblob
Bumps [github.com/Azure/azure-sdk-for-go/sdk/storage/azblob](https://github.com/Azure/azure-sdk-for-go) from 1.5.0 to 1.6.0.
- [Release notes](https://github.com/Azure/azure-sdk-for-go/releases)
- [Changelog](https://github.com/Azure/azure-sdk-for-go/blob/main/documentation/release.md)
- [Commits](https://github.com/Azure/azure-sdk-for-go/compare/sdk/azcore/v1.5.0...sdk/azcore/v1.6.0)

---
updated-dependencies:
- dependency-name: github.com/Azure/azure-sdk-for-go/sdk/storage/azblob
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-02-01 15:56:10 +00:00
Michael Eischer
080c8de1a9
Merge pull request #5227 from restic/dependabot/go_modules/github.com/Azure/azure-sdk-for-go/sdk/azidentity-1.8.1
build(deps): bump github.com/Azure/azure-sdk-for-go/sdk/azidentity from 1.8.0 to 1.8.1
2025-02-01 16:55:04 +01:00
greatroar
c1781e0abb ui/termstatus: Remove unused bytes.Buffer 2025-02-01 08:21:40 +01:00
dependabot[bot]
2b9113721c
build(deps): bump github.com/Azure/azure-sdk-for-go/sdk/azidentity
Bumps [github.com/Azure/azure-sdk-for-go/sdk/azidentity](https://github.com/Azure/azure-sdk-for-go) from 1.8.0 to 1.8.1.
- [Release notes](https://github.com/Azure/azure-sdk-for-go/releases)
- [Changelog](https://github.com/Azure/azure-sdk-for-go/blob/main/documentation/release.md)
- [Commits](https://github.com/Azure/azure-sdk-for-go/compare/sdk/azcore/v1.8.0...sdk/azidentity/v1.8.1)

---
updated-dependencies:
- dependency-name: github.com/Azure/azure-sdk-for-go/sdk/azidentity
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-02-01 01:43:20 +00:00
dependabot[bot]
afe4fcc0d9
build(deps): bump github.com/spf13/pflag from 1.0.5 to 1.0.6
Bumps [github.com/spf13/pflag](https://github.com/spf13/pflag) from 1.0.5 to 1.0.6.
- [Release notes](https://github.com/spf13/pflag/releases)
- [Commits](https://github.com/spf13/pflag/compare/v1.0.5...v1.0.6)

---
updated-dependencies:
- dependency-name: github.com/spf13/pflag
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-02-01 01:43:14 +00:00
Michael Eischer
c2e404a0ee doc: add edit on github link 2025-01-31 18:53:03 +01:00
Winfried Plappert
c4be05dbc2
Issue 4433: Ability to define sort order for output of find command (#5184)
The old sorting behaviour was to sort snapshots from oldest to newest.
The new sorting order is from newest to oldest. If one wants to revert to the
old behaviour, use the option --reverse.

---------

Co-authored-by: Michael Eischer <michael.eischer@fau.de>
2025-01-29 20:44:16 +00:00
rawtaz
d0d887138c
Merge pull request #5219 from MichaelEischer/ci-silence-shadow-builtin
CI: bump golangci-lint and silence warnings about shadowed builtins
2025-01-29 01:30:40 +01:00
Michael Eischer
8eaa4b6602 CI: bump golangci-lint to v1.63.4 2025-01-28 19:55:45 +01:00
Michael Eischer
e77681f2cd remove unnecessary min function 2025-01-28 19:52:22 +01:00
Michael Eischer
a63500663a CI: disable shadow builtin rule
Removing the shadowing cases leads to weird workarounds but doesn't help
much with code clarity.
2025-01-28 19:51:14 +01:00
Michael Eischer
fde64133df
Merge pull request #5212 from MichaelEischer/prune-fix-unused-size-duplicates
prune: correctly account for duplicates in max-unused check
2025-01-26 22:07:47 +01:00
Snshadow
6301250d83
fix: Windows VSS Event ID 8194 (#5170) 2025-01-26 15:25:38 +00:00
Michael Eischer
9331461a13 prune: correctly account for duplicates in max-unused check
The size comparison for `--max-unused` only accounted for unused but not
for duplicate data. For repositories with a large amount of duplicates
this can result in a situation where no data gets pruned even though
the amount of unused data is much higher than specified.
2025-01-19 17:47:49 +01:00
rawtaz
ed3922ac82
Merge pull request #5211 from MichaelEischer/bump-dockerfile-go-version
Bump dockerfile to go 1.23
2025-01-19 08:32:42 +01:00
Michael Eischer
8b63e1cd72
Merge pull request #5129 from tesshuflower/5089_exclude_xattrs_on_restore
Allow excluding xattrs at restore time
2025-01-18 23:15:11 +01:00
Michael Eischer
5e8654c71d restore: fix xattr filter test on windows 2025-01-18 23:07:39 +01:00
Michael Eischer
d5a94583ed bump dockerfile to go 1.23 2025-01-18 18:27:43 +01:00
Srigovind Nayak
115ecb3c92
tag: output the original ID and new snapshotID (#5144)
* tag: output the original ID and new snapshotID

tag: print changed snapshot information immediately

* print changed snapshot immediately after it has been saved
* add message type to the changedSnapshot
* add a summary type which will share the JSON output of the numer of changed snapshots
* updated verbosity of the changed snapshot in text mode to only work when verbosity > 2
* also use the terminal status printer for a standard handling for stdout messages
2025-01-14 18:57:47 +01:00
Michael Eischer
e6f9cfb8c8
Merge pull request #5168 from MichaelEischer/restrict-repository-unpacked
repository: restrict SaveUnpacked and RemoveUnpacked
2025-01-13 22:49:44 +01:00
Michael Eischer
b7ff8ea9cd repository: expose cache via method 2025-01-13 22:40:18 +01:00
Michael Eischer
99e105eeb6 repository: restrict SaveUnpacked and RemoveUnpacked
Those methods now only allow modifying snapshots. Internal data types
used by the repository are now read-only. The repository-internal code
can bypass the restrictions by wrapping the repository in an
`internalRepository` type.

The restriction itself is implemented by using a new datatype
WriteableFileType in the SaveUnpacked and RemoveUnpacked methods. This
statically ensures that code cannot bypass the access restrictions.

The test changes are somewhat noisy as some of them modify repository
internals and therefore require some way to bypass the access
restrictions. This works by capturing an `internalRepository` or
`Backend` when creating the Repository using a test helper function.
2025-01-13 22:39:57 +01:00
Albin Vass
5bf0204caf
Do not skip root tree when searching for trees (#5153)
This fixes an issue where restic cannot find the tree when trying to find the
tree id of a snapshot.

---------

Co-authored-by: Albin Vass <albinvass@gmail.com>
Co-authored-by: Michael Eischer <michael.eischer@fau.de>
2025-01-13 21:08:38 +00:00