Skip to content

Commit

Permalink
Merge branch 'main' into feature/http-extra-options-check-response
Browse files Browse the repository at this point in the history
  • Loading branch information
davidblain-infrabel committed Jan 31, 2025
2 parents 1c291c8 + 9ef89ac commit bd295d4
Show file tree
Hide file tree
Showing 377 changed files with 6,400 additions and 3,559 deletions.
3 changes: 3 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,9 @@ indent_size = 2
[*.ts]
indent_size = 2

[*.tsx]
indent_size = 2

[*.css]
indent_size = 2

Expand Down
30 changes: 6 additions & 24 deletions .github/boring-cyborg.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,16 +37,10 @@ labelPRBasedOnFilePath:
- providers/apache/cassandra/**

provider:apache-drill:
- providers/src/airflow/providers/apache/drill/**/*
- docs/apache-airflow-providers-apache-drill/**/*
- providers/tests/apache/drill/**/*
- providers/tests/system/apache/drill/**/*
- providers/apache/drill/**

provider:apache-druid:
- providers/src/airflow/providers/apache/druid/**/*
- docs/apache-airflow-providers-apache-druid/**/*
- providers/tests/apache/druid/**/*
- providers/tests/system/apache/druid/**/*
- providers/apache/druid/**

provider:apache-flink:
- providers/src/airflow/providers/apache/flink/**/*
Expand Down Expand Up @@ -147,10 +141,7 @@ labelPRBasedOnFilePath:
- providers/datadog/**

provider:dbt-cloud:
- providers/src/airflow/providers/dbt/cloud/**/*
- docs/apache-airflow-providers-dbt-cloud/**/*
- providers/tests/dbt/cloud/**/*
- providers/tests/system/dbt/cloud/**/*
- providers/dbt/cloud/**

provider:dingding:
- providers/src/airflow/providers/dingding/**/*
Expand All @@ -168,10 +159,7 @@ labelPRBasedOnFilePath:
- providers/edge/**

provider:elasticsearch:
- providers/src/airflow/providers/elasticsearch/**/*
- docs/apache-airflow-providers-elasticsearch/**/*
- providers/tests/elasticsearch/**/*
- providers/tests/system/elasticsearch/**/*
- providers/elasticsearch/**

provider:exasol:
- providers/exasol/**
Expand All @@ -188,10 +176,7 @@ labelPRBasedOnFilePath:
- providers/ftp/**

provider:github:
- providers/src/airflow/providers/github/**/*
- docs/apache-airflow-providers-github/**/*
- providers/tests/github/**/*
- providers/tests/system/github/**/*
- providers/github/**

provider:google:
- providers/src/airflow/providers/google/**/*
Expand Down Expand Up @@ -270,10 +255,7 @@ labelPRBasedOnFilePath:
- providers/openlineage/**

provider:opensearch:
- providers/src/airflow/providers/opensearch/**/*
- docs/apache-airflow-providers-opensearch/**/*
- providers/tests/opensearch/**/*
- providers/tests/system/opensearch/**/*
- providers/opensearch/**

provider:opsgenie:
- providers/opsgenie/**
Expand Down
28 changes: 25 additions & 3 deletions .github/workflows/basic-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ jobs:
- run: uv tool run --from apache-airflow-breeze pytest -n auto --color=yes
working-directory: ./dev/breeze/
tests-ui:
timeout-minutes: 10
timeout-minutes: 15
name: React UI tests
runs-on: ${{ fromJSON(inputs.runs-on-as-json-public) }}
if: inputs.run-ui-tests == 'true'
Expand Down Expand Up @@ -115,7 +115,7 @@ jobs:
with:
path: airflow/ui/node_modules/
key: cache-ui-node-modules-v1-${{ runner.os }}-${{ hashFiles('airflow/ui/**/pnpm-lock.yaml') }}
id: restore-eslint-cache
id: restore-eslint-cache-ui
- run: cd airflow/ui && pnpm install --frozen-lockfile
- run: cd airflow/ui && pnpm test
env:
Expand All @@ -127,7 +127,29 @@ jobs:
key: cache-ui-node-modules-v1-${{ runner.os }}-${{ hashFiles('airflow/ui/**/pnpm-lock.yaml') }}
if-no-files-found: 'error'
retention-days: '2'
if: steps.restore-eslint-cache.outputs.stash-hit != 'true'
if: steps.restore-eslint-cache-ui.outputs.stash-hit != 'true'
- name: "Restore eslint cache (simple auth manager UI)"
uses: apache/infrastructure-actions/stash/restore@1c35b5ccf8fba5d4c3fdf25a045ca91aa0cbc468
with:
path: airflow/auth/managers/simple/ui/node_modules/
key: >
cache-simple-am-ui-node-modules-v1-
${{ runner.os }}-${{ hashFiles('airflow/auth/managers/simple/ui/**/pnpm-lock.yaml') }}
id: restore-eslint-cache-simple-am-ui
- run: cd airflow/auth/managers/simple/ui && pnpm install --frozen-lockfile
- run: cd airflow/auth/managers/simple/ui && pnpm test
env:
FORCE_COLOR: 2
- name: "Save eslint cache (ui)"
uses: apache/infrastructure-actions/stash/save@1c35b5ccf8fba5d4c3fdf25a045ca91aa0cbc468
with:
path: airflow/auth/managers/simple/ui/node_modules/
key: >
cache-simple-am-ui-node-modules-v1-
${{ runner.os }}-${{ hashFiles('airflow/auth/managers/simple/ui/**/pnpm-lock.yaml') }}
if-no-files-found: 'error'
retention-days: '2'
if: steps.restore-eslint-cache-simple-am-ui.outputs.stash-hit != 'true'

