Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Publish to multiple channels - Part 2 #6754

Merged
merged 8 commits into from
Jan 15, 2021
Merged
2 changes: 1 addition & 1 deletion eng/promote-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ stages:
exit 1
}
$channels = ${Env:PromoteToChannelIds} -split ","
$channels = ${Env:PromoteToChannelIds} -split "-"
foreach ($channelId in $channels) {
$channelApiEndpoint = "$(MaestroApiEndPoint)/api/channels/${channelId}?api-version=$(MaestroApiVersion)"
$channelInfo = try { Invoke-WebRequest -Method Get -Uri $channelApiEndpoint -Headers $apiHeaders | ConvertFrom-Json } catch { Write-Host "Error: $_" }
Expand Down
3 changes: 2 additions & 1 deletion src/Microsoft.DotNet.Build.Tasks.Feed/src/BlobFeedAction.cs
Original file line number Diff line number Diff line change
Expand Up @@ -190,8 +190,9 @@ public async Task UploadAssetAsync(
}
else
{
FileStream stream = new FileStream(item.ItemSpec, FileMode.Open, FileAccess.Read, FileShare.Read);
epananth marked this conversation as resolved.
Show resolved Hide resolved
Log.LogMessage($"Uploading {item} to {relativeBlobPath}.");
await blobUtils.UploadBlockBlobAsync(item.ItemSpec, relativeBlobPath);
await blobUtils.UploadBlockBlobAsync(item.ItemSpec, relativeBlobPath, stream);
}
}
catch (Exception exc)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ public async Task<bool> ExecuteAsync()
IMaestroApi client = ApiFactory.GetAuthenticated(MaestroApiEndpoint, BuildAssetRegistryToken);
Maestro.Client.Models.Build buildInformation = await client.Builds.GetBuildAsync(BARBuildId);

var targetChannelsIds = TargetChannels.Split(',').Select(ci => int.Parse(ci));
var targetChannelsIds = TargetChannels.Split('-').Select(ci => int.Parse(ci));

foreach (var targetChannelId in targetChannelsIds)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ public override async Task<bool> ExecuteAsync()
{
List<int> targetChannelsIds = new List<int>();

foreach (var channelIdStr in TargetChannels.Split(','))
foreach (var channelIdStr in TargetChannels.Split('-'))
{
if (!int.TryParse(channelIdStr, out var channelId))
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ public static string CalculateMD5(string filename)
}
}

public async Task UploadBlockBlobAsync(string filePath, string blobPath)
public async Task UploadBlockBlobAsync(string filePath, string blobPath, Stream stream)
{
BlobClient blob = GetBlob(blobPath.Replace("\\", "/"));
BlobHttpHeaders headers = GetBlobHeadersByExtension(filePath);
Expand All @@ -83,7 +83,7 @@ public async Task UploadBlockBlobAsync(string filePath, string blobPath)
try
{
await blob.UploadAsync(
filePath,
stream,
headers)
.ConfigureAwait(false);
return true;
Expand Down