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

🎉 Asana source: Add oauth init flow parameters support #6832

Merged
merged 3 commits into from
Oct 7, 2021

Conversation

avida
Copy link
Contributor

@avida avida commented Oct 6, 2021

What

Resolves #6259

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
    • Connector's bootstrap.md. See description and examples
    • 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
    • Connector's bootstrap.md. See description and examples
    • 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.

@github-actions github-actions bot added area/connectors Connector related issues area/documentation Improvements or additions to documentation labels Oct 6, 2021
@avida avida temporarily deployed to more-secrets October 6, 2021 08:05 Inactive
@avida
Copy link
Contributor Author

avida commented Oct 6, 2021

/test connector=connectors/source-asana

🕑 connectors/source-asana https://github.com/airbytehq/airbyte/actions/runs/1311149119
❌ connectors/source-asana https://github.com/airbytehq/airbyte/actions/runs/1311149119
🐛 Binary file (standard input) matches

@avida avida temporarily deployed to more-secrets October 6, 2021 08:56 Inactive
@jrhizor jrhizor temporarily deployed to more-secrets October 6, 2021 08:57 Inactive
@avida
Copy link
Contributor Author

avida commented Oct 6, 2021

/publish connector=bases/source-acceptance-test

🕑 bases/source-acceptance-test https://github.com/airbytehq/airbyte/actions/runs/1311244336
✅ bases/source-acceptance-test https://github.com/airbytehq/airbyte/actions/runs/1311244336

@jrhizor jrhizor temporarily deployed to more-secrets October 6, 2021 09:23 Inactive
@avida
Copy link
Contributor Author

avida commented Oct 6, 2021

/test connector=connectors/source-asana

🕑 connectors/source-asana https://github.com/airbytehq/airbyte/actions/runs/1311274928
✅ connectors/source-asana https://github.com/airbytehq/airbyte/actions/runs/1311274928
Python tests coverage:

	 ---------- coverage: platform linux, python 3.8.10-final-0 -----------
	 Name                                                 Stmts   Miss  Cover
	 ------------------------------------------------------------------------
	 source_acceptance_test/__init__.py                       2      0   100%
	 source_acceptance_test/base.py                          10      4    60%
	 source_acceptance_test/config.py                        74      8    89%
	 source_acceptance_test/conftest.py                     108    108     0%
	 source_acceptance_test/plugin.py                        47     47     0%
	 source_acceptance_test/tests/__init__.py                 4      0   100%
	 source_acceptance_test/tests/test_core.py              200     94    53%
	 source_acceptance_test/tests/test_full_refresh.py       18     11    39%
	 source_acceptance_test/tests/test_incremental.py        69     38    45%
	 source_acceptance_test/utils/__init__.py                 6      0   100%
	 source_acceptance_test/utils/asserts.py                 37      2    95%
	 source_acceptance_test/utils/common.py                  41     24    41%
	 source_acceptance_test/utils/compare.py                 47     20    57%
	 source_acceptance_test/utils/connector_runner.py        82     49    40%
	 source_acceptance_test/utils/json_schema_helper.py     115     14    88%
	 ------------------------------------------------------------------------
	 TOTAL                                                  860    419    51%
	 ---------- coverage: platform linux, python 3.8.10-final-0 -----------
	 Name                       Stmts   Miss  Cover
	 ----------------------------------------------
	 source_asana/__init__.py       2      0   100%
	 source_asana/oauth.py         10      0   100%
	 source_asana/source.py        27     14    48%
	 source_asana/streams.py      118     69    42%
	 ----------------------------------------------
	 TOTAL                        157     83    47%

@avida avida temporarily deployed to more-secrets October 6, 2021 09:31 Inactive
@jrhizor jrhizor temporarily deployed to more-secrets October 6, 2021 09:32 Inactive
@@ -4,15 +4,74 @@
"$schema": "http://json-schema.org/draft-07/schema#",
"title": "Asana Spec",
"type": "object",
"required": ["access_token"],
Copy link
Contributor

Choose a reason for hiding this comment

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

Why we remove "required" param?

Copy link
Contributor Author

@avida avida Oct 6, 2021

Choose a reason for hiding this comment

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

for backward compatability, see my another hotfix PR for github with explanatory comment #6833 (comment)

Copy link
Contributor

Choose a reason for hiding this comment

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

IMO, I like the option of canceling the config check during the read method more than removing the required field from the specification.

@avida avida requested a review from sherifnada October 6, 2021 15:39
},
"client_id": {
"type": "string",
"title": "",
Copy link
Contributor

Choose a reason for hiding this comment

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

title and description should not be empty ;)

"type": "string",
"title": "",
"description": "",
"airbyte_secret": false
Copy link
Contributor

Choose a reason for hiding this comment

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

client ID is not a secret

"oneOf": [
{
"type": "object",
"title": "PAT Credentials",
Copy link
Contributor

Choose a reason for hiding this comment

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

why two titles?

def _get_authenticator(config: dict) -> Union[TokenAuthenticator, AsanaOauth2Authenticator]:
if "access_token" in config:
# Before Oauth we had Person Access Token stored under "access_token"
# config filed, this code here is for backward compatability
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
# config filed, this code here is for backward compatability
# config field, this code here is for backward compatibility

Comment on lines +20 to +26
a = AsanaOauth2Authenticator(
token_refresh_endpoint=URL,
client_secret="client_secret",
client_id="client_id",
refresh_token="refresh_token",
)
token = a.get_access_token()
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
a = AsanaOauth2Authenticator(
token_refresh_endpoint=URL,
client_secret="client_secret",
client_id="client_id",
refresh_token="refresh_token",
)
token = a.get_access_token()
authenticator = AsanaOauth2Authenticator(
token_refresh_endpoint=URL,
client_secret="client_secret",
client_id="client_id",
refresh_token="refresh_token",
)
token = authenticator.get_access_token()

@avida
Copy link
Contributor Author

avida commented Oct 7, 2021

/publish connector=connectors/source-asana

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

@avida avida temporarily deployed to more-secrets October 7, 2021 06:51 Inactive
@jrhizor jrhizor temporarily deployed to more-secrets October 7, 2021 06:52 Inactive
@avida
Copy link
Contributor Author

avida commented Oct 7, 2021

/publish connector=connectors/source-asana

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

@avida avida temporarily deployed to more-secrets October 7, 2021 06:56 Inactive
@jrhizor jrhizor temporarily deployed to more-secrets October 7, 2021 06:57 Inactive
@avida avida merged commit ae63696 into master Oct 7, 2021
@avida avida deleted the drezchykov/asana-oauth branch October 7, 2021 07:15
@avida avida changed the title Asana source: Add oauth init flow parameters support 🎉 Asana source: Add oauth init flow parameters support Oct 7, 2021
schlattk pushed a commit to schlattk/airbyte that referenced this pull request Jan 4, 2022
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/asana connectors/sources-api
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Source Asana: support oauth
6 participants