From 0bae6b4330e3dfd14cd5d05ba94116c367883ddf Mon Sep 17 00:00:00 2001 From: "Md. Ishtiaq Islam" Date: Fri, 3 Jan 2025 17:53:02 +0600 Subject: [PATCH 1/4] Add migrate cmd Signed-off-by: Md. Ishtiaq Islam --- Makefile | 2 +- pkg/cli.go | 2 +- pkg/migrate.go | 158 +++++++++++++++++++++++++++++++++++++++++++++++++ pkg/root.go | 1 + 4 files changed, 161 insertions(+), 2 deletions(-) create mode 100644 pkg/migrate.go diff --git a/Makefile b/Makefile index 7c3fc82ee..e31055738 100644 --- a/Makefile +++ b/Makefile @@ -56,7 +56,7 @@ ARCH := $(if $(GOARCH),$(GOARCH),$(shell go env GOARCH)) GO_VERSION ?= 1.23 BUILD_IMAGE ?= ghcr.io/appscode/golang-dev:$(GO_VERSION) -RESTIC_VER := 0.13.1 +RESTIC_VER := 0.17.3 OUTBIN = bin/$(BIN)-$(OS)-$(ARCH) ifeq ($(OS),windows) diff --git a/pkg/cli.go b/pkg/cli.go index 1c0456f9a..343cde1d2 100644 --- a/pkg/cli.go +++ b/pkg/cli.go @@ -35,7 +35,7 @@ const ( passwordFile = "password.txt" ResticEnvs = "restic-envs" - ResticRegistry = "stashed" + ResticRegistry = "restic" ResticImage = "restic" ResticTag = "latest" cmdKubectl = "kubectl" diff --git a/pkg/migrate.go b/pkg/migrate.go new file mode 100644 index 000000000..7f5ee5a62 --- /dev/null +++ b/pkg/migrate.go @@ -0,0 +1,158 @@ +package pkg + +import ( + "context" + "fmt" + "github.com/pkg/errors" + "github.com/spf13/cobra" + core "k8s.io/api/core/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/cli-runtime/pkg/genericclioptions" + "k8s.io/client-go/kubernetes" + "k8s.io/client-go/rest" + "k8s.io/klog/v2" + "os" + "path/filepath" + "stash.appscode.dev/apimachinery/apis/stash/v1alpha1" + cs "stash.appscode.dev/apimachinery/client/clientset/versioned" + "stash.appscode.dev/apimachinery/pkg/restic" + "stash.appscode.dev/stash/pkg/util" +) + +type migrateOptions struct { + kubeClient *kubernetes.Clientset + config *rest.Config + repo *v1alpha1.Repository +} + +func NewCmdMigrateRepositoryToV2(clientGetter genericclioptions.RESTClientGetter) *cobra.Command { + opt := migrateOptions{} + + cmd := &cobra.Command{ + Use: "migrate", + Short: `Migrate restic repository to v2`, + DisableAutoGenTag: true, + RunE: func(cmd *cobra.Command, args []string) error { + if len(args) == 0 || args[0] == "" { + return fmt.Errorf("repository name not found") + } + repositoryName := args[0] + + var err error + opt.config, err = clientGetter.ToRESTConfig() + if err != nil { + return errors.Wrap(err, "failed to read kubeconfig") + } + namespace, _, err = clientGetter.ToRawKubeConfigLoader().Namespace() + if err != nil { + return err + } + + stshclient, err := cs.NewForConfig(opt.config) + if err != nil { + return err + } + + opt.repo, err = stshclient.StashV1alpha1().Repositories(namespace).Get(context.TODO(), repositoryName, metav1.GetOptions{}) + if err != nil { + return err + } + + opt.kubeClient, err = kubernetes.NewForConfig(opt.config) + if err != nil { + return err + } + + if opt.repo.Spec.Backend.Local != nil { + // get the pod that mount this repository as volume + pod, err := getBackendMountingPod(opt.kubeClient, opt.repo) + if err != nil { + return err + } + return opt.migrateRepoFromPod(pod) + } + + return opt.migrateRepo() + }, + } + + cmd.Flags().StringVar(&imgRestic.Registry, "docker-registry", imgRestic.Registry, "Docker image registry for restic cli") + cmd.Flags().StringVar(&imgRestic.Tag, "image-tag", imgRestic.Tag, "Restic docker image tag") + + return cmd +} + +func (opt *migrateOptions) migrateRepoFromPod(pod *core.Pod) error { + if err := opt.executeMigrateRepoCmdInPod(pod); err != nil { + return err + } + + klog.Infof("Repository %s/%s upgraded to version 2", namespace, opt.repo.Name) + return nil +} + +func (opt *migrateOptions) executeMigrateRepoCmdInPod(pod *core.Pod) error { + command := []string{"/stash-enterprise", "migrate"} + command = append(command, "--repo-name", opt.repo.Name, "--repo-namespace", opt.repo.Namespace) + + out, err := execCommandOnPod(opt.kubeClient, opt.config, pod, command) + if string(out) != "" { + klog.Infoln("Output:", string(out)) + } + return err +} + +func (opt *migrateOptions) migrateRepo() error { + // get source repository secret + secret, err := opt.kubeClient.CoreV1().Secrets(namespace).Get(context.TODO(), opt.repo.Spec.Backend.StorageSecretName, metav1.GetOptions{}) + if err != nil { + return err + } + + if err = os.MkdirAll(ScratchDir, 0o755); err != nil { + return err + } + defer os.RemoveAll(ScratchDir) + + // configure restic wrapper + extraOpt := util.ExtraOptions{ + StorageSecret: secret, + ScratchDir: ScratchDir, + } + // configure setupOption + setupOpt, err := util.SetupOptionsForRepository(*opt.repo, extraOpt) + if err != nil { + return fmt.Errorf("setup option for repository failed") + } + + resticWrapper, err := restic.NewResticWrapper(setupOpt) + if err != nil { + return err + } + + localDirs := &cliLocalDirectories{ + configDir: filepath.Join(ScratchDir, configDirName), + } + // dump restic's environments into `restic-env` file. + // we will pass this env file to restic docker container. + err = resticWrapper.DumpEnv(localDirs.configDir, ResticEnvs) + if err != nil { + return err + } + + extraAgrs := []string{ + "upgrade_repo_v2", "--no-cache", + } + + // For TLS secured Minio/REST server, specify cert path + if resticWrapper.GetCaPath() != "" { + extraAgrs = append(extraAgrs, "--cacert", resticWrapper.GetCaPath()) + } + + // run restore inside docker + if err = runCmdViaDocker(*localDirs, "migrate", extraAgrs); err != nil { + return err + } + klog.Infof("Repository %s/%s upgraded to version 2", namespace, opt.repo.Name) + return nil +} diff --git a/pkg/root.go b/pkg/root.go index 78f6735e8..b391d8fe4 100644 --- a/pkg/root.go +++ b/pkg/root.go @@ -66,5 +66,6 @@ func NewRootCmd() *cobra.Command { rootCmd.AddCommand(NewCmdKey(f)) rootCmd.AddCommand(NewCmdCheckRepository(f)) rootCmd.AddCommand(NewCmdRebuildIndex(f)) + rootCmd.AddCommand(NewCmdMigrateRepositoryToV2(f)) return rootCmd } From 54379f02c394a055c83a4cd339cac03d51bc151d Mon Sep 17 00:00:00 2001 From: "Md. Ishtiaq Islam" Date: Tue, 7 Jan 2025 18:27:09 +0600 Subject: [PATCH 2/4] Add prune cmd Signed-off-by: Md. Ishtiaq Islam --- pkg/migrate.go | 30 ++++++-- pkg/prune.go | 198 +++++++++++++++++++++++++++++++++++++++++++++++++ pkg/root.go | 1 + pkg/unlock.go | 1 + 4 files changed, 224 insertions(+), 6 deletions(-) create mode 100644 pkg/prune.go diff --git a/pkg/migrate.go b/pkg/migrate.go index 7f5ee5a62..6ddd612ab 100644 --- a/pkg/migrate.go +++ b/pkg/migrate.go @@ -1,8 +1,32 @@ +/* +Copyright AppsCode Inc. and Contributors + +Licensed under the AppsCode Community License 1.0.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + https://github.com/appscode/licenses/raw/1.0.0/AppsCode-Community-1.0.0.md + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + package pkg import ( "context" "fmt" + "os" + "path/filepath" + + "stash.appscode.dev/apimachinery/apis/stash/v1alpha1" + cs "stash.appscode.dev/apimachinery/client/clientset/versioned" + "stash.appscode.dev/apimachinery/pkg/restic" + "stash.appscode.dev/stash/pkg/util" + "github.com/pkg/errors" "github.com/spf13/cobra" core "k8s.io/api/core/v1" @@ -11,12 +35,6 @@ import ( "k8s.io/client-go/kubernetes" "k8s.io/client-go/rest" "k8s.io/klog/v2" - "os" - "path/filepath" - "stash.appscode.dev/apimachinery/apis/stash/v1alpha1" - cs "stash.appscode.dev/apimachinery/client/clientset/versioned" - "stash.appscode.dev/apimachinery/pkg/restic" - "stash.appscode.dev/stash/pkg/util" ) type migrateOptions struct { diff --git a/pkg/prune.go b/pkg/prune.go new file mode 100644 index 000000000..cb26aa203 --- /dev/null +++ b/pkg/prune.go @@ -0,0 +1,198 @@ +/* +Copyright AppsCode Inc. and Contributors + +Licensed under the AppsCode Community License 1.0.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + https://github.com/appscode/licenses/raw/1.0.0/AppsCode-Community-1.0.0.md + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package pkg + +import ( + "context" + "fmt" + "os" + "path/filepath" + + "stash.appscode.dev/apimachinery/apis/stash/v1alpha1" + cs "stash.appscode.dev/apimachinery/client/clientset/versioned" + "stash.appscode.dev/apimachinery/pkg/restic" + "stash.appscode.dev/stash/pkg/util" + + "github.com/pkg/errors" + "github.com/spf13/cobra" + core "k8s.io/api/core/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/cli-runtime/pkg/genericclioptions" + "k8s.io/client-go/kubernetes" + "k8s.io/client-go/rest" + "k8s.io/klog/v2" +) + +type pruneOptions struct { + kubeClient *kubernetes.Clientset + config *rest.Config + repo *v1alpha1.Repository + + maxUnusedLimit string + maxRepackSize string + dryRun bool +} + +func NewCmdPruneRepository(clientGetter genericclioptions.RESTClientGetter) *cobra.Command { + opt := pruneOptions{} + + cmd := &cobra.Command{ + Use: "prune", + Short: `Prune restic repository`, + DisableAutoGenTag: true, + RunE: func(cmd *cobra.Command, args []string) error { + if len(args) == 0 || args[0] == "" { + return fmt.Errorf("repository name not found") + } + repositoryName := args[0] + + var err error + opt.config, err = clientGetter.ToRESTConfig() + if err != nil { + return errors.Wrap(err, "failed to read kubeconfig") + } + namespace, _, err = clientGetter.ToRawKubeConfigLoader().Namespace() + if err != nil { + return err + } + + stshclient, err := cs.NewForConfig(opt.config) + if err != nil { + return err + } + + opt.repo, err = stshclient.StashV1alpha1().Repositories(namespace).Get(context.TODO(), repositoryName, metav1.GetOptions{}) + if err != nil { + return err + } + + opt.kubeClient, err = kubernetes.NewForConfig(opt.config) + if err != nil { + return err + } + + extraArgs := opt.getUserExtraArguments() + if opt.repo.Spec.Backend.Local != nil { + // get the pod that mount this repository as volume + pod, err := getBackendMountingPod(opt.kubeClient, opt.repo) + if err != nil { + return err + } + return opt.pruneRepoFromPod(pod, extraArgs) + } + + return opt.pruneRepo(extraArgs) + }, + } + + cmd.Flags().StringVar(&opt.maxUnusedLimit, "max-unused-limit", "", "allow unused data up to the specified limit within the repository") + cmd.Flags().StringVar(&opt.maxRepackSize, "max-repack-size", "", "limit the total size of files to repack") + cmd.Flags().BoolVar(&opt.dryRun, "dry-run", false, "only show what prune would do") + + cmd.Flags().StringVar(&imgRestic.Registry, "docker-registry", imgRestic.Registry, "Docker image registry for restic cli") + cmd.Flags().StringVar(&imgRestic.Tag, "image-tag", imgRestic.Tag, "Restic docker image tag") + + return cmd +} + +func (opt *pruneOptions) pruneRepoFromPod(pod *core.Pod, extraArgs []string) error { + if err := opt.executePruneRepoCmdInPod(pod, extraArgs); err != nil { + return err + } + + klog.Infof("Repository %s/%s is pruned", namespace, opt.repo.Name) + return nil +} + +func (opt *pruneOptions) executePruneRepoCmdInPod(pod *core.Pod, extraArgs []string) error { + command := []string{"/stash-enterprise", "prune"} + command = append(command, extraArgs...) + command = append(command, "--repo-name", opt.repo.Name, "--repo-namespace", opt.repo.Namespace) + + out, err := execCommandOnPod(opt.kubeClient, opt.config, pod, command) + if string(out) != "" { + klog.Infoln("Output:", string(out)) + } + return err +} + +func (opt *pruneOptions) pruneRepo(extraArgs []string) error { + // get source repository secret + secret, err := opt.kubeClient.CoreV1().Secrets(namespace).Get(context.TODO(), opt.repo.Spec.Backend.StorageSecretName, metav1.GetOptions{}) + if err != nil { + return err + } + + if err = os.MkdirAll(ScratchDir, 0o755); err != nil { + return err + } + defer os.RemoveAll(ScratchDir) + + // configure restic wrapper + extraOpt := util.ExtraOptions{ + StorageSecret: secret, + ScratchDir: ScratchDir, + } + // configure setupOption + setupOpt, err := util.SetupOptionsForRepository(*opt.repo, extraOpt) + if err != nil { + return fmt.Errorf("setup option for repository failed") + } + + resticWrapper, err := restic.NewResticWrapper(setupOpt) + if err != nil { + return err + } + + localDirs := &cliLocalDirectories{ + configDir: filepath.Join(ScratchDir, configDirName), + } + // dump restic's environments into `restic-env` file. + // we will pass this env file to restic docker container. + err = resticWrapper.DumpEnv(localDirs.configDir, ResticEnvs) + if err != nil { + return err + } + + // For TLS secured Minio/REST server, specify cert path + if resticWrapper.GetCaPath() != "" { + extraArgs = append(extraArgs, "--cacert", resticWrapper.GetCaPath()) + } + + // run restore inside docker + if err = runCmdViaDocker(*localDirs, "prune", extraArgs); err != nil { + return err + } + klog.Infof("Repository %s/%s is pruned", namespace, opt.repo.Name) + return nil +} + +func (opt *pruneOptions) getUserExtraArguments() []string { + var extraArgs []string + if opt.maxUnusedLimit != "" { + extraArgs = append(extraArgs, + fmt.Sprintf("--max-unused=%s", opt.maxUnusedLimit)) + } + if opt.maxRepackSize != "" { + extraArgs = append(extraArgs, + fmt.Sprintf("--max-repack-size=%s", opt.maxRepackSize)) + } + if opt.dryRun { + extraArgs = append(extraArgs, "--dry-run") + } + return extraArgs +} diff --git a/pkg/root.go b/pkg/root.go index b391d8fe4..70807e365 100644 --- a/pkg/root.go +++ b/pkg/root.go @@ -67,5 +67,6 @@ func NewRootCmd() *cobra.Command { rootCmd.AddCommand(NewCmdCheckRepository(f)) rootCmd.AddCommand(NewCmdRebuildIndex(f)) rootCmd.AddCommand(NewCmdMigrateRepositoryToV2(f)) + rootCmd.AddCommand(NewCmdPruneRepository(f)) return rootCmd } diff --git a/pkg/unlock.go b/pkg/unlock.go index 2e960200e..13f169fba 100644 --- a/pkg/unlock.go +++ b/pkg/unlock.go @@ -188,6 +188,7 @@ func runCmdViaDocker(localDirs cliLocalDirectories, command string, extraArgs [] } args = append(args, extraArgs...) + klog.Infoln("Running docker with args:", args) out, err := exec.Command("docker", args...).CombinedOutput() klog.Infoln("Output:", string(out)) return err From 3cdc9a1f79fde4fa6164153b0500e0d146c44a41 Mon Sep 17 00:00:00 2001 From: "Md. Ishtiaq Islam" Date: Wed, 8 Jan 2025 15:47:01 +0600 Subject: [PATCH 3/4] Refactor Signed-off-by: Md. Ishtiaq Islam --- Makefile | 2 +- pkg/prune.go | 31 ++++++++++++++++++++++++------- pkg/unlock.go | 33 +++------------------------------ pkg/util.go | 29 +++++++++++++++++++++++++++++ 4 files changed, 57 insertions(+), 38 deletions(-) diff --git a/Makefile b/Makefile index e31055738..bb0ea33d7 100644 --- a/Makefile +++ b/Makefile @@ -220,7 +220,7 @@ lint: $(BUILD_DIRS) --env GO111MODULE=on \ --env GOFLAGS="-mod=vendor" \ $(BUILD_IMAGE) \ - golangci-lint run --enable $(ADDTL_LINTERS) --timeout=10m --skip-files="generated.*\.go$\" --skip-dirs-use-default + golangci-lint run --enable $(ADDTL_LINTERS) --timeout=10m --exclude-files="generated.*\.go$\" --exclude-dirs-use-default $(BUILD_DIRS): @mkdir -p $@ diff --git a/pkg/prune.go b/pkg/prune.go index cb26aa203..9106e1b35 100644 --- a/pkg/prune.go +++ b/pkg/prune.go @@ -42,9 +42,12 @@ type pruneOptions struct { config *rest.Config repo *v1alpha1.Repository - maxUnusedLimit string - maxRepackSize string - dryRun bool + maxUnusedLimit string + maxRepackSize string + dryRun bool + repackUncompressed bool + repackCacheableOnly bool + repackSmall bool } func NewCmdPruneRepository(clientGetter genericclioptions.RESTClientGetter) *cobra.Command { @@ -99,9 +102,12 @@ func NewCmdPruneRepository(clientGetter genericclioptions.RESTClientGetter) *cob }, } - cmd.Flags().StringVar(&opt.maxUnusedLimit, "max-unused-limit", "", "allow unused data up to the specified limit within the repository") - cmd.Flags().StringVar(&opt.maxRepackSize, "max-repack-size", "", "limit the total size of files to repack") - cmd.Flags().BoolVar(&opt.dryRun, "dry-run", false, "only show what prune would do") + cmd.Flags().StringVar(&opt.maxUnusedLimit, "max-unused-limit", "", "tolerate given limit of unused data (absolute value in bytes with suffixes k/K, m/M, g/G, t/T, a value in % or the word 'unlimited') (default \"5%\")") + cmd.Flags().StringVar(&opt.maxRepackSize, "max-repack-size", "", "maximum size to repack (allowed suffixes: k/K, m/M, g/G, t/T)") + cmd.Flags().BoolVar(&opt.dryRun, "dry-run", false, "do not modify the repository, just print what would be done") + cmd.Flags().BoolVar(&opt.repackUncompressed, "repack-uncompressed", false, "repack all uncompressed data") + cmd.Flags().BoolVar(&opt.repackCacheableOnly, "repack-cacheable-only", false, "only repack packs which are cacheable") + cmd.Flags().BoolVar(&opt.repackSmall, "repack-small", false, "repack pack files below 80% of target pack size") cmd.Flags().StringVar(&imgRestic.Registry, "docker-registry", imgRestic.Registry, "Docker image registry for restic cli") cmd.Flags().StringVar(&imgRestic.Tag, "image-tag", imgRestic.Tag, "Restic docker image tag") @@ -182,7 +188,9 @@ func (opt *pruneOptions) pruneRepo(extraArgs []string) error { } func (opt *pruneOptions) getUserExtraArguments() []string { - var extraArgs []string + extraArgs := []string{ + "--no-cache", + } if opt.maxUnusedLimit != "" { extraArgs = append(extraArgs, fmt.Sprintf("--max-unused=%s", opt.maxUnusedLimit)) @@ -194,5 +202,14 @@ func (opt *pruneOptions) getUserExtraArguments() []string { if opt.dryRun { extraArgs = append(extraArgs, "--dry-run") } + if opt.repackUncompressed { + extraArgs = append(extraArgs, "--repack-uncompressed") + } + if opt.repackSmall { + extraArgs = append(extraArgs, "--repack-small") + } + if opt.repackCacheableOnly { + extraArgs = append(extraArgs, "--repack-cacheable-only") + } return extraArgs } diff --git a/pkg/unlock.go b/pkg/unlock.go index 13f169fba..b6dcb4938 100644 --- a/pkg/unlock.go +++ b/pkg/unlock.go @@ -20,8 +20,6 @@ import ( "context" "fmt" "os" - "os/exec" - "os/user" "path/filepath" "stash.appscode.dev/apimachinery/apis/stash/v1alpha1" @@ -152,44 +150,19 @@ func (opt *unlockOptions) unlockRepository() error { return err } - extraAgrs := []string{ + extraArgs := []string{ "--no-cache", } // For TLS secured Minio/REST server, specify cert path if resticWrapper.GetCaPath() != "" { - extraAgrs = append(extraAgrs, "--cacert", resticWrapper.GetCaPath()) + extraArgs = append(extraArgs, "--cacert", resticWrapper.GetCaPath()) } // run unlock inside docker - if err = runCmdViaDocker(*localDirs, "unlock", extraAgrs); err != nil { + if err = runCmdViaDocker(*localDirs, "unlock", extraArgs); err != nil { return err } klog.Infof("Repository %s/%s has been unlocked successfully", opt.repo.Namespace, opt.repo.Name) return nil } - -func runCmdViaDocker(localDirs cliLocalDirectories, command string, extraArgs []string) error { - // get current user - currentUser, err := user.Current() - if err != nil { - return err - } - args := []string{ - "run", - "--rm", - "-u", currentUser.Uid, - "-v", ScratchDir + ":" + ScratchDir, - "--env", "HTTP_PROXY=" + os.Getenv("HTTP_PROXY"), - "--env", "HTTPS_PROXY=" + os.Getenv("HTTPS_PROXY"), - "--env-file", filepath.Join(localDirs.configDir, ResticEnvs), - imgRestic.ToContainerImage(), - command, - } - - args = append(args, extraArgs...) - klog.Infoln("Running docker with args:", args) - out, err := exec.Command("docker", args...).CombinedOutput() - klog.Infoln("Output:", string(out)) - return err -} diff --git a/pkg/util.go b/pkg/util.go index d8871a882..049af9a43 100644 --- a/pkg/util.go +++ b/pkg/util.go @@ -20,6 +20,10 @@ import ( "bytes" "context" "fmt" + "os" + "os/exec" + "os/user" + "path/filepath" "strings" "time" @@ -148,3 +152,28 @@ func getContainerName(pod *core.Pod) string { return apis.StashContainer } + +func runCmdViaDocker(localDirs cliLocalDirectories, command string, extraArgs []string) error { + // get current user + currentUser, err := user.Current() + if err != nil { + return err + } + args := []string{ + "run", + "--rm", + "-u", currentUser.Uid, + "-v", ScratchDir + ":" + ScratchDir, + "--env", "HTTP_PROXY=" + os.Getenv("HTTP_PROXY"), + "--env", "HTTPS_PROXY=" + os.Getenv("HTTPS_PROXY"), + "--env-file", filepath.Join(localDirs.configDir, ResticEnvs), + imgRestic.ToContainerImage(), + command, + } + + args = append(args, extraArgs...) + klog.Infoln("Running docker with args:", args) + out, err := exec.Command("docker", args...).CombinedOutput() + klog.Infoln("Output:", string(out)) + return err +} From 129bce27e7443eb470778cce38c597db43bd87b8 Mon Sep 17 00:00:00 2001 From: "Md. Ishtiaq Islam" Date: Tue, 14 Jan 2025 09:54:22 +0600 Subject: [PATCH 4/4] Resolve comments Signed-off-by: Md. Ishtiaq Islam --- pkg/migrate.go | 1 - pkg/prune.go | 1 - 2 files changed, 2 deletions(-) diff --git a/pkg/migrate.go b/pkg/migrate.go index 6ddd612ab..db6b296d9 100644 --- a/pkg/migrate.go +++ b/pkg/migrate.go @@ -167,7 +167,6 @@ func (opt *migrateOptions) migrateRepo() error { extraAgrs = append(extraAgrs, "--cacert", resticWrapper.GetCaPath()) } - // run restore inside docker if err = runCmdViaDocker(*localDirs, "migrate", extraAgrs); err != nil { return err } diff --git a/pkg/prune.go b/pkg/prune.go index 9106e1b35..08d6b4990 100644 --- a/pkg/prune.go +++ b/pkg/prune.go @@ -179,7 +179,6 @@ func (opt *pruneOptions) pruneRepo(extraArgs []string) error { extraArgs = append(extraArgs, "--cacert", resticWrapper.GetCaPath()) } - // run restore inside docker if err = runCmdViaDocker(*localDirs, "prune", extraArgs); err != nil { return err }