From 9319ee2b40d412215c1e41992fbb52d2ee016983 Mon Sep 17 00:00:00 2001 From: alafanechere Date: Wed, 27 Nov 2024 16:51:22 +0100 Subject: [PATCH] airbyte-ci: up-to-date: specific changelog comment for base image upgrade to rootless --- airbyte-ci/connectors/pipelines/README.md | 1 + .../airbyte_ci/connectors/up_to_date/pipeline.py | 9 +++++++-- .../pipelines/airbyte_ci/steps/base_image.py | 7 ++++++- airbyte-ci/connectors/pipelines/pipelines/hacks.py | 13 +++++++++++++ airbyte-ci/connectors/pipelines/pyproject.toml | 2 +- 5 files changed, 28 insertions(+), 4 deletions(-) diff --git a/airbyte-ci/connectors/pipelines/README.md b/airbyte-ci/connectors/pipelines/README.md index 920782c1369f..3a34d862c3f5 100644 --- a/airbyte-ci/connectors/pipelines/README.md +++ b/airbyte-ci/connectors/pipelines/README.md @@ -850,6 +850,7 @@ airbyte-ci connectors --language=low-code migrate-to-manifest-only | Version | PR | Description | | ------- | ---------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------- | +| 4.43.1 | [#48725](https://github.com/airbytehq/airbyte/pull/48725) | up-to-date: specific changelog comment for base image upgrade to rootless. | | 4.43.0 | [#36545](https://github.com/airbytehq/airbyte/pull/36545) | Switch to `airbyte` user when available in Python base image. | | 4.42.2 | [#48404](https://github.com/airbytehq/airbyte/pull/48404) | Include `advanced_auth` in spec migration for manifest-only pipeline | | 4.42.1 | [#47316](https://github.com/airbytehq/airbyte/pull/47316) | Connector testing: skip incremental acceptance test when the connector is not released. | diff --git a/airbyte-ci/connectors/pipelines/pipelines/airbyte_ci/connectors/up_to_date/pipeline.py b/airbyte-ci/connectors/pipelines/pipelines/airbyte_ci/connectors/up_to_date/pipeline.py index ede69ad81627..784010461536 100644 --- a/airbyte-ci/connectors/pipelines/pipelines/airbyte_ci/connectors/up_to_date/pipeline.py +++ b/airbyte-ci/connectors/pipelines/pipelines/airbyte_ci/connectors/up_to_date/pipeline.py @@ -8,6 +8,7 @@ from typing import TYPE_CHECKING from jinja2 import Environment, PackageLoader, select_autoescape +from pipelines import hacks from pipelines.airbyte_ci.connectors.build_image.steps import run_connector_build from pipelines.airbyte_ci.connectors.context import ConnectorContext from pipelines.airbyte_ci.connectors.reports import ConnectorReport @@ -88,7 +89,7 @@ async def run_connector_up_to_date_pipeline( upgrade_base_image_in_metadata_result = await upgrade_base_image_in_metadata.run() step_results.append(upgrade_base_image_in_metadata_result) if upgrade_base_image_in_metadata_result.success: - connector_directory = upgrade_base_image_in_metadata_result.output + connector_directory = upgrade_base_image_in_metadata_result.output["updated_connector_directory"] exported_modified_files = await upgrade_base_image_in_metadata.export_modified_files(context.connector.code_directory) context.logger.info(f"Exported files following the base image upgrade: {exported_modified_files}") all_modified_files.update(exported_modified_files) @@ -157,8 +158,12 @@ async def run_connector_up_to_date_pipeline( documentation_directory = await context.get_repo_dir( include=[str(context.connector.local_connector_documentation_directory)] ).directory(str(context.connector.local_connector_documentation_directory)) + + changelog_entry_comment = hacks.determine_changelog_entry_comment( + upgrade_base_image_in_metadata_result, CHANGELOG_ENTRY_COMMENT + ) add_changelog_entry = AddChangelogEntry( - context, documentation_directory, new_version, CHANGELOG_ENTRY_COMMENT, created_pr.number + context, documentation_directory, new_version, changelog_entry_comment, created_pr.number ) add_changelog_entry_result = await add_changelog_entry.run() step_results.append(add_changelog_entry_result) diff --git a/airbyte-ci/connectors/pipelines/pipelines/airbyte_ci/steps/base_image.py b/airbyte-ci/connectors/pipelines/pipelines/airbyte_ci/steps/base_image.py index 03c0c21d5854..6a2fcc020b32 100644 --- a/airbyte-ci/connectors/pipelines/pipelines/airbyte_ci/steps/base_image.py +++ b/airbyte-ci/connectors/pipelines/pipelines/airbyte_ci/steps/base_image.py @@ -75,6 +75,7 @@ async def update_base_image_in_metadata( async def _run(self) -> StepResult: latest_base_image_address = await self.get_latest_base_image_address() + updated_base_image_address = None if latest_base_image_address is None: return StepResult( step=self, @@ -103,6 +104,7 @@ async def _run(self) -> StepResult: updated_connector_directory = await self.update_base_image_in_metadata( original_connector_directory, latest_base_image_address, self.set_if_not_exists ) + updated_base_image_address = latest_base_image_address except NoBaseImageAddressInMetadataError: return StepResult( step=self, @@ -115,5 +117,8 @@ async def _run(self) -> StepResult: step=self, status=StepStatus.SUCCESS, stdout=f"Updated base image to {latest_base_image_address} in {METADATA_FILE_NAME}", - output=updated_connector_directory, + output={ + "updated_connector_directory": updated_connector_directory, + "updated_base_image_address": updated_base_image_address, + }, ) diff --git a/airbyte-ci/connectors/pipelines/pipelines/hacks.py b/airbyte-ci/connectors/pipelines/pipelines/hacks.py index 4f9a655f329c..38beddb7644b 100644 --- a/airbyte-ci/connectors/pipelines/pipelines/hacks.py +++ b/airbyte-ci/connectors/pipelines/pipelines/hacks.py @@ -12,11 +12,13 @@ import asyncclick as click from connector_ops.utils import ConnectorLanguage # type: ignore from pipelines import consts +from pipelines.airbyte_ci.steps.base_image import UpdateBaseImageMetadata from pipelines.helpers.github import AIRBYTE_GITHUB_REPO_URL, is_automerge_pull_request, update_commit_status_check if TYPE_CHECKING: from dagger import Container from pipelines.airbyte_ci.connectors.context import ConnectorContext + from pipelines.models.steps import StepResult async def cache_latest_cdk(context: ConnectorContext) -> None: @@ -123,3 +125,14 @@ def do_regression_test_status_check(ctx: click.Context, status_check_name: str, should_send=should_send, logger=logger, ) + + +def determine_changelog_entry_comment(upgrade_base_image_in_metadata_result: StepResult, default_comment: str) -> str: + assert isinstance( + upgrade_base_image_in_metadata_result.step, UpdateBaseImageMetadata + ), "StepResult's step must be instance of UpdateBaseImageMetadata" + if upgrade_base_image_in_metadata_result.output.get("updated_base_image_address"): + updated_base_image_address = upgrade_base_image_in_metadata_result.output.get("updated_base_image_address") + if "airbyte/python-connector-base:3.0.0" in updated_base_image_address: + return "Starting with this version, the Docker image is now rootless. Please note that this and future versions will not be compatible with Airbyte versions earlier than 0.64" + return default_comment diff --git a/airbyte-ci/connectors/pipelines/pyproject.toml b/airbyte-ci/connectors/pipelines/pyproject.toml index 3ab8d5d5c1de..6b24ad178b77 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 = "4.43.0" +version = "4.43.1" description = "Packaged maintained by the connector operations team to perform CI for connectors' pipelines" authors = ["Airbyte "]