diff --git a/.github/workflows/approve-regression-tests-command.yml b/.github/workflows/approve-regression-tests-command.yml index 223519fd782fb..55442731f71d4 100644 --- a/.github/workflows/approve-regression-tests-command.yml +++ b/.github/workflows/approve-regression-tests-command.yml @@ -24,10 +24,6 @@ on: required: false run-name: "Approve Regression Tests #${{ github.event.inputs.pr }}" -concurrency: - group: ${{ github.workflow }}-${{ github.event.inputs.pr }} - # Cancel any previous runs on the same branch if they are still in progress - cancel-in-progress: true jobs: approve-regression-tests: @@ -65,8 +61,6 @@ jobs: - name: Approve regression tests id: approve - env: - GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: | echo "approving ...." response=$(curl --write-out '%{http_code}' --silent --output /dev/null \ @@ -85,7 +79,7 @@ jobs: else echo "Regression tests approved." fi - + - name: Append success comment uses: peter-evans/create-or-update-comment@v4 if: success() diff --git a/airbyte-ci/connectors/pipelines/pipelines/airbyte_ci/connectors/test/commands.py b/airbyte-ci/connectors/pipelines/pipelines/airbyte_ci/connectors/test/commands.py index 68861b394747e..03ebf989556a0 100644 --- a/airbyte-ci/connectors/pipelines/pipelines/airbyte_ci/connectors/test/commands.py +++ b/airbyte-ci/connectors/pipelines/pipelines/airbyte_ci/connectors/test/commands.py @@ -14,10 +14,11 @@ from pipelines.airbyte_ci.connectors.test.steps.common import LiveTests from pipelines.cli.click_decorators import click_ci_requirements_option from pipelines.cli.dagger_pipeline_command import DaggerPipelineCommand -from pipelines.consts import LOCAL_BUILD_PLATFORM, MAIN_CONNECTOR_TESTING_SECRET_STORE_ALIAS, CIContext, ContextState +from pipelines.consts import LOCAL_BUILD_PLATFORM, MAIN_CONNECTOR_TESTING_SECRET_STORE_ALIAS, ContextState +from pipelines.hacks import do_regression_test_status_check_maybe from pipelines.helpers.execution import argument_parsing from pipelines.helpers.execution.run_steps import RunStepOptions -from pipelines.helpers.github import update_commit_status_check, update_global_commit_status_check_for_tests +from pipelines.helpers.github import update_global_commit_status_check_for_tests from pipelines.helpers.utils import fail_if_missing_docker_hub_creds from pipelines.models.secrets import GSMSecretStore from pipelines.models.steps import STEP_PARAMS @@ -125,17 +126,7 @@ async def test( if ctx.obj["selected_connectors_with_modified_files"]: update_global_commit_status_check_for_tests(ctx.obj, "pending") - if any([connector.support_level == "certified" for connector in ctx.obj["selected_connectors"]]): - update_commit_status_check( - ctx.obj["git_revision"], - "failure", - ctx.obj["gha_workflow_run_url"], - description="Check if regression tests have been manually approved", - context=REGRESSION_TEST_MANUAL_APPROVAL_CONTEXT, - is_optional=False, - should_send=ctx.obj.get("ci_context") == CIContext.PULL_REQUEST, - logger=main_logger, - ) + do_regression_test_status_check_maybe(ctx, REGRESSION_TEST_MANUAL_APPROVAL_CONTEXT, main_logger) else: main_logger.warn("No connector were selected for testing.") update_global_commit_status_check_for_tests(ctx.obj, "success") diff --git a/airbyte-ci/connectors/pipelines/pipelines/hacks.py b/airbyte-ci/connectors/pipelines/pipelines/hacks.py index e11cc5664b234..d9a8ac6aef948 100644 --- a/airbyte-ci/connectors/pipelines/pipelines/hacks.py +++ b/airbyte-ci/connectors/pipelines/pipelines/hacks.py @@ -6,9 +6,12 @@ from __future__ import annotations +from logging import Logger from typing import TYPE_CHECKING, Callable, List +import asyncclick as click from pipelines import consts +from pipelines.helpers.github import update_commit_status_check if TYPE_CHECKING: from dagger import Container @@ -70,3 +73,22 @@ def never_fail_exec_inner(container: Container) -> Container: return container.with_exec(["sh", "-c", f"{' '.join(command)}; echo $? > /exit_code"], skip_entrypoint=True) return never_fail_exec_inner + + +def do_regression_test_status_check_maybe(ctx: click.Context, status_check_name: str, logger: Logger) -> None: + """ + Emit a failing status check that requires a manual override, via a /-command. + + Only required for certified connectors. + """ + if any([connector.support_level == "certified" for connector in ctx.obj["selected_connectors"]]): + update_commit_status_check( + ctx.obj["git_revision"], + "failure", + ctx.obj["gha_workflow_run_url"], + description="Check if regression tests have been manually approved", + context=status_check_name, + is_optional=False, + should_send=ctx.obj.get("ci_context") == consts.CIContext.PULL_REQUEST, + logger=logger, + )