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

QA checks: implement icon and documentation checks #21845

Merged
merged 5 commits into from
Jan 26, 2023

Conversation

alafanechere
Copy link
Contributor

@alafanechere alafanechere commented Jan 25, 2023

What

Closes #21715
Closes #21714
Closes #21712

Implement actual QA checks that will run on /test:

  • check if a documentation file exists
  • check an icon file is available
  • check the changelog is up to date

How

  • Create a Connector utility class to gather all the connector metadata we need for these checks (doc path, icon path etc.)

Implement :

  • check_documentation_file_exists
  • check_changelog_entry_is_updated
  • check_connector_icon_is_available
  • check_documentation_follows_guidelines -> I disabled this check as its too strict and will lead to multiple failures of GA connectors with docs slightly drifting from the expected template.

Recommended reading order

def check_documentation_file_exists(connector: Connector) -> bool:

def check_documentation_follows_guidelines(connector: Connector) -> bool:

def check_changelog_entry_is_updated(connector: Connector) -> bool:

def check_connector_icon_is_available(connector: Connector) -> bool:

🚨 User Impact 🚨

The connectors failing at the following checks will get a failed build:

  • check_documentation_file_exists
  • check_changelog_entry_is_updated
  • check_connector_icon_is_available

@alafanechere alafanechere temporarily deployed to more-secrets January 25, 2023 14:29 — with GitHub Actions Inactive
@alafanechere alafanechere temporarily deployed to more-secrets January 25, 2023 14:29 — with GitHub Actions Inactive
@alafanechere alafanechere force-pushed the augustin/qa-checks/doc-and-icon-availability branch from c2cbf6a to 08e3def Compare January 25, 2023 14:31
@alafanechere alafanechere temporarily deployed to more-secrets January 25, 2023 14:33 — with GitHub Actions Inactive
@alafanechere alafanechere temporarily deployed to more-secrets January 25, 2023 14:33 — with GitHub Actions Inactive
@alafanechere alafanechere temporarily deployed to more-secrets January 25, 2023 14:36 — with GitHub Actions Inactive
@alafanechere alafanechere temporarily deployed to more-secrets January 25, 2023 14:36 — with GitHub Actions Inactive
@github-actions
Copy link
Contributor

github-actions bot commented Jan 25, 2023

Airbyte Code Coverage

There is no coverage information present for the Files changed

Total Project Coverage 23.97%

@alafanechere alafanechere marked this pull request as ready for review January 25, 2023 14:38
@alafanechere alafanechere requested a review from a team January 25, 2023 14:38
@alafanechere
Copy link
Contributor Author

/test on source-facebook-marketing -> QA Checks are expected to pass

@alafanechere alafanechere temporarily deployed to more-secrets January 25, 2023 14:41 — with GitHub Actions Inactive
@alafanechere alafanechere force-pushed the augustin/qa-checks/doc-and-icon-availability branch from fc66c0b to c49df14 Compare January 25, 2023 14:43
@alafanechere
Copy link
Contributor Author

alafanechere commented Jan 25, 2023

/test on source-hellobaton -> QA Checks are expected to fail because of missing docs

@alafanechere alafanechere temporarily deployed to more-secrets January 25, 2023 14:45 — with GitHub Actions Inactive
@alafanechere alafanechere temporarily deployed to more-secrets January 25, 2023 14:45 — with GitHub Actions Inactive
@alafanechere alafanechere temporarily deployed to more-secrets January 25, 2023 14:46 — with GitHub Actions Inactive
@alafanechere alafanechere temporarily deployed to more-secrets January 25, 2023 14:54 — with GitHub Actions Inactive
Copy link
Contributor

@pedroslopez pedroslopez left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice!

Q: At what point do you think we need to add tests for these checks? I think if we're relying on some of this to determine cloud availability we should have some level of testing around these tools.

tools/ci_connector_ops/ci_connector_ops/utils.py Outdated Show resolved Hide resolved
return connector.documentation_file_path.exists()

def check_documentation_follows_guidelines(connector: Connector) -> bool:
"""Documentation guidelines are defined here https://hackmd.io/Bz75cgATSbm7DjrAqgl4rw"""
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

neat! I hadn't seen these guidelines.

Are these linked to from any official airbyte site (e.g. docs?) If so, may be worth pointing to the airbyte link rather than hackmd in case it ever changes...

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@airbytehq/docs is https://hackmd.io/Bz75cgATSbm7DjrAqgl4rw making its way to our official doc?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nope, not yet at least. The hackmd format lets contributors use the markdown format more easily than the Docs site.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I meant: is there a link to this template? Are these connectors doc guidelines shared in our official doc?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We link to it from our Contribution guide: https://docs.airbyte.com/contributing-to-airbyte/updating-documentation#additional-guidelines
Is that what you're looking for?

