diff --git a/airbyte-ci/connectors/pipelines/pipelines/tests/common.py b/airbyte-ci/connectors/pipelines/pipelines/tests/common.py index 25e709c2c0ea..c08a3edc931a 100644 --- a/airbyte-ci/connectors/pipelines/pipelines/tests/common.py +++ b/airbyte-ci/connectors/pipelines/pipelines/tests/common.py @@ -282,3 +282,28 @@ 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") + 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") + if not is_using_base_image: + return StepResult( + self, + StepStatus.FAILURE, + stdout="Connector is certified but does not use our base image. Please set connectorBuildOptions.baseImage in the connector metadata.", + ) + has_dockerfile = "Dockerfile" in await self.context.get_connector_dir(include="Dockerfile").entries() + if has_dockerfile: + return StepResult( + self, + StepStatus.FAILURE, + stdout="Connector is certified but is still using a Dockerfile. Please remove the Dockerfile and set connectorBuildOptions.baseImage in the connector metadata.", + ) + 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 77aed7f61c31..119b6adef34a 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 import LOCAL_BUILD_PLATFORM from pipelines.builds.python_connectors import BuildConnectorImage 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 @@ -195,6 +195,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]