Hi hackers,

While working on a new pg_logicalinspect module ([1]), I reached a point where
all the CI tests were green except the compiler warnings one. Then, to save time
addressing the issue, I modified the .cirrus.tasks.yml file to $SUBJECT.

I think this could be useful for others too, so please find attached this tiny
patch.

Note that the patch does not add an extra "ci-task-only", but for simplicity it
it renames ci-os-only to ci-task-only.


[1]: 
https://www.postgresql.org/message-id/ZuF2Okt7aBR//bxu%40ip-10-97-1-34.eu-west-3.compute.internal

Looking forward to your feedback,

Regards,

-- 
Bertrand Drouvot
PostgreSQL Contributors Team
RDS Open Source Databases
Amazon Web Services: https://aws.amazon.com
>From b7289ee0f909e905b0e083cd3be41910c9c6a827 Mon Sep 17 00:00:00 2001
From: Bertrand Drouvot <bertranddrouvot...@gmail.com>
Date: Wed, 11 Sep 2024 11:01:41 +0000
Subject: [PATCH v1] Allow CI to only run the compiler warnings task

That could be useful to only run the CI compiler warnings task when addressing
compiler warnings issues.

Renaming ci-os-only to ci-task-only and adding filtering for the "compilerwarnings"
task.
---
 .cirrus.tasks.yml   | 16 ++++++++--------
 src/tools/ci/README |  7 ++++---
 2 files changed, 12 insertions(+), 11 deletions(-)
  22.5% src/tools/ci/

diff --git a/.cirrus.tasks.yml b/.cirrus.tasks.yml
index 90cb95c868..a4e3b51045 100644
--- a/.cirrus.tasks.yml
+++ b/.cirrus.tasks.yml
@@ -59,7 +59,7 @@ task:
   # push-wait-for-ci cycle time a bit when debugging operating system specific
   # failures. Uses skip instead of only_if, as cirrus otherwise warns about
   # only_if conditions not matching.
-  skip: $CIRRUS_CHANGE_MESSAGE =~ '.*\nci-os-only:.*'
+  skip: $CIRRUS_CHANGE_MESSAGE =~ '.*\nci-task-only:.*'
 
   env:
     CPUS: 4
@@ -142,7 +142,7 @@ task:
   <<: *freebsd_task_template
 
   depends_on: SanityCheck
-  only_if: $CIRRUS_CHANGE_MESSAGE !=~ '.*\nci-os-only:.*' || $CIRRUS_CHANGE_MESSAGE =~ '.*\nci-os-only:[^\n]*freebsd.*'
+  only_if: $CIRRUS_CHANGE_MESSAGE !=~ '.*\nci-task-only:.*' || $CIRRUS_CHANGE_MESSAGE =~ '.*\nci-task-only:[^\n]*freebsd.*'
 
   sysinfo_script: |
     id
@@ -282,7 +282,7 @@ task:
   <<: *linux_task_template
 
   depends_on: SanityCheck
-  only_if: $CIRRUS_CHANGE_MESSAGE !=~ '.*\nci-os-only:.*' || $CIRRUS_CHANGE_MESSAGE =~ '.*\nci-os-only:[^\n]*linux.*'
+  only_if: $CIRRUS_CHANGE_MESSAGE !=~ '.*\nci-task-only:.*' || $CIRRUS_CHANGE_MESSAGE =~ '.*\nci-task-only:[^\n]*linux.*'
 
   ccache_cache:
     folder: ${CCACHE_DIR}
@@ -441,7 +441,7 @@ task:
   <<: *macos_task_template
 
   depends_on: SanityCheck
-  only_if: $CIRRUS_CHANGE_MESSAGE !=~ '.*\nci-os-only:.*' || $CIRRUS_CHANGE_MESSAGE =~ '.*\nci-os-only:[^\n]*(macos|darwin|osx).*'
+  only_if: $CIRRUS_CHANGE_MESSAGE !=~ '.*\nci-task-only:.*' || $CIRRUS_CHANGE_MESSAGE =~ '.*\nci-task-only:[^\n]*(macos|darwin|osx).*'
 
   sysinfo_script: |
     id
@@ -560,7 +560,7 @@ task:
   <<: *windows_task_template
 
   depends_on: SanityCheck
-  only_if: $CIRRUS_CHANGE_MESSAGE !=~ '.*\nci-os-only:.*' || $CIRRUS_CHANGE_MESSAGE =~ '.*\nci-os-only:[^\n]*windows.*'
+  only_if: $CIRRUS_CHANGE_MESSAGE !=~ '.*\nci-task-only:.*' || $CIRRUS_CHANGE_MESSAGE =~ '.*\nci-task-only:[^\n]*windows.*'
 
   setup_additional_packages_script: |
     REM choco install -y --no-progress ...
@@ -598,8 +598,8 @@ task:
   # due to resource constraints we don't run this task by default for now
   trigger_type: manual
   # worth using only_if despite being manual, otherwise this task will show up
-  # when e.g. ci-os-only: linux is used.
-  only_if: $CIRRUS_CHANGE_MESSAGE !=~ '.*\nci-os-only:.*' || $CIRRUS_CHANGE_MESSAGE =~ '.*\nci-os-only:[^\n]*mingw.*'
+  # when e.g. ci-task-only: linux is used.
+  only_if: $CIRRUS_CHANGE_MESSAGE !=~ '.*\nci-task-only:.*' || $CIRRUS_CHANGE_MESSAGE =~ '.*\nci-task-only:[^\n]*mingw.*'
   # otherwise it'll be sorted before other tasks
   depends_on: SanityCheck
 
@@ -658,7 +658,7 @@ task:
   # use always: to continue after failures. Task that did not run count as a
   # success, so we need to recheck SanityChecks's condition here ...
   depends_on: SanityCheck
-  only_if: $CIRRUS_CHANGE_MESSAGE !=~ '.*\nci-os-only:.*'
+  only_if: $CIRRUS_CHANGE_MESSAGE !=~ '.*\nci-task-only:.*' || $CIRRUS_CHANGE_MESSAGE =~ '.*\nci-task-only:[^\n]*compilerwarnings.*'
 
   env:
     CPUS: 4
diff --git a/src/tools/ci/README b/src/tools/ci/README
index 30ddd200c9..da4125defa 100644
--- a/src/tools/ci/README
+++ b/src/tools/ci/README
@@ -61,10 +61,11 @@ Controlling CI via commit messages
 The behavior of CI can be controlled by special content in commit
 messages. Currently the following controls are available:
 
-- ci-os-only: {(freebsd|linux|macos|windows|mingw)}
+- ci-task-only: {(freebsd|linux|macos|windows|mingw|compilerwarnings)}
 
-  Only runs CI on operating systems specified. This can be useful when
-  addressing portability issues affecting only a subset of platforms.
+  Only runs CI compiler warnings or on operating systems specified. This can be
+  useful when addressing portability issues affecting only a subset of platforms
+  or when addressing compiler warnings issues.
 
 
 Using custom compute resources for CI
-- 
2.34.1

Reply via email to