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

[master] Update dependencies from dotnet/arcade #350

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions eng/Version.Details.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
<ProductDependencies>
</ProductDependencies>
<ToolsetDependencies>
<Dependency Name="Microsoft.DotNet.Arcade.Sdk" Version="1.0.0-beta.19326.44">
<Dependency Name="Microsoft.DotNet.Arcade.Sdk" Version="1.0.0-beta.19327.39">
<Uri>https://github.com/dotnet/arcade</Uri>
<Sha>d39a62deaf3aa4e03c0b7dadc320a517e0e00187</Sha>
<Sha>247c0290c554a68dd3e560dd88fb0da26353d9d7</Sha>
</Dependency>
</ToolsetDependencies>
</Dependencies>
28 changes: 28 additions & 0 deletions eng/common/post-build/nuget-validation.ps1
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
}
69 changes: 69 additions & 0 deletions eng/common/post-build/trigger-subscriptions.ps1
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!"
4 changes: 4 additions & 0 deletions eng/common/sdl/extract-artifact-packages.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,10 @@ $ExtractPackage = {
}
}
function ExtractArtifacts {
if (!(Test-Path $InputPath)) {
Write-Host "Input Path does not exist: $InputPath"
ExitWithExitCode 0
}
$Jobs = @()
Get-ChildItem "$InputPath\*.nupkg" |
ForEach-Object {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ stages:
/p:BlobBasePath='$(Build.ArtifactStagingDirectory)/BlobArtifacts/'
/p:Configuration=Release

- job:
- job: publish_assets
displayName: Publish Assets
dependsOn: setupMaestroVars
variables:
Expand Down Expand Up @@ -111,7 +111,10 @@ stages:
-PersonalAccessToken $(dn-bot-dnceng-unviersal-packages-rw)
enabled: false


- template: ../trigger-subscription.yml
parameters:
ChannelId: ${{ variables.InternalServicing_30_Channel_Id }}

- stage: IS_PublishValidation
displayName: Publish Validation
variables:
Expand Down Expand Up @@ -164,4 +167,4 @@ stages:

- template: ../promote-build.yml
parameters:
ChannelId: ${{ variables.InternalServicing_30_Channel_Id }}
ChannelId: ${{ variables.InternalServicing_30_Channel_Id }}
5 changes: 4 additions & 1 deletion eng/common/templates/post-build/channels/public-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ stages:
/p:BlobBasePath='$(Build.ArtifactStagingDirectory)/BlobArtifacts/'
/p:Configuration=Release

- job:
- job: publish_assets
displayName: Publish Assets
dependsOn: setupMaestroVars
variables:
Expand Down Expand Up @@ -111,6 +111,9 @@ stages:
-PersonalAccessToken $(dn-bot-dnceng-unviersal-packages-rw)
enabled: false

- template: ../trigger-subscription.yml
parameters:
ChannelId: ${{ variables.PublicRelease_30_Channel_Id }}

- stage: PubRel_PublishValidation
displayName: Publish Validation
Expand Down
20 changes: 20 additions & 0 deletions eng/common/templates/post-build/post-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ parameters:
enableSourceLinkValidation: true
enableSigningValidation: true
enableSymbolValidation: true
enableNugetValidation: true
SDLValidationParameters:
enable: false
params: ''
Expand All @@ -11,6 +12,25 @@ stages:
dependsOn: build
displayName: Validate
jobs:
- ${{ if eq(parameters.enableNugetValidation, 'true') }}:
- job:
displayName: NuGet Validation
pool:
vmImage: 'windows-2019'
steps:
- task: DownloadBuildArtifacts@0
displayName: Download Package Artifacts
inputs:
buildType: current
artifactName: PackageArtifacts

- task: PowerShell@2
displayName: Validate
inputs:
filePath: $(Build.SourcesDirectory)/eng/common/post-build/nuget-validation.ps1
arguments: -PackagesPath $(Build.ArtifactStagingDirectory)/PackageArtifacts/
-ToolDestinationPath $(Agent.BuildDirectory)/Extract/

- ${{ if eq(parameters.enableSigningValidation, 'true') }}:
- job:
displayName: Signing Validation
Expand Down
11 changes: 11 additions & 0 deletions eng/common/templates/post-build/trigger-subscription.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
parameters:
ChannelId: 0

steps:
- task: PowerShell@2
displayName: Triggering subscriptions
inputs:
filePath: $(Build.SourcesDirectory)/eng/common/post-build/trigger-subscriptions.ps1
arguments: -SourceRepo $(Build.Repository.Uri)
-ChannelId ${{ parameters.ChannelId }}
-BarToken $(MaestroAccessTokenInt)
2 changes: 1 addition & 1 deletion global.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@
"xcopy-msbuild": "15.9.0-alpha"
},
"msbuild-sdks": {
"Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.19326.44"
"Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.19327.39"
}
}