From c89f6624b57cfa8590c90fd0352869958df1725b Mon Sep 17 00:00:00 2001
From: Rafael Guterres Jeffman <rjeffman@redhat.com>
Date: Mon, 17 Jan 2022 09:31:45 -0300
Subject: [PATCH] upstream CI: Update Python version when building containers.

Newer Ansible versions will require at least Python 3.8 to be used,
and the build containers pipeline was requiring Python 3.6, which is
EOL.

This patch requests the latest Python version available for the
controller, and allows it to be configured to a specific version if,
and when, needed.
---
 molecule/c8s-build/molecule.yml           |  1 +
 tests/azure/azure-pipelines.yml           | 20 +++---
 tests/azure/build-containers.yml          | 10 +--
 tests/azure/nightly.yml                   | 74 +++++++++++------------
 tests/azure/templates/build_container.yml |  5 +-
 5 files changed, 57 insertions(+), 53 deletions(-)

diff --git a/molecule/c8s-build/molecule.yml b/molecule/c8s-build/molecule.yml
index 86d5d610..88552151 100644
--- a/molecule/c8s-build/molecule.yml
+++ b/molecule/c8s-build/molecule.yml
@@ -16,3 +16,4 @@ provisioner:
   name: ansible
   playbooks:
     prepare: ../resources/playbooks/prepare-build.yml
+prerun: false
diff --git a/tests/azure/azure-pipelines.yml b/tests/azure/azure-pipelines.yml
index d188fd54..199cf8e9 100644
--- a/tests/azure/azure-pipelines.yml
+++ b/tests/azure/azure-pipelines.yml
@@ -40,16 +40,16 @@ stages:
       scenario: c8s
       ansible_version: ">=2.9,<2.10"
 
-# CentOS 8
-
-- stage: CentOS8_Ansible_2_9
-  dependsOn: []
-  jobs:
-  - template: templates/group_tests.yml
-    parameters:
-      build_number: $(Build.BuildNumber)
-      scenario: centos-8
-      ansible_version: ">=2.9,<2.10"
+# # CentOS 8
+#
+# - stage: CentOS8_Ansible_2_9
+#   dependsOn: []
+#   jobs:
+#   - template: templates/group_tests.yml
+#     parameters:
+#       build_number: $(Build.BuildNumber)
+#       scenario: centos-8
+#       ansible_version: ">=2.9,<2.10"
 
 # CentOS 7
 
diff --git a/tests/azure/build-containers.yml b/tests/azure/build-containers.yml
index 9bdc5521..000b542c 100644
--- a/tests/azure/build-containers.yml
+++ b/tests/azure/build-containers.yml
@@ -21,11 +21,11 @@ jobs:
     container_name: centos-7
     build_scenario_name: centos-7-build
 
-- template: templates/build_container.yml
-  parameters:
-    job_name_suffix: Centos8
-    container_name: centos-8
-    build_scenario_name: centos-8-build
+# - template: templates/build_container.yml
+#   parameters:
+#     job_name_suffix: Centos8
+#     container_name: centos-8
+#     build_scenario_name: centos-8-build
 
 - template: templates/build_container.yml
   parameters:
diff --git a/tests/azure/nightly.yml b/tests/azure/nightly.yml
index 9c17a6f9..ef97ed99 100644
--- a/tests/azure/nightly.yml
+++ b/tests/azure/nightly.yml
@@ -119,43 +119,43 @@ stages:
       scenario: c8s
       ansible_version: ""
 
-# CentOS 8
-
-- stage: CentOS8_Ansible_2_9
-  dependsOn: []
-  jobs:
-  - template: templates/group_tests.yml
-    parameters:
-      build_number: $(Build.BuildNumber)
-      scenario: centos-8
-      ansible_version: ">=2.9,<2.10"
-
-- stage: CentOS8_Ansible_Core_2_11
-  dependsOn: []
-  jobs:
-  - template: templates/group_tests.yml
-    parameters:
-      build_number: $(Build.BuildNumber)
-      scenario: centos-8
-      ansible_version: "-core >=2.11,<2.12"
-
-- stage: CentOS8_Ansible_Core_2_12
-  dependsOn: []
-  jobs:
-  - template: templates/group_tests.yml
-    parameters:
-      build_number: $(Build.BuildNumber)
-      scenario: centos-8
-      ansible_version: "-core >=2.12,<2.13"
-
-- stage: CentOS8_Ansible_latest
-  dependsOn: []
-  jobs:
-  - template: templates/group_tests.yml
-    parameters:
-      build_number: $(Build.BuildNumber)
-      scenario: centos-8
-      ansible_version: ""
+# # CentOS 8
+#
+# - stage: CentOS8_Ansible_2_9
+#   dependsOn: []
+#   jobs:
+#   - template: templates/group_tests.yml
+#     parameters:
+#       build_number: $(Build.BuildNumber)
+#       scenario: centos-8
+#       ansible_version: ">=2.9,<2.10"
+#
+# - stage: CentOS8_Ansible_Core_2_11
+#   dependsOn: []
+#   jobs:
+#   - template: templates/group_tests.yml
+#     parameters:
+#       build_number: $(Build.BuildNumber)
+#       scenario: centos-8
+#       ansible_version: "-core >=2.11,<2.12"
+#
+# - stage: CentOS8_Ansible_Core_2_12
+#   dependsOn: []
+#   jobs:
+#   - template: templates/group_tests.yml
+#     parameters:
+#       build_number: $(Build.BuildNumber)
+#       scenario: centos-8
+#       ansible_version: "-core >=2.12,<2.13"
+#
+# - stage: CentOS8_Ansible_latest
+#   dependsOn: []
+#   jobs:
+#   - template: templates/group_tests.yml
+#     parameters:
+#       build_number: $(Build.BuildNumber)
+#       scenario: centos-8
+#       ansible_version: ""
 
 # CentOS 7
 
diff --git a/tests/azure/templates/build_container.yml b/tests/azure/templates/build_container.yml
index b474c964..7d5c1fb0 100644
--- a/tests/azure/templates/build_container.yml
+++ b/tests/azure/templates/build_container.yml
@@ -6,6 +6,9 @@ parameters:
     type: string
   - name: build_scenario_name
     type: string
+  - name: python_version
+    type: string
+    default: 3.x
 
 jobs:
 - job: BuildTestImage${{ parameters.job_name_suffix }}
@@ -13,7 +16,7 @@ jobs:
   steps:
   - task: UsePythonVersion@0
     inputs:
-      versionSpec: '3.6'
+      versionSpec: '${{ parameters.python_version }}'
 
   - script: python -m pip install --upgrade pip setuptools wheel ansible
     displayName: Install tools
-- 
GitLab