Skip to content

Commit

Permalink
airbyte-ci: up-to-date: specific changelog comment for base image upg…
Browse files Browse the repository at this point in the history
…rade to rootless
  • Loading branch information
alafanechere committed Nov 27, 2024
1 parent da30172 commit 9319ee2
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 4 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 @@ -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. |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand All @@ -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,
},
)
13 changes: 13 additions & 0 deletions airbyte-ci/connectors/pipelines/pipelines/hacks.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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
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.43.0"
version = "4.43.1"
description = "Packaged maintained by the connector operations team to perform CI for connectors' pipelines"
authors = ["Airbyte <[email protected]>"]

Expand Down

0 comments on commit 9319ee2

Please sign in to comment.