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

🐛 Source Github: Fix set up validation #5456

Conversation

yevhenii-ldv
Copy link
Contributor

What

closes #5434.

How

Describe the solution

Recommended reading order

  1. x.java
  2. y.python

Pre-merge Checklist

Expand the relevant checklist and delete the others.

New Connector

Community member or Airbyter

  • Community member? Grant edit access to maintainers (instructions)
  • Secrets in the connector's spec are annotated with airbyte_secret
  • Unit & integration tests added and passing. Community members, please provide proof of success locally e.g: screenshot or copy-paste unit, integration, and acceptance test output. To run acceptance tests for a Python connector, follow instructions in the README. For java connectors run ./gradlew :airbyte-integrations:connectors:<name>:integrationTest.
  • Code reviews completed
  • Documentation updated
    • Connector's README.md
    • docs/SUMMARY.md
    • docs/integrations/<source or destination>/<name>.md including changelog. See changelog example
    • docs/integrations/README.md
    • airbyte-integrations/builds.md
  • PR name follows PR naming conventions
  • Connector added to connector index like described here

Airbyter

If this is a community PR, the Airbyte engineer reviewing this PR is responsible for the below items.

  • Create a non-forked branch based on this PR and test the below items on it
  • Build is successful
  • Credentials added to Github CI. Instructions.
  • /test connector=connectors/<name> command is passing.
  • New Connector version released on Dockerhub by running the /publish command described here

Updating a connector

Community member or Airbyter

  • Grant edit access to maintainers (instructions)
  • Secrets in the connector's spec are annotated with airbyte_secret
  • Unit & integration tests added and passing. Community members, please provide proof of success locally e.g: screenshot or copy-paste unit, integration, and acceptance test output. To run acceptance tests for a Python connector, follow instructions in the README. For java connectors run ./gradlew :airbyte-integrations:connectors:<name>:integrationTest.
  • Code reviews completed
  • Documentation updated
    • Connector's README.md
    • Changelog updated in docs/integrations/<source or destination>/<name>.md including changelog. See changelog example
  • PR name follows PR naming conventions
  • Connector version bumped like described here

Airbyter

If this is a community PR, the Airbyte engineer reviewing this PR is responsible for the below items.

  • Create a non-forked branch based on this PR and test the below items on it
  • Build is successful
  • Credentials added to Github CI. Instructions.
  • /test connector=connectors/<name> command is passing.
  • New Connector version released on Dockerhub by running the /publish command described here

Connector Generator

  • Issue acceptance criteria met
  • PR name follows PR naming conventions
  • If adding a new generator, add it to the list of scaffold modules being tested
  • The generator test modules (all connectors with -scaffold in their name) have been updated with the latest scaffold by running ./gradlew :airbyte-integrations:connector-templates:generator:testScaffoldTemplates then checking in your changes
  • Documentation which references the generator is updated as needed.

@yevhenii-ldv yevhenii-ldv changed the title bug Source Github: Fix set up validation Source Github: Fix set up validation Aug 17, 2021
@github-actions github-actions bot added the area/connectors Connector related issues label Aug 17, 2021
@yevhenii-ldv yevhenii-ldv changed the title Source Github: Fix set up validation 🐛 Source Github: Fix set up validation Aug 17, 2021
@yevhenii-ldv yevhenii-ldv requested a review from keu August 17, 2021 07:19
@yevhenii-ldv
Copy link
Contributor Author

yevhenii-ldv commented Aug 17, 2021

/test connector=connectors/source-github

🕑 connectors/source-github https://github.com/airbytehq/airbyte/actions/runs/1138365066
❌ connectors/source-github https://github.com/airbytehq/airbyte/actions/runs/1138365066

@jrhizor jrhizor temporarily deployed to more-secrets August 17, 2021 07:28 Inactive
@yevhenii-ldv
Copy link
Contributor Author

yevhenii-ldv commented Aug 17, 2021

/test connector=connectors/source-github

🕑 connectors/source-github https://github.com/airbytehq/airbyte/actions/runs/1138431723
✅ connectors/source-github https://github.com/airbytehq/airbyte/actions/runs/1138431723

@jrhizor jrhizor temporarily deployed to more-secrets August 17, 2021 07:54 Inactive
Comment on lines 57 to 58
organizations = list(filter(None, config.get("organization", "").split(" ")))
repositories = list(filter(None, config.get("repository", "").split(" ")))
Copy link
Member

Choose a reason for hiding this comment

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

If user doesn't send the two field any change to print the exception? Because both will become a empty string and not a None value.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@marcosmarxm Sorry, I didn't quite understand what you meant, could you reformulate it?

Copy link
Contributor

Choose a reason for hiding this comment

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

