This is an automated email from the ASF dual-hosted git repository.

potiuk pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/airflow.git


The following commit(s) were added to refs/heads/main by this push:
     new 6d7563de33 Optimize number of versions run when CI scripts change 
(#38426)
6d7563de33 is described below

commit 6d7563de33d9cdcbf745ed28547b97dc497a080b
Author: Jarek Potiuk <ja...@potiuk.com>
AuthorDate: Sat Mar 23 15:09:19 2024 +0100

    Optimize number of versions run when CI scripts change (#38426)
    
    When CI scripts change we want to run full set of tests to make sure
    that the new scripts are working fine. But we do not necessarily want
    to run all matrix combos of Python/Kubernetes and DB tests - it's enough
    to run ALL tests but with default versions.
    
    This PR implements that. It separates "full tests needed" output
    from "all versions" output. The first one set to "true" will make the CI
    run all kinds of tests but only the presences of "all versions" = "true"
    will run all combinations of versions to be used, otherwise just
    "default" versions will be used.
    
    The "all version" output will be automatically triggered when:
    
    * direct push (AKA "canary") or "schedule" build is run in the
      airflow repo
    * "all versions" label is set on the PR
    * build dependencies changed in the build in pyproject.toml
    * project dependencies changed in the build in pyproject.toml or
      when generated_provider_dependencies.json changed.
    
    Those conditions are important enought to trigger a build with all
    versions changed. We still have the "canary" build always running
    all version checks - so that it will catch any potential issues that
    regular PRs to "scripts"/"workflows" might cause and the contributor
    might still add "all versions" label in the PR if unsure.
    
    Contributor might also add "default versions only" label on a PR
    to force the build to only use default versions even if dependencies
    change in the PR.
---
 dev/breeze/doc/ci/04_selective_checks.md           | 153 +++++++++++----------
 dev/breeze/doc/ci/07_debugging.md                  |  17 ++-
 .../src/airflow_breeze/utils/selective_checks.py   | 106 +++++++++-----
 dev/breeze/tests/test_selective_checks.py          |  84 ++++++++---
 4 files changed, 231 insertions(+), 129 deletions(-)

diff --git a/dev/breeze/doc/ci/04_selective_checks.md 
b/dev/breeze/doc/ci/04_selective_checks.md
index 061cb1644b..9a4959dfc5 100644
--- a/dev/breeze/doc/ci/04_selective_checks.md
+++ b/dev/breeze/doc/ci/04_selective_checks.md
@@ -164,65 +164,67 @@ separated by spaces. This is to accommodate for the wau 
how outputs of this kind
 Github Actions to pass the list of parameters to a command to execute
 
 
-| Output                             | Meaning of the output                   
                                                             | Example value    
                          | List as string |
-|------------------------------------|------------------------------------------------------------------------------------------------------|--------------------------------------------|----------------|
-| affected-providers-list-as-string  | List of providers affected when they 
are selectively affected.                                       | airbyte http  
                             | *              |
-| all-python-versions                | List of all python versions there are 
available in the form of JSON array                            | ['3.8', '3.9', 
'3.10']                     |                |
-| all-python-versions-list-as-string | List of all python versions there are 
available in the form of space separated string                | 3.8 3.9 3.10   
                            | *              |
-| basic-checks-only                  | Whether to run all static checks 
("false") or only basic set of static checks ("true")               | false     
                                 |                |
-| cache-directive                    | Which cache should be used for images 
("registry", "local" , "disabled")                             | registry       
                            |                |
-| chicken-egg-providers              | List of providers that should be 
considered as "chicken-egg" - expecting development Airflow version |           
                                 |                |
-| ci-image-build                     | Whether CI image build is needed        
                                                             | true             
                          |                |
-| debug-resources                    | Whether resources usage should be 
printed during parallel job execution ("true"/ "false")            | false      
                                |                |
-| default-branch                     | Which branch is default for the build 
("main" for main branch, "v2-4-test" for 2.4 line etc.)        | main           
                            |                |
-| default-constraints-branch         | Which branch is default for the build 
("constraints-main" for main branch, "constraints-2-4" etc.)   | 
constraints-main                           |                |
-| default-helm-version               | Which Helm version to use as default    
                                                             | v3.9.4           
                          |                |
-| default-kind-version               | Which Kind version to use as default    
                                                             | v0.16.0          
                          |                |
-| default-kubernetes-version         | Which Kubernetes version to use as 
default                                                           | v1.25.2     
                               |                |
-| default-mysql-version              | Which MySQL version to use as default   
                                                             | 5.7              
                          |                |
-| default-postgres-version           | Which Postgres version to use as 
default                                                             | 10        
                                 |                |
-| default-python-version             | Which Python version to use as default  
                                                             | 3.8              
                          |                |
-| docs-build                         | Whether to build documentation 
("true"/"false")                                                      | true    
                                   |                |
-| docs-list-as-string                | What filter to apply to docs building - 
based on which documentation packages should be built        | apache-airflow 
helm-chart google           |                |
-| full-tests-needed                  | Whether this build runs complete set of 
tests or only subset (for faster PR builds) [1]              | false            
                          |                |
-| helm-version                       | Which Helm version to use for tests     
                                                             | v3.9.4           
                          |                |
-| is-airflow-runner                  | Whether runner used is an airflow or 
infrastructure runner (true if airflow/false if infrastructure) | false         
                             |                |
-| is-amd-runner                      | Whether runner used is an AMD one       
                                                             | true             
                          |                |
-| is-arm-runner                      | Whether runner used is an ARM one       
                                                             | false            
                          |                |
-| is-committer-build                 | Whether the build is triggered by a 
committer                                                        | false        
                              |                |
-| is-k8s-runner                      | Whether the build runs on our k8s 
infrastructure                                                     | false      
                                |                |
-| is-self-hosted-runner              | Whether the runner is self-hosted       
                                                             | false            
                          |                |
-| is-vm-runner                       | Whether the runner uses VM to run       
                                                             | true             
                          |                |
-| kind-version                       | Which Kind version to use for tests     
                                                             | v0.16.0          
                          |                |
-| kubernetes-combos-list-as-string   | All combinations of Python version and 
Kubernetes version to use for tests as space-separated string | 3.8-v1.25.2 
3.9-v1.26.4                    | *              |
-| kubernetes-versions                | All Kubernetes versions to use for 
tests as JSON array                                               | ['v1.25.2'] 
                               |                |
-| kubernetes-versions-list-as-string | All Kubernetes versions to use for 
tests as space-separated string                                   | v1.25.2     
                               | *              |
-| mypy-folders                       | List of folders to be considered for 
mypy                                                            | []            
                             |                |
-| mysql-exclude                      | Which versions of MySQL to exclude for 
tests as JSON array                                           | []              
                           |                |
-| mysql-versions                     | Which versions of MySQL to use for 
tests as JSON array                                               | ['5.7']     
                               |                |
-| needs-api-codegen                  | Whether "api-codegen" are needed to run 
("true"/"false")                                             | true             
                          |                |
-| needs-api-tests                    | Whether "api-tests" are needed to run 
("true"/"false")                                               | true           
                            |                |
-| needs-helm-tests                   | Whether Helm tests are needed to run 
("true"/"false")                                                | true          
                             |                |
-| needs-javascript-scans             | Whether javascript CodeQL scans should 
be run ("true"/"false")                                       | true            
                           |                |
-| needs-mypy                         | Whether mypy check is supposed to run 
in this build                                                  | true           
                            |                |
-| needs-python-scans                 | Whether Python CodeQL scans should be 
run ("true"/"false")                                           | true           
                            |                |
-| parallel-test-types-list-as-string | Which test types should be run for unit 
tests                                                        | API Always 
Providers Providers\[-google\]  | *              |
-| postgres-exclude                   | Which versions of Postgres to exclude 
for tests as JSON array                                        | []             
                            |                |
-| postgres-versions                  | Which versions of Postgres to use for 
tests as JSON array                                            | ['10']         
                            |                |
-| prod-image-build                   | Whether PROD image build is needed      
                                                             | true             
                          |                |
-| prod-image-build                   | Whether PROD image build is needed      
                                                             | true             
                          |                |
-| providers-compatibility-checks     | List of dicts: (python_version, 
airflow_version, removed_providers) for compatibility checks         | []       
                                  |                |
-| python-versions                    | List of python versions to use for that 
build                                                        | ['3.8']          
                          | *              |
-| python-versions-list-as-string     | Which versions of MySQL to use for 
tests as space-separated string                                   | 3.8         
                               | *              |
-| run-amazon-tests                   | Whether Amazon tests should be run 
("true"/"false")                                                  | true        
                               |                |
-| run-kubernetes-tests               | Whether Kubernetes tests should be run 
("true"/"false")                                              | true            
                           |                |
-| run-tests                          | Whether unit tests should be run 
("true"/"false")                                                    | true      
                                 |                |
-| run-www-tests                      | Whether WWW tests should be run 
("true"/"false")                                                     | true     
                                  |                |
-| runs-on                            | List of labels assigned for runners for 
that build (used to select runners)                          | ["ubuntu-22.04"] 
                          |                |
-| skip-pre-commits                   | Which pre-commits should be skipped 
during the static-checks run                                     | 
check-provider-yaml-valid,flynt,identity   |                |
-| skip-provider-tests                | When provider tests should be skipped 
(on non-main branch or when no provider changes detected)      | true           
                            |                |
-| sqlite-exclude                     | Which versions of Sqlite to exclude for 
tests as JSON array                                          | []               
                          |                |
-| upgrade-to-newer-dependencies      | Whether the image build should attempt 
to upgrade all dependencies (true/false or commit hash)       | false           
                           |                |
+| Output                             | Meaning of the output                   
                                                             | Example value    
                         | List as string |
+|------------------------------------|------------------------------------------------------------------------------------------------------|-------------------------------------------|----------------|
+| affected-providers-list-as-string  | List of providers affected when they 
are selectively affected.                                       | airbyte http  
                            | *              |
+| all-python-versions                | List of all python versions there are 
available in the form of JSON array                            | ['3.8', '3.9', 
'3.10']                    |                |
+| all-python-versions-list-as-string | List of all python versions there are 
available in the form of space separated string                | 3.8 3.9 3.10   
                           | *              |
+| all-versions                       | If set to true, then all python, k8s, 
DB versions are used for tests.                                | false          
                           |                |
+| basic-checks-only                  | Whether to run all static checks 
("false") or only basic set of static checks ("true")               | false     
                                |                |
+| cache-directive                    | Which cache should be used for images 
("registry", "local" , "disabled")                             | registry       
                           |                |
+| chicken-egg-providers              | List of providers that should be 
considered as "chicken-egg" - expecting development Airflow version |           
                                |                |
+| ci-image-build                     | Whether CI image build is needed        
                                                             | true             
                         |                |
+| debug-resources                    | Whether resources usage should be 
printed during parallel job execution ("true"/ "false")            | false      
                               |                |
+| default-branch                     | Which branch is default for the build 
("main" for main branch, "v2-4-test" for 2.4 line etc.)        | main           
                           |                |
+| default-constraints-branch         | Which branch is default for the build 
("constraints-main" for main branch, "constraints-2-4" etc.)   | 
constraints-main                          |                |
+| default-helm-version               | Which Helm version to use as default    
                                                             | v3.9.4           
                         |                |
+| default-kind-version               | Which Kind version to use as default    
                                                             | v0.16.0          
                         |                |
+| default-kubernetes-version         | Which Kubernetes version to use as 
default                                                           | v1.25.2     
                              |                |
+| default-mysql-version              | Which MySQL version to use as default   
                                                             | 5.7              
                         |                |
+| default-postgres-version           | Which Postgres version to use as 
default                                                             | 10        
                                |                |
+| default-python-version             | Which Python version to use as default  
                                                             | 3.8              
                         |                |
+| docs-build                         | Whether to build documentation 
("true"/"false")                                                      | true    
                                  |                |
+| docs-list-as-string                | What filter to apply to docs building - 
based on which documentation packages should be built        | apache-airflow 
helm-chart google          |                |
+| full-tests-needed                  | Whether this build runs complete set of 
tests or only subset (for faster PR builds) [1]              | false            
                         |                |
+| generated-dependencies-changed     | Whether generated dependencies have 
changed ("true"/"false")                                         | false        
                             |                |
+| helm-version                       | Which Helm version to use for tests     
                                                             | v3.9.4           
                         |                |
+| is-airflow-runner                  | Whether runner used is an airflow or 
infrastructure runner (true if airflow/false if infrastructure) | false         
                            |                |
+| is-amd-runner                      | Whether runner used is an AMD one       
                                                             | true             
                         |                |
+| is-arm-runner                      | Whether runner used is an ARM one       
                                                             | false            
                         |                |
+| is-committer-build                 | Whether the build is triggered by a 
committer                                                        | false        
                             |                |
+| is-k8s-runner                      | Whether the build runs on our k8s 
infrastructure                                                     | false      
                               |                |
+| is-self-hosted-runner              | Whether the runner is self-hosted       
                                                             | false            
                         |                |
+| is-vm-runner                       | Whether the runner uses VM to run       
                                                             | true             
                         |                |
+| kind-version                       | Which Kind version to use for tests     
                                                             | v0.16.0          
                         |                |
+| kubernetes-combos-list-as-string   | All combinations of Python version and 
Kubernetes version to use for tests as space-separated string | 3.8-v1.25.2 
3.9-v1.26.4                   | *              |
+| kubernetes-versions                | All Kubernetes versions to use for 
tests as JSON array                                               | ['v1.25.2'] 
                              |                |
+| kubernetes-versions-list-as-string | All Kubernetes versions to use for 
tests as space-separated string                                   | v1.25.2     
                              | *              |
+| mypy-folders                       | List of folders to be considered for 
mypy                                                            | []            
                            |                |
+| mysql-exclude                      | Which versions of MySQL to exclude for 
tests as JSON array                                           | []              
                          |                |
+| mysql-versions                     | Which versions of MySQL to use for 
tests as JSON array                                               | ['5.7']     
                              |                |
+| needs-api-codegen                  | Whether "api-codegen" are needed to run 
("true"/"false")                                             | true             
                         |                |
+| needs-api-tests                    | Whether "api-tests" are needed to run 
("true"/"false")                                               | true           
                           |                |
+| needs-helm-tests                   | Whether Helm tests are needed to run 
("true"/"false")                                                | true          
                            |                |
+| needs-javascript-scans             | Whether javascript CodeQL scans should 
be run ("true"/"false")                                       | true            
                          |                |
+| needs-mypy                         | Whether mypy check is supposed to run 
in this build                                                  | true           
                           |                |
+| needs-python-scans                 | Whether Python CodeQL scans should be 
run ("true"/"false")                                           | true           
                           |                |
+| parallel-test-types-list-as-string | Which test types should be run for unit 
tests                                                        | API Always 
Providers Providers\[-google\] | *              |
+| postgres-exclude                   | Which versions of Postgres to exclude 
for tests as JSON array                                        | []             
                           |                |
+| postgres-versions                  | Which versions of Postgres to use for 
tests as JSON array                                            | ['10']         
                           |                |
+| prod-image-build                   | Whether PROD image build is needed      
                                                             | true             
                         |                |
+| prod-image-build                   | Whether PROD image build is needed      
                                                             | true             
                         |                |
+| providers-compatibility-checks     | List of dicts: (python_version, 
airflow_version, removed_providers) for compatibility checks         | []       
                                 |                |
+| python-versions                    | List of python versions to use for that 
build                                                        | ['3.8']          
                         | *              |
+| python-versions-list-as-string     | Which versions of MySQL to use for 
tests as space-separated string                                   | 3.8         
                              | *              |
+| run-amazon-tests                   | Whether Amazon tests should be run 
("true"/"false")                                                  | true        
                              |                |
+| run-kubernetes-tests               | Whether Kubernetes tests should be run 
("true"/"false")                                              | true            
                          |                |
+| run-tests                          | Whether unit tests should be run 
("true"/"false")                                                    | true      
                                |                |
+| run-www-tests                      | Whether WWW tests should be run 
("true"/"false")                                                     | true     
                                 |                |
+| runs-on                            | List of labels assigned for runners for 
that build (used to select runners)                          | ["ubuntu-22.04"] 
                         |                |
+| skip-pre-commits                   | Which pre-commits should be skipped 
during the static-checks run                                     | 
check-provider-yaml-valid,flynt,identity  |                |
+| skip-provider-tests                | When provider tests should be skipped 
(on non-main branch or when no provider changes detected)      | true           
                           |                |
+| sqlite-exclude                     | Which versions of Sqlite to exclude for 
tests as JSON array                                          | []               
                         |                |
+| upgrade-to-newer-dependencies      | Whether the image build should attempt 
to upgrade all dependencies (true/false or commit hash)       | false           
                          |                |
 
 
 [1] Note for deciding if `full tests needed` mode is enabled and provider.yaml 
files.
@@ -264,7 +266,13 @@ Also, for most of the jobs, committer builds by default 
use "Self-hosted" runner
 builds use "Public" runners. For committers, this can be overridden by setting 
the
 `use public runners` label in the PR.
 
-If you are testing CI workflow changes and want to limit the number of matrix 
combinations generated by
+If you are testing CI workflow changes and want to test it for more complete 
matrix combinations generated by
+the jobs - you can set `all versions` label in the PR. This will run the PRs 
with the same combinations
+of versions as the `canary` main build. Using `all versions` is automatically 
set when build or project
+dependencies change in `pyproject.toml`.
+
+If you are testing CI workflow changes and change `pyproject.toml` or 
`generated/provider_dependencies.json` and you
+want to limit the number of matrix combinations generated by
 the jobs - you can set `default versions only` label in the PR. This will 
limit the number of versions
 used in the matrix to the default ones (default Python version and default 
Kubernetes version).
 
@@ -285,18 +293,19 @@ unsuccessful runs of the tests.
 As mentioned below, you can influence the outputs of selected checks by 
setting labels to the PR. Here is
 am overview of possible labels and their meaning:
 
-| Label                         | Affected outputs                         | 
Meaning                                                                         
                            |
-|-------------------------------|------------------------------------------|-------------------------------------------------------------------------------------------------------------|
-| canary                        | is-canary-run                            | 
If set, the PR run from apache/airflow repo behaves as `canary` run (can only 
be run by maintainer).        |
-| debug ci resources            | debug-ci-resources                       | 
If set, then debugging resources is enabled during parallel tests and you can 
see them in the output.       |
-| default versions only         | python-versions-*, kubernetes-versions-* | 
If set, the number of Python and Kubernetes versions used by the build will be 
limited to the default ones. |
-| disable image cache           | cache-directive                          | 
If set, the image cache is disables when building the image.                    
                            |
-| include success outputs       | include-success-outputs                  | 
By default, outputs of successful parallel tests are not shown - enabling this 
flag will make then shown.   |
-| latest versions only          | python-versions-*, kubernetes-versions-* | 
If set, the number of Python and Kubernetes versions used by the build will be 
limited to the latest ones.  |
-| full tests needed             | full-tests-needed                        | 
Run complete set of tests, including all Python all DB versions, and all test 
types.                        |
-| non committer build           | is-committer-build                       | 
If set then even for non-committer builds, the scripts used for images are used 
from target branch.         |
-| upgrade to newer dependencies | upgrade-to-newer-dependencies            | 
If set then dependencies in the CI image build are upgraded to the newer ones.  
                            |
-| use public runners            | runs-on                                  | 
Force using public runners even for Committer runs.                             
                            |
+| Label                         | Affected outputs              | Meaning      
                                                                                
                   |
+|-------------------------------|-------------------------------|-----------------------------------------------------------------------------------------------------------------|
+| canary                        | is-canary-run                 | If set, the 
PR run from apache/airflow repo behaves as `canary` run (can only be run by 
maintainer).            |
+| debug ci resources            | debug-ci-resources            | If set, then 
debugging resources is enabled during parallel tests and you can see them in 
the output.           |
+| default versions only         | all-versions, *-versions-*    | If set, the 
number of Python and Kubernetes, DB versions used by the build will be limited 
to the default ones. |
+| disable image cache           | cache-directive               | If set, the 
image cache is disables when building the image.                                
                    |
+| include success outputs       | include-success-outputs       | By default, 
outputs of successful parallel tests are not shown - enabling this flag will 
make then shown.       |
+| latest versions only          | *-versions-*, *-versions-*    | If set, the 
number of Python, Kubernetes, DB versions used by the build will be limited to 
the latest ones.     |
+| all versions                  | all-versions, *-versions-*    | Run tests 
for all python and k8s versions.                                                
                      |
+| full tests needed             | full-tests-needed             | Run complete 
set of tests (might be with default or all python/k8s versions)                 
                   |
+| non committer build           | is-committer-build            | If set then 
even for non-committer builds, the scripts used for images are used from target 
branch.             |
+| upgrade to newer dependencies | upgrade-to-newer-dependencies | If set then 
dependencies in the CI image build are upgraded to the newer ones.              
                    |
+| use public runners            | runs-on                       | Force using 
public runners even for Committer runs.                                         
                    |
 
 
 -----
diff --git a/dev/breeze/doc/ci/07_debugging.md 
b/dev/breeze/doc/ci/07_debugging.md
index 0516a95d2b..6e6d46584e 100644
--- a/dev/breeze/doc/ci/07_debugging.md
+++ b/dev/breeze/doc/ci/07_debugging.md
@@ -54,11 +54,20 @@ maintainer.
   rather than using `Build images` workflow and use the same breeze
   version for building image and testing
 - When you want to test changes to workflows and CI scripts you can set
-  `default versions only` label to the PR or `latest versions only`.
+  `all versions` label to the PR or `latest versions only`.
+  This will make the PR run using "all" versions of
+  Python, Kubernetes and the DBS. By default - unless you also change
+  dependencies in `pyproject.toml` or `generated/provider_dependencies.json`
+  such PRs will only use "default" versions of Python, Kubernetes and
+  DBs. This is useful when you want to test changes to the CI scripts
+  are not affected by the versions of Python, Kubernetes and DBs.
+- Even if you change dependencies in `pyproject.toml`, or
+  `generated/provider_dependencies.json`, when you want to test changes to 
workflows
+  and CI scripts you can set `default versions only` label to the
   This will make the PR run using the default (or latest) versions of
-  Python and Kubernetes. This is useful when you want to test changes to
-  the CI scripts and workflows and you want to use far less resources
-  than the full tests.
+  Python and Kubernetes and DBs. This is useful when you want to test
+  changes to the CI scripts and workflows and you want to use far
+  less resources than the full tests.
 - When you want to test changes to `build-images.yml` workflow you
   should push your branch as `main` branch in your local fork. This will
   run changed `build-images.yml` workflow as it will be in `main` branch
diff --git a/dev/breeze/src/airflow_breeze/utils/selective_checks.py 
b/dev/breeze/src/airflow_breeze/utils/selective_checks.py
index 6214a7e3b3..d0f0e39a9c 100644
--- a/dev/breeze/src/airflow_breeze/utils/selective_checks.py
+++ b/dev/breeze/src/airflow_breeze/utils/selective_checks.py
@@ -68,6 +68,7 @@ DEBUG_CI_RESOURCES_LABEL = "debug ci resources"
 USE_PUBLIC_RUNNERS_LABEL = "use public runners"
 NON_COMMITTER_BUILD_LABEL = "non committer build"
 DEFAULT_VERSIONS_ONLY_LABEL = "default versions only"
+ALL_VERSIONS_LABEL = "all versions"
 LATEST_VERSIONS_ONLY_LABEL = "latest versions only"
 DISABLE_IMAGE_CACHE_LABEL = "disable image cache"
 INCLUDE_SUCCESS_OUTPUTS_LABEL = "include success outputs"
@@ -431,26 +432,54 @@ class SelectiveChecks:
     def default_constraints_branch(self) -> str:
         return self._default_constraints_branch
 
-    @cached_property
-    def full_tests_needed(self) -> bool:
-        if not self._commit_ref:
-            get_console().print("[warning]Running everything as commit is 
missing[/]")
-            return True
+    def _should_run_all_tests_and_versions(self) -> bool:
         if self._github_event in [GithubEvents.PUSH, GithubEvents.SCHEDULE, 
GithubEvents.WORKFLOW_DISPATCH]:
-            get_console().print(f"[warning]Full tests needed because event is 
{self._github_event}[/]")
+            get_console().print(f"[warning]Running everything because event is 
{self._github_event}[/]")
             return True
-        if self._matching_files(
-            FileGroupForCi.ENVIRONMENT_FILES, CI_FILE_GROUP_MATCHES, 
CI_FILE_GROUP_EXCLUDES
-        ):
-            get_console().print("[warning]Running everything because env files 
changed[/]")
+        if not self._commit_ref:
+            get_console().print("[warning]Running everything in all versions 
as commit is missing[/]")
             return True
         if self.pyproject_toml_changed:
             if self.build_system_changed_in_pyproject_toml:
-                get_console().print("[warning]Running everything: build-system 
changed in pyproject.toml[/]")
+                get_console().print(
+                    "[warning]Running everything with all versions: 
build-system"
+                    "changed in pyproject.toml[/]"
+                )
                 return True
             if self.dependencies_changed_in_pyproject_toml:
-                get_console().print("[warning]Running everything: dependencies 
changed in pyproject.toml[/]")
+                get_console().print(
+                    "[warning]Running everything with all versions: "
+                    "dependencies changed in pyproject.toml[/]"
+                )
                 return True
+        if self.generated_dependencies_changed:
+            get_console().print(
+                "[warning]Running everything with all versions: provider 
dependencies changed[/]"
+            )
+            return True
+        return False
+
+    @cached_property
+    def all_versions(self) -> bool:
+        if DEFAULT_VERSIONS_ONLY_LABEL in self._pr_labels:
+            return False
+        if LATEST_VERSIONS_ONLY_LABEL in self._pr_labels:
+            return False
+        if ALL_VERSIONS_LABEL in self._pr_labels:
+            return True
+        if self._should_run_all_tests_and_versions():
+            return True
+        return False
+
+    @cached_property
+    def full_tests_needed(self) -> bool:
+        if self._should_run_all_tests_and_versions():
+            return True
+        if self._matching_files(
+            FileGroupForCi.ENVIRONMENT_FILES, CI_FILE_GROUP_MATCHES, 
CI_FILE_GROUP_EXCLUDES
+        ):
+            get_console().print("[warning]Running full set of tests because 
env files changed[/]")
+            return True
         if FULL_TESTS_NEEDED_LABEL in self._pr_labels:
             get_console().print(
                 "[warning]Full tests needed because "
@@ -461,13 +490,10 @@ class SelectiveChecks:
 
     @cached_property
     def python_versions(self) -> list[str]:
-        if self.full_tests_needed:
-            if DEFAULT_VERSIONS_ONLY_LABEL in self._pr_labels:
-                return [DEFAULT_PYTHON_MAJOR_MINOR_VERSION]
-            elif LATEST_VERSIONS_ONLY_LABEL in self._pr_labels:
-                return CURRENT_PYTHON_MAJOR_MINOR_VERSIONS[-1:]
-            else:
-                return CURRENT_PYTHON_MAJOR_MINOR_VERSIONS
+        if self.all_versions:
+            return CURRENT_PYTHON_MAJOR_MINOR_VERSIONS
+        if self.latest_versions_only:
+            return [CURRENT_PYTHON_MAJOR_MINOR_VERSIONS[-1]]
         return [DEFAULT_PYTHON_MAJOR_MINOR_VERSION]
 
     @cached_property
@@ -481,13 +507,10 @@ class SelectiveChecks:
         Even if we remove them from the main version. This is needed to make 
sure we can cherry-pick
         changes from main to the previous branch.
         """
-        if self.full_tests_needed:
-            if DEFAULT_VERSIONS_ONLY_LABEL in self._pr_labels:
-                return [DEFAULT_PYTHON_MAJOR_MINOR_VERSION]
-            elif LATEST_VERSIONS_ONLY_LABEL in self._pr_labels:
-                return ALL_PYTHON_MAJOR_MINOR_VERSIONS[-1:]
-            else:
-                return ALL_PYTHON_MAJOR_MINOR_VERSIONS
+        if self.all_versions:
+            return ALL_PYTHON_MAJOR_MINOR_VERSIONS
+        if self.latest_versions_only:
+            return [CURRENT_PYTHON_MAJOR_MINOR_VERSIONS[-1]]
         return [DEFAULT_PYTHON_MAJOR_MINOR_VERSION]
 
     @cached_property
@@ -496,11 +519,19 @@ class SelectiveChecks:
 
     @cached_property
     def postgres_versions(self) -> list[str]:
-        return CURRENT_POSTGRES_VERSIONS if self.full_tests_needed else 
[DEFAULT_POSTGRES_VERSION]
+        if self.all_versions:
+            return CURRENT_POSTGRES_VERSIONS
+        if self.latest_versions_only:
+            return [CURRENT_POSTGRES_VERSIONS[-1]]
+        return [DEFAULT_POSTGRES_VERSION]
 
     @cached_property
     def mysql_versions(self) -> list[str]:
-        return CURRENT_MYSQL_VERSIONS if self.full_tests_needed else 
[DEFAULT_MYSQL_VERSION]
+        if self.all_versions:
+            return CURRENT_MYSQL_VERSIONS
+        if self.latest_versions_only:
+            return [CURRENT_MYSQL_VERSIONS[-1]]
+        return [DEFAULT_MYSQL_VERSION]
 
     @cached_property
     def kind_version(self) -> str:
@@ -512,7 +543,7 @@ class SelectiveChecks:
 
     @cached_property
     def postgres_exclude(self) -> list[dict[str, str]]:
-        if not self.full_tests_needed:
+        if not self.all_versions:
             # Only basic combination so we do not need to exclude anything
             return []
         return [
@@ -525,7 +556,7 @@ class SelectiveChecks:
 
     @cached_property
     def mysql_exclude(self) -> list[dict[str, str]]:
-        if not self.full_tests_needed:
+        if not self.all_versions:
             # Only basic combination so we do not need to exclude anything
             return []
         return [
@@ -542,13 +573,10 @@ class SelectiveChecks:
 
     @cached_property
     def kubernetes_versions(self) -> list[str]:
-        if self.full_tests_needed:
-            if DEFAULT_VERSIONS_ONLY_LABEL in self._pr_labels:
-                return [DEFAULT_KUBERNETES_VERSION]
-            elif LATEST_VERSIONS_ONLY_LABEL in self._pr_labels:
-                return CURRENT_KUBERNETES_VERSIONS[-1:]
-            else:
-                return CURRENT_KUBERNETES_VERSIONS
+        if self.all_versions:
+            return CURRENT_KUBERNETES_VERSIONS
+        if self.latest_versions_only:
+            return [CURRENT_KUBERNETES_VERSIONS[-1]]
         return [DEFAULT_KUBERNETES_VERSION]
 
     @cached_property
@@ -849,6 +877,10 @@ class SelectiveChecks:
         diff = "\n".join([line for line in difflib.ndiff(old_lines, new_lines) 
if line and line[0] in "+-?"])
         get_console().print(diff)
 
+    @cached_property
+    def generated_dependencies_changed(self) -> bool:
+        return "generated/provider_dependencies.json" in self._files
+
     @cached_property
     def pyproject_toml_changed(self) -> bool:
         if not self._commit_ref:
diff --git a/dev/breeze/tests/test_selective_checks.py 
b/dev/breeze/tests/test_selective_checks.py
index 7527f67dca..de64a834a8 100644
--- a/dev/breeze/tests/test_selective_checks.py
+++ b/dev/breeze/tests/test_selective_checks.py
@@ -748,12 +748,15 @@ def test_full_test_needed_when_scripts_changes(files: 
tuple[str, ...], expected_
         (
             pytest.param(
                 ("INTHEWILD.md",),
-                ("full tests needed",),
+                ("full tests needed", "all versions"),
                 "main",
                 {
                     "affected-providers-list-as-string": 
ALL_PROVIDERS_AFFECTED,
+                    "all-versions": "true",
                     "all-python-versions": "['3.8', '3.9', '3.10', '3.11', 
'3.12']",
                     "all-python-versions-list-as-string": "3.8 3.9 3.10 3.11 
3.12",
+                    "mysql-versions": "['8.0', '8.3']",
+                    "postgres-versions": "['12', '13', '14', '15', '16']",
                     "python-versions": "['3.8', '3.9', '3.10', '3.11', 
'3.12']",
                     "python-versions-list-as-string": "3.8 3.9 3.10 3.11 3.12",
                     "kubernetes-versions": "['v1.26.14', 'v1.27.11', 
'v1.28.7', 'v1.29.2']",
@@ -771,7 +774,8 @@ def test_full_test_needed_when_scripts_changes(files: 
tuple[str, ...], expected_
                     "needs-mypy": "true",
                     "mypy-folders": "['airflow', 'providers', 'docs', 'dev']",
                 },
-                id="Everything should run including all providers when full 
tests are needed",
+                id="Everything should run including all providers when full 
tests are needed, "
+                "and all versions are required.",
             )
         ),
         (
@@ -783,6 +787,9 @@ def test_full_test_needed_when_scripts_changes(files: 
tuple[str, ...], expected_
                     "affected-providers-list-as-string": 
ALL_PROVIDERS_AFFECTED,
                     "all-python-versions": "['3.8']",
                     "all-python-versions-list-as-string": "3.8",
+                    "all-versions": "false",
+                    "mysql-versions": "['8.0']",
+                    "postgres-versions": "['12']",
                     "python-versions": "['3.8']",
                     "python-versions-list-as-string": "3.8",
                     "kubernetes-versions": "['v1.26.14']",
@@ -804,6 +811,39 @@ def test_full_test_needed_when_scripts_changes(files: 
tuple[str, ...], expected_
                 "but with single python and kubernetes if `default versions 
only` label is set",
             )
         ),
+        (
+            pytest.param(
+                ("INTHEWILD.md",),
+                ("full tests needed",),
+                "main",
+                {
+                    "affected-providers-list-as-string": 
ALL_PROVIDERS_AFFECTED,
+                    "all-python-versions": "['3.8']",
+                    "all-python-versions-list-as-string": "3.8",
+                    "all-versions": "false",
+                    "mysql-versions": "['8.0']",
+                    "postgres-versions": "['12']",
+                    "python-versions": "['3.8']",
+                    "python-versions-list-as-string": "3.8",
+                    "kubernetes-versions": "['v1.26.14']",
+                    "kubernetes-versions-list-as-string": "v1.26.14",
+                    "kubernetes-combos-list-as-string": "3.8-v1.26.14",
+                    "ci-image-build": "true",
+                    "prod-image-build": "true",
+                    "run-tests": "true",
+                    "docs-build": "true",
+                    "docs-list-as-string": ALL_DOCS_SELECTED_FOR_BUILD,
+                    "full-tests-needed": "true",
+                    "skip-pre-commits": 
"identity,mypy-airflow,mypy-dev,mypy-docs,mypy-providers",
+                    "upgrade-to-newer-dependencies": "false",
+                    "parallel-test-types-list-as-string": 
ALL_CI_SELECTIVE_TEST_TYPES,
+                    "needs-mypy": "true",
+                    "mypy-folders": "['airflow', 'providers', 'docs', 'dev']",
+                },
+                id="Everything should run including all providers when full 
tests are needed "
+                "but with single python and kubernetes if no version label is 
set",
+            )
+        ),
         (
             pytest.param(
                 ("INTHEWILD.md",),
@@ -813,7 +853,10 @@ def test_full_test_needed_when_scripts_changes(files: 
tuple[str, ...], expected_
                     "affected-providers-list-as-string": 
ALL_PROVIDERS_AFFECTED,
                     "all-python-versions": "['3.12']",
                     "all-python-versions-list-as-string": "3.12",
+                    "all-versions": "false",
                     "default-python-version": "3.12",
+                    "mysql-versions": "['8.3']",
+                    "postgres-versions": "['16']",
                     "python-versions": "['3.12']",
                     "python-versions-list-as-string": "3.12",
                     "kubernetes-versions": "['v1.29.2']",
@@ -832,7 +875,7 @@ def test_full_test_needed_when_scripts_changes(files: 
tuple[str, ...], expected_
                     "mypy-folders": "['airflow', 'providers', 'docs', 'dev']",
                 },
                 id="Everything should run including all providers when full 
tests are needed "
-                "but with single python and kubernetes if `default versions 
only` label is set",
+                "but with single python and kubernetes if `latest versions 
only` label is set",
             )
         ),
         (
@@ -845,10 +888,14 @@ def test_full_test_needed_when_scripts_changes(files: 
tuple[str, ...], expected_
                 "main",
                 {
                     "affected-providers-list-as-string": 
ALL_PROVIDERS_AFFECTED,
-                    "all-python-versions": "['3.8', '3.9', '3.10', '3.11', 
'3.12']",
-                    "all-python-versions-list-as-string": "3.8 3.9 3.10 3.11 
3.12",
-                    "python-versions": "['3.8', '3.9', '3.10', '3.11', 
'3.12']",
-                    "python-versions-list-as-string": "3.8 3.9 3.10 3.11 3.12",
+                    "all-python-versions": "['3.8']",
+                    "all-python-versions-list-as-string": "3.8",
+                    "all-versions": "false",
+                    "python-versions": "['3.8']",
+                    "python-versions-list-as-string": "3.8",
+                    "kubernetes-versions": "['v1.26.14']",
+                    "kubernetes-versions-list-as-string": "v1.26.14",
+                    "kubernetes-combos-list-as-string": "3.8-v1.26.14",
                     "ci-image-build": "true",
                     "prod-image-build": "true",
                     "run-tests": "true",
@@ -872,10 +919,14 @@ def test_full_test_needed_when_scripts_changes(files: 
tuple[str, ...], expected_
                 "main",
                 {
                     "affected-providers-list-as-string": 
ALL_PROVIDERS_AFFECTED,
-                    "all-python-versions": "['3.8', '3.9', '3.10', '3.11', 
'3.12']",
-                    "all-python-versions-list-as-string": "3.8 3.9 3.10 3.11 
3.12",
-                    "python-versions": "['3.8', '3.9', '3.10', '3.11', 
'3.12']",
-                    "python-versions-list-as-string": "3.8 3.9 3.10 3.11 3.12",
+                    "all-python-versions": "['3.8']",
+                    "all-python-versions-list-as-string": "3.8",
+                    "all-versions": "false",
+                    "python-versions": "['3.8']",
+                    "python-versions-list-as-string": "3.8",
+                    "kubernetes-versions": "['v1.26.14']",
+                    "kubernetes-versions-list-as-string": "v1.26.14",
+                    "kubernetes-combos-list-as-string": "3.8-v1.26.14",
                     "ci-image-build": "true",
                     "prod-image-build": "true",
                     "run-tests": "true",
@@ -899,10 +950,11 @@ def test_full_test_needed_when_scripts_changes(files: 
tuple[str, ...], expected_
                 "v2-7-stable",
                 {
                     "affected-providers-list-as-string": 
ALL_PROVIDERS_AFFECTED,
-                    "all-python-versions": "['3.8', '3.9', '3.10', '3.11', 
'3.12']",
-                    "all-python-versions-list-as-string": "3.8 3.9 3.10 3.11 
3.12",
-                    "python-versions": "['3.8', '3.9', '3.10', '3.11', 
'3.12']",
-                    "python-versions-list-as-string": "3.8 3.9 3.10 3.11 3.12",
+                    "all-python-versions": "['3.8']",
+                    "all-python-versions-list-as-string": "3.8",
+                    "python-versions": "['3.8']",
+                    "python-versions-list-as-string": "3.8",
+                    "all-versions": "false",
                     "ci-image-build": "true",
                     "prod-image-build": "true",
                     "run-tests": "true",
@@ -1846,7 +1898,7 @@ def test_has_migrations(files: tuple[str, ...], 
has_migrations: bool):
             id="Regular tests",
         ),
         pytest.param(
-            ("full tests needed",),
+            ("all versions",),
             {"providers-compatibility-checks": 
json.dumps(BASE_PROVIDERS_COMPATIBILITY_CHECKS)},
             id="full tests",
         ),

Reply via email to