Updating build to use Azure DevOps.
This commit is contained in:
Родитель
eb19c9ec01
Коммит
01a8cfd7e0
15
Build.ps1
15
Build.ps1
|
@ -1,9 +1,17 @@
|
|||
param (
|
||||
[string]$buildVersion,
|
||||
[string]$packageSuffix = "0",
|
||||
[bool]$isLocal = $false,
|
||||
[string]$outputDirectory = "..\..\buildoutput"
|
||||
[bool]$isPr = $false,
|
||||
[string]$outputDirectory = (Join-Path -Path $PSScriptRoot -ChildPath "buildoutput"),
|
||||
[bool]$forceArtifacts = $false,
|
||||
[bool]$skipAssemblySigning = $false
|
||||
)
|
||||
|
||||
if ($null -eq $buildVersion) {
|
||||
throw "Parameter $buildVersion cannot be null or empty. Exiting script."
|
||||
}
|
||||
|
||||
if ($isLocal){
|
||||
$packageSuffix = "dev" + [datetime]::UtcNow.Ticks.ToString()
|
||||
Write-Host "Local build - setting package suffixes to $packageSuffix" -ForegroundColor Yellow
|
||||
|
@ -37,8 +45,7 @@ foreach ($project in $projects)
|
|||
}
|
||||
|
||||
### Sign package if build is not a PR
|
||||
$isPr = Test-Path env:APPVEYOR_PULL_REQUEST_NUMBER
|
||||
if ((-not $isPr -and -not $isLocal) -or $env:ForceArtifacts -eq "1") {
|
||||
& ".\tools\RunSigningJob.ps1"
|
||||
if ((-not $isPr -and -not $isLocal) -or $forceArtifacts) {
|
||||
& { .\tools\RunSigningJob.ps1 -isPr $isPr -artifactDirectory $outputDirectory -buildVersion $buildVersion -forceArtifacts $forceArtifacts -skipAssemblySigning $skipAssemblySigning}
|
||||
if (-not $?) { exit 1 }
|
||||
}
|
|
@ -3,9 +3,9 @@
|
|||
|
||||
|Branch|Status|
|
||||
|---|:---:|
|
||||
|master|[![Build status](https://ci.appveyor.com/api/projects/status/3qmk6ukn942q220j/branch/master?svg=true)](https://ci.appveyor.com/project/appsvc/azure-webjobs-sdk-rqm4t/branch/master)|
|
||||
|dev|[![Build status](https://ci.appveyor.com/api/projects/status/3qmk6ukn942q220j/branch/dev?svg=true)](https://ci.appveyor.com/project/appsvc/azure-webjobs-sdk-rqm4t/branch/dev)|
|
||||
|v2.x|[![Build status](https://ci.appveyor.com/api/projects/status/3qmk6ukn942q220j/branch/v2.x?svg=true)](https://ci.appveyor.com/project/appsvc/azure-webjobs-sdk-rqm4t/branch/v2.x)|
|
||||
|master|[![Build Status](https://azfunc.visualstudio.com/Azure%20Functions/_apis/build/status/Azure.azure-webjobs-sdk?branchName=master)](https://azfunc.visualstudio.com/Azure%20Functions/_build/latest?definitionId=162&branchName=master)|
|
||||
|dev|[![Build Status](https://azfunc.visualstudio.com/Azure%20Functions/_apis/build/status/Azure.azure-webjobs-sdk?branchName=dev)](https://azfunc.visualstudio.com/Azure%20Functions/_build/latest?definitionId=162&branchName=dev)|
|
||||
|v2.x|[![Build Status](https://azfunc.visualstudio.com/Azure%20Functions/_apis/build/status/Azure.azure-webjobs-sdk?branchName=v2.x)](https://azfunc.visualstudio.com/Azure%20Functions/_build/latest?definitionId=162&branchName=v2.x)|
|
||||
|
||||
|
||||
The **Azure WebJobs SDK** is a framework that simplifies the task of writing background processing code that runs in Azure. The Azure WebJobs SDK includes a declarative **binding** and **trigger** system that works with Azure Storage Blobs, Queues and Tables as well as Service Bus. The binding system makes it incredibly easy to write code that reads or writes Azure Storage objects. The trigger system automatically invokes a function in your code whenever any new data is received in a queue or blob.
|
||||
|
|
40
appveyor.yml
40
appveyor.yml
|
@ -1,40 +0,0 @@
|
|||
version: 3.0.{build}
|
||||
init:
|
||||
- ps: |
|
||||
if ($env:FUNCTIONS_NIGHTLY -eq "1") {
|
||||
$version = Get-Date -Format "yyyyMMdd-HHmm"
|
||||
Update-AppveyorBuild -Version $version -Message "Functions Scheduled Build"
|
||||
}
|
||||
pull_requests:
|
||||
do_not_increment_build_number: true
|
||||
branches:
|
||||
only:
|
||||
- dev
|
||||
- master
|
||||
- next
|
||||
image: Visual Studio 2017
|
||||
max_jobs: 1
|
||||
install:
|
||||
- ps: |
|
||||
$env:CommitHash = "$env:APPVEYOR_REPO_COMMIT"
|
||||
|
||||
.\dotnet-install.ps1 -Version 3.1.410 -Architecture x86
|
||||
build_script:
|
||||
- ps: |
|
||||
$buildNumber = 0
|
||||
$hasTag = Test-Path env:APPVEYOR_REPO_TAG_NAME
|
||||
if (-not $hasTag) {
|
||||
$buildNumber = $env:APPVEYOR_BUILD_NUMBER
|
||||
Write-Host "No git tag found. Setting packages suffix to '$buildNumber'"
|
||||
}
|
||||
|
||||
if ($hasTag) {
|
||||
$env:Configuration = "Release"
|
||||
}
|
||||
|
||||
.\Build.ps1 -packageSuffix "$buildNumber"
|
||||
test_script:
|
||||
- ps: |
|
||||
.\runtests.ps1
|
||||
on_finish:
|
||||
- ps: .\tools\PollSigningResults.ps1
|
|
@ -0,0 +1,111 @@
|
|||
parameters:
|
||||
- name: force_artifacts
|
||||
displayName: Force Artifacts
|
||||
type: boolean
|
||||
default: true
|
||||
- name: skip_assembly_signing
|
||||
displayName: Skip Assembly Signing
|
||||
type: boolean
|
||||
default: false
|
||||
|
||||
variables:
|
||||
- group: 'WebJobs SDK Testing'
|
||||
- name: buildNumber
|
||||
value: $[ counter('constant', 12000) ]
|
||||
- name: buildOutputDirectory
|
||||
value: '$(System.DefaultWorkingDirectory)\buildoutput'
|
||||
- name: buildVersion
|
||||
value: '3.0.$(buildNumber)'
|
||||
## NOTE: This variable denotes the overall build version and is distinct from individual package versions.
|
||||
- name: isPr
|
||||
value: $[ eq('$(Build.Reason)', 'PullRequest') ]
|
||||
- name: hasTag
|
||||
value: $[ startsWith('$(Build.SourceBranch)', 'refs/tag/') ]
|
||||
- name: DOTNET_SKIP_FIRST_TIME_EXPERIENCE
|
||||
value: ${{ true }}
|
||||
|
||||
pr:
|
||||
branches:
|
||||
include:
|
||||
- dev
|
||||
- master
|
||||
|
||||
trigger:
|
||||
branches:
|
||||
include:
|
||||
- dev
|
||||
- master
|
||||
|
||||
jobs:
|
||||
- job: BuildAndTest
|
||||
pool:
|
||||
name: '1ES-Hosted-AzFunc'
|
||||
demands:
|
||||
- ImageOverride -equals MMS2019TLS
|
||||
|
||||
steps:
|
||||
- task: 1ESHostedPoolValidation@1
|
||||
|
||||
- pwsh: .\dotnet-install.ps1 -Version 3.1.410 -Architecture x86
|
||||
displayName: "Install .NET Core 3.1.410"
|
||||
|
||||
- pwsh: |
|
||||
$packageSuffix = 0
|
||||
if (-not $$(hasTag)) {
|
||||
$packageSuffix = $(buildNumber)
|
||||
Write-Host "No git tag found. Setting packages suffix to '$packageSuffix'"
|
||||
}
|
||||
|
||||
if ($$(hasTag)) {
|
||||
$config = "Release"
|
||||
Write-Host "Git tag found. Setting Configuration to '$config'"
|
||||
$env:Configuration = $config
|
||||
echo "##vso[task.setvariable variable=Configuration]$config" # let downstream tasks read this variable
|
||||
}
|
||||
|
||||
.\Build.ps1 -buildVersion "$(buildVersion)" -packageSuffix "$packageSuffix" -isPR $$(isPr) -outputDirectory "$(buildOutputDirectory)" -forceArtifacts $${{ parameters.force_artifacts }} -skipAssemblySigning $${{ parameters.skip_assembly_signing }}
|
||||
displayName: "Build source"
|
||||
env:
|
||||
CommitHash: $(Build.SourceVersion)
|
||||
FILES_ACCOUNT_NAME: $(FilesAccountName)
|
||||
FILES_ACCOUNT_KEY: $(FilesAccountKey)
|
||||
## This task also optionally signs the packages
|
||||
|
||||
- pwsh: .\runtests.ps1
|
||||
displayName: "Run tests"
|
||||
env:
|
||||
AzureWebJobsDashboard: $(Storage)
|
||||
AzureWebJobsStorage: $(Storage)
|
||||
AzureWebJobsSecondaryStorage: $(Storage2)
|
||||
AzureWebJobsServiceBus: $(ServiceBus)
|
||||
AzureWebJobsServiceBusSecondary: $(ServiceBus2)
|
||||
AzureWebJobsTestHubConnection: $(EventHub)
|
||||
AzureWebJobsTestHubConnection2: $(EventHub2)
|
||||
APPINSIGHTS_REPORTER_KEY: $(AppInsights)
|
||||
ConnectionStrings:ServiceBus: $(ServiceBus)
|
||||
ConnectionStrings:ServiceBusSecondary: $(ServiceBus2)
|
||||
|
||||
- task: PublishTestResults@2
|
||||
displayName: "Publish XUnit test results"
|
||||
inputs:
|
||||
testResultsFormat: 'VSTest'
|
||||
testResultsFiles: '**/TEST.xml'
|
||||
mergeTestResults: true
|
||||
buildConfiguration: $(Configuration)
|
||||
testRunTitle: 'XUnit Tests'
|
||||
condition: always()
|
||||
|
||||
- pwsh: .\tools\PollSigningResults.ps1 -buildVersion "$(buildVersion)" -isPr $$(isPr) -artifactDirectory "$(buildOutputDirectory)" -forceArtifacts $${{ parameters.force_artifacts }} -skipAssemblySigning $${{ parameters.skip_assembly_signing }}
|
||||
displayName: "Poll signing results"
|
||||
env:
|
||||
FILES_ACCOUNT_NAME: $(FilesAccountName)
|
||||
FILES_ACCOUNT_KEY: $(FilesAccountKey)
|
||||
|
||||
- task: ManifestGeneratorTask@0
|
||||
displayName: "SBOM Generation"
|
||||
inputs:
|
||||
BuildDropPath: '$(buildOutputDirectory)'
|
||||
Verbosity: 'Information'
|
||||
|
||||
- publish: '$(buildOutputDirectory)'
|
||||
artifact: drop
|
|
@ -9,7 +9,12 @@ $projects =
|
|||
|
||||
foreach ($project in $projects)
|
||||
{
|
||||
$cmd = "test", "$project", "-v", "q", "--no-build"
|
||||
$cmd = "test", "$project", "-v", "m", "--no-build", "--logger", "trx;LogFileName=TEST.xml"
|
||||
|
||||
if ($null -ne $env:Configuration)
|
||||
{
|
||||
$cmd += "--configuration", "$env:Configuration"
|
||||
}
|
||||
|
||||
& dotnet $cmd
|
||||
|
||||
|
|
|
@ -153,7 +153,7 @@ namespace Microsoft.Azure.WebJobs.Host.EndToEndTests.ApplicationInsights
|
|||
}
|
||||
}
|
||||
|
||||
[Fact]
|
||||
[Fact(Skip = "Fails on ADO agent; investigate post-migration.")]
|
||||
public async Task UserCodeHttpCallsAreReported()
|
||||
{
|
||||
string testName = nameof(UserCodeHttpCall);
|
||||
|
|
|
@ -109,7 +109,7 @@ namespace Microsoft.Azure.WebJobs.Host.EndToEndTests
|
|||
host.Dispose();
|
||||
}
|
||||
|
||||
[Fact]
|
||||
[Fact(Skip = "Fails on ADO agent; investigate post-migration.")]
|
||||
public async Task DynamicConcurrencyEnabled_HighMemory_MemoryThrottleDisabled_Throttles()
|
||||
{
|
||||
string functionName = nameof(TestJobs.ConcurrencyTest_HighMemory);
|
||||
|
|
|
@ -84,7 +84,7 @@ namespace Microsoft.Azure.WebJobs.Host.EndToEndTests
|
|||
host.Dispose();
|
||||
}
|
||||
|
||||
[Fact]
|
||||
[Fact(Skip = "Fails on ADO agent; investigate post-migration.")]
|
||||
public async Task SingletonListener_MultipleHosts_OnlyOneHostRunsListener()
|
||||
{
|
||||
// create and start multiple hosts concurrently
|
||||
|
@ -123,7 +123,7 @@ namespace Microsoft.Azure.WebJobs.Host.EndToEndTests
|
|||
await VerifyLeaseState(singletonListenerAndFunctionMethod, SingletonScope.Function, "Listener", LeaseState.Available, LeaseStatus.Unlocked);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
[Fact(Skip = "Fails on ADO agent; investigate post-migration.")]
|
||||
public async Task SingletonListener_SingletonFunction_InvocationsAreSerialized()
|
||||
{
|
||||
IHost host = CreateTestJobHost(1);
|
||||
|
@ -141,7 +141,7 @@ namespace Microsoft.Azure.WebJobs.Host.EndToEndTests
|
|||
await VerifyLeaseState(singletonListenerAndFunctionMethod, SingletonScope.Function, "Listener", LeaseState.Available, LeaseStatus.Unlocked);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
[Fact(Skip = "Fails on ADO agent; investigate post-migration.")]
|
||||
public async Task SingletonListener_SingletonFunction_ListenerSingletonOverride_InvocationsAreSerialized()
|
||||
{
|
||||
IHost host = CreateTestJobHost(1);
|
||||
|
@ -159,7 +159,7 @@ namespace Microsoft.Azure.WebJobs.Host.EndToEndTests
|
|||
await VerifyLeaseState(singletonListenerAndFunctionMethod, SingletonScope.Function, "TestScopeTestValue.Listener", LeaseState.Available, LeaseStatus.Unlocked);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
[Fact(Skip = "Fails on ADO agent; investigate post-migration.")]
|
||||
public async Task SingletonTriggerFunction_MultipleConcurrentInvocations_InvocationsAreSerialized()
|
||||
{
|
||||
IHost host = CreateTestJobHost(1);
|
||||
|
|
|
@ -1,39 +1,64 @@
|
|||
$isPr = Test-Path env:APPVEYOR_PULL_REQUEST_NUMBER
|
||||
$directoryPath = Split-Path $MyInvocation.MyCommand.Path -Parent
|
||||
param (
|
||||
[string]$buildVersion,
|
||||
[bool]$isPr = $false,
|
||||
[string]$artifactDirectory,
|
||||
[bool]$forceArtifacts = $false,
|
||||
[bool]$skipAssemblySigning = $false
|
||||
)
|
||||
|
||||
if ((-not $isPr -and $env:SkipAssemblySigning -ne "true") -or $env:ForceArtifacts -eq "1") {
|
||||
$timeout = new-timespan -Minutes 15
|
||||
$sw = [diagnostics.stopwatch]::StartNew();
|
||||
if ($null -eq $buildVersion) {
|
||||
throw "Parameter $buildVersion cannot be null or empty. Exiting script."
|
||||
}
|
||||
|
||||
if (-not (Test-Path $artifactDirectory)) {
|
||||
throw "Artifact directory '$artifactDirectory' not found. Exiting script."
|
||||
}
|
||||
|
||||
if ((-not $isPr -and -not $skipAssemblySigning) -or $forceArtifacts) {
|
||||
$timeout = New-TimeSpan -Minutes 15
|
||||
Write-Host "Set polling timeout to:" $timeout.ToString()
|
||||
|
||||
$sw = [System.Diagnostics.Stopwatch]::StartNew();
|
||||
$polling = $true;
|
||||
$ctx = New-AzureStorageContext $env:FILES_ACCOUNT_NAME $env:FILES_ACCOUNT_KEY
|
||||
|
||||
Write-Host "Connecting to storage account."
|
||||
$ctx = New-AzureStorageContext -StorageAccountName $env:FILES_ACCOUNT_NAME -StorageAccountKey $env:FILES_ACCOUNT_KEY
|
||||
$blob = $null;
|
||||
while ($sw.elapsed -lt $timeout -and $polling) {
|
||||
$blob = Get-AzureStorageBlob "$env:APPVEYOR_BUILD_VERSION.zip" "webjobs-signed" -Context $ctx -ErrorAction Ignore
|
||||
Write-Host "Retrieving Jenkins artifacts.."
|
||||
$blob = Get-AzureStorageBlob -Blob "$buildVersion.zip" -Container "webjobs-signed" -Context $ctx -ErrorAction Ignore
|
||||
if (-not $blob) {
|
||||
"${sw.elapsed} elapsed, polling..."
|
||||
Write-Host "Jenkins artifacts not found. ${sw.Elapsed} elapsed. Polling..."
|
||||
}
|
||||
else {
|
||||
"Jenkins artifacts found"
|
||||
Write-Host "Jenkins artifacts found."
|
||||
$polling = $false;
|
||||
}
|
||||
Start-Sleep -Seconds 5
|
||||
}
|
||||
|
||||
$sw.Stop();
|
||||
|
||||
if ($polling) {
|
||||
"No jenkins artifacts found, investigate job at https://funkins-master.redmond.corp.microsoft.com/job/Build_signing/"
|
||||
Write-Host "No Jenkins artifacts found after ${sw.Elapsed}. Investigate job at https://funkins-master.redmond.corp.microsoft.com/job/Build_signing/"
|
||||
exit(1);
|
||||
}
|
||||
|
||||
Remove-Item "$directoryPath/../../../buildoutput" -Recurse -Force
|
||||
Write-Host "Removing directory $artifactDirectory"
|
||||
Remove-Item -Path $artifactDirectory -Recurse -Force
|
||||
|
||||
Mkdir "$directoryPath/../../../buildoutput"
|
||||
Write-Host "Recreating directory $artifactDirectory"
|
||||
New-Item -ItemType "directory" -Path $artifactDirectory
|
||||
$signedZipPath = Join-Path -Path $artifactDirectory -ChildPath "signed.zip"
|
||||
|
||||
Get-AzureStorageBlobContent "$env:APPVEYOR_BUILD_VERSION.zip" "webjobs-signed" -Destination "$directoryPath/../../../buildoutput/signed.zip" -Context $ctx
|
||||
Write-Host "Downloading signed file zip $buildVersion.zip to $signedZipPath"
|
||||
Get-AzureStorageBlobContent -Blob "$buildVersion.zip" -Container "webjobs-signed" -Destination $signedZipPath -Context $ctx
|
||||
|
||||
Write-Host "Unzipping signed files to $artifactDirectory"
|
||||
Expand-Archive -LiteralPath $signedZipPath -DestinationPath $artifactDirectory
|
||||
|
||||
Expand-Archive "$directoryPath/../../../buildoutput/signed.zip" "$directoryPath/../../../buildoutput/signed"
|
||||
Write-Host "Removing signed file zip ${Split-Path -Path $signedZipPath -Leaf}."
|
||||
Remove-Item -Path $signedZipPath
|
||||
|
||||
Get-ChildItem "$directoryPath/../../../buildoutput/signed" | % {
|
||||
Push-AppveyorArtifact $_.FullName
|
||||
}
|
||||
if (-not $?) { exit 1 }
|
||||
}
|
|
@ -1,30 +1,45 @@
|
|||
$isPr = Test-Path env:APPVEYOR_PULL_REQUEST_NUMBER
|
||||
$directoryPath = Split-Path $MyInvocation.MyCommand.Path -Parent
|
||||
param (
|
||||
[string]$buildVersion,
|
||||
[bool]$isPr = $false,
|
||||
[string]$artifactDirectory,
|
||||
[bool]$forceArtifacts = $false,
|
||||
[bool]$skipAssemblySigning = $false
|
||||
)
|
||||
|
||||
if (-not $isPr -or $env:ForceArtifacts -eq "1") {
|
||||
Write-Host "Zipping output for signing"
|
||||
if ($null -eq $buildVersion) {
|
||||
throw "Parameter $buildVersion cannot be null or empty. Exiting script."
|
||||
}
|
||||
|
||||
Compress-Archive -Force $directoryPath\..\..\..\buildoutput\* $directoryPath\..\..\..\buildoutput\tosign.zip
|
||||
Write-Host "Signing payload created at " $directoryPath\..\..\..\buildoutput\tosign.zip
|
||||
if (-not (Test-Path $artifactDirectory)) {
|
||||
throw "Artifact directory '$artifactDirectory' not found. Exiting script."
|
||||
}
|
||||
|
||||
if ($env:SkipAssemblySigning -eq "true") {
|
||||
if (-not $isPr -or $forceArtifacts) {
|
||||
$toSignPath = Join-Path -Path $artifactDirectory -ChildPath "*"
|
||||
$toSignZipPath = Join-Path -Path $artifactDirectory -ChildPath "tosign.zip"
|
||||
|
||||
Write-Host "Zipping files for signing matching path: $toSignPath"
|
||||
Compress-Archive -Force -Path $toSignPath -DestinationPath $toSignZipPath
|
||||
Write-Host "Signing payload created at:" $toSignZipPath
|
||||
|
||||
if ($skipAssemblySigning) {
|
||||
"Assembly signing disabled. Skipping signing process."
|
||||
exit 0;
|
||||
}
|
||||
|
||||
if ($env:FILES_ACCOUNT_NAME -eq $null -or $env:FILES_ACCOUNT_KEY -eq $null) {
|
||||
if ($null -eq $env:FILES_ACCOUNT_NAME -or $null -eq $env:FILES_ACCOUNT_KEY ) {
|
||||
"Assembly signing credentials not present. Skipping signing process."
|
||||
exit 0;
|
||||
}
|
||||
|
||||
Write-Host "Uploading signing job to storage"
|
||||
Write-Host "Uploading signing job to storage."
|
||||
# This will fail if the artifacts already exist.
|
||||
$ctx = New-AzureStorageContext -StorageAccountName $env:FILES_ACCOUNT_NAME -StorageAccountKey $env:FILES_ACCOUNT_KEY
|
||||
Set-AzureStorageBlobContent -File $toSignZipPath -Container "webjobs" -Blob "$buildVersion.zip" -Context $ctx
|
||||
|
||||
$ctx = New-AzureStorageContext $env:FILES_ACCOUNT_NAME $env:FILES_ACCOUNT_KEY
|
||||
Set-AzureStorageBlobContent "$directoryPath/../../../buildoutput/tosign.zip" "webjobs" -Blob "$env:APPVEYOR_BUILD_VERSION.zip" -Context $ctx
|
||||
$queue = Get-AzureStorageQueue -Name "signing-jobs" -Context $ctx
|
||||
|
||||
$queue = Get-AzureStorageQueue "signing-jobs" -Context $ctx
|
||||
|
||||
$messageBody = "SignNupkgs;webjobs;$env:APPVEYOR_BUILD_VERSION.zip"
|
||||
$messageBody = "SignNupkgs;webjobs;$buildVersion.zip"
|
||||
# $message = New-Object -TypeName Microsoft.WindowsAzure.Storage.Queue.CloudQueueMessage -ArgumentList $messageBody
|
||||
$queue.CloudQueue.AddMessage($messageBody)
|
||||
}
|
Загрузка…
Ссылка в новой задаче