Skip to content

Commit

Permalink
airbyte-ci: allow empty pull request number for migrate-base-image
Browse files Browse the repository at this point in the history
…cmd (#36220)
  • Loading branch information
natikgadzhi authored Mar 24, 2024
1 parent 3716a38 commit cc388fc
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 16 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 @@ -652,6 +652,7 @@ E.G.: running Poe tasks on the modified internal packages of the current branch:

| Version | PR | Description |
| ------- | ---------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------- |
| 4.6.2 | [#36220](https://github.com/airbytehq/airbyte/pull/36220) | Allow using `migrate-to-base-image` without PULL_REQUEST_NUMBER |
| 4.6.1 | [#36319](https://github.com/airbytehq/airbyte/pull/36319) | Fix `ValueError` related to PR number in migrate-to-poetry |
| 4.6.0 | [#35583](https://github.com/airbytehq/airbyte/pull/35583) | Implement the `airbyte-ci connectors migrate-to-poetry` command. |
| 4.5.4 | [#36206](https://github.com/airbytehq/airbyte/pull/36206) | Revert poetry cache removal during nightly builds |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
# Copyright (c) 2023 Airbyte, Inc., all rights reserved.
#


import asyncclick as click
from pipelines.airbyte_ci.connectors.context import ConnectorContext
from pipelines.airbyte_ci.connectors.migrate_to_base_image.pipeline import run_connector_migration_to_base_image_pipeline
Expand All @@ -14,13 +15,16 @@
cls=DaggerPipelineCommand,
short_help="Make the selected connectors use our base image: remove dockerfile, update metadata.yaml and update documentation.",
)
@click.argument("pull-request-number", type=str)
@click.option("pull-request-number", type=str, required=False, default=None)
@click.pass_context
async def migrate_to_base_image(
ctx: click.Context,
pull_request_number: str,
pull_request_number: str | None,
) -> bool:
"""Bump a connector version: update metadata.yaml, changelog and delete legacy files."""
"""
Bump a connector version: update metadata.yaml, changelog and delete legacy files.
If the `PULL_REQUEST_NUMBER` is not provided, no changelog entry will be added.
"""

fail_if_missing_docker_hub_creds(ctx)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -284,12 +284,11 @@ async def run_connector_base_image_upgrade_pipeline(context: ConnectorContext, s


async def run_connector_migration_to_base_image_pipeline(
context: ConnectorContext, semaphore: "Semaphore", pull_request_number: str
context: ConnectorContext, semaphore: "Semaphore", pull_request_number: str | None
) -> Report:
async with semaphore:
steps_results = []
async with context:
# DELETE DOCKERFILE
delete_docker_file = DeleteConnectorFile(
context,
"Dockerfile",
Expand Down Expand Up @@ -330,16 +329,17 @@ async def run_connector_migration_to_base_image_pipeline(
bump_version_in_metadata_result = await bump_version_in_metadata.run()
steps_results.append(bump_version_in_metadata_result)

# ADD CHANGELOG ENTRY
add_changelog_entry = AddChangelogEntry(
context,
bump_version_in_metadata_result.output,
new_version,
"Base image migration: remove Dockerfile and use the python-connector-base image",
pull_request_number,
)
add_changelog_entry_result = await add_changelog_entry.run()
steps_results.append(add_changelog_entry_result)
# ADD CHANGELOG ENTRY only if the PR number is provided.
if pull_request_number is not None:
add_changelog_entry = AddChangelogEntry(
context,
bump_version_in_metadata_result.output,
new_version,
"Base image migration: remove Dockerfile and use the python-connector-base image",
pull_request_number,
)
add_changelog_entry_result = await add_changelog_entry.run()
steps_results.append(add_changelog_entry_result)

# UPDATE DOC
add_build_instructions_to_doc = AddBuildInstructionsToReadme(
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.6.1"
version = "4.6.2"
description = "Packaged maintained by the connector operations team to perform CI for connectors' pipelines"
authors = ["Airbyte <[email protected]>"]

Expand Down

0 comments on commit cc388fc

Please sign in to comment.