Skip to content

Conversation

@grubberr
Copy link
Contributor

@grubberr grubberr commented Nov 14, 2021

Signed-off-by: Sergey Chvalyuk grubberr@gmail.com

How

Add an implementation of oAuth2 logic to the connector and the Java server part

Manual result of tests:

  1. Redirect to the Harvest auth window:

Screenshot 2021-11-16 at 20 59 22

2. Auth result:

Screenshot 2021-11-16 at 21 01 19

Pre-merge Checklist

Expand the relevant checklist and delete the others.

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

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
  • After the new connector version is published, connector version bumped in the seed directory as described here
  • Seed specs have been re-generated by building the platform and committing the changes to the seed spec files, as described here

Signed-off-by: Sergey Chvalyuk <grubberr@gmail.com>
@github-actions github-actions bot added the area/connectors Connector related issues label Nov 14, 2021
@grubberr grubberr linked an issue Nov 14, 2021 that may be closed by this pull request
@grubberr grubberr self-assigned this Nov 14, 2021
@grubberr grubberr temporarily deployed to more-secrets November 14, 2021 17:47 Inactive
Signed-off-by: Sergey Chvalyuk <grubberr@gmail.com>
@github-actions github-actions bot added the area/documentation Improvements or additions to documentation label Nov 14, 2021
@grubberr grubberr temporarily deployed to more-secrets November 14, 2021 17:50 Inactive
@grubberr grubberr temporarily deployed to more-secrets November 15, 2021 21:03 Inactive
Signed-off-by: Sergey Chvalyuk <grubberr@gmail.com>
@grubberr grubberr requested review from antixar and bazarnov November 15, 2021 21:57
@grubberr grubberr temporarily deployed to more-secrets November 16, 2021 13:44 Inactive
@grubberr
Copy link
Contributor Author

grubberr commented Nov 16, 2021

/test connector=connectors/source-harvest

🕑 connectors/source-harvest https://github.com/airbytehq/airbyte/actions/runs/1467105606
❌ connectors/source-harvest https://github.com/airbytehq/airbyte/actions/runs/1467105606
🐛

@jrhizor jrhizor temporarily deployed to more-secrets November 16, 2021 13:47 Inactive
Signed-off-by: Sergey Chvalyuk <grubberr@gmail.com>
@grubberr
Copy link
Contributor Author

grubberr commented Nov 16, 2021

/test connector=connectors/source-harvest

🕑 connectors/source-harvest https://github.com/airbytehq/airbyte/actions/runs/1467295934
❌ connectors/source-harvest https://github.com/airbytehq/airbyte/actions/runs/1467295934
🐛

@grubberr grubberr temporarily deployed to more-secrets November 16, 2021 14:31 Inactive
@jrhizor jrhizor temporarily deployed to more-secrets November 16, 2021 14:32 Inactive
@grubberr
Copy link
Contributor Author

grubberr commented Nov 16, 2021

/test connector=connectors/source-harvest

🕑 connectors/source-harvest https://github.com/airbytehq/airbyte/actions/runs/1467409208
❌ connectors/source-harvest https://github.com/airbytehq/airbyte/actions/runs/1467409208
🐛

@jrhizor jrhizor temporarily deployed to more-secrets November 16, 2021 15:00 Inactive
Signed-off-by: Sergey Chvalyuk <grubberr@gmail.com>
@grubberr
Copy link
Contributor Author

grubberr commented Nov 16, 2021

/test connector=connectors/source-harvest

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

 ---------- coverage: platform linux, python 3.8.10-final-0 ----------- Name Stmts Miss Cover ------------------------------------------------ source_harvest/__init__.py 2 2 0% source_harvest/auth.py 13 13 0% source_harvest/source.py 33 33 0% source_harvest/streams.py 162 162 0% ------------------------------------------------ TOTAL 210 210 0% ---------- 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 75 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 38 27 29% 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 62 25 60% source_acceptance_test/utils/connector_runner.py 82 49 40% source_acceptance_test/utils/json_schema_helper.py 115 14 88% ------------------------------------------------------------------------ TOTAL 896 440 51% 
@grubberr grubberr temporarily deployed to more-secrets November 16, 2021 15:18 Inactive
@jrhizor jrhizor temporarily deployed to more-secrets November 16, 2021 15:19 Inactive
Copy link
Contributor

@antixar antixar left a comment

Choose a reason for hiding this comment

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

Please add basic tests for Java part. You can use examples of other ready connectors.

@grubberr
Copy link
Contributor Author

grubberr commented Nov 19, 2021

/test connector=connectors/source-harvest

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

 ---------- coverage: platform linux, python 3.8.10-final-0 ----------- Name Stmts Miss Cover ------------------------------------------------ source_harvest/__init__.py 2 2 0% source_harvest/auth.py 11 11 0% source_harvest/source.py 33 33 0% source_harvest/streams.py 162 162 0% ------------------------------------------------ TOTAL 208 208 0% ---------- 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 75 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 38 27 29% 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 62 25 60% source_acceptance_test/utils/connector_runner.py 82 49 40% source_acceptance_test/utils/json_schema_helper.py 115 14 88% ------------------------------------------------------------------------ TOTAL 896 440 51% 
