Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prepare for release 11.9-v22 #1161

Merged
merged 1 commit into from
Mar 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ require (
kmodules.xyz/client-go v0.25.12
kmodules.xyz/custom-resources v0.25.0
kmodules.xyz/offshoot-api v0.25.0
stash.appscode.dev/apimachinery v0.26.0
stash.appscode.dev/apimachinery v0.27.0
)

require (
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -898,5 +898,5 @@ sigs.k8s.io/structured-merge-diff/v4 v4.2.3 h1:PRbqxJClWWYMNV1dhaG4NsibJbArud9kF
sigs.k8s.io/structured-merge-diff/v4 v4.2.3/go.mod h1:qjx8mGObPmV2aSZepjQjbmb2ihdVs8cGKBraizNC69E=
sigs.k8s.io/yaml v1.3.0 h1:a2VclLzOGrwOHDiV8EfBGhvjHvP46CtW5j6POvhYGGo=
sigs.k8s.io/yaml v1.3.0/go.mod h1:GeOyir5tyXNByN85N/dRIT9es5UQNerPYEKK56eTBm8=
stash.appscode.dev/apimachinery v0.26.0 h1:74H87DYEMFUO6vesQARIaiXG9N6wSyakTzSoJhBRJZ0=
stash.appscode.dev/apimachinery v0.26.0/go.mod h1:SLknx4Og4nrUflEJIQF5gjolXmetqXrpisoDlFNV2DI=
stash.appscode.dev/apimachinery v0.27.0 h1:3Ldo0ncYnsRT4VukSrawan0jWjc+D/nss1yAyDjWj8A=
stash.appscode.dev/apimachinery v0.27.0/go.mod h1:0bPMB3d0+3oR2hBqFeZyskBDEO5CyWnkHNV+Gp67bMA=
2 changes: 1 addition & 1 deletion vendor/modules.txt
Original file line number Diff line number Diff line change
Expand Up @@ -664,7 +664,7 @@ sigs.k8s.io/structured-merge-diff/v4/value
# sigs.k8s.io/yaml v1.3.0
## explicit; go 1.12
sigs.k8s.io/yaml
# stash.appscode.dev/apimachinery v0.26.0
# stash.appscode.dev/apimachinery v0.27.0
## explicit; go 1.18
stash.appscode.dev/apimachinery/apis
stash.appscode.dev/apimachinery/apis/repositories
Expand Down
26 changes: 15 additions & 11 deletions vendor/stash.appscode.dev/apimachinery/pkg/restic/commands.go
Original file line number Diff line number Diff line change
Expand Up @@ -149,12 +149,7 @@ func (w *ResticWrapper) backupFromStdin(options BackupOptions) ([]byte, error) {
klog.Infoln("Backing up stdin data")

// first add StdinPipeCommands, then add restic command
var commands []Command
if len(options.StdinPipeCommands) != 0 {
for i := range options.StdinPipeCommands {
commands = append(commands, options.StdinPipeCommands[i])
}
}
commands := options.StdinPipeCommands

args := []interface{}{"backup", "--stdin", "--quiet", "--json"}
if options.StdinFileName != "" {
Expand All @@ -177,6 +172,19 @@ func (w *ResticWrapper) backupFromStdin(options BackupOptions) ([]byte, error) {
func (w *ResticWrapper) cleanup(retentionPolicy v1alpha1.RetentionPolicy, host string) ([]byte, error) {
klog.Infoln("Cleaning old snapshots according to retention policy")

out, err := w.tryCleanup(retentionPolicy, host)
if err == nil || !strings.Contains(err.Error(), "unlock") {
return out, err
}
// repo is locked, so unlock first
klog.Warningln("repo found locked, so unlocking before pruning, err:", err.Error())
if o2, e2 := w.unlock(); e2 != nil {
return o2, e2
}
return w.tryCleanup(retentionPolicy, host)
}

func (w *ResticWrapper) tryCleanup(retentionPolicy v1alpha1.RetentionPolicy, host string) ([]byte, error) {
args := []interface{}{"forget", "--quiet", "--json"}

if host != "" {
Expand Down Expand Up @@ -304,11 +312,7 @@ func (w *ResticWrapper) dump(dumpOptions DumpOptions) ([]byte, error) {
commands := []Command{
{Name: ResticCMD, Args: args},
}
if len(dumpOptions.StdoutPipeCommands) != 0 {
for i := range dumpOptions.StdoutPipeCommands {
commands = append(commands, dumpOptions.StdoutPipeCommands[i])
}
}
commands = append(commands, dumpOptions.StdoutPipeCommands...)
return w.run(commands...)
}

Expand Down