221 lines
8.3 KiB
YAML
221 lines
8.3 KiB
YAML
# Rebuild pipeline for WinGet.
|
|
|
|
# Name of the run
|
|
name: '$(Build.DefinitionName)-$(Build.DefinitionVersion)-$(Date:yyyyMMdd)-$(Rev:r)'
|
|
|
|
trigger: none
|
|
pr: none
|
|
|
|
variables:
|
|
Rebuild.SkipManifestIndexUpdate: $[coalesce(variables.SkipManifestIndexUpdate, 'False')]
|
|
Rebuild.SkipPausePublishPipeline: $[coalesce(variables.SkipPausePublishPipeline, 'False')]
|
|
Rebuild.EnableContainerBackup: $[coalesce(variables.EnableContainerBackup, 'False')]
|
|
Rebuild.ClearContainer: $[coalesce(variables.ClearContainer, 'False')]
|
|
|
|
resources:
|
|
repositories:
|
|
- repository: 1ESPipelineTemplates
|
|
type: git
|
|
name: 1ESPipelineTemplates/1ESPipelineTemplates
|
|
ref: refs/tags/release
|
|
extends:
|
|
template: v1/1ES.Official.PipelineTemplate.yml@1ESPipelineTemplates
|
|
parameters:
|
|
pool:
|
|
name: Azure-Pipelines-1ESPT-ExDShared
|
|
image: windows-2022
|
|
os: windows
|
|
customBuildTags:
|
|
- ES365AIMigrationTooling
|
|
|
|
stages:
|
|
- stage: WinGetSvc_Rebuild
|
|
jobs:
|
|
# Agent phase.
|
|
- job: 'Rebuild'
|
|
displayName: 'Start Rebuild'
|
|
variables:
|
|
skipComponentGovernanceDetection: ${{ true }}
|
|
runCodesignValidationInjection: ${{ false }}
|
|
timeoutInMinutes: 0
|
|
|
|
steps:
|
|
|
|
# Allow scripts to access the system token.
|
|
# Don't fetch all history.
|
|
# Don't fetch tags.
|
|
- checkout: self
|
|
persistCredentials: true
|
|
clean: true
|
|
fetchDepth: 1
|
|
fetchTags: false
|
|
|
|
# Roll back agent to 2.76, see issue https://github.com/Azure/azure-cli/issues/32088#issuecomment-3283886207
|
|
# NOTE: Remove the next 3 steps once issue is fixed.
|
|
- powershell: |
|
|
Start-Process msiexec -ArgumentList ' /x {37CCEB8D-306A-4DB4-B25B-7608A093D184} /qn' -NoNewWindow -Wait
|
|
displayName: "Uninstall Azure CLI"
|
|
|
|
- powershell: |
|
|
Invoke-WebRequest -Uri "https://azurecliprod.blob.core.windows.net/msi/azure-cli-2.76.0-x64.msi" -OutFile "azure-cli-2.76.0.msi"
|
|
Start-Process msiexec -ArgumentList '/i "azure-cli-2.76.0.msi" /quiet /norestart' -NoNewWindow -Wait
|
|
displayName: "Install Azure CLI 2.76.0"
|
|
workingDirectory: $(Agent.TempDirectory)
|
|
|
|
- script: |
|
|
az version
|
|
displayName: "Check Azure CLI version"
|
|
|
|
# Downloads all the setup files and its dependencies.
|
|
- task: AzureCLI@2
|
|
displayName: 'Azure Setup'
|
|
inputs:
|
|
azureSubscription: '$(WinGetSvc.DataAccess)'
|
|
scriptType: batch
|
|
scriptLocation: inlineScript
|
|
inlineScript: |
|
|
az storage blob download-batch --auth-mode login -d . --pattern * -s servicewrapper --output none --account-name $(ValidationStorageAccountName)
|
|
addSpnToEnvironment: true
|
|
|
|
# WinGet setup
|
|
- task: CmdLine@2
|
|
name: 'wingetsetup'
|
|
displayName: 'WinGet Setup'
|
|
env:
|
|
HOST_KEY: $(AzureFunctionHostKey)
|
|
SIGN_ENDPOINT: $(AzFuncSignEndpoint)
|
|
PUBLISH_ENDPOINT: $(AzFuncRebuildPublishEndpoint)
|
|
CLEANUP_ENDPOINT: $(AzFuncRebuildCleanupEndpoint)
|
|
RESTSOURCE_REBUILD_ENDPOINT: $(AzFuncRestSourceRebuildEndpoint)
|
|
inputs:
|
|
script: 'winget_rebuild_setup.cmd'
|
|
workingDirectory: scripts
|
|
|
|
- task: AzureCLI@2
|
|
displayName: 'Validate Manifests'
|
|
inputs:
|
|
azureSubscription: '$(WinGetSvc.DataAccess)'
|
|
scriptType: batch
|
|
scriptLocation: inlineScript
|
|
inlineScript: |
|
|
WinGetSvcWrapper.exe rebuild --operationId %BUILD_BUILDNUMBER%
|
|
addSpnToEnvironment: true
|
|
failOnStandardError: true
|
|
env:
|
|
ValidationStorageAccountName: $(ValidationStorageAccountName)
|
|
CacheStorageAccountName: $(CacheStorageAccountName)
|
|
StorageManagedIdentityClientId: $(StorageManagedIdentityClientId)
|
|
WinGet:AppConfig:PrimaryEndpoint: $(AppConfigPrimaryEndpoint)
|
|
WinGet:AppConfig:SecondaryEndpoint: $(AppConfigSecondaryEndpoint)
|
|
DIApplicationInsightKey: $(DIApplicationInsightKey)
|
|
PackagePublisher: $(PackagePublisher)
|
|
SYSTEM_ACCESSTOKEN: $(System.AccessToken)
|
|
ExecutionEnvironment: $(WinGetSvc.ExecutionEnvironment)
|
|
SkipPausePublishPipeline: $(Rebuild.SkipPausePublishPipeline)
|
|
|
|
# Agentless phase. Depends on previous job.
|
|
- job: 'SignPackage'
|
|
pool: server
|
|
timeoutInMinutes: 1500
|
|
displayName: 'Sign package'
|
|
dependsOn:
|
|
- 'Rebuild'
|
|
variables:
|
|
HostKeySecret: $[ dependencies.Rebuild.outputs['wingetsetup.hostkey']]
|
|
SignEndpointSecret: $[ dependencies.Rebuild.outputs['wingetsetup.signEndpoint']]
|
|
steps:
|
|
|
|
# Sign package.
|
|
- task: AzureFunction@1
|
|
displayName: 'Signing package'
|
|
inputs:
|
|
function: '$(SignEndpointSecret)'
|
|
key: '$(HostKeySecret)'
|
|
body: |
|
|
{
|
|
"operationId": "$(Build.BuildNumber)",
|
|
"buildId": "$(Build.BuildId)",
|
|
"projectId": "$(system.TeamProjectId)",
|
|
"planId": "$(system.PlanId)",
|
|
"jobId": "$(system.JobId)",
|
|
"timelineId": "$(system.TimelineId)",
|
|
"taskInstanceId": "$(system.TaskInstanceId)",
|
|
"repository": "$(build.repository.id)",
|
|
"pipelineType": "RebuildPipeline",
|
|
}
|
|
waitForCompletion: "true"
|
|
|
|
# Agentless phase. Depends on previous job.
|
|
- job: 'Publish'
|
|
pool: server
|
|
timeoutInMinutes: 1500
|
|
displayName: 'Publish'
|
|
dependsOn:
|
|
- 'Rebuild'
|
|
- 'SignPackage'
|
|
variables:
|
|
HostKeySecret: $[ dependencies.Rebuild.outputs['wingetsetup.hostkey']]
|
|
PublishEndpointSecret: $[ dependencies.Rebuild.outputs['wingetsetup.publishEndpoint']]
|
|
steps:
|
|
|
|
# Rebuild Publish.
|
|
- task: AzureFunction@1
|
|
displayName: 'Publish'
|
|
inputs:
|
|
function: '$(PublishEndpointSecret)'
|
|
key: '$(HostKeySecret)'
|
|
body: |
|
|
{
|
|
"operationId": "$(Build.BuildNumber)",
|
|
"buildId": "$(Build.BuildId)",
|
|
"projectId": "$(system.TeamProjectId)",
|
|
"planId": "$(system.PlanId)",
|
|
"jobId": "$(system.JobId)",
|
|
"timelineId": "$(system.TimelineId)",
|
|
"taskInstanceId": "$(system.TaskInstanceId)",
|
|
"repository": "$(build.repository.id)",
|
|
"pipelineType": "RebuildPipeline",
|
|
"containerName": "$(CacheContainerName)",
|
|
"commitTablePartitionKey": "$(CommitTablePartitionKey)",
|
|
"commitTableRowKey": "$(CommitTableRowKey)",
|
|
"enableContainerBackup": "$(Rebuild.EnableContainerBackup)",
|
|
"skipManifestIndexUpdate": "$(Rebuild.SkipManifestIndexUpdate)",
|
|
"clearContainer": "$(Rebuild.ClearContainer)",
|
|
}
|
|
waitForCompletion: "true"
|
|
|
|
# Agentless phase. Depends on previous job.
|
|
- job: 'Cleanup'
|
|
pool: server
|
|
timeoutInMinutes: 1500
|
|
displayName: 'Cleanup'
|
|
dependsOn:
|
|
- 'Rebuild'
|
|
- 'SignPackage'
|
|
- 'Publish'
|
|
condition: and(succeededOrFailed(), ne(variables['Rebuild.SkipPausePublishPipeline'], 'True'))
|
|
variables:
|
|
HostKeySecret: $[ dependencies.Rebuild.outputs['wingetsetup.hostkey']]
|
|
CleanupEndpointSecret: $[ dependencies.Rebuild.outputs['wingetsetup.cleanupEndpoint']]
|
|
steps:
|
|
|
|
# Rebuild cleanup.
|
|
- task: AzureFunction@1
|
|
displayName: 'Cleanup'
|
|
inputs:
|
|
function: '$(CleanupEndpointSecret)'
|
|
key: '$(HostKeySecret)'
|
|
body: |
|
|
{
|
|
"operationId": "$(Build.BuildNumber)",
|
|
"buildId": "$(Build.BuildId)",
|
|
"projectId": "$(system.TeamProjectId)",
|
|
"planId": "$(system.PlanId)",
|
|
"jobId": "$(system.JobId)",
|
|
"timelineId": "$(system.TimelineId)",
|
|
"taskInstanceId": "$(system.TaskInstanceId)",
|
|
"repository": "$(build.repository.id)",
|
|
"pipelineType": "RebuildPipeline",
|
|
}
|
|
waitForCompletion: "true"
|