From 37e95e5003cb3897f83c5c85a29bd77b9e5940cc Mon Sep 17 00:00:00 2001 From: Peter Collins Date: Thu, 30 Jan 2025 15:24:20 -0500 Subject: [PATCH 1/5] [ci] Move build pipeline to dnceng-public Updates the build pipeline to run in new build in the dnceng-public org: https://dev.azure.com/dnceng-public/public/_build?definitionId=304 The OneLocBuild job has been moved to a separate pipeline file that will run on a schedule in the DevDiv org. --- Localize/onelocbuild.yaml | 72 ++++++++++ build-tools/automation/azure-pipelines.yaml | 146 +------------------- 2 files changed, 79 insertions(+), 139 deletions(-) create mode 100644 Localize/onelocbuild.yaml diff --git a/Localize/onelocbuild.yaml b/Localize/onelocbuild.yaml new file mode 100644 index 000000000..a50cb62be --- /dev/null +++ b/Localize/onelocbuild.yaml @@ -0,0 +1,72 @@ +trigger: none +pr: none + +schedules: +- cron: "0 6 * * *" + displayName: Run daily at 6:00 UTC + branches: + include: + - main +- cron: "0 6 * * Sunday" + displayName: Run weekly on Sunday at 6:00 UTC + branches: + include: + - main + always: true + +jobs: +- job: OneLocBuild + displayName: OneLocBuild + condition: and(eq(variables['System.TeamProject'], 'DevDiv'), eq(variables['Build.SourceBranch'], 'refs/heads/main')) + pool: + name: AzurePipelines-EO + demands: + - ImageOverride -equals 1ESPT-Windows2022 + timeoutInMinutes: 30 + variables: + - group: Xamarin-Secrets + workspace: + clean: all + steps: + - checkout: self + clean: true + + # https://eng.ms/docs/cloud-ai-platform/devdiv/one-engineering-system-1es/1es-docs/1es-security-configuration/configuration-guides/pat-burndown-guidance#authentication-from-pipelines + # Requires Azure client 2.x + - task: AzureCLI@2 + displayName: 'Set AzDO.OneLocBuildToken' + enabled: true + inputs: + azureSubscription: 'VSEng-AzureDevOps-ceapex-OneLocBuild' # Azure DevOps service connection + scriptType: 'pscore' + scriptLocation: 'inlineScript' + inlineScript: | + # if this fails, check out this bash script that includes diagnostics: + # https://gist.github.com/johnterickson/19f80a3e969e39f1000d118739176e62 + # Note that the resource is specified to limit the token to Azure DevOps + $token = az account get-access-token --query accessToken --resource 499b84ac-1321-427f-aa17-267ca6975798 -o tsv + Write-Host "##vso[task.setvariable variable=AzDO.OneLocBuildToken;issecret=true]${token}" + + - task: OneLocBuild@2 + displayName: OneLocBuild + env: + SYSTEM_ACCESSTOKEN: $(System.AccessToken) + inputs: + locProj: Localize/LocProject.json + outDir: $(Build.StagingDirectory) + packageSourceAuth: patAuth + patVariable: $(AzDO.OneLocBuildToken) + isCreatePrSelected: true + repoType: gitHub + gitHubPatVariable: $(github--pat--vs-mobiletools-engineering-service2) + prSourceBranchPrefix: locpr + isShouldReusePrSelected: true + isAutoCompletePrSelected: false + isUseLfLineEndingsSelected: true + + - task: PublishBuildArtifacts@1 + displayName: Publish Localization Files + inputs: + PathtoPublish: $(Build.StagingDirectory)/loc + ArtifactName: Loc + condition: succeededOrFailed() \ No newline at end of file diff --git a/build-tools/automation/azure-pipelines.yaml b/build-tools/automation/azure-pipelines.yaml index 0625cda42..c7a6fa86d 100644 --- a/build-tools/automation/azure-pipelines.yaml +++ b/build-tools/automation/azure-pipelines.yaml @@ -3,16 +3,13 @@ trigger: - main - release/* - - d17-* - dependabot/* - - dev/* pr: branches: include: - main - release/* - - d17-* paths: exclude: - README.md @@ -29,22 +26,16 @@ variables: DotNetCoreVersion: 8.0.303 DotNetTargetFramework: net8.0 NetCoreTargetFrameworkPathSuffix: -$(DotNetTargetFramework) - 1ESWindowsPool: AzurePipelines-EO - 1ESWindowsImage: AzurePipelinesWindows2022compliant - 1ESMacPool: Azure Pipelines - 1ESMacImage: macOS-13 - DisablePipelineConfigDetector: true + HostedPoolName: Azure Pipelines + HostedWinImage: windows-2022 + HostedMacImage: macOS-14 jobs: - job: windows_dotnet_build displayName: Windows - .NET pool: - name: $(1ESWindowsPool) - demands: - - ImageOverride -equals $(1ESWindowsImage) - variables: - VSINSTALLDIR: C:\Program Files\Microsoft Visual Studio\2022\Enterprise\ - Codeql.Enabled: true + name: $(HostedPoolName) + vmImage: $(HostedWinImage) timeoutInMinutes: 60 workspace: clean: all @@ -76,8 +67,8 @@ jobs: - job: mac_dotnet_build displayName: Mac - .NET pool: - name: $(1ESMacPool) - vmImage: $(1ESMacImage) + name: $(HostedPool) + vmImage: $(HostedMacImage) timeoutInMinutes: 20 workspace: clean: all @@ -98,126 +89,3 @@ jobs: - template: templates\fail-on-dirty-tree.yaml - template: templates\fail-on-issue.yaml - - -- job: api_scan - displayName: API Scan - dependsOn: windows_dotnet_build - condition: and(eq(dependencies.windows_dotnet_build.result, 'Succeeded'), eq(variables['Build.SourceBranch'], '${{ parameters.ApiScanSourceBranch }}')) - pool: - name: MAUI-1ESPT - demands: ImageOverride -equals 1ESPT-Windows2022 - timeoutInMinutes: 480 - workspace: - clean: all - steps: - - task: DownloadPipelineArtifact@2 - displayName: Download build artifacts - inputs: - artifactName: artifacts - downloadPath: $(Build.SourcesDirectory) - - ### Copy .dll, .exe, .pdb files for APIScan - - task: CopyFiles@2 - displayName: Collect Files for APIScan - inputs: - Contents: | - $(Build.SourcesDirectory)\$(Build.Configuration)$(NetCoreTargetFrameworkPathSuffix)\**\?(*.dll|*.exe|*.pdb) - !$(Build.SourcesDirectory)\**\jnimarshalmethod-gen.* - !$(Build.SourcesDirectory)\**\Mono.CSharp.dll - !$(Build.SourcesDirectory)\**\SgmlReader.exe - !$(Build.SourcesDirectory)\**\win-*\java-interop.dll - TargetFolder: $(Build.StagingDirectory)\apiscan - OverWrite: true - flattenFolders: true - - - task: APIScan@2 - displayName: Run APIScan - inputs: - softwareFolder: $(Build.StagingDirectory)\apiscan - symbolsFolder: 'SRV*http://symweb;$(Build.StagingDirectory)\apiscan' - softwareName: $(ApiScanName) - softwareVersionNum: $(Build.SourceBranchName)-$(Build.SourceVersion)$(System.JobAttempt) - isLargeApp: true - toolVersion: Latest - env: - AzureServicesAuthConnectionString: runAs=App;AppId=$(ApiScanMAUI1ESPTManagedId) - - - task: SdtReport@2 - displayName: Guardian Export - Security Report - inputs: - GdnExportAllTools: false - GdnExportGdnToolApiScan: true - GdnExportOutputSuppressionFile: source.gdnsuppress - - - task: PublishSecurityAnalysisLogs@3 - displayName: Publish Guardian Artifacts - inputs: - ArtifactName: APIScan Logs - ArtifactType: Container - AllTools: false - APIScan: true - ToolLogsNotFoundAction: Warning - - - task: PostAnalysis@2 - displayName: Fail Build on Guardian Issues - inputs: - GdnBreakAllTools: false - GdnBreakGdnToolApiScan: true - - -- job: OneLocBuild - displayName: OneLocBuild - condition: and(eq(variables['System.TeamProject'], 'DevDiv'), eq(variables['Build.SourceBranch'], 'refs/heads/main')) - pool: - name: AzurePipelines-EO - demands: - - ImageOverride -equals 1ESPT-Windows2022 - timeoutInMinutes: 30 - variables: - - group: Xamarin-Secrets - workspace: - clean: all - steps: - - checkout: self - clean: true - - # https://eng.ms/docs/cloud-ai-platform/devdiv/one-engineering-system-1es/1es-docs/1es-security-configuration/configuration-guides/pat-burndown-guidance#authentication-from-pipelines - # Requires Azure client 2.x - - task: AzureCLI@2 - displayName: 'Set AzDO.OneLocBuildToken' - enabled: true - inputs: - azureSubscription: 'VSEng-AzureDevOps-ceapex-OneLocBuild' # Azure DevOps service connection - scriptType: 'pscore' - scriptLocation: 'inlineScript' - inlineScript: | - # if this fails, check out this bash script that includes diagnostics: - # https://gist.github.com/johnterickson/19f80a3e969e39f1000d118739176e62 - # Note that the resource is specified to limit the token to Azure DevOps - $token = az account get-access-token --query accessToken --resource 499b84ac-1321-427f-aa17-267ca6975798 -o tsv - Write-Host "##vso[task.setvariable variable=AzDO.OneLocBuildToken;issecret=true]${token}" - - - task: OneLocBuild@2 - displayName: OneLocBuild - env: - SYSTEM_ACCESSTOKEN: $(System.AccessToken) - inputs: - locProj: Localize/LocProject.json - outDir: $(Build.StagingDirectory) - packageSourceAuth: patAuth - patVariable: $(AzDO.OneLocBuildToken) - isCreatePrSelected: true - repoType: gitHub - gitHubPatVariable: $(github--pat--vs-mobiletools-engineering-service2) - prSourceBranchPrefix: locpr - isShouldReusePrSelected: true - isAutoCompletePrSelected: false - isUseLfLineEndingsSelected: true - - - task: PublishBuildArtifacts@1 - displayName: Publish Localization Files - inputs: - PathtoPublish: $(Build.StagingDirectory)/loc - ArtifactName: Loc - condition: succeededOrFailed() From 2f222fa235d6c4315e295136c80b0c712bb3d737 Mon Sep 17 00:00:00 2001 From: Peter Collins Date: Thu, 30 Jan 2025 15:28:49 -0500 Subject: [PATCH 2/5] Syntax --- build-tools/automation/azure-pipelines.yaml | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/build-tools/automation/azure-pipelines.yaml b/build-tools/automation/azure-pipelines.yaml index c7a6fa86d..8fe06a4a7 100644 --- a/build-tools/automation/azure-pipelines.yaml +++ b/build-tools/automation/azure-pipelines.yaml @@ -15,10 +15,6 @@ pr: - README.md - Documentation/* -parameters: -- name: ApiScanSourceBranch - default: 'refs/heads/main' - # Global variables variables: RunningOnCI: true @@ -67,7 +63,7 @@ jobs: - job: mac_dotnet_build displayName: Mac - .NET pool: - name: $(HostedPool) + name: $(HostedPoolName) vmImage: $(HostedMacImage) timeoutInMinutes: 20 workspace: From 565b381d48a0fbbcf3ce8650b80327463021a636 Mon Sep 17 00:00:00 2001 From: Peter Collins Date: Thu, 30 Jan 2025 16:33:35 -0500 Subject: [PATCH 3/5] Try dnceng win pool --- build-tools/automation/azure-pipelines.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/build-tools/automation/azure-pipelines.yaml b/build-tools/automation/azure-pipelines.yaml index 8fe06a4a7..a3adca813 100644 --- a/build-tools/automation/azure-pipelines.yaml +++ b/build-tools/automation/azure-pipelines.yaml @@ -25,13 +25,13 @@ variables: HostedPoolName: Azure Pipelines HostedWinImage: windows-2022 HostedMacImage: macOS-14 + DncEngPublicPoolName: NetCore-Public jobs: - job: windows_dotnet_build displayName: Windows - .NET pool: - name: $(HostedPoolName) - vmImage: $(HostedWinImage) + name: $(DncEngPublicPoolName) timeoutInMinutes: 60 workspace: clean: all From c6a9b21061b0eeb19b528548d890c678f758a52e Mon Sep 17 00:00:00 2001 From: Peter Collins Date: Thu, 30 Jan 2025 16:44:24 -0500 Subject: [PATCH 4/5] Revert "Try dnceng win pool" This reverts commit 565b381d48a0fbbcf3ce8650b80327463021a636. --- build-tools/automation/azure-pipelines.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/build-tools/automation/azure-pipelines.yaml b/build-tools/automation/azure-pipelines.yaml index a3adca813..8fe06a4a7 100644 --- a/build-tools/automation/azure-pipelines.yaml +++ b/build-tools/automation/azure-pipelines.yaml @@ -25,13 +25,13 @@ variables: HostedPoolName: Azure Pipelines HostedWinImage: windows-2022 HostedMacImage: macOS-14 - DncEngPublicPoolName: NetCore-Public jobs: - job: windows_dotnet_build displayName: Windows - .NET pool: - name: $(DncEngPublicPoolName) + name: $(HostedPoolName) + vmImage: $(HostedWinImage) timeoutInMinutes: 60 workspace: clean: all From 22e92fb58f95e60a2cd20d896c508d6426b0d027 Mon Sep 17 00:00:00 2001 From: Peter Collins Date: Thu, 30 Jan 2025 16:45:33 -0500 Subject: [PATCH 5/5] Eof --- Localize/onelocbuild.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Localize/onelocbuild.yaml b/Localize/onelocbuild.yaml index a50cb62be..3ce16b684 100644 --- a/Localize/onelocbuild.yaml +++ b/Localize/onelocbuild.yaml @@ -69,4 +69,4 @@ jobs: inputs: PathtoPublish: $(Build.StagingDirectory)/loc ArtifactName: Loc - condition: succeededOrFailed() \ No newline at end of file + condition: succeededOrFailed()