Skip to content

Commit

Permalink
cr comments
Browse files Browse the repository at this point in the history
  • Loading branch information
clnoll committed Jul 11, 2024
1 parent d396ee0 commit 754e581
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 20 deletions.
8 changes: 1 addition & 7 deletions .github/workflows/approve-regression-tests-command.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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 \
Expand All @@ -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()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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")
Expand Down
22 changes: 22 additions & 0 deletions airbyte-ci/connectors/pipelines/pipelines/hacks.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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,
)

0 comments on commit 754e581

Please sign in to comment.