Comment on lines +64 to +73
if not check_documentation_file_exists(connector):
return False
with open(connector.documentation_file_path) as f:
after_changelog = False
for line in f:
if "# changelog" in line.lower():
after_changelog = True
if after_changelog and connector.version in line:
return True
return False
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: This check is great to have, though having it run as the first part of the /check command feels like it might be a bit of a DX hit. I think in general people tend to work on changes and deal with bumping versions and changelog later on in the process, but from looking at the example runs, this is running as part of the integration-tests step and blocks other SATs from running.

This isn't really a comment on this specific set of changes, but I think it would be nice if we could separate the integration-tests step from these QA checks (and potentially have them run in parallel), so people can still /test and see the SAT results. In my mind integration tests and these QA checks are somewhat separate.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@pedroslopez I've moved the run-qa-check command in a different step of the test-command.yml workflow. I had to change the report.sh script to define the build as failing if test or QA checks are failing. (cc. @bechurch I think this script will help you understand how the build results are persisted to S3).

The changes are in 80fd32d .

@alafanechere
Copy link
Contributor Author

This isn't really a comment on this specific set of changes, but I think it would be nice if we could separate the integration-tests step from these QA checks (and potentially have them run in parallel), so people can still /test and see the SAT results. In my mind integration tests and these QA checks are somewhat separate.

I think you're 💯 right. I'll run QA checks in a different step, after SAT, but in the same /test workflow.

At what point do you think we need to add tests for these checks? I think if we're relying on some of this to determine cloud availability we should have some level of testing around these tools.

👮‍♂️ . I will, in this PR.

@alafanechere alafanechere temporarily deployed to more-secrets January 26, 2023 08:20 — with GitHub Actions Inactive
@alafanechere alafanechere force-pushed the augustin/qa-checks/doc-and-icon-availability branch 2 times, most recently from a606d4d to c9c8570 Compare January 26, 2023 09:16
@alafanechere alafanechere temporarily deployed to more-secrets January 26, 2023 09:19 — with GitHub Actions Inactive
@alafanechere alafanechere force-pushed the augustin/qa-checks/doc-and-icon-availability branch from c9c8570 to 9cc775e Compare January 26, 2023 09:31
@alafanechere alafanechere temporarily deployed to more-secrets January 26, 2023 09:34 — with GitHub Actions Inactive
@alafanechere alafanechere temporarily deployed to more-secrets January 26, 2023 09:34 — with GitHub Actions Inactive
@alafanechere alafanechere temporarily deployed to more-secrets January 26, 2023 09:53 — with GitHub Actions Inactive
@alafanechere alafanechere temporarily deployed to more-secrets January 26, 2023 09:53 — with GitHub Actions Inactive
@alafanechere alafanechere force-pushed the augustin/qa-checks/doc-and-icon-availability branch 2 times, most recently from a71b326 to a7bc513 Compare January 26, 2023 13:35
@alafanechere alafanechere force-pushed the augustin/qa-checks/doc-and-icon-availability branch from a7bc513 to 3eccb4c Compare January 26, 2023 13:38
@octavia-squidington-iv octavia-squidington-iv added the area/frontend Related to the Airbyte webapp label Jan 26, 2023
@alafanechere alafanechere force-pushed the augustin/qa-checks/doc-and-icon-availability branch from 2cb730a to 3eccb4c Compare January 26, 2023 13:42
@octavia-squidington-iv octavia-squidington-iv removed the area/frontend Related to the Airbyte webapp label Jan 26, 2023
@alafanechere alafanechere temporarily deployed to more-secrets January 26, 2023 13:45 — with GitHub Actions Inactive
@alafanechere alafanechere temporarily deployed to more-secrets January 26, 2023 13:45 — with GitHub Actions Inactive
from typing import Dict, Optional, Set, Tuple

import git
import requests
import yaml

AIRBYTE_REPO = git.Repo(".")
DIFFED_BRANCH = "origin/master"
Copy link
Contributor Author

@alafanechere alafanechere Jan 26, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I declared this as a constant for easier mocking. When running unit tests we want to switch it to the active branch.

@alafanechere
Copy link
Contributor Author

@pedroslopez I implemented your suggested changes:

  • Make QA checks run after integration tests in /test
  • Write tests for the QA checks + refactor the utils to use the new Connector dataclass

Copy link
Contributor

@pedroslopez pedroslopez left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:shipit:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
4 participants