]> git.proxmox.com Git - mirror_edk2.git/commitdiff
CI: make Python version configurable
authorOliver Steffen <osteffen@redhat.com>
Mon, 16 Jan 2023 17:40:28 +0000 (18:40 +0100)
committermergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
Tue, 17 Jan 2023 19:06:32 +0000 (19:06 +0000)
Add a new parameter "usePythonVersion" to the CI job templates.
This makes it possible to specify the version of Python to use.
The default value is '', in which case Python will not be downloaded
at runtime and the one provided by the VM/container image will be used.

Additionally, add a template .azurepipelines/templates/defaults.yml,
from which the default Pyhton version string can be obtained.

Signed-off-by: Oliver Steffen <osteffen@redhat.com>
Reviewed-by: Michael Kubacki <michael.kubacki@microsoft.com>
Acked-by: Ard Biesheuvel <ardb@kernel.org>
Acked-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Chris Fernald <chfernal@microsoft.com>
.azurepipelines/Ubuntu-GCC5.yml
.azurepipelines/Windows-VS2019.yml
.azurepipelines/templates/defaults.yml [new file with mode: 0644]
.azurepipelines/templates/platform-build-run-steps.yml
.azurepipelines/templates/pr-gate-build-job.yml
.azurepipelines/templates/pr-gate-steps.yml

index f83951eeaf8614ea2b9a86b1c7d08190bcc5b4bf..4f9dcf017093054aa8c12c41d1f83eede11c914f 100644 (file)
@@ -13,13 +13,13 @@ pr:
 - master\r
 - stable/*\r
 \r
+variables:\r
+  - template: templates/defaults.yml\r
+\r
 jobs:\r
 - template: templates/pr-gate-build-job.yml\r
   parameters:\r
     tool_chain_tag: 'GCC5'\r
     vm_image: 'ubuntu-latest'\r
     arch_list: "IA32,X64,ARM,AARCH64,RISCV64,LOONGARCH64"\r
-    extra_install_step:\r
-    - bash: sudo apt-get install -y lcov\r
-      displayName: Install Code Coverage Tools\r
-      condition: and(gt(variables.pkg_count, 0), succeeded())\r
+    usePythonVersion: ${{ variables.default_python_version }}\r
index c07e5bb43424997602573361674dff74b58e753a..58bb98d42b2867ff16a53a4221f628d7da270682 100644 (file)
@@ -12,12 +12,16 @@ pr:
 - master\r
 - stable/*\r
 \r
+variables:\r
+  - template: templates/defaults.yml\r
+\r
 jobs:\r
 - template: templates/pr-gate-build-job.yml\r
   parameters:\r
     tool_chain_tag: 'VS2019'\r
     vm_image: 'windows-2019'\r
     arch_list: "IA32,X64"\r
+    usePythonVersion: ${{ variables.default_python_version }}\r
     extra_install_step:\r
     - powershell: choco install opencppcoverage; Write-Host "##vso[task.prependpath]C:\Program Files\OpenCppCoverage"\r
       displayName: Install Code Coverage Tool\r
diff --git a/.azurepipelines/templates/defaults.yml b/.azurepipelines/templates/defaults.yml
new file mode 100644 (file)
index 0000000..b490944
--- /dev/null
@@ -0,0 +1,11 @@
+## @file\r
+# File templates/default.yml\r
+#\r
+# template file containing common default values\r
+#\r
+# Copyright (c) Red Hat, Inc.\r
+# SPDX-License-Identifier: BSD-2-Clause-Patent\r
+##\r
+\r
+variables:\r
+  default_python_version: ">=3.10.6"\r
index 40a31a509fc5a6597a1fc8ec689fc5a2b1f49266..8803d80cf51c4bcfe312ab6a554a68ddcbf34fb8 100644 (file)
@@ -34,6 +34,9 @@ parameters:
 - name: extra_install_step\r
   type: stepList\r
   default: []\r
+- name: usePythonVersion\r
+  type: string\r
+  default: ''\r
 \r
 steps:\r
 - checkout: self\r
@@ -42,8 +45,9 @@ steps:
 \r
 - task: UsePythonVersion@0\r
   inputs:\r
-    versionSpec: ">=3.10.6"\r
+    versionSpec: ${{ parameters.usePythonVersion }}\r
     architecture: "x64"\r
+  condition: ne('${{ parameters.usePythonVersion }}', '')\r
 \r
 - script: pip install -r pip-requirements.txt --upgrade\r
   displayName: 'Install/Upgrade pip modules'\r
index fff61a3193b0e082e3209ca1d3adf0e27600e924..b8573b90da1c77234f3ad51903c3743551bcaa4b 100644 (file)
@@ -13,6 +13,7 @@ parameters:
   vm_image: ''\r
   arch_list: ''\r
   extra_install_step: []\r
+  usePythonVersion: ''\r
 \r
 # Build step\r
 jobs:\r
@@ -78,6 +79,7 @@ jobs:
       build_pkgs: $(Build.Pkgs)\r
       build_targets: $(Build.Targets)\r
       build_archs: ${{ parameters.arch_list }}\r
+      usePythonVersion: ${{ parameters.usePythonVersion }}\r
       extra_install_step: ${{ parameters.extra_install_step }}\r
 \r
 - job: Build_${{ parameters.tool_chain_tag }}_TARGET_CODE_COVERAGE\r
index 080f60aea6ab949fb0b883542b14a6600730dfc4..ebc1e86c37d495307e8ea456703ff8c25c2c96f5 100644 (file)
@@ -12,6 +12,7 @@ parameters:
   build_pkgs: ''\r
   build_targets: ''\r
   build_archs: ''\r
+  usePythonVersion: ''\r
   extra_install_step: []\r
 \r
 steps:\r
@@ -21,8 +22,9 @@ steps:
 \r
 - task: UsePythonVersion@0\r
   inputs:\r
-    versionSpec: '>=3.10.6'\r
-    architecture: 'x64'\r
+    versionSpec: ${{ parameters.usePythonVersion }}\r
+    architecture: "x64"\r
+  condition: ne('${{ parameters.usePythonVersion }}', '')\r
 \r
 - script: pip install -r pip-requirements.txt --upgrade\r
   displayName: 'Install/Upgrade pip modules'\r