694 строки
31 KiB
YAML
694 строки
31 KiB
YAML
# Copyright (c) Microsoft Corporation.
|
|
# Licensed under the MIT license.
|
|
|
|
#Multi-configuration and multi-agent job options are not exported to YAML. Configure these options using documentation guidance: https://docs.microsoft.com/vsts/pipelines/process/phases
|
|
trigger:
|
|
- none
|
|
pr:
|
|
- none
|
|
|
|
parameters:
|
|
- name: UseOlderBuildArtifacts
|
|
displayName: (Expert option) Use artifacts from build id set in BUILDIDFORARTIFACTS variable? (UseOlderBuildArtifacts)
|
|
type: boolean
|
|
default: false
|
|
- name: VPackVersionAppendId
|
|
displayName: (Expert option) Append build id to VPack versions (VPackVersionAppendId)
|
|
type: boolean
|
|
default: false
|
|
|
|
resources:
|
|
repositories:
|
|
- repository: ComplianceRepo
|
|
type: github
|
|
endpoint: microsoft
|
|
name: PowerShell/Compliance
|
|
ref: master
|
|
|
|
variables:
|
|
SigningServer: "http://rfc3161.gtm.corp.microsoft.com/TSS/HttpTspServer"
|
|
BuildConfiguration: 'Release'
|
|
VPACKVERSIONBUILDIDSUFFIX: ''
|
|
${{ if or(startsWith(variables['Build.SourceBranch'], 'refs/tags/v'), eq(variables['Build.SourceBranchName'], 'main')) }}:
|
|
TEMPVERSIONSUFFIX: ''
|
|
SKIPSIGN: 'false'
|
|
SKIPPUBLISH: 'false'
|
|
${{ if not(or(startsWith(variables['Build.SourceBranch'], 'refs/tags/v'), eq(variables['Build.SourceBranchName'], 'main'))) }}:
|
|
TEMPVERSIONSUFFIX: '$(Build.SourceBranchName)'
|
|
SKIPSIGN: 'true'
|
|
SKIPPUBLISH: 'true'
|
|
|
|
name: $(BuildDefinitionName)_$(date:yyMM).$(date:dd)$(rev:rrr)
|
|
|
|
stages:
|
|
- stage: 'Build_Test_FactoryOrchestrator_AnyCPU'
|
|
displayName: 'Build and test Factory Orchestrator client & service'
|
|
jobs:
|
|
# Build the solution on Linux and run tests.
|
|
# The binaries released for Linux are built in Build_Test_FactoryOrchestrator_Windows_AnyCPU on a Windows host,
|
|
# but this ensures the solution and code works properly on Linux.
|
|
- job: "Build_Test_FactoryOrchestrator_HostedLinux_AnyCPU"
|
|
pool:
|
|
vmImage: 'ubuntu-20.04'
|
|
variables:
|
|
BuildPlatform: 'AnyCPU'
|
|
BuildConfiguration: 'Release'
|
|
FORepoRoot: '$(Build.SourcesDirectory)'
|
|
steps:
|
|
- checkout: self
|
|
- template: ./templates/template-set-initial-variables.yml
|
|
- pwsh: |
|
|
Get-Item -Path env:* | Sort-Object Name
|
|
displayName: "Print all variables"
|
|
# Build & Test (Linux)
|
|
- template: ./templates/template-build-test-service.yml
|
|
- job: "Build_Test_Publish_FactoryOrchestrator_HostedWindows_AnyCPU"
|
|
pool:
|
|
name: "Hosted Windows 2019 with VS2019"
|
|
demands:
|
|
- msbuild
|
|
- visualstudio
|
|
variables:
|
|
BuildPlatform: 'AnyCPU'
|
|
steps:
|
|
- checkout: self
|
|
- template: ./templates/template-set-initial-variables.yml
|
|
- template: ./templates/template-install-netcore.yml
|
|
- pwsh: |
|
|
Get-Item -Path env:* | Sort-Object Name
|
|
displayName: "Print all variables"
|
|
- template: ./templates/template-build-test-service.yml
|
|
- task: PowerShell@2
|
|
displayName: 'Create NET Core Test Files Zip'
|
|
inputs:
|
|
targetType: filePath
|
|
filePath: $(FORepoRoot)/build/internal/CreateTestZip.ps1
|
|
arguments: '-TestBinRoot $(Build.ARTIFACTSTAGINGDIRECTORY)/bin/tests/$(BuildConfiguration)/AnyCPU/ -OutFolder $(Build.ARTIFACTSTAGINGDIRECTORY)/bin/tests/TestZip'
|
|
failOnStderr: true
|
|
pwsh: true
|
|
timeoutInMinutes: 5
|
|
- template: ./templates/template-dotnet-publish-service.yml
|
|
parameters:
|
|
BuildPlatform: 'x86'
|
|
- template: ./templates/template-dotnet-publish-service.yml
|
|
parameters:
|
|
BuildPlatform: 'x64'
|
|
- template: ./templates/template-dotnet-publish-service.yml
|
|
parameters:
|
|
BuildPlatform: 'arm'
|
|
- template: ./templates/template-dotnet-publish-service.yml
|
|
parameters:
|
|
BuildPlatform: 'arm64'
|
|
- template: ./templates/template-dotnet-publish-service.yml
|
|
parameters:
|
|
BuildPlatform: 'x64'
|
|
BuildOS: 'linux'
|
|
- template: ./templates/template-dotnet-publish-service.yml
|
|
parameters:
|
|
BuildPlatform: 'arm'
|
|
BuildOS: 'linux'
|
|
- template: ./templates/template-dotnet-publish-service.yml
|
|
parameters:
|
|
BuildPlatform: 'arm64'
|
|
BuildOS: 'linux'
|
|
- template: ./templates/template-dotnet-publish-pwsh-library.yml
|
|
- template: ./templates/template-build-uwpclient.yml
|
|
- publish: '$(Build.ARTIFACTSTAGINGDIRECTORY)/bin/$(BuildConfiguration)/$(BuildPlatform)'
|
|
artifact: 'UnsignedBin_$(BuildConfiguration)_AnyCPU'
|
|
displayName: 'Publish unsigned binaries AnyCPU'
|
|
- publish: '$(Build.ARTIFACTSTAGINGDIRECTORY)/bin/$(BuildConfiguration)/Publish/win'
|
|
artifact: 'UnsignedBin_Windows_$(BuildConfiguration)_Publish'
|
|
displayName: 'Publish unsigned binaries service publish'
|
|
- publish: '$(Build.ARTIFACTSTAGINGDIRECTORY)/bin/$(BuildConfiguration)/Publish/linux'
|
|
artifact: 'UnsignedBin_Linux_$(BuildConfiguration)_Publish'
|
|
displayName: 'Publish unsigned binaries linux service publish'
|
|
- publish: '$(Build.ARTIFACTSTAGINGDIRECTORY)/bin/tests'
|
|
artifact: 'UnsignedBin_$(BuildConfiguration)_AnyCPU_Tests'
|
|
displayName: 'Publish unsigned test binaries and zip'
|
|
- task: CopyFiles@2
|
|
inputs:
|
|
sourceFolder: "$(FORepoRoot)/src/UWPClientLibrary/obj/$(BuildConfiguration)/"
|
|
targetFolder: "$(Build.ARTIFACTSTAGINGDIRECTORY)/UWPClientLibraryNuspecs/"
|
|
contents: "*.nuspec"
|
|
displayName: 'Copy Windows UWPClient nuspecs'
|
|
- publish: '$(Build.ARTIFACTSTAGINGDIRECTORY)/UWPClientLibraryNuspecs/'
|
|
artifact: 'UWPClient_Nuspecs'
|
|
displayName: 'Publish Windows UWPClient nuspecs'
|
|
|
|
- stage: 'Build_Test_FactoryOrchestrator_Windows_Apps'
|
|
displayName: 'Build Factory Orchestrator app'
|
|
dependsOn:
|
|
- 'Build_Test_FactoryOrchestrator_AnyCPU'
|
|
pool:
|
|
name: "Hosted Windows 2019 with VS2019"
|
|
demands:
|
|
- msbuild
|
|
- visualstudio
|
|
|
|
jobs:
|
|
- job: "Build_FactoryOrchestrator_App"
|
|
strategy:
|
|
matrix:
|
|
Release_x86:
|
|
BuildPlatform: 'x86'
|
|
Release_x64:
|
|
BuildPlatform: 'x64'
|
|
Release_Arm:
|
|
BuildPlatform: 'ARM'
|
|
maxParallel: '3'
|
|
steps:
|
|
- checkout: self
|
|
- template: ./templates/template-set-initial-variables.yml
|
|
- template: ./templates/template-install-netcore.yml
|
|
- pwsh: |
|
|
Get-Item -Path env:* | Sort-Object Name
|
|
displayName: "Print all variables"
|
|
- download: current
|
|
artifact: 'UnsignedBin_$(BuildConfiguration)_AnyCPU'
|
|
- task: CopyFiles@2
|
|
inputs:
|
|
sourceFolder: "$(Pipeline.Workspace)/UnsignedBin_$(BuildConfiguration)_AnyCPU"
|
|
targetFolder: "$(Build.ARTIFACTSTAGINGDIRECTORY)/bin/$(BuildConfiguration)/AnyCPU"
|
|
- template: ./templates/template-build-app.yml
|
|
- publish: '$(Build.ARTIFACTSTAGINGDIRECTORY)/bin/$(BuildConfiguration)/$(BuildPlatform)'
|
|
artifact: 'UnsignedBin_Windows_$(BuildConfiguration)_$(BuildPlatform)'
|
|
displayName: 'Publish unsigned Windows bin'
|
|
|
|
- stage: 'Sign_Binaries'
|
|
pool:
|
|
name: "Hosted Windows 2019 with VS2019"
|
|
demands:
|
|
- msbuild
|
|
- visualstudio
|
|
dependsOn:
|
|
- 'Build_Test_FactoryOrchestrator_Windows_Apps'
|
|
jobs:
|
|
- job: 'Sign_Windows'
|
|
steps:
|
|
- checkout: self
|
|
clean: true
|
|
- checkout: ComplianceRepo
|
|
clean: true
|
|
- template: ./templates/template-set-initial-variables.yml
|
|
- pwsh: |
|
|
Get-Item -Path env:* | Sort-Object Name
|
|
displayName: "Print all variables"
|
|
- ${{ if ne(parameters.UseOlderBuildArtifacts, true) }}:
|
|
- download: current
|
|
artifact: UnsignedBin_$(BuildConfiguration)_AnyCPU
|
|
- download: current
|
|
artifact: UnsignedBin_Windows_$(BuildConfiguration)_Publish
|
|
- download: current
|
|
artifact: UnsignedBin_Windows_$(BuildConfiguration)_x86
|
|
- download: current
|
|
artifact: UnsignedBin_Windows_$(BuildConfiguration)_x64
|
|
- download: current
|
|
artifact: UnsignedBin_Windows_$(BuildConfiguration)_ARM
|
|
- ${{ if eq(parameters.UseOlderBuildArtifacts, true) }}:
|
|
# Use these DownloadPipelineArtifact@2 tasks to use an older build artifact for testing.
|
|
# Useful to quickly iterate on later stages of the build.
|
|
# Set BUILDIDFORARTIFACTS variable to the desired build you want to use binaries from.
|
|
- task: DownloadPipelineArtifact@2
|
|
inputs:
|
|
source: specific
|
|
artifact: UnsignedBin_$(BuildConfiguration)_AnyCPU
|
|
allowFailedBuilds: true
|
|
allowPartiallySucceededBuilds: true
|
|
project: 'OneCore'
|
|
pipeline: $(System.DefinitionId)
|
|
runVersion: 'specific'
|
|
runId: $(BUILDIDFORARTIFACTS)
|
|
path: "$(Pipeline.Workspace)/UnsignedBin_$(BuildConfiguration)_AnyCPU"
|
|
displayName: "Download from BUILDIDFORARTIFACTS build"
|
|
- task: DownloadPipelineArtifact@2
|
|
inputs:
|
|
source: specific
|
|
artifact: UnsignedBin_Windows_$(BuildConfiguration)_Publish
|
|
allowFailedBuilds: true
|
|
allowPartiallySucceededBuilds: true
|
|
project: 'OneCore'
|
|
pipeline: $(System.DefinitionId)
|
|
runVersion: 'specific'
|
|
runId: $(BUILDIDFORARTIFACTS)
|
|
path: "$(Pipeline.Workspace)/UnsignedBin_Windows_$(BuildConfiguration)_Publish"
|
|
displayName: "Download from BUILDIDFORARTIFACTS build"
|
|
- task: DownloadPipelineArtifact@2
|
|
inputs:
|
|
source: specific
|
|
artifact: UnsignedBin_Windows_$(BuildConfiguration)_x86
|
|
allowFailedBuilds: true
|
|
allowPartiallySucceededBuilds: true
|
|
project: 'OneCore'
|
|
pipeline: $(System.DefinitionId)
|
|
runVersion: 'specific'
|
|
runId: $(BUILDIDFORARTIFACTS)
|
|
path: "$(Pipeline.Workspace)/UnsignedBin_Windows_$(BuildConfiguration)_x86"
|
|
displayName: "Download from BUILDIDFORARTIFACTS build"
|
|
- task: DownloadPipelineArtifact@2
|
|
inputs:
|
|
source: specific
|
|
artifact: UnsignedBin_Windows_$(BuildConfiguration)_x64
|
|
allowFailedBuilds: true
|
|
allowPartiallySucceededBuilds: true
|
|
project: 'OneCore'
|
|
pipeline: $(System.DefinitionId)
|
|
runVersion: 'specific'
|
|
runId: $(BUILDIDFORARTIFACTS)
|
|
path: "$(Pipeline.Workspace)/UnsignedBin_Windows_$(BuildConfiguration)_x64"
|
|
displayName: "Download from BUILDIDFORARTIFACTS build"
|
|
- task: DownloadPipelineArtifact@2
|
|
inputs:
|
|
source: specific
|
|
artifact: UnsignedBin_Windows_$(BuildConfiguration)_ARM
|
|
allowFailedBuilds: true
|
|
allowPartiallySucceededBuilds: true
|
|
project: 'OneCore'
|
|
pipeline: $(System.DefinitionId)
|
|
runVersion: 'specific'
|
|
runId: $(BUILDIDFORARTIFACTS)
|
|
path: "$(Pipeline.Workspace)/UnsignedBin_Windows_$(BuildConfiguration)_ARM"
|
|
displayName: "Download from BUILDIDFORARTIFACTS build"
|
|
- task: CopyFiles@2
|
|
inputs:
|
|
sourceFolder: "$(Pipeline.Workspace)/UnsignedBin_$(BuildConfiguration)_AnyCPU"
|
|
targetFolder: "$(Build.ARTIFACTSTAGINGDIRECTORY)/unsignedbin/AnyCPU"
|
|
- task: CopyFiles@2
|
|
inputs:
|
|
sourceFolder: "$(Pipeline.Workspace)/UnsignedBin_Windows_$(BuildConfiguration)_Publish"
|
|
targetFolder: "$(Build.ARTIFACTSTAGINGDIRECTORY)/unsignedbin/Publish/win"
|
|
- task: CopyFiles@2
|
|
inputs:
|
|
sourceFolder: "$(Pipeline.Workspace)/UnsignedBin_Windows_$(BuildConfiguration)_x86"
|
|
targetFolder: "$(Build.ARTIFACTSTAGINGDIRECTORY)/unsignedbin/x86"
|
|
- task: CopyFiles@2
|
|
inputs:
|
|
sourceFolder: "$(Pipeline.Workspace)/UnsignedBin_Windows_$(BuildConfiguration)_x64"
|
|
targetFolder: "$(Build.ARTIFACTSTAGINGDIRECTORY)/unsignedbin/x64"
|
|
- task: CopyFiles@2
|
|
inputs:
|
|
sourceFolder: "$(Pipeline.Workspace)/UnsignedBin_Windows_$(BuildConfiguration)_ARM"
|
|
targetFolder: "$(Build.ARTIFACTSTAGINGDIRECTORY)/unsignedbin/ARM"
|
|
- template: ./templates/template-sign-binaries-windows.yml
|
|
parameters:
|
|
ShouldSign: "$(SHOULDSIGN)"
|
|
- pwsh: |
|
|
$vstsCommandString = "vso[build.addbuildtag]SignedBuild"
|
|
Write-Host "sending " + $vstsCommandString
|
|
Write-Host "##$vstsCommandString"
|
|
displayName: 'Tag build as SignedBuild'
|
|
condition: and(succeeded(), eq(variables['SHOULDSIGN'], 'true'))
|
|
|
|
- stage: compliance
|
|
displayName: Compliance
|
|
dependsOn:
|
|
- 'Sign_Binaries'
|
|
jobs:
|
|
- job: Compliance_Job
|
|
pool:
|
|
name: Package ES Standard Build
|
|
steps:
|
|
- checkout: self
|
|
clean: true
|
|
|
|
- checkout: ComplianceRepo
|
|
clean: true
|
|
|
|
- template: ./templates/template-set-initial-variables.yml
|
|
|
|
- pwsh: |
|
|
Get-Item -Path env:* | Sort-Object Name
|
|
displayName: "Print all variables"
|
|
|
|
- ${{ if ne(parameters.UseOlderBuildArtifacts, true) }}:
|
|
- download: 'current'
|
|
artifact: 'SignedBin_Windows_Release_AllPlatforms'
|
|
patterns: |
|
|
**/JKang.*.dll
|
|
**/PE-Utility.dll
|
|
**/PeterKottas.*.dll
|
|
**/DasMulli.*.dll
|
|
**/Microsoft.FactoryOrchestrator*.@(dll|exe)
|
|
**/*.msixbundle
|
|
**/*.msix
|
|
|
|
- ${{ if eq(parameters.UseOlderBuildArtifacts, true) }}:
|
|
# Use these DownloadPipelineArtifact@2 tasks to use an older build artifact for testing.
|
|
# Useful to quickly iterate on later stages of the build.
|
|
# Set BUILDIDFORARTIFACTS variable to the desired build you want to use binaries from.
|
|
- task: DownloadPipelineArtifact@2
|
|
inputs:
|
|
source: specific
|
|
artifact: SignedBin_Windows_Release_AllPlatforms
|
|
allowFailedBuilds: true
|
|
allowPartiallySucceededBuilds: true
|
|
project: 'OneCore'
|
|
pipeline: $(System.DefinitionId)
|
|
runVersion: 'specific'
|
|
runId: $(BUILDIDFORARTIFACTS)
|
|
path: "$(Pipeline.Workspace)/SignedBin_Windows_Release_AllPlatforms"
|
|
patterns: |
|
|
**/JKang.*.dll
|
|
**/PE-Utility.dll
|
|
**/PeterKottas.*.dll
|
|
**/DasMulli.*.dll
|
|
**/Microsoft.FactoryOrchestrator*.@(dll|exe)
|
|
**/*.msixbundle
|
|
**/*.msix
|
|
displayName: "Download from BUILDIDFORARTIFACTS build"
|
|
|
|
- template: assembly-module-compliance.yml@ComplianceRepo
|
|
parameters:
|
|
# binskim
|
|
AnalyzeTarget: '$(Pipeline.Workspace)/SignedBin_Windows_Release_AllPlatforms/*JKang.*.dll;$(Pipeline.Workspace)/SignedBin_Windows_Release_AllPlatforms/*PE-Utility.dll;$(Pipeline.Workspace)/SignedBin_Windows_Release_AllPlatforms/*FactoryOrchestraor*.dll;$(Pipeline.Workspace)/SignedBin_Windows_Release_AllPlatforms/*FactoryOrchestrator*.exe;$(Pipeline.Workspace)/SignedBin_Windows_Release_AllPlatforms/Common.Logging*.dll;$(Pipeline.Workspace)/SignedBin_Windows_Release_AllPlatforms/System.Net.IPNetwork.dll;$(Pipeline.Workspace)/SignedBin_Windows_Release_AllPlatforms/SimpleBase.dll;$(Pipeline.Workspace)/SignedBin_Windows_Release_AllPlatforms/Makaretu.*.dll'
|
|
AnalyzeSymPath: 'SRV*'
|
|
# component-governance
|
|
sourceScanPath: '$(FORepoRoot)/src'
|
|
# credscan
|
|
suppressionsFile: '$(FORepoRoot)/build/config/CredScanSuppressions.json'
|
|
# TermCheck
|
|
optionsRulesDBPath: ''
|
|
optionsFTPath: ''
|
|
# tsa-upload
|
|
codeBaseName: 'FactoryOrchestrator'
|
|
# API Scan
|
|
softwareFolder: '$(Pipeline.Workspace)/SignedBin_Windows_Release_AllPlatforms'
|
|
softwareName: 'FactoryOrchestrator'
|
|
softwareVersion: '$(VERSIONPREFIX)$(VERSIONSUFFIXVPACK)'
|
|
APIScan: 'true'
|
|
|
|
# This stage only publishes Azure DevOps pipeline artifacts. It does not release anything publicly.
|
|
- stage: 'Sign_Publish_NuGet_ServiceZip_Artifacts'
|
|
displayName: 'Create signed NuGet packages and service zip files'
|
|
dependsOn:
|
|
- 'Sign_Binaries'
|
|
pool:
|
|
name: "Hosted Windows 2019 with VS2019"
|
|
demands:
|
|
- msbuild
|
|
- visualstudio
|
|
jobs:
|
|
- job: Job_Sign_Publish_NuGet_ServiceZip_Artifacts
|
|
steps:
|
|
- checkout: self
|
|
clean: true
|
|
- checkout: ComplianceRepo
|
|
clean: true
|
|
|
|
- template: ./templates/template-set-initial-variables.yml
|
|
|
|
# Set output variable used as condition for final stage (public release)
|
|
- pwsh: |
|
|
if ($env:SKIPPUBLISH -eq 'false' -or (($null -ne $env:FORCEPUBLISH) -and ($env:FORCEPUBLISH -eq $true)))
|
|
{
|
|
$vstsCommandString = "vso[task.setvariable variable=SHOULDPUBLISH;isOutput=true]true"
|
|
}
|
|
else
|
|
{
|
|
$vstsCommandString = "vso[task.setvariable variable=SHOULDPUBLISH;isOutput=true]false"
|
|
}
|
|
Write-Host "sending " + $vstsCommandString
|
|
Write-Host "##$vstsCommandString"
|
|
displayName: 'Set SHOULDPUBLISH Global'
|
|
name: SPOutput
|
|
|
|
- template: ./templates/template-install-netcore.yml
|
|
- task: NuGetToolInstaller@1
|
|
- pwsh: |
|
|
Get-Item -Path env:* | Sort-Object Name
|
|
displayName: "Print all variables"
|
|
- task: DotNetCoreCLI@2
|
|
inputs:
|
|
command: 'restore'
|
|
projects: '$(FORepoRoot)/src/FactoryOrchestratorNoApp.sln'
|
|
displayName: 'dotnet restore'
|
|
|
|
- ${{ if ne(parameters.UseOlderBuildArtifacts, true) }}:
|
|
- download: 'current'
|
|
artifact: 'SignedBin_Windows_Release_AllPlatforms'
|
|
- download: 'current'
|
|
artifact: 'UnsignedBin_Linux_Release_Publish'
|
|
- download: 'current'
|
|
artifact: 'UWPClient_Nuspecs'
|
|
- ${{ if eq(parameters.UseOlderBuildArtifacts, true) }}:
|
|
# Use these DownloadPipelineArtifact@2 tasks to use an older build artifact for testing.
|
|
# Useful to quickly iterate on later stages of the build.
|
|
# Set BUILDIDFORARTIFACTS variable to the desired build you want to use binaries from.
|
|
- task: DownloadPipelineArtifact@2
|
|
inputs:
|
|
source: specific
|
|
artifact: SignedBin_Windows_Release_AllPlatforms
|
|
allowFailedBuilds: true
|
|
allowPartiallySucceededBuilds: true
|
|
project: 'OneCore'
|
|
pipeline: $(System.DefinitionId)
|
|
runVersion: 'specific'
|
|
runId: $(BUILDIDFORARTIFACTS)
|
|
path: "$(Pipeline.Workspace)/SignedBin_Windows_Release_AllPlatforms"
|
|
displayName: "Download from BUILDIDFORARTIFACTS build"
|
|
- task: DownloadPipelineArtifact@2
|
|
inputs:
|
|
source: specific
|
|
artifact: UnsignedBin_Linux_Release_Publish
|
|
allowFailedBuilds: true
|
|
allowPartiallySucceededBuilds: true
|
|
project: 'OneCore'
|
|
pipeline: $(System.DefinitionId)
|
|
runVersion: 'specific'
|
|
runId: $(BUILDIDFORARTIFACTS)
|
|
path: "$(Pipeline.Workspace)/UnsignedBin_Linux_Release_Publish"
|
|
displayName: "Download from BUILDIDFORARTIFACTS build"
|
|
- task: DownloadPipelineArtifact@2
|
|
inputs:
|
|
source: specific
|
|
artifact: UWPClient_Nuspecs
|
|
allowFailedBuilds: true
|
|
allowPartiallySucceededBuilds: true
|
|
project: 'OneCore'
|
|
pipeline: $(System.DefinitionId)
|
|
runVersion: 'specific'
|
|
runId: $(BUILDIDFORARTIFACTS)
|
|
path: "$(Pipeline.Workspace)/UWPClient_Nuspecs"
|
|
displayName: "Download from BUILDIDFORARTIFACTS build"
|
|
|
|
- task: CopyFiles@2
|
|
inputs:
|
|
sourceFolder: "$(Pipeline.Workspace)/SignedBin_Windows_Release_AllPlatforms"
|
|
targetFolder: "$(Build.ARTIFACTSTAGINGDIRECTORY)/bin/Release"
|
|
- task: CopyFiles@2
|
|
inputs:
|
|
sourceFolder: "$(Pipeline.Workspace)/UnsignedBin_Linux_Release_Publish"
|
|
targetFolder: "$(Build.ARTIFACTSTAGINGDIRECTORY)/bin/Release/Publish/linux"
|
|
|
|
- template: ./templates/template-pack-sign-nuget.yml
|
|
parameters:
|
|
ShouldSign: "$(SHOULDSIGN)"
|
|
|
|
- template: ./templates/template-create-service-zip.yml
|
|
parameters:
|
|
BuildConfiguration: 'Release'
|
|
BuildPlatform: 'x86'
|
|
- template: ./templates/template-create-service-zip.yml
|
|
parameters:
|
|
BuildConfiguration: 'Release'
|
|
BuildPlatform: 'x64'
|
|
- template: ./templates/template-create-service-zip.yml
|
|
parameters:
|
|
BuildConfiguration: 'Release'
|
|
BuildPlatform: 'arm'
|
|
- template: ./templates/template-create-service-zip.yml
|
|
parameters:
|
|
BuildConfiguration: 'Release'
|
|
BuildPlatform: 'arm64'
|
|
- template: ./templates/template-create-service-zip.yml
|
|
parameters:
|
|
BuildConfiguration: 'Release'
|
|
BuildPlatform: 'x64'
|
|
BuildOS: 'linux'
|
|
- template: ./templates/template-create-service-zip.yml
|
|
parameters:
|
|
BuildConfiguration: 'Release'
|
|
BuildPlatform: 'arm'
|
|
BuildOS: 'linux'
|
|
- template: ./templates/template-create-service-zip.yml
|
|
parameters:
|
|
BuildConfiguration: 'Release'
|
|
BuildPlatform: 'arm64'
|
|
BuildOS: 'linux'
|
|
- publish: '$(Build.ARTIFACTSTAGINGDIRECTORY)\bin\Release\Publish\Zips\'
|
|
artifact: ServiceZips
|
|
|
|
# This final stage publishes to NuGet.org, PowerShell Gallery, vPacks, and the public symbol server. Only run it if you want to make your build outputs public!
|
|
# It uses the FO-Publish-Release environment to require manual approval before running.
|
|
# TODO: see if we can get this to publish a GitHub release
|
|
- stage: 'Publish_vPack_PSGallery_NuGet_Symbols_PUBLIC'
|
|
displayName: 'Public publish of packages and symbols'
|
|
condition: and(or(eq(variables['FORCEPUBLISH'], true),eq(stageDependencies.Sign_Publish_NuGet_ServiceZip_Artifacts.outputs['Job_Sign_Publish_NuGet_ServiceZip_Artifacts.SPOutput.SHOULDPUBLISH'], 'true')), succeeded())
|
|
dependsOn:
|
|
- 'Sign_Publish_NuGet_ServiceZip_Artifacts'
|
|
- 'compliance'
|
|
pool:
|
|
name: Package ES Standard Build
|
|
jobs:
|
|
- deployment: Job_Publish_vPack_PSGallery_NuGet_Symbols_PUBLIC
|
|
environment: FO-Publish-Release
|
|
strategy:
|
|
runOnce:
|
|
deploy:
|
|
steps:
|
|
- checkout: self
|
|
clean: true
|
|
- template: ./templates/template-set-initial-variables.yml
|
|
- template: ./templates/template-install-netcore.yml
|
|
|
|
- ${{ if eq(parameters.VPackVersionAppendId, true) }}:
|
|
- pwsh: |
|
|
$vstsCommandString = "vso[task.setvariable variable=VPACKVERSIONBUILDIDSUFFIX]$env:BUILD_BUILDID"
|
|
Write-Host "sending " + $vstsCommandString
|
|
Write-Host "##$vstsCommandString"
|
|
displayName: 'Set build id VPack suffix'
|
|
|
|
- pwsh: |
|
|
Get-Item -Path env:* | Sort-Object Name
|
|
displayName: "Print all variables"
|
|
|
|
- ${{ if ne(parameters.UseOlderBuildArtifacts, true) }}:
|
|
- download: 'current'
|
|
artifact: 'SignedBin_Windows_Release_AllPlatforms'
|
|
- download: 'current'
|
|
artifact: 'SignedNugets_Windows_Release'
|
|
- download: 'current'
|
|
artifact: 'UnsignedBin_$(BuildConfiguration)_AnyCPU_Tests'
|
|
patterns: 'TestZip/*'
|
|
- ${{ if eq(parameters.UseOlderBuildArtifacts, true) }}:
|
|
# Use these DownloadPipelineArtifact@2 tasks to use an older build artifact for publishing.
|
|
# Useful to release a build in stages if things went awry.
|
|
# Set BUILDIDFORARTIFACTS variable to the desired build you want to use binaries from for publishing.
|
|
- task: DownloadPipelineArtifact@2
|
|
inputs:
|
|
source: specific
|
|
artifact: SignedBin_Windows_Release_AllPlatforms
|
|
allowFailedBuilds: true
|
|
allowPartiallySucceededBuilds: true
|
|
project: 'OneCore'
|
|
pipeline: $(System.DefinitionId)
|
|
runVersion: 'specific'
|
|
runId: $(BUILDIDFORARTIFACTS)
|
|
path: "$(Pipeline.Workspace)/SignedBin_Windows_Release_AllPlatforms"
|
|
displayName: "Download from BUILDIDFORARTIFACTS build"
|
|
- task: DownloadPipelineArtifact@2
|
|
inputs:
|
|
source: specific
|
|
artifact: SignedNugets_Windows_Release
|
|
allowFailedBuilds: true
|
|
allowPartiallySucceededBuilds: true
|
|
project: 'OneCore'
|
|
pipeline: $(System.DefinitionId)
|
|
runVersion: 'specific'
|
|
runId: $(BUILDIDFORARTIFACTS)
|
|
path: "$(Pipeline.Workspace)/SignedNugets_Windows_Release"
|
|
displayName: "Download from BUILDIDFORARTIFACTS build"
|
|
- task: DownloadPipelineArtifact@2
|
|
inputs:
|
|
source: specific
|
|
artifact: 'UnsignedBin_$(BuildConfiguration)_AnyCPU_Tests'
|
|
patterns: 'TestZip/*'
|
|
allowFailedBuilds: true
|
|
allowPartiallySucceededBuilds: true
|
|
project: 'OneCore'
|
|
pipeline: $(System.DefinitionId)
|
|
runVersion: 'specific'
|
|
runId: $(BUILDIDFORARTIFACTS)
|
|
path: "$(Pipeline.Workspace)/UnsignedBin_$(BuildConfiguration)_AnyCPU_Tests"
|
|
displayName: "Download from BUILDIDFORARTIFACTS build"
|
|
|
|
# Expects ArtifactServices.Symbol.PAT secret variable to be defined with a PAT
|
|
- pwsh: |
|
|
$vstsCommandString = "vso[task.setvariable variable=ArtifactServices.Symbol.AccountName]microsoftpublicsymbols"
|
|
Write-Host "sending " + $vstsCommandString
|
|
Write-Host "##$vstsCommandString"
|
|
displayName: 'Set symbol publish variables'
|
|
|
|
# Publish pdbs to microsoftpublicsymbols
|
|
- task: PublishSymbols@2
|
|
inputs:
|
|
symbolsFolder: '$(Pipeline.Workspace)/SignedBin_Windows_Release_AllPlatforms'
|
|
searchPattern: '**/*.pdb'
|
|
indexSources: 'false'
|
|
SymbolServerType: 'teamServices'
|
|
SymbolsArtifactName: 'Symbols_Release'
|
|
SymbolsProduct: 'FactoryOrchestrator'
|
|
SymbolsVersion: '$(VersionPrefix)$(VERSIONSUFFIXVPACK)'
|
|
condition: and(ne(variables['SKIPPDBPUBLISH'], 'true'), succeeded())
|
|
displayName: 'publish symbols to public server'
|
|
|
|
# Publish PowerShell module to PowerShell Gallery with API key in secret variable OCSYM.PSGalleryApiKey
|
|
- pwsh: |
|
|
$userModulePath = $env:PSModulePath.Split(';')[0]
|
|
. robocopy /S "$(Pipeline.Workspace)\SignedBin_Windows_Release_AllPlatforms\Publish\win\Microsoft.FactoryOrchestrator.PowerShell" "$userModulePath\Microsoft.FactoryOrchestrator.Client"
|
|
$ErrorActionPreference = "silentlyContinue"
|
|
publish-module -Name "Microsoft.FactoryOrchestrator.Client" -NuGetApiKey $(OCSYM.PSGalleryApiKey) -AllowPrerelease
|
|
$err = Get-Error
|
|
if (($err.Exception.HResult -eq -2146233088) -and ($($err.CategoryInfo.TargetName) -eq "Microsoft.PowerShell.PackageManagement.Cmdlets.FindPackage"))
|
|
{
|
|
# Handle weird bug where publish succeeds but this error is seen
|
|
Write-Host "Package successfully published"
|
|
exit 0
|
|
}
|
|
else
|
|
{
|
|
#write out error
|
|
$ErrorActionPreference = "stop"
|
|
write-error $err
|
|
exit 1
|
|
}
|
|
condition: and(ne(variables['SKIPPWSHPUBLISH'], 'true'), succeeded())
|
|
displayName: 'Publish PowerShell module to PSGallery'
|
|
|
|
# Publish NuGet binary & symbol packages to NuGet.org with API key in secret variable OCSYM.NuGetApiKey
|
|
- task: DotNetCoreCLI@2
|
|
displayName: 'Push Nuget Binary and Symbol Packages'
|
|
inputs:
|
|
command: custom
|
|
custom: nuget
|
|
arguments: >
|
|
push $(Pipeline.Workspace)\SignedNugets_Windows_Release\*.nupkg
|
|
-s https://api.nuget.org/v3/index.json
|
|
-k $(OCSYM.NuGetApiKey)
|
|
condition: and(ne(variables['SKIPNUGETPUBLISH'], 'true'), succeeded())
|
|
|
|
- task: CopyFiles@2
|
|
inputs:
|
|
sourceFolder: "$(Pipeline.Workspace)/SignedBin_Windows_Release_AllPlatforms/Publish"
|
|
targetFolder: "$(Build.ARTIFACTSTAGINGDIRECTORY)/bin/Release/Publish"
|
|
|
|
# Push all vPacks
|
|
- template: ./templates/template-push-vpack-service.yml
|
|
parameters:
|
|
BuildConfiguration: 'Release'
|
|
BuildPlatform: 'x86'
|
|
- template: ./templates/template-push-vpack-service.yml
|
|
parameters:
|
|
BuildConfiguration: 'Release'
|
|
BuildPlatform: 'x64'
|
|
- template: ./templates/template-push-vpack-service.yml
|
|
parameters:
|
|
BuildConfiguration: 'Release'
|
|
BuildPlatform: 'arm'
|
|
- template: ./templates/template-push-vpack-service.yml
|
|
parameters:
|
|
BuildConfiguration: 'Release'
|
|
BuildPlatform: 'arm64'
|
|
- template: ./templates/template-push-vpack-other.yml
|
|
- publish: '$(Build.ARTIFACTSTAGINGDIRECTORY)/VPackManifests'
|
|
artifact: VPackManifests
|
|
- pwsh: |
|
|
$vstsCommandString = "vso[build.addbuildtag]OfficialRelease"
|
|
Write-Host "sending " + $vstsCommandString
|
|
Write-Host "##$vstsCommandString"
|
|
displayName: 'Tag build as OfficialRelease'
|
|
- pwsh: |
|
|
$vstsCommandString = "vso[build.addbuildtag]$(VERSIONPREFIX)$(VERSIONSUFFIXVPACK)"
|
|
Write-Host "sending " + $vstsCommandString
|
|
Write-Host "##$vstsCommandString"
|
|
displayName: 'Tag build with version'
|