Skip to content

Commit

Permalink
Merge pull request #60 from nicon89/feature/allow_gcloud_bucket_with_…
Browse files Browse the repository at this point in the history
…path

Adding fileName to gcloud command to allow usage of bucket name with path
  • Loading branch information
maxisam committed Jun 1, 2023
2 parents 8b59140 + c54c649 commit a8e8771
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions pkg/backup/gcloud.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package backup

import (
"fmt"
"path/filepath"
"strings"
"time"

Expand All @@ -22,8 +23,10 @@ func gCloudUpload(file string, plan config.Plan) (string, error) {
}
}

upload := fmt.Sprintf("gsutil cp %v gs://%v",
file, plan.GCloud.Bucket)
fileName := filepath.Base(file)

upload := fmt.Sprintf("gsutil cp %v gs://%v/%v",
file, plan.GCloud.Bucket, fileName)

result, err := sh.Command("/bin/sh", "-c", upload).SetTimeout(time.Duration(plan.Scheduler.Timeout) * time.Minute).CombinedOutput()
output := ""
Expand Down

0 comments on commit a8e8771

Please sign in to comment.