|
15 | 15 | from pipelines import main_logger
|
16 | 16 | from pipelines.bases import ConnectorWithModifiedFiles
|
17 | 17 | from pipelines.builds import run_connector_build_pipeline
|
| 18 | +from pipelines.connector_changes.base_image_version_upgrade import run_connector_base_image_upgrade_pipeline |
18 | 19 | from pipelines.connector_changes.format import run_connector_format_pipeline
|
19 |
| -from pipelines.connector_changes.metadata_update import run_connector_base_image_upgrade_pipeline |
| 20 | +from pipelines.connector_changes.version_bump import run_connector_version_bump_pipeline |
20 | 21 | from pipelines.contexts import ConnectorContext, ContextState, PublishConnectorContext
|
21 | 22 | from pipelines.github import update_global_commit_status_check_for_tests
|
22 | 23 | from pipelines.pipelines.connectors import run_connectors_pipelines
|
@@ -574,6 +575,70 @@ def upgrade_base_image(ctx: click.Context, commit_and_push: bool, export_to_host
|
574 | 575 | return True
|
575 | 576 |
|
576 | 577 |
|
| 578 | +@connectors.command(cls=DaggerPipelineCommand, help="Upgrades the base image version used by the selected connectors..") |
| 579 | +@click.argument("bump-type", type=click.Choice(["patch", "minor", "major"])) |
| 580 | +@click.argument("pull-request-number", type=str) |
| 581 | +@click.argument("changelog-entry", type=str) |
| 582 | +@click.option("--commit-and-push", default=False) |
| 583 | +@click.option("--export-to-host", default=True) |
| 584 | +@click.option("--set-if-exists", default=True) |
| 585 | +@click.pass_context |
| 586 | +def bump_version( |
| 587 | + ctx: click.Context, |
| 588 | + bump_type: str, |
| 589 | + pull_request_number: str, |
| 590 | + changelog_entry: str, |
| 591 | + commit_and_push: bool, |
| 592 | + export_to_host: bool, |
| 593 | + set_if_exists: bool, |
| 594 | +) -> bool: |
| 595 | + """Upgrades the base image version used by the selected connectors.""" |
| 596 | + |
| 597 | + if ctx.obj["is_local"] and commit_and_push: |
| 598 | + raise click.UsageError("You can't use the --commit-and-push option in local mode.") |
| 599 | + if ctx.obj["is_local"] and not export_to_host: |
| 600 | + main_logger.warning("Not using the --export-to-host option in local mode will not change anything on your local repo.") |
| 601 | + |
| 602 | + connectors_contexts = [ |
| 603 | + ConnectorContext( |
| 604 | + pipeline_name=f"Upgrade base image versions of connector {connector.technical_name}", |
| 605 | + connector=connector, |
| 606 | + is_local=ctx.obj["is_local"], |
| 607 | + git_branch=ctx.obj["git_branch"], |
| 608 | + git_revision=ctx.obj["git_revision"], |
| 609 | + ci_report_bucket=ctx.obj["ci_report_bucket_name"], |
| 610 | + report_output_prefix=ctx.obj["report_output_prefix"], |
| 611 | + use_remote_secrets=ctx.obj["use_remote_secrets"], |
| 612 | + gha_workflow_run_url=ctx.obj.get("gha_workflow_run_url"), |
| 613 | + dagger_logs_url=ctx.obj.get("dagger_logs_url"), |
| 614 | + pipeline_start_timestamp=ctx.obj.get("pipeline_start_timestamp"), |
| 615 | + ci_context=ctx.obj.get("ci_context"), |
| 616 | + ci_gcs_credentials=ctx.obj["ci_gcs_credentials"], |
| 617 | + ci_git_user=ctx.obj["ci_git_user"], |
| 618 | + ci_github_access_token=ctx.obj["ci_github_access_token"], |
| 619 | + open_report_in_browser=False, |
| 620 | + ) |
| 621 | + for connector in ctx.obj["selected_connectors_with_modified_files"] |
| 622 | + ] |
| 623 | + |
| 624 | + anyio.run( |
| 625 | + run_connectors_pipelines, |
| 626 | + connectors_contexts, |
| 627 | + run_connector_version_bump_pipeline, |
| 628 | + "Version bump pipeline pipeline", |
| 629 | + ctx.obj["concurrency"], |
| 630 | + ctx.obj["dagger_logs_path"], |
| 631 | + ctx.obj["execute_timeout"], |
| 632 | + commit_and_push, |
| 633 | + export_to_host, |
| 634 | + bump_type, |
| 635 | + changelog_entry, |
| 636 | + pull_request_number, |
| 637 | + ) |
| 638 | + |
| 639 | + return True |
| 640 | + |
| 641 | + |
577 | 642 | def log_selected_connectors(selected_connectors_with_modified_files: List[ConnectorWithModifiedFiles]) -> None:
|
578 | 643 | if selected_connectors_with_modified_files:
|
579 | 644 | selected_connectors_names = [c.technical_name for c in selected_connectors_with_modified_files]
|
|
0 commit comments