diff options
author | Felix Lange <fjl@twurst.com> | 2016-11-09 06:46:46 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-11-09 06:46:46 +0800 |
commit | 8b1df1a259fe6dc4c15e391e9c0762c9621d9d72 (patch) | |
tree | 9f647c583c2e29c62191940f3b12f36ab11a4b6c | |
parent | 9bc97a5785d3d350a084b46fc77a8439b8dc533b (diff) | |
download | dexon-8b1df1a259fe6dc4c15e391e9c0762c9621d9d72.tar dexon-8b1df1a259fe6dc4c15e391e9c0762c9621d9d72.tar.gz dexon-8b1df1a259fe6dc4c15e391e9c0762c9621d9d72.tar.bz2 dexon-8b1df1a259fe6dc4c15e391e9c0762c9621d9d72.tar.lz dexon-8b1df1a259fe6dc4c15e391e9c0762c9621d9d72.tar.xz dexon-8b1df1a259fe6dc4c15e391e9c0762c9621d9d72.tar.zst dexon-8b1df1a259fe6dc4c15e391e9c0762c9621d9d72.zip |
build: fix remote path for archive uploads (#3243)
archiveUpload did not handle absolute paths correctly. Fix it by using
the basename and ensure that uploads can be tested using -n.
-rw-r--r-- | build/ci.go | 4 | ||||
-rw-r--r-- | internal/build/azure.go | 6 |
2 files changed, 8 insertions, 2 deletions
diff --git a/build/ci.go b/build/ci.go index f5ef54b75..691f5233e 100644 --- a/build/ci.go +++ b/build/ci.go @@ -359,11 +359,11 @@ func archiveUpload(archive string, blobstore string, signer string) error { Token: os.Getenv("AZURE_BLOBSTORE_TOKEN"), Container: strings.SplitN(blobstore, "/", 2)[1], } - if err := build.AzureBlobstoreUpload(archive, archive, auth); err != nil { + if err := build.AzureBlobstoreUpload(archive, filepath.Base(archive), auth); err != nil { return err } if signer != "" { - if err := build.AzureBlobstoreUpload(archive+".asc", archive+".asc", auth); err != nil { + if err := build.AzureBlobstoreUpload(archive+".asc", filepath.Base(archive+".asc"), auth); err != nil { return err } } diff --git a/internal/build/azure.go b/internal/build/azure.go index 124c3f6ec..ceac6a4cd 100644 --- a/internal/build/azure.go +++ b/internal/build/azure.go @@ -16,6 +16,7 @@ package build import ( + "fmt" "os" "github.com/Azure/azure-sdk-for-go/storage" @@ -36,6 +37,11 @@ type AzureBlobstoreConfig struct { // // See: https://msdn.microsoft.com/en-us/library/azure/dd179451.aspx#Anchor_3 func AzureBlobstoreUpload(path string, name string, config AzureBlobstoreConfig) error { + if *DryRunFlag { + fmt.Printf("would upload %q to %s/%s/%s\n", path, config.Account, config.Container, name) + return nil + } + // Create an authenticated client against the Azure cloud rawClient, err := storage.NewBasicClient(config.Account, config.Token) if err != nil { |