Skip to content

Commit

Permalink
platform/api/azure: cleanup after Azcopy
Browse files Browse the repository at this point in the history
Azcopy unfortunately leaves behind log files and plan files in $HOME/.azcopy.
Passing `--log-level=NONE` removes the log files (but stdout remains informational)
and the plans files are cleaned up after the copy command finishes.

Signed-off-by: Jeremi Piotrowski <jpiotrowski@microsoft.com>
  • Loading branch information
jepio committed Aug 27, 2021
1 parent 5ba958d commit 320de90
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion platform/api/azure/storage_mit.go
Original file line number Diff line number Diff line change
Expand Up @@ -352,10 +352,12 @@ func (a *API) CopyBlob(storageaccount, storagekey, container, targetBlob, source
if err != nil {
return err
}
cmd := exec.Command(azcopy, "cp", "--blob-type=PageBlob", sourceBlob, dstSas)
cmd := exec.Command(azcopy, "cp", "--blob-type=PageBlob", "--log-level=NONE", sourceBlob, dstSas)
cmd.Stderr = os.Stderr
cmd.Stdout = os.Stdout
err = cmd.Run()
// azcopy leaves behind "plan" files in case a job needs to be retried
_ = exec.Command("azcopy", "jobs", "clean").Run()
if err == nil {
return nil
}
Expand Down

0 comments on commit 320de90

Please sign in to comment.