On Wed, Jun 26, 2024 at 12:00 PM Tom Lane <t...@sss.pgh.pa.us> wrote:
> Thomas Munro <thomas.mu...@gmail.com> writes:
> > I know how to find out which darwin version is running: uname -r | sed
> > 's/\..*//'.  What I don't know is how to find the darwin version for a
> > macports installation.
>
> "port platform"?

Thanks, that's exactly what I was looking for.

But I thought of an easier way: instead of trying to do my own cache
invalidation with shell script and duct tape, I can include the
current OS major version in the cache key used to carry the
macports directory between CI runs.  Hopefully Cirrus's cache machinery
is smart enough to age out the old stuff eventually.

This seems to have the desired effect.  I've registered this thread to
see how cfbot likes this, and see if anyone sees a problem with
switching to the "macos-runner:sonoma" image, or the cache key scheme.

https://commitfest.postgresql.org/48/5076/

FTR there is a newer macOS release that recently came out, Sequoia aka
macOS 15, but the image available to us for CI is marked beta so I
figured we can wait a bit longer for that.
From 3889d9e34f65f3a2dc51d52fe11df7a71a72ec66 Mon Sep 17 00:00:00 2001
From: Thomas Munro <thomas.munro@gmail.com>
Date: Wed, 26 Jun 2024 10:43:50 +1200
Subject: [PATCH v2] ci: Upgrade macOS version from 13 to 14.

We also need to change the macports_url to an installer for 14, and
change the cache key we use to cache the whole macports installation to
include the Darwin major version, since otherwise it would break.

Back-patch to 15 where CI began.

Discussion: https://postgr.es/m/CA%2BhUKGLqJdv6RcwyZ_0H7khxtLTNJyuK%2BvDFzv3uwYbn8hKH6A%40mail.gmail.com
---
 .cirrus.tasks.yml                    | 10 ++++++++--
 src/tools/ci/ci_macports_packages.sh |  2 +-
 2 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/.cirrus.tasks.yml b/.cirrus.tasks.yml
index 33646faeadf..4802eb2192f 100644
--- a/.cirrus.tasks.yml
+++ b/.cirrus.tasks.yml
@@ -411,7 +411,7 @@ task:
 
 
 task:
-  name: macOS - Ventura - Meson
+  name: macOS - Sonoma - Meson
 
   env:
     CPUS: 4 # always get that much for cirrusci macOS instances
@@ -420,7 +420,9 @@ task:
     # work OK. See
     # https://postgr.es/m/20220927040208.l3shfcidovpzqxfh%40awork3.anarazel.de
     TEST_JOBS: 8
-    IMAGE: ghcr.io/cirruslabs/macos-ventura-base:latest
+    # If changing the macOS release, you probably also need to change
+    # macports_url in src/tools/ci/ci_macports_packages.sh
+    IMAGE: ghcr.io/cirruslabs/macos-runner:sonoma
 
     CIRRUS_WORKING_DIR: ${HOME}/pgsql/
     CCACHE_DIR: ${HOME}/ccache
@@ -460,6 +462,10 @@ task:
   # updates macports every time.
   macports_cache:
     folder: ${MACPORTS_CACHE}
+    fingerprint_script: |
+      # Include the darwin version in the cache key.  If the OS image changes
+      # to a different major version, we need to reinstall.
+      uname -r | sed 's/\..*//'
   setup_additional_packages_script: |
     sh src/tools/ci/ci_macports_packages.sh \
       ccache \
diff --git a/src/tools/ci/ci_macports_packages.sh b/src/tools/ci/ci_macports_packages.sh
index f87256e0908..db811a28c8e 100755
--- a/src/tools/ci/ci_macports_packages.sh
+++ b/src/tools/ci/ci_macports_packages.sh
@@ -13,7 +13,7 @@ set -e
 
 packages="$@"
 
-macports_url="https://github.com/macports/macports-base/releases/download/v2.8.1/MacPorts-2.8.1-13-Ventura.pkg";
+macports_url="https://github.com/macports/macports-base/releases/download/v2.9.3/MacPorts-2.9.3-14-Sonoma.pkg";
 cache_dmg="macports.hfs.dmg"
 
 if [ "$CIRRUS_CI" != "true" ]; then
-- 
2.45.2

Reply via email to