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>
- 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
- 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
--- /dev/null
+## @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
- name: extra_install_step\r
type: stepList\r
default: []\r
+- name: usePythonVersion\r
+ type: string\r
+ default: ''\r
\r
steps:\r
- checkout: self\r
\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
vm_image: ''\r
arch_list: ''\r
extra_install_step: []\r
+ usePythonVersion: ''\r
\r
# Build step\r
jobs:\r
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
build_pkgs: ''\r
build_targets: ''\r
build_archs: ''\r
+ usePythonVersion: ''\r
extra_install_step: []\r
\r
steps:\r
\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