From 5b909c0beee178be36dfea9f0427f02bbb78c5b2 Mon Sep 17 00:00:00 2001 From: Ella Hathaway <67609881+ellahathaway@users.noreply.github.com> Date: Tue, 17 Dec 2024 00:41:15 -0800 Subject: [PATCH] Use variables for container values (#45490) --- 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 5903dae5a770..e94468470b1c 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: $(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')) }}: