Skip to content

Commit 2a04315

Browse files
authored
Prepare for release 8.0.14-v23 (#687)
ProductLine: Stash Release: v2023.03.13 Release-tracker: stashed/CHANGELOG#63 Signed-off-by: 1gtm <1gtm@appscode.com>
1 parent 93517b8 commit 2a04315

File tree

4 files changed

+19
-15
lines changed

4 files changed

+19
-15
lines changed

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ require (
1515
kmodules.xyz/client-go v0.25.12
1616
kmodules.xyz/custom-resources v0.25.0
1717
kmodules.xyz/offshoot-api v0.25.0
18-
stash.appscode.dev/apimachinery v0.26.0
18+
stash.appscode.dev/apimachinery v0.27.0
1919
)
2020

2121
require (

go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -898,5 +898,5 @@ sigs.k8s.io/structured-merge-diff/v4 v4.2.3 h1:PRbqxJClWWYMNV1dhaG4NsibJbArud9kF
898898
sigs.k8s.io/structured-merge-diff/v4 v4.2.3/go.mod h1:qjx8mGObPmV2aSZepjQjbmb2ihdVs8cGKBraizNC69E=
899899
sigs.k8s.io/yaml v1.3.0 h1:a2VclLzOGrwOHDiV8EfBGhvjHvP46CtW5j6POvhYGGo=
900900
sigs.k8s.io/yaml v1.3.0/go.mod h1:GeOyir5tyXNByN85N/dRIT9es5UQNerPYEKK56eTBm8=
901-
stash.appscode.dev/apimachinery v0.26.0 h1:74H87DYEMFUO6vesQARIaiXG9N6wSyakTzSoJhBRJZ0=
902-
stash.appscode.dev/apimachinery v0.26.0/go.mod h1:SLknx4Og4nrUflEJIQF5gjolXmetqXrpisoDlFNV2DI=
901+
stash.appscode.dev/apimachinery v0.27.0 h1:3Ldo0ncYnsRT4VukSrawan0jWjc+D/nss1yAyDjWj8A=
902+
stash.appscode.dev/apimachinery v0.27.0/go.mod h1:0bPMB3d0+3oR2hBqFeZyskBDEO5CyWnkHNV+Gp67bMA=

vendor/modules.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -664,7 +664,7 @@ sigs.k8s.io/structured-merge-diff/v4/value
664664
# sigs.k8s.io/yaml v1.3.0
665665
## explicit; go 1.12
666666
sigs.k8s.io/yaml
667-
# stash.appscode.dev/apimachinery v0.26.0
667+
# stash.appscode.dev/apimachinery v0.27.0
668668
## explicit; go 1.18
669669
stash.appscode.dev/apimachinery/apis
670670
stash.appscode.dev/apimachinery/apis/repositories

vendor/stash.appscode.dev/apimachinery/pkg/restic/commands.go

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -149,12 +149,7 @@ func (w *ResticWrapper) backupFromStdin(options BackupOptions) ([]byte, error) {
149149
klog.Infoln("Backing up stdin data")
150150

151151
// first add StdinPipeCommands, then add restic command
152-
var commands []Command
153-
if len(options.StdinPipeCommands) != 0 {
154-
for i := range options.StdinPipeCommands {
155-
commands = append(commands, options.StdinPipeCommands[i])
156-
}
157-
}
152+
commands := options.StdinPipeCommands
158153

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

175+
out, err := w.tryCleanup(retentionPolicy, host)
176+
if err == nil || !strings.Contains(err.Error(), "unlock") {
177+
return out, err
178+
}
179+
// repo is locked, so unlock first
180+
klog.Warningln("repo found locked, so unlocking before pruning, err:", err.Error())
181+
if o2, e2 := w.unlock(); e2 != nil {
182+
return o2, e2
183+
}
184+
return w.tryCleanup(retentionPolicy, host)
185+
}
186+
187+
func (w *ResticWrapper) tryCleanup(retentionPolicy v1alpha1.RetentionPolicy, host string) ([]byte, error) {
180188
args := []interface{}{"forget", "--quiet", "--json"}
181189

182190
if host != "" {
@@ -304,11 +312,7 @@ func (w *ResticWrapper) dump(dumpOptions DumpOptions) ([]byte, error) {
304312
commands := []Command{
305313
{Name: ResticCMD, Args: args},
306314
}
307-
if len(dumpOptions.StdoutPipeCommands) != 0 {
308-
for i := range dumpOptions.StdoutPipeCommands {
309-
commands = append(commands, dumpOptions.StdoutPipeCommands[i])
310-
}
311-
}
315+
commands = append(commands, dumpOptions.StdoutPipeCommands...)
312316
return w.run(commands...)
313317
}
314318

0 commit comments

Comments
 (0)