Skip to content

Commit

Permalink
Enable "upgrade_to_newer_dependencies" when only provider.yaml change (
Browse files Browse the repository at this point in the history
…#25464)

When provider.yaml change and pre-commig has not be run to regenerate
generated/dependencies.json, it might happen that building CI image
will fail due to conflicting dependencies so developer has no
chance to find out that pre-commit needs to be also run dependencies
regenerated.

This PR changes selective checks to also trigger the dependencies
upgrade when only provider.yaml changed.
  • Loading branch information
potiuk committed Aug 2, 2022
1 parent d2c626a commit 2ee0e1f
Show file tree
Hide file tree
Showing 2 changed files with 52 additions and 0 deletions.
1 change: 1 addition & 0 deletions dev/breeze/src/airflow_breeze/utils/selective_checks.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@ def __hash__(self):
r"^setup.cfg",
r"^setup.py",
r"^generated/provider_dependencies.json$",
r"^airflow/providers/.*/provider.yaml$",
],
FileGroupForCi.DOC_FILES: [
r"^docs",
Expand Down
51 changes: 51 additions & 0 deletions dev/breeze/tests/test_selective_checks.py
Original file line number Diff line number Diff line change
Expand Up @@ -612,3 +612,54 @@ def test_no_commit_provided_trigger_full_build_for_any_event_type(github_event):
},
str(sc),
)


@pytest.mark.parametrize(
"files, expected_outputs,",
[
pytest.param(
("airflow/models/dag.py",),
{
"upgrade-to-newer-dependencies": "false",
},
id="Regular source changed",
),
pytest.param(
("setup.py",),
{
"upgrade-to-newer-dependencies": "true",
},
id="Setup.py changed",
),
pytest.param(
("setup.cfg",),
{
"upgrade-to-newer-dependencies": "true",
},
id="Setup.cfg changed",
),
pytest.param(
('airflow/providers/microsoft/azure/provider.yaml',),
{
"upgrade-to-newer-dependencies": "true",
},
id="Provider.yaml changed",
),
pytest.param(
('generated/provider_dependencies.json',),
{
"upgrade-to-newer-dependencies": "true",
},
id="Generated provider_dependencies changed",
),
],
)
def test_upgrade_to_newer_dependencies(files: Tuple[str, ...], expected_outputs: Dict[str, str]):
sc = SelectiveChecks(
files=files,
commit_ref="HEAD",
github_event=GithubEvents.PULL_REQUEST,
pr_labels=(),
default_branch="main",
)
assert_outputs_are_printed(expected_outputs, str(sc))

0 comments on commit 2ee0e1f

Please sign in to comment.