Skip to content

Commit

Permalink
airbyte-ci: skip incremental acceptance test when the connector is no…
Browse files Browse the repository at this point in the history
…t released (#47308)
  • Loading branch information
alafanechere authored Oct 23, 2024
1 parent 15ff3ee commit c3db769
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 5 deletions.
1 change: 1 addition & 0 deletions airbyte-ci/connectors/pipelines/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -851,6 +851,7 @@ airbyte-ci connectors --language=low-code migrate-to-manifest-only

| Version | PR | Description |
| ------- | ---------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------- |
| 4.41.6 | [#47308](https://github.com/airbytehq/airbyte/pull/47308) | Connector testing: skip incremental acceptance test when the connector is not released. |
| 4.41.5 | [#47255](https://github.com/airbytehq/airbyte/pull/47255) | Fix `DisableProgressiveRollout` following Dagger API change. |
| 4.41.4 | [#47203](https://github.com/airbytehq/airbyte/pull/47203) | Fix some `with_exec` and entrypoint usage following Dagger upgrade |
| 4.41.3 | [#47189](https://github.com/airbytehq/airbyte/pull/47189) | Fix up-to-date which did not export doc to the right path |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -388,7 +388,14 @@ async def get_failed_pytest_node_ids(self, current_acceptance_tests_report_log:
failed_nodes.add(single_test_report["nodeid"])
return failed_nodes

async def get_result_log_on_master(self) -> Artifact:
def _get_master_metadata(self) -> Dict[str, Any]:
raw_master_metadata = requests.get(f"{GITHUB_URL_PREFIX_FOR_CONNECTORS}/{self.context.connector.technical_name}/metadata.yaml")
master_metadata = yaml.safe_load(raw_master_metadata.text)
if not master_metadata:
raise FileNotFoundError(f"Could not fetch metadata file for {self.context.connector.technical_name} on master.")
return master_metadata

async def get_result_log_on_master(self, master_metadata: dict) -> Artifact:
"""Runs acceptance test on the released image of the connector and returns the report log.
The released image version is fetched from the master metadata file of the connector.
We're not using the online connector registry here as some connectors might not be released to OSS nor Airbyte Cloud.
Expand All @@ -397,8 +404,6 @@ async def get_result_log_on_master(self) -> Artifact:
Returns:
Artifact: The report log of the acceptance tests run on the released image.
"""
raw_master_metadata = requests.get(f"{GITHUB_URL_PREFIX_FOR_CONNECTORS}/{self.context.connector.technical_name}/metadata.yaml")
master_metadata = yaml.safe_load(raw_master_metadata.text)
master_docker_image_tag = master_metadata["data"]["dockerImageTag"]
released_image = f'{master_metadata["data"]["dockerRepository"]}:{master_docker_image_tag}'
released_container = self.dagger_client.container().from_(released_image)
Expand All @@ -410,6 +415,7 @@ async def _run(self, current_acceptance_tests_result: StepResult) -> StepResult:
"""Compare the acceptance tests report log of the current image with the one of the released image.
Fails if there are new failing tests in the current acceptance tests report log.
"""

if current_acceptance_tests_result.consider_in_overall_status:
return StepResult(
step=self, status=StepStatus.SKIPPED, stdout="Skipping because the current acceptance tests are hard failures."
Expand All @@ -421,8 +427,19 @@ async def _run(self, current_acceptance_tests_result: StepResult) -> StepResult:
return StepResult(
step=self, status=StepStatus.SKIPPED, stdout="No failing acceptance tests were detected on the current version."
)
try:
master_metadata = self._get_master_metadata()
except FileNotFoundError as exc:
return StepResult(
step=self,
status=StepStatus.SKIPPED,
stdout="The connector does not have a metadata file on master. Skipping incremental acceptance tests.",
exc_info=exc,
)

master_result_logs = await self.get_result_log_on_master(master_metadata)

master_failings = await self.get_failed_pytest_node_ids(await self.get_result_log_on_master())
master_failings = await self.get_failed_pytest_node_ids(master_result_logs)
new_failing_nodes = current_failing_nodes - master_failings
if not new_failing_nodes:
return StepResult(
Expand Down
2 changes: 1 addition & 1 deletion airbyte-ci/connectors/pipelines/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ build-backend = "poetry.core.masonry.api"

[tool.poetry]
name = "pipelines"
version = "4.41.5"
version = "4.41.6"
description = "Packaged maintained by the connector operations team to perform CI for connectors' pipelines"
authors = ["Airbyte <[email protected]>"]

Expand Down

0 comments on commit c3db769

Please sign in to comment.