This repository has been archived by the owner on Feb 25, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 647
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update dependencies from https://github.com/dotnet/arcade build 20190…
…630.1 (#1823) - Microsoft.DotNet.Arcade.Sdk - 1.0.0-beta.19330.1
- Loading branch information
1 parent
22f3483
commit 10ac253
Showing
19 changed files
with
705 additions
and
49 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
# This script validates NuGet package metadata information using this | ||
# tool: https://github.com/NuGet/NuGetGallery/tree/jver-verify/src/VerifyMicrosoftPackage | ||
|
||
param( | ||
[Parameter(Mandatory=$true)][string] $PackagesPath, # Path to where the packages to be validated are | ||
[Parameter(Mandatory=$true)][string] $ToolDestinationPath # Where the validation tool should be downloaded to | ||
) | ||
|
||
$ErrorActionPreference = "Stop" | ||
Set-StrictMode -Version 2.0 | ||
|
||
. $PSScriptRoot\..\tools.ps1 | ||
|
||
try { | ||
$url = "https://raw.githubusercontent.com/NuGet/NuGetGallery/jver-verify/src/VerifyMicrosoftPackage/verify.ps1" | ||
|
||
New-Item -ItemType "directory" -Path ${ToolDestinationPath} -Force | ||
|
||
Invoke-WebRequest $url -OutFile ${ToolDestinationPath}\verify.ps1 | ||
|
||
& ${ToolDestinationPath}\verify.ps1 ${PackagesPath}\*.nupkg | ||
} | ||
catch { | ||
Write-PipelineTaskError "NuGet package validation failed. Please check error logs." | ||
Write-Host $_ | ||
Write-Host $_.ScriptStackTrace | ||
ExitWithExitCode 1 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
param( | ||
[Parameter(Mandatory=$true)][int] $BuildId, | ||
[Parameter(Mandatory=$true)][int] $ChannelId, | ||
[Parameter(Mandatory=$true)][string] $BarToken, | ||
[string] $MaestroEndpoint = "https://maestro-prod.westus2.cloudapp.azure.com", | ||
[string] $ApiVersion = "2019-01-16" | ||
) | ||
|
||
$ErrorActionPreference = "Stop" | ||
Set-StrictMode -Version 2.0 | ||
|
||
. $PSScriptRoot\..\tools.ps1 | ||
|
||
function Get-Headers([string]$accept, [string]$barToken) { | ||
$headers = New-Object 'System.Collections.Generic.Dictionary[[String],[String]]' | ||
$headers.Add('Accept',$accept) | ||
$headers.Add('Authorization',"Bearer $barToken") | ||
return $headers | ||
} | ||
|
||
try { | ||
$maestroHeaders = Get-Headers 'application/json' $BarToken | ||
|
||
# Get info about which channels the build has already been promoted to | ||
$getBuildApiEndpoint = "$MaestroEndpoint/api/builds/${BuildId}?api-version=$ApiVersion" | ||
$buildInfo = Invoke-WebRequest -Method Get -Uri $getBuildApiEndpoint -Headers $maestroHeaders | ConvertFrom-Json | ||
|
||
if (!$buildInfo) { | ||
Write-Host "Build with BAR ID $BuildId was not found in BAR!" | ||
ExitWithExitCode 1 | ||
} | ||
|
||
# Find whether the build is already assigned to the channel or not | ||
if ($buildInfo.channels) { | ||
foreach ($channel in $buildInfo.channels) { | ||
if ($channel.Id -eq $ChannelId) { | ||
Write-Host "The build with BAR ID $BuildId is already on channel $ChannelId!" | ||
ExitWithExitCode 0 | ||
} | ||
} | ||
} | ||
|
||
Write-Host "Build not present in channel $ChannelId. Promoting build ... " | ||
|
||
$promoteBuildApiEndpoint = "$maestroEndpoint/api/channels/${ChannelId}/builds/${BuildId}?api-version=$ApiVersion" | ||
Invoke-WebRequest -Method Post -Uri $promoteBuildApiEndpoint -Headers $maestroHeaders | ||
Write-Host "done." | ||
} | ||
catch { | ||
Write-Host "There was an error while trying to promote build '$BuildId' to channel '$ChannelId'" | ||
Write-Host $_ | ||
Write-Host $_.ScriptStackTrace | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
param( | ||
[Parameter(Mandatory=$true)][string] $SourceRepo, | ||
[Parameter(Mandatory=$true)][int] $ChannelId, | ||
[string] $MaestroEndpoint = "https://maestro-prod.westus2.cloudapp.azure.com", | ||
[string] $BarToken, | ||
[string] $ApiVersion = "2019-01-16" | ||
) | ||
|
||
$ErrorActionPreference = "Stop" | ||
Set-StrictMode -Version 2.0 | ||
|
||
. $PSScriptRoot\..\tools.ps1 | ||
|
||
function Get-Headers([string]$accept, [string]$barToken) { | ||
$headers = New-Object 'System.Collections.Generic.Dictionary[[String],[String]]' | ||
$headers.Add('Accept',$accept) | ||
$headers.Add('Authorization',"Bearer $barToken") | ||
return $headers | ||
} | ||
|
||
# Get all the $SourceRepo subscriptions | ||
$normalizedSurceRepo = $SourceRepo.Replace('dnceng@', '') | ||
$getSubscriptionsApiEndpoint = "$maestroEndpoint/api/subscriptions?sourceRepository=$normalizedSurceRepo&api-version=$apiVersion" | ||
$headers = Get-Headers 'application/json' $barToken | ||
|
||
$subscriptions = Invoke-WebRequest -Uri $getSubscriptionsApiEndpoint -Headers $headers | ConvertFrom-Json | ||
|
||
if (!$subscriptions) { | ||
Write-Host "No subscriptions found for source repo '$normalizedSurceRepo' in channel '$ChannelId'" | ||
return | ||
} | ||
|
||
$subscriptionsToTrigger = New-Object System.Collections.Generic.List[string] | ||
$failedTriggeredSubscription = $false | ||
|
||
# Get all enabled subscriptions that need dependency flow on 'everyBuild' | ||
foreach ($subscription in $subscriptions) { | ||
if ($subscription.enabled -and $subscription.policy.updateFrequency -like 'everyBuild' -and $subscription.channel.id -eq $ChannelId) { | ||
Write-Host "$subscription.id" | ||
[void]$subscriptionsToTrigger.Add($subscription.id) | ||
} | ||
} | ||
|
||
foreach ($subscriptionToTrigger in $subscriptionsToTrigger) { | ||
try { | ||
$triggerSubscriptionApiEndpoint = "$maestroEndpoint/api/subscriptions/$subscriptionToTrigger/trigger?api-version=$apiVersion" | ||
$headers = Get-Headers 'application/json' $BarToken | ||
|
||
Write-Host "Triggering subscription '$subscriptionToTrigger'..." | ||
|
||
Invoke-WebRequest -Uri $triggerSubscriptionApiEndpoint -Headers $headers -Method Post | ||
|
||
Write-Host "Subscription '$subscriptionToTrigger' triggered!" | ||
} | ||
catch | ||
{ | ||
Write-Host "There was an error while triggering subscription '$subscriptionToTrigger'" | ||
Write-Host $_ | ||
Write-Host $_.ScriptStackTrace | ||
$failedTriggeredSubscription = $true | ||
} | ||
} | ||
|
||
if ($failedTriggeredSubscription) { | ||
Write-Host "At least one subscription failed to be triggered..." | ||
ExitWithExitCode 1 | ||
} | ||
|
||
Write-Host "All subscriptions were triggered successfully!" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
param( | ||
[Parameter(Mandatory=$true)][string] $InputPath, # Full path to directory where artifact packages are stored | ||
[Parameter(Mandatory=$true)][string] $ExtractPath # Full path to directory where the packages will be extracted | ||
) | ||
|
||
$ErrorActionPreference = "Stop" | ||
Set-StrictMode -Version 2.0 | ||
$ExtractPackage = { | ||
param( | ||
[string] $PackagePath # Full path to a NuGet package | ||
) | ||
|
||
if (!(Test-Path $PackagePath)) { | ||
Write-PipelineTaskError "Input file does not exist: $PackagePath" | ||
ExitWithExitCode 1 | ||
} | ||
|
||
$RelevantExtensions = @(".dll", ".exe", ".pdb") | ||
Write-Host -NoNewLine "Extracting" ([System.IO.Path]::GetFileName($PackagePath)) "... " | ||
|
||
$PackageId = [System.IO.Path]::GetFileNameWithoutExtension($PackagePath) | ||
$ExtractPath = Join-Path -Path $using:ExtractPath -ChildPath $PackageId | ||
|
||
Add-Type -AssemblyName System.IO.Compression.FileSystem | ||
|
||
[System.IO.Directory]::CreateDirectory($ExtractPath); | ||
|
||
try { | ||
$zip = [System.IO.Compression.ZipFile]::OpenRead($PackagePath) | ||
|
||
$zip.Entries | | ||
Where-Object {$RelevantExtensions -contains [System.IO.Path]::GetExtension($_.Name)} | | ||
ForEach-Object { | ||
$TargetFile = Join-Path -Path $ExtractPath -ChildPath $_.Name | ||
|
||
[System.IO.Compression.ZipFileExtensions]::ExtractToFile($_, $TargetFile, $true) | ||
} | ||
} | ||
catch { | ||
|
||
} | ||
finally { | ||
$zip.Dispose() | ||
} | ||
} | ||
function ExtractArtifacts { | ||
if (!(Test-Path $InputPath)) { | ||
Write-Host "Input Path does not exist: $InputPath" | ||
ExitWithExitCode 0 | ||
} | ||
$Jobs = @() | ||
Get-ChildItem "$InputPath\*.nupkg" | | ||
ForEach-Object { | ||
$Jobs += Start-Job -ScriptBlock $ExtractPackage -ArgumentList $_.FullName | ||
} | ||
|
||
foreach ($Job in $Jobs) { | ||
Wait-Job -Id $Job.Id | Receive-Job | ||
} | ||
} | ||
|
||
try { | ||
Measure-Command { ExtractArtifacts } | ||
} | ||
catch { | ||
Write-Host $_ | ||
Write-Host $_.Exception | ||
Write-Host $_.ScriptStackTrace | ||
ExitWithExitCode 1 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<packages> | ||
<package id="Microsoft.Guardian.Cli" version="0.3.2"/> | ||
<package id="Microsoft.Guardian.Cli" version="0.6.0"/> | ||
</packages> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.