Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .github/workflows/ci-image-checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,10 @@ on: # yamllint disable-line rule:truthy
description: "Whether to use uv to build the image (true/false)"
required: true
type: string
only-pyproject-toml-files-changed:
description: "Whether only pyproject.toml files changed in the PR"
required: true
type: string
secrets:
DOCS_AWS_ACCESS_KEY_ID:
required: true
Expand Down Expand Up @@ -201,6 +205,7 @@ jobs:
SKIP_GROUP_OUTPUT: "true"
DEFAULT_BRANCH: ${{ inputs.branch }}
RUFF_FORMAT: "github"
ONLY_PYPROJECT_TOML_FILES_CHANGED: ${{ inputs.only-pyproject-toml-files-changed }}

mypy:
timeout-minutes: 45
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,8 @@ jobs:
needs-helm-tests: ${{ steps.selective-checks.outputs.needs-helm-tests }}
needs-mypy: ${{ steps.selective-checks.outputs.needs-mypy }}
only-new-ui-files: ${{ steps.selective-checks.outputs.only-new-ui-files }}
only-pyproject-toml-files-changed: >-
${{ steps.selective-checks.outputs.only-pyproject-toml-files-changed }}
postgres-exclude: ${{ steps.selective-checks.outputs.postgres-exclude }}
postgres-versions: ${{ steps.selective-checks.outputs.postgres-versions }}
prod-image-build: ${{ steps.selective-checks.outputs.prod-image-build }}
Expand Down Expand Up @@ -288,6 +290,7 @@ jobs:
debug-resources: ${{ needs.build-info.outputs.debug-resources }}
docs-build: ${{ needs.build-info.outputs.docs-build }}
needs-api-codegen: ${{ needs.build-info.outputs.needs-api-codegen }}
only-pyproject-toml-files-changed: $${ needs.build-info.outputs.only-pyproject-toml-files-changed }}
default-postgres-version: ${{ needs.build-info.outputs.default-postgres-version }}
run-coverage: ${{ needs.build-info.outputs.run-coverage }}
use-uv: ${{ needs.build-info.outputs.use-uv }}
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -1 +1 @@
e29939368f39c46e19c799094b0ad7ec
a3d122555ba87f1510c8cca9715e6a93
Original file line number Diff line number Diff line change
Expand Up @@ -914,6 +914,11 @@ def provider_action_summary(description: str, message_type: MessageType, package
is_flag=True,
help="Skip changelog generation. This is used in pre-commit that updates build-files only.",
)
@click.option(
"--skip-readme",
is_flag=True,
help="Skip readme generation. This is used in pre-commit that updates build-files only.",
)
@option_verbose
def prepare_provider_documentation(
base_branch: str,
Expand All @@ -926,6 +931,7 @@ def prepare_provider_documentation(
reapply_templates_only: bool,
skip_git_fetch: bool,
skip_changelog: bool,
skip_readme: bool,
):
from airflow_breeze.prepare_providers.provider_documentation import (
PrepareReleaseDocsChangesOnlyException,
Expand Down Expand Up @@ -982,6 +988,7 @@ def prepare_provider_documentation(
provider_id=provider_id,
with_breaking_changes=with_breaking_changes,
maybe_with_new_features=maybe_with_new_features,
skip_readme=skip_readme,
)
if not only_min_version_update and not reapply_templates_only and not skip_changelog:
with ci_group(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -258,6 +258,7 @@
"--reapply-templates-only",
"--skip-git-fetch",
"--skip-changelog",
"--skip-readme",
],
}
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1155,6 +1155,7 @@ def _generate_readme_rst(context: dict[str, Any], provider_details: ProviderPack
def _generate_build_files_for_provider(
context: dict[str, Any],
provider_details: ProviderPackageDetails,
skip_readme: bool,
):
init_py_content = black_format(
render_template(
Expand All @@ -1166,7 +1167,8 @@ def _generate_build_files_for_provider(
)
init_py_path = provider_details.base_provider_package_path / "__init__.py"
init_py_path.write_text(init_py_content)
_generate_readme_rst(context, provider_details)
if not skip_readme:
_generate_readme_rst(context, provider_details)
_generate_docs_conf(context, provider_details)
regenerate_pyproject_toml(context, provider_details, version_suffix=None)
_generate_get_provider_info_py(context, provider_details)
Expand All @@ -1191,13 +1193,14 @@ def _replace_min_airflow_version_in_provider_yaml(


def update_min_airflow_version_and_build_files(
provider_id: str, with_breaking_changes: bool, maybe_with_new_features: bool
provider_id: str, with_breaking_changes: bool, maybe_with_new_features: bool, skip_readme: bool
):
"""Updates min airflow version in provider yaml and __init__.py

:param provider_id: provider package id
:param with_breaking_changes: whether there are any breaking changes
:param maybe_with_new_features: whether there are any new features
:param skip_readme: skip updating readme: skip_readme
:return:
"""
provider_details = get_provider_details(provider_id)
Expand All @@ -1211,6 +1214,7 @@ def update_min_airflow_version_and_build_files(
_generate_build_files_for_provider(
context=jinja_context,
provider_details=provider_details,
skip_readme=skip_readme,
)
_replace_min_airflow_version_in_provider_yaml(
context=jinja_context, provider_yaml_path=provider_details.provider_yaml_path
Expand Down
4 changes: 4 additions & 0 deletions dev/breeze/src/airflow_breeze/utils/selective_checks.py
Original file line number Diff line number Diff line change
Expand Up @@ -777,6 +777,10 @@ def run_tests(self) -> bool:
def run_system_tests(self) -> bool:
return self.run_tests

@cached_property
def only_pyproject_toml_files_changed(self) -> bool:
return all(Path(file).name == "pyproject.toml" for file in self._files)

@cached_property
def ci_image_build(self) -> bool:
# in case pyproject.toml changed, CI image should be built - even if no build dependencies
Expand Down
32 changes: 22 additions & 10 deletions scripts/ci/pre_commit/update_providers_build_files.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
# under the License.
from __future__ import annotations

import os
import subprocess
import sys
from pathlib import Path
Expand Down Expand Up @@ -67,17 +68,28 @@ def _find_all_providers(examined_file: Path) -> None:
console.print("[red]\nThe found providers list cannot be empty[/]")
sys.exit(1)

cmd = [
"breeze",
"release-management",
"prepare-provider-documentation",
"--reapply-templates-only",
"--skip-git-fetch",
"--only-min-version-update",
]

if os.environ.get("ONLY_PYPROJECT_TOML_CHANGED", "") == "true":
# in order to make dependabot happy we skip generating changelog/readme when only
# pyproject.toml files changed
cmd.extend(
[
"--skip-changelog",
"--skip-readme",
]
)

cmd.extend(providers)
res = subprocess.run(
[
"breeze",
"release-management",
"prepare-provider-documentation",
"--reapply-templates-only",
"--skip-git-fetch",
"--skip-changelog",
"--only-min-version-update",
*list(providers),
],
cmd,
check=False,
)
if res.returncode != 0:
Expand Down