Hi, On Thu, 18 Sept 2025 at 15:30, Andres Freund <[email protected]> wrote: > > Hi, > > On 2025-09-15 11:50:07 +0300, Nazir Bilal Yavuz wrote: > > On Thu, 11 Sept 2025 at 17:55, Jacob Champion > > <[email protected]> wrote: > > > > > > On Thu, Sep 11, 2025 at 7:18 AM Peter Eisentraut <[email protected]> > > > wrote: > > > > I don't think we need this level of complication. We already have the > > > > situation that for example "linux" covers several tasks > > > > > > Recently, I've wished that it were otherwise; if I'm debugging a > > > Meson-only test failure in Linux, I don't want to burn credits running > > > Autoconf. > > > > I agree with Jacob. I think it would be better if each task had its > > own tag. I left it as "vs2019" for now. > > I don't really agree that this is something that needs to be changed as part > of this.
Definitely. > Or that the CI_OS_ONLY is really the way to tackle this. > > Perhaps we should just have CI_TASK_ONLY and CI_OS_ONLY? I think this is a good idea. How about something like the attached? It allows you to expand to the CI_*_ONLY option. -- Regards, Nazir Bilal Yavuz Microsoft
From 7a1f1df4345cdd401062adc046b74bc275f0b31a Mon Sep 17 00:00:00 2001 From: Nazir Bilal Yavuz <[email protected]> Date: Fri, 19 Sep 2025 14:32:29 +0300 Subject: [PATCH v1] ci: Add CI_TASK_ONLY Expand CI_OS_ONLY with CI_TASK_ONLY. This allows to differentiate OSes from the tasks. --- .cirrus.star | 111 +++++++++++++++++++++++++++++++++------------- .cirrus.tasks.yml | 2 +- 2 files changed, 80 insertions(+), 33 deletions(-) diff --git a/.cirrus.star b/.cirrus.star index e9bb672b959..f718befa9c6 100644 --- a/.cirrus.star +++ b/.cirrus.star @@ -63,10 +63,9 @@ def main(): return output -def compute_environment_vars(): +def compute_automatic_trigger_tasks(): cenv = {} - ### # Some tasks are manually triggered by default because they might use too # many resources for users of free Cirrus credits, but they can be # triggered automatically by naming them in an environment variable e.g. @@ -83,42 +82,90 @@ def compute_environment_vars(): else: value = 'manual' cenv[name] = value - ### - ### - # Parse "ci-os-only:" tag in commit message and set - # CI_{$OS}_ENABLED variable for each OS + return cenv - # We want to disable SanityCheck if testing just a specific OS. This - # shortens push-wait-for-ci cycle time a bit when debugging operating - # system specific failures. Just treating it as an OS in that case + +def compute_ci_regex_helper(name): + return r"(^|.*\n)ci-{}-only: ([^\n]+)($|\n.*)".format(name) + +def compute_ci_tasks(compute_ci_dict): + cenv = {} + + # Parse "ci-{name}-only:" tag in commit message and set + # CI_${NAME}_ENABLED variable for each OS or task + + # We want to disable SanityCheck if testing just a specific OS or task. + # This shortens push-wait-for-ci cycle time a bit when debugging operating + # system specific failures. Just treating it as an OS or task in that case # suffices. - - operating_systems = [ - 'compilerwarnings', - 'freebsd', - 'linux', - 'macos', - 'mingw', - 'netbsd', - 'openbsd', - 'sanitycheck', - 'windows', - ] commit_message = env.get('CIRRUS_CHANGE_MESSAGE') - match_re = r"(^|.*\n)ci-os-only: ([^\n]+)($|\n.*)" - # re.match() returns an array with a tuple of (matched-string, match_1, ...) - m = re.match(match_re, commit_message) - if m and len(m) > 0: - os_only = m[0][2] - os_only_list = re.split(r'[, ]+', os_only) - else: - os_only_list = operating_systems + # Firstly, try to find if there is specification. If yes, then it is safe + # to disable not specified tasks. + specified = False + for name in compute_ci_dict: + match_re = compute_ci_regex_helper(name) + # re.match() returns an array with a tuple of (matched-string, match_1, ...) + m = re.match(match_re, commit_message) + if m and len(m) > 0: + # We have at least one specified task + specified = True + break - for os in operating_systems: - os_enabled = os in os_only_list - cenv['CI_{0}_ENABLED'.format(os.upper())] = os_enabled + for name in compute_ci_dict: + name_list = compute_ci_dict[name] + + # Same as above + match_re = compute_ci_regex_helper(name) + m = re.match(match_re, commit_message) + + name_only_list = [] + if m and len(m) > 0: + name_only = m[0][2] + name_only_list = re.split(r'[, ]+', name_only) + elif not specified: + name_only_list = name_list + + for name in name_list: + name_enabled = name in name_only_list + cenv['CI_{0}_ENABLED'.format(name.upper())] = name_enabled + + return cenv + + +def compute_environment_vars(): + cenv = {} + cenv.update(compute_automatic_trigger_tasks()) + + ### + # Compute which tasks to run + compute_ci_dict = {} + + operating_systems = { + 'os': + [ + 'freebsd', + 'linux', + 'macos', + 'netbsd', + 'openbsd', + 'windows', + ] + } + compute_ci_dict.update(operating_systems) + + tasks = { + 'task': + [ + 'compilerwarnings', + 'mingw', + 'sanitycheck', + ] + } + compute_ci_dict.update(tasks) + + cenv.update(compute_ci_tasks(compute_ci_dict)) ### return cenv diff --git a/.cirrus.tasks.yml b/.cirrus.tasks.yml index eca9d62fc22..e655a95b45a 100644 --- a/.cirrus.tasks.yml +++ b/.cirrus.tasks.yml @@ -817,7 +817,7 @@ task: trigger_type: $CI_TRIGGER_TYPE_MINGW depends_on: SanityCheck - only_if: $CI_MINGW_ENABLED + only_if: $CI_MINGW_ENABLED || $CI_WINDOWS_ENABLED env: TEST_JOBS: 4 # higher concurrency causes occasional failures -- 2.51.0
