From e09677aa7eafadc0e149c747435fad50324e663c Mon Sep 17 00:00:00 2001
From: Ian Pittwood <ian.pittwood@rstudio.com>
Date: Mon, 13 Nov 2023 13:01:26 -0800
Subject: [PATCH] Override Python versions in manual workflow for CentOS 7
 builds

---
 .github/workflows/build-manual.yaml | 27 +++++++++------------------
 1 file changed, 9 insertions(+), 18 deletions(-)

diff --git a/.github/workflows/build-manual.yaml b/.github/workflows/build-manual.yaml
index 3c74ec876..2f1137a09 100644
--- a/.github/workflows/build-manual.yaml
+++ b/.github/workflows/build-manual.yaml
@@ -42,22 +42,6 @@ on:
           - preview
           - daily
           - release
-      r_version:
-        description: "Primary R version"
-        required: false
-        default: "4.2.3"
-      r_version_alt:
-        description: "Alternate R version"
-        required: false
-        default: "4.1.3"
-      python_version:
-        description: "Primary Python version"
-        required: false
-        default: "3.9.17"
-      python_version_alt:
-        description: "Alternate Python version"
-        required: false
-        default: "3.8.17"
       use_s3_download_url:
         description: "Force build to download binaries directly from S3 where applicable."
         required: false
@@ -109,9 +93,16 @@ jobs:
         id: get-build-args
         run: |
           EOF=$(dd if=/dev/urandom bs=15 count=1 status=none | base64)
-          VERSION_INPUTS="R_VERSION=${{ inputs.r_version }} R_VERSION_ALT=${{ inputs.r_version_alt }} PYTHON_VERSION=${{ inputs.python_version }} PYTHON_VERSION_ALT=${{ inputs.python_version_alt }}"
           ARGS_CMD=""
           USE_S3_DOWNLOAD_URL=""
+          VERSION_OVERRIDES=""
+          if [[ "${{inputs.os}}" == "centos7" ]]; then
+            # FIXME(ianpittwood): This is probably a silly way of doing this. We don't have CentOS builds for later 
+            #                     Python versions so we need to override them. This is done via matrix in the release CI
+            #                     but we don't have that here. We're also limited by the 10 input cap so these can't be
+            #                     passed by the user alongside R versions as I would've liked to do.
+            VERSION_OVERRIDES="PYTHON_VERSION=3.9.14 PYTHON_VERSION_ALT=3.8.15"
+          fi
           if [[ "${{ inputs.type }}" == "release" ]]; then
             ARGS_CMD="get-product-args"
             if [[ "${{ inputs.use_s3_download_url }}" == "true" ]]; then
@@ -122,7 +113,7 @@ jobs:
           fi
           BUILD_ARGS=$( \
               just -f ci.Justfile \
-              ${VERSION_INPUTS} \
+              ${VERSION_OVERRIDES} \
               ${ARGS_CMD} \
               ${{ inputs.product }} \
               ${{ inputs.os }} \