backube / volsync

Asynchronous data replication for Kubernetes volumes
https://volsync.readthedocs.io
GNU Affero General Public License v3.0
601 stars 68 forks source link

update ensure_initialized in restic mover script #1420

Closed tesshuflower closed 1 month ago

tesshuflower commented 1 month ago

Describe what this PR does

Updates the ensure_initialized function in the restic mover script.

I came across this info in the restic docs: https://restic.readthedocs.io/en/stable/075_scripting.html#check-if-a-repository-is-already-initialized

Essentially it recommends using restic cat config in order to determine if a repo has been initialized.

A few things:

Generally this may not be needed as restic init is still supposed to fail if the repo has been previously initialized, but this moves more towards the recommended way for restic.

Also adds an e2e test for the gitops scenario of restoring from a non-existent bucket/repo.

Is there anything that requires special attention?

Related issues:

sonarcloud[bot] commented 1 month ago

Quality Gate Passed Quality Gate passed

Issues
0 New issues
0 Accepted issues

Measures
0 Security Hotspots
0.0% Coverage on New Code
0.0% Duplication on New Code

See analysis details on SonarCloud

codecov[bot] commented 1 month ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 67.4%. Comparing base (b46916a) to head (ed1c9c6). Report is 9 commits behind head on main.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #1420 +/- ## ======================================= - Coverage 67.6% 67.4% -0.2% ======================================= Files 57 57 Lines 5844 5844 ======================================= - Hits 3952 3941 -11 - Misses 1609 1615 +6 - Partials 283 288 +5 ``` | [Files with missing lines](https://app.codecov.io/gh/backube/volsync/pull/1420?dropdown=coverage&src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=backube) | Coverage Δ | | |---|---|---| | [controllers/mover/restic/logfilter.go](https://app.codecov.io/gh/backube/volsync/pull/1420?src=pr&el=tree&filepath=controllers%2Fmover%2Frestic%2Flogfilter.go&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=backube#diff-Y29udHJvbGxlcnMvbW92ZXIvcmVzdGljL2xvZ2ZpbHRlci5nbw==) | `100.0% <ø> (ø)` | | ... and [1 file with indirect coverage changes](https://app.codecov.io/gh/backube/volsync/pull/1420/indirect-changes?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=backube)
tesshuflower commented 1 month ago

/cc @JohnStrunk

openshift-ci[bot] commented 1 month ago

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: JohnStrunk, tesshuflower

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files: - ~~[OWNERS](https://github.com/backube/volsync/blob/main/OWNERS)~~ [JohnStrunk,tesshuflower] Approvers can indicate their approval by writing `/approve` in a comment Approvers can cancel approval by writing `/approve cancel` in a comment
tesshuflower commented 1 month ago

/retest