Add support for channels when publishing the artifacts to the blob storagewq

This commit is contained in:
Sridhar Periyasamy 2015-10-28 17:11:32 -07:00
parent d4fb47ab0f
commit 1da18be693
2 changed files with 13 additions and 2 deletions

View file

@ -27,6 +27,12 @@ function CheckRequiredVariables
return $false return $false
} }
# this variable is set by the CI system
if([string]::IsNullOrEmpty($env:CHANNEL))
{
return $false
}
return $true return $true
} }
@ -58,7 +64,7 @@ elseif([System.IO.Path]::GetExtension($file).ToLower() -eq ".msi")
Write-Host "Uploading $fileName to dotnet feed.." 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 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

View file

@ -59,6 +59,11 @@ validate_env_variables(){
ret=1 ret=1
fi fi
if [[ -z "$CHANNEL" ]]; then
echo "CHANNEL environment variable not set"
ret=1
fi
return $ret return $ret
} }
@ -72,7 +77,7 @@ upload_file_to_blob_storage(){
FOLDER="Binaries" FOLDER="Binaries"
fi 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 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=$? result=$?