Skip to content

Commit

Permalink
updates pipeline to bypass ci checks for release candidate promotion PRs
Browse files Browse the repository at this point in the history
  • Loading branch information
pnilan committed Dec 17, 2024
1 parent 920aef8 commit 8e6e620
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 7 deletions.
1 change: 1 addition & 0 deletions airbyte-ci/connectors/auto_merge/src/auto_merge/consts.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

AIRBYTE_REPO = "airbytehq/airbyte"
AUTO_MERGE_LABEL = "auto-merge"
AUTO_MERGE_PROMOTED_RC_LABEL = "auto-merge/promoted-rc"
BASE_BRANCH = "master"
CONNECTOR_PATH_PREFIXES = {
"airbyte-integrations/connectors",
Expand Down
7 changes: 4 additions & 3 deletions airbyte-ci/connectors/auto_merge/src/auto_merge/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@

from github import Auth, Github

from .consts import AIRBYTE_REPO, AUTO_MERGE_LABEL, BASE_BRANCH, MERGE_METHOD
from .consts import AIRBYTE_REPO, AUTO_MERGE_LABEL, AUTO_MERGE_PROMOTED_RC_LABEL, BASE_BRANCH, MERGE_METHOD
from .env import GITHUB_TOKEN, PRODUCTION
from .helpers import generate_job_summary_as_markdown
from .pr_validators import ENABLED_VALIDATORS
from .pr_validators import DEFAULT_ENABLED_VALIDATORS, PROMOTED_RC_PR_VALIDATORS

if TYPE_CHECKING:
from github.Commit import Commit as GithubCommit
Expand Down Expand Up @@ -49,7 +49,8 @@ def check_if_pr_is_auto_mergeable(head_commit: GithubCommit, pr: PullRequest, re
Returns:
bool: True if the PR is auto-mergeable, False otherwise
"""
for validator in ENABLED_VALIDATORS:
validators = PROMOTED_RC_PR_VALIDATORS if AUTO_MERGE_PROMOTED_RC_LABEL in pr.labels else DEFAULT_ENABLED_VALIDATORS
for validator in validators:
is_valid, error = validator(head_commit, pr, required_checks)
if not is_valid:
if error:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,12 +48,14 @@ def head_commit_passes_all_required_checks(
return True, None


# A PR is considered auto-mergeable if:
# A standard PR is considered auto-mergeable if:
# - it has the AUTO_MERGE_LABEL
# - it targets the BASE_BRANCH
# - it touches only files in CONNECTOR_PATH_PREFIXES
# - the head commit passes all required checks

# PLEASE BE CAREFUL OF THE VALIDATOR ORDERING
# Let's declared faster checks first as the check_if_pr_is_auto_mergeable function fails fast.
ENABLED_VALIDATORS = [has_auto_merge_label, targets_main_branch, only_modifies_connectors, head_commit_passes_all_required_checks]
# Let's declare faster checks first as the check_if_pr_is_auto_mergeable function fails fast.
DEFAULT_ENABLED_VALIDATORS = [has_auto_merge_label, targets_main_branch, only_modifies_connectors, head_commit_passes_all_required_checks]

PROMOTED_RC_PR_VALIDATORS = [has_auto_merge_label, targets_main_branch, only_modifies_connectors]
Original file line number Diff line number Diff line change
Expand Up @@ -750,7 +750,7 @@ async def run_connector_promote_pipeline(context: PublishConnectorContext, semap
all_modified_files.update(
await add_changelog_entry.export_modified_files(context.connector.local_connector_documentation_directory)
)
post_changelog_pr_update = CreateOrUpdatePullRequest(context, skip_ci=False, labels=["auto-merge"])
post_changelog_pr_update = CreateOrUpdatePullRequest(context, skip_ci=True, labels=["auto-merge", "auto-merge/promoted-rc"])
pr_creation_args, pr_creation_kwargs = get_promotion_pr_creation_arguments(
all_modified_files, context, results, current_version, promoted_version
)
Expand Down

0 comments on commit 8e6e620

Please sign in to comment.