tests-www:
timeout-minutes: 10
Expand Down
9 changes: 1 addition & 8 deletions Dockerfile.ci
Original file line number Diff line number Diff line change
Expand Up @@ -935,17 +935,10 @@ function check_boto_upgrade() {
# We need to include few dependencies to pass pip check with other dependencies:
# * oss2 as dependency as otherwise jmespath will be bumped (sync with alibaba provider)
# * cryptography is kept for snowflake-connector-python limitation (sync with snowflake provider)
# * requests needs to be limited to be compatible with apache beam (sync with apache-beam provider)
# * yandexcloud requirements for requests does not match those of apache.beam and latest botocore
# Both requests and yandexcloud exclusion above might be removed after
# https://github.com/apache/beam/issues/32080 is addressed
# This is already addressed and planned for 2.59.0 release.
# When you remove yandexcloud and opensearch from the above list, you can also remove the
# optional providers_dependencies exclusions from "test_example_dags.py" in "tests/always".
set -x
# shellcheck disable=SC2086
${PACKAGING_TOOL_CMD} install ${EXTRA_INSTALL_FLAGS} --upgrade boto3 botocore \
"oss2>=2.14.0" "cryptography<43.0.0" "requests!=2.32.*,<3.0.0,>=2.24.0"
"oss2>=2.14.0" "cryptography<43.0.0" "opensearch-py"
set +x
pip check
}
Expand Down
2 changes: 2 additions & 0 deletions airflow/api_connexion/schemas/task_instance_schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ class Meta:
priority_weight = auto_field()
operator = auto_field()
queued_dttm = auto_field(data_key="queued_when")
scheduled_dttm = auto_field(data_key="scheduled_when")
pid = auto_field()
executor = auto_field()
executor_config = auto_field()
Expand Down Expand Up @@ -102,6 +103,7 @@ class Meta:
priority_weight = auto_field()
operator = auto_field()
queued_dttm = auto_field(data_key="queued_when")
scheduled_dttm = auto_field(data_key="scheduled_when")
pid = auto_field()
executor = auto_field()
executor_config = auto_field()
Expand Down
12 changes: 12 additions & 0 deletions airflow/api_fastapi/core_api/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,15 @@ class BaseModel(PydanticBaseModel):
"""

model_config = ConfigDict(from_attributes=True, populate_by_name=True)


class StrictBaseModel(BaseModel):
"""
StrictBaseModel is a base Pydantic model for REST API that does not allow any extra fields.
Use this class for models that should not have any extra fields in the payload.
:meta private:
"""

model_config = ConfigDict(from_attributes=True, populate_by_name=True, extra="forbid")
10 changes: 5 additions & 5 deletions airflow/api_fastapi/core_api/datamodels/assets.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,19 +21,19 @@

from pydantic import Field, field_validator

from airflow.api_fastapi.core_api.base import BaseModel
from airflow.api_fastapi.core_api.base import BaseModel, StrictBaseModel
from airflow.utils.log.secrets_masker import redact


class DagScheduleAssetReference(BaseModel):
class DagScheduleAssetReference(StrictBaseModel):
"""DAG schedule reference serializer for assets."""

dag_id: str
created_at: datetime
updated_at: datetime


class TaskOutletAssetReference(BaseModel):
class TaskOutletAssetReference(StrictBaseModel):
"""Task outlet reference serializer for assets."""

dag_id: str
Expand Down Expand Up @@ -84,7 +84,7 @@ class AssetAliasCollectionResponse(BaseModel):
total_entries: int


class DagRunAssetReference(BaseModel):
class DagRunAssetReference(StrictBaseModel):
"""DAGRun serializer for asset responses."""

run_id: str
Expand Down Expand Up @@ -141,7 +141,7 @@ class QueuedEventCollectionResponse(BaseModel):
total_entries: int


class CreateAssetEventsBody(BaseModel):
class CreateAssetEventsBody(StrictBaseModel):
"""Create asset events request."""

asset_id: int
Expand Down
4 changes: 2 additions & 2 deletions airflow/api_fastapi/core_api/datamodels/backfills.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@

from datetime import datetime

from airflow.api_fastapi.core_api.base import BaseModel
from airflow.api_fastapi.core_api.base import BaseModel, StrictBaseModel
from airflow.models.backfill import ReprocessBehavior


class BackfillPostBody(BaseModel):
class BackfillPostBody(StrictBaseModel):
"""Object used for create backfill request."""

dag_id: str
Expand Down
6 changes: 3 additions & 3 deletions airflow/api_fastapi/core_api/datamodels/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@

from pydantic import Discriminator, Field, Tag

from airflow.api_fastapi.core_api.base import BaseModel
from airflow.api_fastapi.core_api.base import BaseModel, StrictBaseModel

# Common Bulk Data Models
T = TypeVar("T")
Expand Down Expand Up @@ -57,7 +57,7 @@ class BulkActionNotOnExistence(enum.Enum):
SKIP = "skip"


class BulkBaseAction(BaseModel, Generic[T]):
class BulkBaseAction(StrictBaseModel, Generic[T]):
"""Base class for bulk actions."""

action: BulkAction = Field(..., description="The action to be performed on the entities.")
Expand Down Expand Up @@ -88,7 +88,7 @@ def _action_discriminator(action: Any) -> str:
return BulkAction(action["action"]).value


class BulkBody(BaseModel, Generic[T]):
class BulkBody(StrictBaseModel, Generic[T]):
"""Serializer for bulk entity operations."""

actions: list[
Expand Down
8 changes: 4 additions & 4 deletions airflow/api_fastapi/core_api/datamodels/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@
# under the License.
from __future__ import annotations

from airflow.api_fastapi.core_api.base import BaseModel
from airflow.api_fastapi.core_api.base import StrictBaseModel


class ConfigOption(BaseModel):
class ConfigOption(StrictBaseModel):
"""Config option."""

key: str
Expand All @@ -32,7 +32,7 @@ def text_format(self):
return f"{self.key} = {self.value}"


class ConfigSection(BaseModel):
class ConfigSection(StrictBaseModel):
"""Config Section Schema."""

name: str
Expand All @@ -53,7 +53,7 @@ def text_format(self):
return f"[{self.name}]\n" + "\n".join(option.text_format for option in self.options) + "\n"


class Config(BaseModel):
class Config(StrictBaseModel):
"""List of config sections with their options."""

sections: list[ConfigSection]
Expand Down
4 changes: 2 additions & 2 deletions airflow/api_fastapi/core_api/datamodels/connections.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
from pydantic import Field, field_validator
from pydantic_core.core_schema import ValidationInfo

from airflow.api_fastapi.core_api.base import BaseModel
from airflow.api_fastapi.core_api.base import BaseModel, StrictBaseModel
from airflow.utils.log.secrets_masker import redact


Expand Down Expand Up @@ -76,7 +76,7 @@ class ConnectionTestResponse(BaseModel):


# Request Models
class ConnectionBody(BaseModel):
class ConnectionBody(StrictBaseModel):
"""Connection Serializer for requests body."""

connection_id: str = Field(serialization_alias="conn_id", max_length=200, pattern=r"^[\w.-]+$")
Expand Down
10 changes: 5 additions & 5 deletions airflow/api_fastapi/core_api/datamodels/dag_run.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@

from pydantic import AwareDatetime, Field, NonNegativeInt, computed_field, model_validator

from airflow.api_fastapi.core_api.base import BaseModel
from airflow.api_fastapi.core_api.base import BaseModel, StrictBaseModel
from airflow.models import DagRun
from airflow.utils import timezone
from airflow.utils.state import DagRunState
Expand All @@ -37,14 +37,14 @@ class DAGRunPatchStates(str, Enum):
FAILED = DagRunState.FAILED


class DAGRunPatchBody(BaseModel):
class DAGRunPatchBody(StrictBaseModel):
"""DAG Run Serializer for PATCH requests."""

state: DAGRunPatchStates | None = None
note: str | None = Field(None, max_length=1000)


class DAGRunClearBody(BaseModel):
class DAGRunClearBody(StrictBaseModel):
"""DAG Run serializer for clear endpoint body."""

dry_run: bool = True
Expand Down Expand Up @@ -78,7 +78,7 @@ class DAGRunCollectionResponse(BaseModel):
total_entries: int


class TriggerDAGRunPostBody(BaseModel):
class TriggerDAGRunPostBody(StrictBaseModel):
"""Trigger DAG Run Serializer for POST body."""

dag_run_id: str | None = None
Expand Down Expand Up @@ -109,7 +109,7 @@ def logical_date(self) -> datetime:
return timezone.utcnow()


class DAGRunsBatchBody(BaseModel):
class DAGRunsBatchBody(StrictBaseModel):
"""List DAG Runs body for batch endpoint."""

order_by: str | None = None
Expand Down
4 changes: 2 additions & 2 deletions airflow/api_fastapi/core_api/datamodels/dags.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
field_validator,
)

from airflow.api_fastapi.core_api.base import BaseModel
from airflow.api_fastapi.core_api.base import BaseModel, StrictBaseModel
from airflow.api_fastapi.core_api.datamodels.dag_tags import DagTagResponse
from airflow.configuration import conf

Expand Down Expand Up @@ -92,7 +92,7 @@ def file_token(self) -> str:
return serializer.dumps(self.fileloc)


class DAGPatchBody(BaseModel):
class DAGPatchBody(StrictBaseModel):
"""Dag Serializer for updatable bodies."""

is_paused: bool
Expand Down
6 changes: 3 additions & 3 deletions airflow/api_fastapi/core_api/datamodels/pools.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

from pydantic import BeforeValidator, ConfigDict, Field

from airflow.api_fastapi.core_api.base import BaseModel
from airflow.api_fastapi.core_api.base import BaseModel, StrictBaseModel


def _call_function(function: Callable[[], int]) -> int:
Expand Down Expand Up @@ -60,7 +60,7 @@ class PoolCollectionResponse(BaseModel):
total_entries: int


class PoolPatchBody(BaseModel):
class PoolPatchBody(StrictBaseModel):
"""Pool serializer for patch bodies."""

model_config = ConfigDict(populate_by_name=True, from_attributes=True)
Expand All @@ -71,7 +71,7 @@ class PoolPatchBody(BaseModel):
include_deferred: bool | None = None


class PoolBody(BasePool):
class PoolBody(BasePool, StrictBaseModel):
"""Pool serializer for post bodies."""

pool: str = Field(alias="name", max_length=256)
Expand Down
Loading

0 comments on commit bd295d4

Please sign in to comment.