From ab843e6ee555a0806109aa0c3bc8bfa8381bfd77 Mon Sep 17 00:00:00 2001 From: Ella Hathaway Date: Mon, 16 Dec 2024 19:57:11 +0000 Subject: [PATCH 1/2] Use variables for container values --- eng/pipelines/templates/jobs/vmr-build.yml | 2 +- .../templates/variables/vmr-build.yml | 3 + src/SourceBuild/content/eng/pipelines/ci.yml | 103 +++++++++--------- 3 files changed, 56 insertions(+), 52 deletions(-) diff --git a/eng/pipelines/templates/jobs/vmr-build.yml b/eng/pipelines/templates/jobs/vmr-build.yml index 8aaed9b0ba55..1655f7a9c1fe 100644 --- a/eng/pipelines/templates/jobs/vmr-build.yml +++ b/eng/pipelines/templates/jobs/vmr-build.yml @@ -131,7 +131,7 @@ jobs: ${{ if ne(parameters.container.image, '') }}: container: image: ${{ parameters.container.image }} - options: --privileged + options: ${{ variables.defaultContainerOptions }} # Currently, CodeQL slows the build down too much # https://github.com/dotnet/source-build/issues/4276 diff --git a/eng/pipelines/templates/variables/vmr-build.yml b/eng/pipelines/templates/variables/vmr-build.yml index 61a478fbd502..6706dbc6cb29 100644 --- a/eng/pipelines/templates/variables/vmr-build.yml +++ b/eng/pipelines/templates/variables/vmr-build.yml @@ -12,6 +12,9 @@ variables: - name: VmrBranch value: ${{ replace(replace(variables['Build.SourceBranch'], 'refs/heads/', ''), 'refs/pull/', '') }} +- name: defaultContainerOptions + value: --privileged + - name: almaLinuxContainerName value: almaLinuxContainer - name: almaLinuxContainerImage diff --git a/src/SourceBuild/content/eng/pipelines/ci.yml b/src/SourceBuild/content/eng/pipelines/ci.yml index 9d37796b3ff7..b868753ddcf8 100644 --- a/src/SourceBuild/content/eng/pipelines/ci.yml +++ b/src/SourceBuild/content/eng/pipelines/ci.yml @@ -44,6 +44,7 @@ variables: value: ${{ eq(variables['Build.Reason'], 'PullRequest') }} - template: /eng/common/templates-official/variables/pool-providers.yml@self +- template: /src/sdk/eng/pipelines/templates/variables/vmr-build.yml@self resources: repositories: @@ -78,57 +79,57 @@ extends: baselineFile: $(Build.SourcesDirectory)\.config\guardian\.gdnbaselines containers: - almaLinuxContainer: - image: mcr.microsoft.com/dotnet-buildtools/prereqs:almalinux-8-source-build - options: --privileged - alpineLatestContainer: - image: mcr.microsoft.com/dotnet-buildtools/prereqs:alpine-3.21-amd64 - options: --privileged - alpinePreviousContainer: - image: mcr.microsoft.com/dotnet-buildtools/prereqs:alpine-3.20-withnode - options: --privileged - centOSStreamContainer: - image: mcr.microsoft.com/dotnet-buildtools/prereqs:centos-stream9 - options: --privileged - fedoraContainer: - image: mcr.microsoft.com/dotnet-buildtools/prereqs:fedora-41 - options: --privileged - ubuntuContainer: - image: mcr.microsoft.com/dotnet-buildtools/prereqs:ubuntu-24.04 - options: --privileged - ubuntuArmContainer: - image: mcr.microsoft.com/dotnet-buildtools/prereqs:ubuntu-24.04-arm64 - options: --privileged - azurelinuxX64CrossContainer: - image: mcr.microsoft.com/dotnet-buildtools/prereqs:azurelinux-3.0-net9.0-cross-amd64 - options: --privileged - azurelinuxArmCrossContainer: - image: mcr.microsoft.com/dotnet-buildtools/prereqs:azurelinux-3.0-net9.0-cross-arm - options: --privileged - azurelinuxArm64CrossContainer: - image: mcr.microsoft.com/dotnet-buildtools/prereqs:azurelinux-3.0-net9.0-cross-arm64 - options: --privileged - azurelinuxX64AlpineCrossContainer: - image: mcr.microsoft.com/dotnet-buildtools/prereqs:azurelinux-3.0-net9.0-cross-amd64-alpine - options: --privileged - azurelinuxArmAlpineCrossContainer: - image: mcr.microsoft.com/dotnet-buildtools/prereqs:azurelinux-3.0-net9.0-cross-arm-alpine - options: --privileged - azurelinuxArm64AlpineCrossContainer: - image: mcr.microsoft.com/dotnet-buildtools/prereqs:azurelinux-3.0-net9.0-cross-arm64-alpine - options: --privileged - androidCrossContainer: - image: mcr.microsoft.com/dotnet-buildtools/prereqs:azurelinux-3.0-net9.0-cross-android-amd64 - options: --privileged - linuxBionicCrossContainer: - image: mcr.microsoft.com/dotnet-buildtools/prereqs:azurelinux-3.0-net9.0-android-openssl - options: --privileged - browserCrossContainer: - image: mcr.microsoft.com/dotnet-buildtools/prereqs:azurelinux-3.0-net9.0-webassembly-amd64 - options: --privileged - wasiCrossContainer: - image: mcr.microsoft.com/dotnet-buildtools/prereqs:azurelinux-3.0-net9.0-webassembly-amd64 - options: --privileged + ${{ variables.almaLinuxContainerName }}: + image: ${{ variables.almaLinuxContainerImage }} + options: ${{ variables.defaultContainerOptions }} + ${{ variables.alpineLatestContainerName }}: + image: ${{ variables.alpineLatestContainerImage }} + options: ${{ variables.defaultContainerOptions }} + ${{ variables.alpinePreviousContainerName }}: + image: ${{ variables.alpinePreviousContainerImage }} + options: ${{ variables.defaultContainerOptions }} + ${{ variables.centOSStreamContainerName }}: + image: ${{ variables.centOSStreamContainerImage }} + options: ${{ variables.defaultContainerOptions }} + ${{ variables.fedoraContainerName }}: + image: ${{ variables.fedoraContainerImage }} + options: ${{ variables.defaultContainerOptions }} + ${{ variables.ubuntuContainerName }}: + image: ${{ variables.ubuntuContainerImage }} + options: ${{ variables.defaultContainerOptions }} + ${{ variables.ubuntuArmContainerName }}: + image: ${{ variables.ubuntuArmContainerImage }} + options: ${{ variables.defaultContainerOptions }} + ${{ variables.azurelinuxX64CrossContainerName }}: + image: ${{ variables.azurelinuxX64CrossContainerImage }} + options: ${{ variables.defaultContainerOptions }} + ${{ variables.azurelinuxArmCrossContainerName }}: + image: ${{ variables.azurelinuxArmCrossContainerImage }} + options: ${{ variables.defaultContainerOptions }} + ${{ variables.azurelinuxArm64CrossContainerName }}: + image: ${{ variables.azurelinuxArm64CrossContainerImage }} + options: ${{ variables.defaultContainerOptions }} + ${{ variables.azurelinuxX64AlpineCrossContainerName }}: + image: ${{ variables.azurelinuxX64AlpineCrossContainerImage }} + options: ${{ variables.defaultContainerOptions }} + ${{ variables.azurelinuxArmAlpineCrossContainerName }}: + image: ${{ variables.azurelinuxArmAlpineCrossContainerImage }} + options: ${{ variables.defaultContainerOptions }} + ${{ variables.azurelinuxArm64AlpineCrossContainerName }}: + image: ${{ variables.azurelinuxArm64AlpineCrossContainerImage }} + options: ${{ variables.defaultContainerOptions }} + ${{ variables.androidCrossContainerName }}: + image: ${{ variables.androidCrossContainerImage }} + options: ${{ variables.defaultContainerOptions }} + ${{ variables.linuxBionicCrossContainerName }}: + image: ${{ variables.linuxBionicCrossContainerImage }} + options: ${{ variables.defaultContainerOptions }} + ${{ variables.browserCrossContainerName }}: + image: ${{ variables.browserCrossContainerImage }} + options: ${{ variables.defaultContainerOptions }} + ${{ variables.wasiCrossContainerName }}: + image: ${{ variables.wasiCrossContainerImage }} + options: ${{ variables.defaultContainerOptions }} stages: - ${{ if and(ne(variables.isPRTrigger, 'true'), eq(variables['System.TeamProject'], 'internal')) }}: From 8ad54538d9aa4a07aa09a4ff94f4679e7fd9360c Mon Sep 17 00:00:00 2001 From: Ella Hathaway Date: Mon, 16 Dec 2024 21:40:30 +0000 Subject: [PATCH 2/2] Try using macro syntax for pulic pipeline configurations --- eng/pipelines/templates/jobs/vmr-build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eng/pipelines/templates/jobs/vmr-build.yml b/eng/pipelines/templates/jobs/vmr-build.yml index 1655f7a9c1fe..ae1a4e5bbbbf 100644 --- a/eng/pipelines/templates/jobs/vmr-build.yml +++ b/eng/pipelines/templates/jobs/vmr-build.yml @@ -131,7 +131,7 @@ jobs: ${{ if ne(parameters.container.image, '') }}: container: image: ${{ parameters.container.image }} - options: ${{ variables.defaultContainerOptions }} + options: $(defaultContainerOptions) # Currently, CodeQL slows the build down too much # https://github.com/dotnet/source-build/issues/4276