Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

airbyte-ci: disable test reports PR comments #31871

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions airbyte-ci/connectors/pipelines/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -408,9 +408,10 @@ This command runs the Python tests for a airbyte-ci poetry package.
## Changelog
| Version | PR | Description |
| ------- | ---------------------------------------------------------- | --------------------------------------------------------------------------------------------------------- |
| 2.5.1 | [#31774](https://github.com/airbytehq/airbyte/pull/31774) | Add a docker configuration check on `airbyte-ci` startup. |
| 2.5.2 | [#31871](https://github.com/airbytehq/airbyte/pull/31871) | Deactivate PR comments, add HTML report links to the PR status when its ready. |
| 2.5.1 | [#31774](https://github.com/airbytehq/airbyte/pull/31774) | Add a docker configuration check on `airbyte-ci` startup. |
| 2.5.0 | [#31766](https://github.com/airbytehq/airbyte/pull/31766) | Support local connectors secrets. |
| 2.4.0 | [#31716](https://github.com/airbytehq/airbyte/pull/31716) | Enable pre-release publish with local CDK.
| 2.4.0 | [#31716](https://github.com/airbytehq/airbyte/pull/31716) | Enable pre-release publish with local CDK. |
| 2.3.1 | [#31748](https://github.com/airbytehq/airbyte/pull/31748) | Use AsyncClick library instead of base Click. |
| 2.3.0 | [#31699](https://github.com/airbytehq/airbyte/pull/31699) | Support optional concurrent CAT execution. |
| 2.2.6 | [#31752](https://github.com/airbytehq/airbyte/pull/31752) | Only authenticate when secrets are available. |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -252,9 +252,6 @@ async def __aexit__(
if self.should_save_report:
await self.report.save()

if self.report.should_be_commented_on_pr:
self.report.post_comment_on_pr()

await asyncify(update_commit_status_check)(**self.github_commit_status)

if self.should_send_slack_message:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
from rich.style import Style
from rich.table import Table
from rich.text import Text
from tabulate import tabulate


@dataclass(frozen=True)
Expand All @@ -41,15 +40,6 @@ def html_report_remote_storage_key(self) -> str: # noqa D102
def html_report_url(self) -> str: # noqa D102
return f"{GCS_PUBLIC_DOMAIN}/{self.pipeline_context.ci_report_bucket}/{self.html_report_remote_storage_key}"

@property
def should_be_commented_on_pr(self) -> bool: # noqa D102
return (
self.pipeline_context.should_save_report
and self.pipeline_context.is_ci
and self.pipeline_context.pull_request
and self.pipeline_context.PRODUCTION
)

def to_json(self) -> str:
"""Create a JSON representation of the connector test report.

Expand Down Expand Up @@ -79,28 +69,6 @@ def to_json(self) -> str:
}
)

def post_comment_on_pr(self) -> None:
icon_url = f"https://raw.githubusercontent.com/airbytehq/airbyte/{self.pipeline_context.git_revision}/{self.pipeline_context.connector.code_directory}/icon.svg"
global_status_emoji = "✅" if self.success else "❌"
commit_url = f"{self.pipeline_context.pull_request.html_url}/commits/{self.pipeline_context.git_revision}"
markdown_comment = f'## <img src="{icon_url}" width="40" height="40"> {self.pipeline_context.connector.technical_name} test report (commit [`{self.pipeline_context.git_revision[:10]}`]({commit_url})) - {global_status_emoji}\n\n'
markdown_comment += f"⏲️ Total pipeline duration: {format_duration(self.run_duration)} \n\n"
report_data = [
[step_result.step.title, step_result.status.get_emoji()]
for step_result in self.steps_results
if step_result.status is not StepStatus.SKIPPED
]
markdown_comment += tabulate(report_data, headers=["Step", "Result"], tablefmt="pipe") + "\n\n"
markdown_comment += f"🔗 [View the logs here]({self.html_report_url})\n\n"

if self.pipeline_context.dagger_cloud_url:
markdown_comment += f"☁️ [View runs for commit in Dagger Cloud]({self.pipeline_context.dagger_cloud_url})\n\n"

markdown_comment += "*Please note that tests are only run on PR ready for review. Please set your PR to draft mode to not flood the CI engine and upstream service on following commits.*\n"
markdown_comment += "**You can run the same pipeline locally on this branch with the [airbyte-ci](https://github.com/airbytehq/airbyte/blob/master/airbyte-ci/connectors/pipelines/README.md) tool with the following command**\n"
markdown_comment += f"```bash\nairbyte-ci connectors --name={self.pipeline_context.connector.technical_name} test\n```\n\n"
self.pipeline_context.pull_request.create_issue_comment(markdown_comment)

async def to_html(self) -> str:
env = Environment(
loader=PackageLoader("pipelines.airbyte_ci.connectors.test.steps"),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -147,10 +147,11 @@ def ci_github_access_token_secret(self) -> Secret:
@property
def github_commit_status(self) -> dict:
"""Build a dictionary used as kwargs to the update_commit_status_check function."""
target_url = self.report.html_report_url if self.report else self.gha_workflow_run_url
return {
"sha": self.git_revision,
"state": self.state.value["github_state"],
"target_url": self.gha_workflow_run_url,
"target_url": target_url,
"description": self.state.value["description"],
"context": self.pipeline_name,
"should_send": self.is_pr,
Expand Down
Loading
Loading