Skip to content

Commit

Permalink
Prepare for release 2.6.1-v11 (#90)
Browse files Browse the repository at this point in the history
ProductLine: Stash

Release: v2023.03.13

Release-tracker: stashed/CHANGELOG#63

Signed-off-by: 1gtm <1gtm@appscode.com>
  • Loading branch information
1gtm authored Mar 13, 2023
1 parent 78b4136 commit 29202da
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 15 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,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

0 comments on commit 29202da

Please sign in to comment.