@jrhizor jrhizor temporarily deployed to more-secrets November 19, 2021 14:04 Inactive
"complete_oauth_output_specification": {
"refresh_token": {
"type": "string",
"path_in_connector_config": ["credentials", 0, "refresh_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
"path_in_connector_config": ["credentials", 0, "refresh_token"]
"path_in_connector_config": ["credentials", "refresh_token"]
Copy link
Contributor Author

Choose a reason for hiding this comment

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

fixed

"complete_oauth_server_output_specification": {
"client_id": {
"type": "string",
"path_in_connector_config": ["credentials", 0, "client_id"]
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
"path_in_connector_config": ["credentials", 0, "client_id"]
"path_in_connector_config": ["credentials", "client_id"]
Copy link
Contributor Author

Choose a reason for hiding this comment

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

fixed

},
"client_secret": {
"type": "string",
"path_in_connector_config": ["credentials", 0, "client_secret"]
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
"path_in_connector_config": ["credentials", 0, "client_secret"]
"path_in_connector_config": ["credentials", "client_secret"]
Copy link
Contributor Author

Choose a reason for hiding this comment

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

fixed

Comment on lines +97 to +98
"oauth_config_specification": {
"complete_oauth_output_specification": {
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
"oauth_config_specification": {
"complete_oauth_output_specification": {
"oauth_config_specification": {
"predicate_key": ["credentials", "auth_type"],
"predicate_value": "Client",
"complete_oauth_output_specification": {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

is it mistake here ?
I see that predicate_key not inside oauth_config_specification

Copy link
Contributor

Choose a reason for hiding this comment

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

oh you're right then it's:

Suggested change
"oauth_config_specification": {
"complete_oauth_output_specification": {
"predicate_key": ["credentials", "auth_type"],
"predicate_value": "Client",
"oauth_config_specification": {
"complete_oauth_output_specification": {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

fixed

Copy link
Contributor

@ChristopheDuong ChristopheDuong left a comment

Choose a reason for hiding this comment

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

The object inside:

  • complete_oauth_output_specification
  • complete_oauth_server_input_specification
  • complete_oauth_server_output_specification

needs to be JSON schema object, so you need to add a layer of

 "type": "object", "additionalProperties": false, "properties": { 
Comment on lines 104 to 111
"complete_oauth_server_input_specification": {
"client_id": {
"type": "string"
},
"client_secret": {
"type": "string"
}
},
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
"complete_oauth_server_input_specification": {
"client_id": {
"type": "string"
},
"client_secret": {
"type": "string"
}
},
"complete_oauth_server_input_specification": {
"type": "object",
"additionalProperties": "false",
"properties": {
"client_id": {
"type": "string"
},
"client_secret": {
"type": "string"
}
}
},
Copy link
Contributor Author

Choose a reason for hiding this comment

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

fixed

Signed-off-by: Sergey Chvalyuk <grubberr@gmail.com>
@grubberr grubberr temporarily deployed to more-secrets November 19, 2021 16:15 Inactive
@grubberr
Copy link
Contributor Author

grubberr commented Nov 19, 2021

/test connector=connectors/source-harvest

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

 ---------- coverage: platform linux, python 3.8.10-final-0 ----------- /actions-runner/_work/airbyte/airbyte/airbyte-integrations/connectors/source-harvest/.venv/lib/python3.8/site-packages/coverage/control.py:761: CoverageWarning: No data was collected. (no-data-collected) Name Stmts Miss Cover self._warn("No data was collected.", slug="no-data-collected") ------------------------------------------------ source_harvest/__init__.py 2 2 0% source_harvest/auth.py 11 11 0% source_harvest/source.py 33 33 0% source_harvest/streams.py 162 162 0% ------------------------------------------------ TOTAL 208 208 0% ---------- 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 75 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 38 27 29% 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 62 25 60% source_acceptance_test/utils/connector_runner.py 82 49 40% source_acceptance_test/utils/json_schema_helper.py 115 14 88% ------------------------------------------------------------------------ TOTAL 896 440 51% 
@jrhizor jrhizor temporarily deployed to more-secrets November 19, 2021 16:17 Inactive
read_secrets source-google-workspace-admin-reports "$GOOGLE_WORKSPACE_ADMIN_REPORTS_TEST_CREDS"
read_secrets source-greenhouse "$GREENHOUSE_TEST_CREDS"
read_secrets source-greenhouse "$GREENHOUSE_TEST_CREDS_LIMITED" "config_users_only.json"
read_secrets source-harvest "$HARVEST_INTEGRATION_TESTS_CREDS"
Copy link
Contributor

Choose a reason for hiding this comment

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

curious why are these removed?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We are switching from Github secrets to Google Secrets. New approach based on google secrets allow to dynamically generate secrets/config.json for current connector without this hard-coded variable.

Signed-off-by: Sergey Chvalyuk <grubberr@gmail.com>
@grubberr grubberr temporarily deployed to more-secrets November 19, 2021 18:06 Inactive
@grubberr
Copy link
Contributor Author

grubberr commented Nov 19, 2021

/publish connector=connectors/source-harvest

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

@jrhizor jrhizor temporarily deployed to more-secrets November 19, 2021 18:12 Inactive
Signed-off-by: Sergey Chvalyuk <grubberr@gmail.com>
@grubberr grubberr merged commit 778b0f2 into master Nov 19, 2021
@grubberr grubberr deleted the grubberr/7707-source-harvest branch November 19, 2021 18:23
@grubberr grubberr temporarily deployed to more-secrets November 19, 2021 18:24 Inactive
schlattk pushed a commit to schlattk/airbyte that referenced this pull request Jan 4, 2022
* add OAuth 2.0 for source-harvest Signed-off-by: Sergey Chvalyuk <grubberr@gmail.com>
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

6 participants