From 1da18be693fc1be3e8ef377e36bc30705a78a176 Mon Sep 17 00:00:00 2001 From: Sridhar Periyasamy Date: Wed, 28 Oct 2015 17:11:32 -0700 Subject: [PATCH] Add support for channels when publishing the artifacts to the blob storagewq --- scripts/publish.ps1 | 8 +++++++- scripts/publish.sh | 7 ++++++- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/scripts/publish.ps1 b/scripts/publish.ps1 index 1b2dc94ce..f2757c78d 100644 --- a/scripts/publish.ps1 +++ b/scripts/publish.ps1 @@ -27,6 +27,12 @@ function CheckRequiredVariables return $false } + # this variable is set by the CI system + if([string]::IsNullOrEmpty($env:CHANNEL)) + { + return $false + } + return $true } @@ -58,7 +64,7 @@ elseif([System.IO.Path]::GetExtension($file).ToLower() -eq ".msi") Write-Host "Uploading $fileName to dotnet feed.." -$Upload_URI = "https://$env:STORAGE_ACCOUNT.blob.core.windows.net/$env:STORAGE_CONTAINER/$Folder/$env:DOTNET_BUILD_VERSION/$fileName$env:SASTOKEN" +$Upload_URI = "https://$env:STORAGE_ACCOUNT.blob.core.windows.net/$env:STORAGE_CONTAINER/$env:CHANNEL/$Folder/$env:DOTNET_BUILD_VERSION/$fileName$env:SASTOKEN" Invoke-WebRequest -URI $Upload_URI -Method PUT -Headers @{"x-ms-blob-type"="BlockBlob"; "x-ms-date"="2015-10-23";"x-ms-version"="2013-08-15"} -InFile $file diff --git a/scripts/publish.sh b/scripts/publish.sh index a538332f5..757b45d3f 100755 --- a/scripts/publish.sh +++ b/scripts/publish.sh @@ -59,6 +59,11 @@ validate_env_variables(){ ret=1 fi + if [[ -z "$CHANNEL" ]]; then + echo "CHANNEL environment variable not set" + ret=1 + fi + return $ret } @@ -72,7 +77,7 @@ upload_file_to_blob_storage(){ FOLDER="Binaries" fi - UPLOAD_URL="https://$STORAGE_ACCOUNT.blob.core.windows.net/$STORAGE_CONTAINER/$FOLDER/$DOTNET_BUILD_VERSION/$filename$SASTOKEN" + UPLOAD_URL="https://$STORAGE_ACCOUNT.blob.core.windows.net/$STORAGE_CONTAINER/$CHANNEL/$FOLDER/$DOTNET_BUILD_VERSION/$filename$SASTOKEN" curl -L -H "x-ms-blob-type: BlockBlob" -H "x-ms-date: 2015-10-21" -H "x-ms-version: 2013-08-15" $UPLOAD_URL -T $UPLOAD_FILE result=$?