diff --git a/airbyte-ci/connectors/pipelines/README.md b/airbyte-ci/connectors/pipelines/README.md index 477720409cfa..cf015e8e938d 100644 --- a/airbyte-ci/connectors/pipelines/README.md +++ b/airbyte-ci/connectors/pipelines/README.md @@ -425,12 +425,13 @@ This command runs the Python tests for a airbyte-ci poetry package. ## Changelog | Version | PR | Description | | ------- | ---------------------------------------------------------- | --------------------------------------------------------------------------------------------------------- | -| 1.9.0 | [#30520](https://github.com/airbytehq/airbyte/pull/30520) | New commands: `bump-version`, `upgrade-base-image`, `migrate-to-base-image`. | -| 1.8.0 | [#30520](https://github.com/airbytehq/airbyte/pull/30520) | New commands: `bump-version`, `upgrade-base-image`, `migrate-to-base-image`. | -| 1.7.2 | [#31343](https://github.com/airbytehq/airbyte/pull/31343) | Bind Pytest integration tests to a dockerhost. | -| 1.7.1 | [#31332](https://github.com/airbytehq/airbyte/pull/31332) | Disable Gradle step caching on source-postgres. | -| 1.7.0 | [#30526](https://github.com/airbytehq/airbyte/pull/30526) | Implement pre/post install hooks support. | -| 1.6.0 | [#30474](https://github.com/airbytehq/airbyte/pull/30474) | Test connector inside their containers. | +| 1.10.0 | [#30527](https://github.com/airbytehq/airbyte/pull/30527) | Add a new check for python connectors to make sure certified connectors use our base image. +| 1.9.0 | [#30520](https://github.com/airbytehq/airbyte/pull/30520) | New commands: `bump-version`, `upgrade-base-image`, `migrate-to-base-image`. | | +| 1.8.0 | [#31369](https://github.com/airbytehq/airbyte/pull/31369) | Remove metadata test commands | +| 1.7.2 | [#31343](https://github.com/airbytehq/airbyte/pull/31343) | Bind Pytest integration tests to a dockerhost. | +| 1.7.1 | [#31332](https://github.com/airbytehq/airbyte/pull/31332) | Disable Gradle step caching on source-postgres. | +| 1.7.0 | [#30526](https://github.com/airbytehq/airbyte/pull/30526) | Implement pre/post install hooks support. | +| 1.6.0 | [#30474](https://github.com/airbytehq/airbyte/pull/30474) | Test connector inside their containers. | | 1.5.1 | [#31227](https://github.com/airbytehq/airbyte/pull/31227) | Use python 3.11 in amazoncorretto-bazed gradle containers, run 'test' gradle task instead of 'check'. | | 1.5.0 | [#30456](https://github.com/airbytehq/airbyte/pull/30456) | Start building Python connectors using our base images. | | 1.4.6 | [ #31087](https://github.com/airbytehq/airbyte/pull/31087) | Throw error if airbyte-ci tools is out of date | diff --git a/airbyte-ci/connectors/pipelines/pipelines/tests/common.py b/airbyte-ci/connectors/pipelines/pipelines/tests/common.py index 253a9257434c..3e4dbfbe9c67 100644 --- a/airbyte-ci/connectors/pipelines/pipelines/tests/common.py +++ b/airbyte-ci/connectors/pipelines/pipelines/tests/common.py @@ -283,3 +283,29 @@ async def _build_connector_acceptance_test(self, connector_under_test_image_tar: ) return cat_container.with_unix_socket("/var/run/docker.sock", self.context.dagger_client.host().unix_socket("/var/run/docker.sock")) + + +class CheckBaseImageIsUsed(Step): + title = "Check our base image is used" + + async def _run(self, *args, **kwargs) -> StepResult: + is_certified = self.context.connector.metadata.get("supportLevel") == "certified" + if not is_certified: + self.skip("Connector is not certified, it does not require the use of our base image.") + + is_using_base_image = self.context.connector.metadata.get("connectorBuildOptions", {}).get("baseImage") is not None + migration_hint = f"Please run 'airbyte-ci connectors --name={self.context.connector.technical_name} migrate-to-base-image {self.context.pull_request.number}' and commit the changes." + if not is_using_base_image: + return StepResult( + self, + StepStatus.FAILURE, + stdout=f"Connector is certified but does not use our base image. {migration_hint}", + ) + has_dockerfile = "Dockerfile" in await (await self.context.get_connector_dir(include="Dockerfile")).entries() + if has_dockerfile: + return StepResult( + self, + StepStatus.FAILURE, + stdout=f"Connector is certified but is still using a Dockerfile. {migration_hint}", + ) + return StepResult(self, StepStatus.SUCCESS, stdout="Connector is certified and uses our base image.") diff --git a/airbyte-ci/connectors/pipelines/pipelines/tests/python_connectors.py b/airbyte-ci/connectors/pipelines/pipelines/tests/python_connectors.py index a24eba9f1555..d2ec0da1a7cd 100644 --- a/airbyte-ci/connectors/pipelines/pipelines/tests/python_connectors.py +++ b/airbyte-ci/connectors/pipelines/pipelines/tests/python_connectors.py @@ -14,7 +14,7 @@ from pipelines.builds.python_connectors import BuildConnectorImages from pipelines.consts import LOCAL_BUILD_PLATFORM from pipelines.contexts import ConnectorContext -from pipelines.tests.common import AcceptanceTests +from pipelines.tests.common import AcceptanceTests, CheckBaseImageIsUsed from pipelines.utils import export_container_to_tarball @@ -226,6 +226,7 @@ async def run_all_tests(context: ConnectorContext) -> List[StepResult]: tasks = [ task_group.soonify(IntegrationTests(context).run)(connector_container), task_group.soonify(AcceptanceTests(context).run)(connector_image_tar_file), + task_group.soonify(CheckBaseImageIsUsed(context).run)(), ] return step_results + [task.value for task in tasks] diff --git a/airbyte-ci/connectors/pipelines/pyproject.toml b/airbyte-ci/connectors/pipelines/pyproject.toml index 790e19968c70..4ed618b2e445 100644 --- a/airbyte-ci/connectors/pipelines/pyproject.toml +++ b/airbyte-ci/connectors/pipelines/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "poetry.core.masonry.api" [tool.poetry] name = "pipelines" -version = "1.9.0" +version = "1.10.0" description = "Packaged maintained by the connector operations team to perform CI for connectors' pipelines" authors = ["Airbyte "]