@yevhenii-ldv we don't handle the case when both fields are empty. I think we should either handle this by schema (use oneOf) or in the code.

Copy link
Contributor

@keu keu Aug 17, 2021

Choose a reason for hiding this comment

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

also about repo/org usage, not sure which one will take precedence. Maybe it is better to use a single field and ask a user to use format:
<org>:<repo> or simply <org> (or <org>:*)
i.e.

repositories = "airbyte:*,eugene:airbyte"

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@keu @marcosmarxm
Unfortunately, in order to maintain backward compatibility, the Sheriff and I made a decision that using oneOf will not work in this case and it is necessary to check directly in the check method, and not in the spec.json.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@keu As for Organizations and Repositories - now there have absolutely equal rights and we receive data for absolutely all repositories that we received using both fields.

Copy link
Contributor

Choose a reason for hiding this comment

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

please use single field repositories with the following format acceptable:

  • org/repo - sync concrete repo
  • org/ - sync all repos from org

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@keu done

@@ -127,6 +127,8 @@ def read_records(self, stream_slice: Mapping[str, any] = None, **kwargs) -> Iter
# For private repositories `Teams` stream is not available and we get "404 Client Error: Not Found for
# url: https://api.github.com/orgs/sherifnada/teams?per_page=100" error.
error_msg = f"Syncing `Team` stream isn't available for repository `{stream_slice['repository']}`."
else:
raise e
Copy link
Member

Choose a reason for hiding this comment

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

Can we have an additional information where this error is being thrown? Maybe

else:
    logging.ERROR("Undefined error while reading records")
    raise e

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

@github-actions github-actions bot added the area/documentation Improvements or additions to documentation label Aug 17, 2021
@yevhenii-ldv
Copy link
Contributor Author

yevhenii-ldv commented Aug 17, 2021

/test connector=connectors/source-github

🕑 connectors/source-github https://github.com/airbytehq/airbyte/actions/runs/1140364264
❌ connectors/source-github https://github.com/airbytehq/airbyte/actions/runs/1140364264

@jrhizor jrhizor temporarily deployed to more-secrets August 17, 2021 18:18 Inactive
@jrhizor jrhizor temporarily deployed to more-secrets August 17, 2021 18:30 Inactive
@yevhenii-ldv
Copy link
Contributor Author

yevhenii-ldv commented Aug 17, 2021

/test connector=connectors/source-github

🕑 connectors/source-github https://github.com/airbytehq/airbyte/actions/runs/1140434490
✅ connectors/source-github https://github.com/airbytehq/airbyte/actions/runs/1140434490

@jrhizor jrhizor temporarily deployed to more-secrets August 17, 2021 18:43 Inactive

repositories_list = []
repositories_list = [repo for repo in repositories if not re.match("^.*/\\*$", repo)]
organizations = [org.split("/")[0] for org in repositories if org not in repositories_list]
Copy link
Member

Choose a reason for hiding this comment

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

Are we going to pull all repos from organization without the user request this? @yevhenii-ldv

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@marcosmarxm If the user specifies, for example, airbytehq/*, this means that he wants to pull all the repositories for this organization.

Copy link
Member

Choose a reason for hiding this comment

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

btw, there is no unit_test for this? would be amazing to have a test mocking this function.

Copy link
Member

@marcosmarxm marcosmarxm left a comment

Choose a reason for hiding this comment

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

LGTM, but this private functions must have functions

@yevhenii-ldv
Copy link
Contributor Author

yevhenii-ldv commented Aug 18, 2021

/publish connector=connectors/source-github

🕑 connectors/source-github https://github.com/airbytehq/airbyte/actions/runs/1143046034
❌ connectors/source-github https://github.com/airbytehq/airbyte/actions/runs/1143046034

@jrhizor jrhizor temporarily deployed to more-secrets August 18, 2021 12:12 Inactive
@yevhenii-ldv
Copy link
Contributor Author

yevhenii-ldv commented Aug 18, 2021

/publish connector=connectors/source-github

🕑 connectors/source-github https://github.com/airbytehq/airbyte/actions/runs/1143084463
✅ connectors/source-github https://github.com/airbytehq/airbyte/actions/runs/1143084463

@jrhizor jrhizor temporarily deployed to more-secrets August 18, 2021 12:23 Inactive
@yevhenii-ldv yevhenii-ldv merged commit 03e1ff9 into master Aug 18, 2021
@yevhenii-ldv yevhenii-ldv deleted the ykurochkin/github-connector-set-up-validation-failing-on-non-required-field branch August 18, 2021 13:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/connectors Connector related issues area/documentation Improvements or additions to documentation connectors/source/github connectors/sources-api
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Github Connector: Set up validation failing on non-required field
5 participants