Skip to content

Commit b69639e

Browse files
Bazdavydov-dalafanechereoctavia-squidington-iii
authored
🎉 Source Gitlab: add OAuth2.0 authentication support (#7506)
* added support of oauth2.0 * added OAuthFlow.java part * bumped version of the Dockerfile * corrected SAT * added unit_test for Oauth java part, added integration-test for java part * added changelog * fix java part test * updated after review * updated spec.json * updated after review * #7480 source gitlab: rm empty files * #7480 source gitlab: add single use refresh token authenticator * #7480 source gitlab: upd oauth implementation * #7480 source gitlab: refactor auth * #7480 fix oauth: java * #7480 source gitlab: review fixes * #7480 source gitlab: upd release stage * #7480 source gitlab: fix unit tests * #7480 source gitlab: update expected records * #7480 source gitlab: upd sats * #7480 source gitlab: upd expected records * #7480 source Gitlab: use SingleUseRefreshTokenOauth as is * #7480 sourcte gitlab: upd expected records * auto-bump connector version Co-authored-by: Denys Davydov <[email protected]> Co-authored-by: Augustin <[email protected]> Co-authored-by: Octavia Squidington III <[email protected]>
1 parent 115144b commit b69639e

File tree

15 files changed

+833
-291
lines changed

15 files changed

+833
-291
lines changed

airbyte-config/init/src/main/resources/seed/source_definitions.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -605,11 +605,11 @@
605605
- name: Gitlab
606606
sourceDefinitionId: 5e6175e5-68e1-4c17-bff9-56103bbb0d80
607607
dockerRepository: airbyte/source-gitlab
608-
dockerImageTag: 0.1.12
608+
dockerImageTag: 1.0.0
609609
documentationUrl: https://docs.airbyte.com/integrations/sources/gitlab
610610
icon: gitlab.svg
611611
sourceType: api
612-
releaseStage: alpha
612+
releaseStage: beta
613613
- name: Glassfrog
614614
sourceDefinitionId: cf8ff320-6272-4faa-89e6-4402dc17e5d5
615615
dockerRepository: airbyte/source-glassfrog

airbyte-config/init/src/main/resources/seed/source_specs.yaml

Lines changed: 107 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4732,31 +4732,76 @@
47324732
path_in_connector_config:
47334733
- "credentials"
47344734
- "client_secret"
4735-
- dockerImage: "airbyte/source-gitlab:0.1.12"
4735+
- dockerImage: "airbyte/source-gitlab:1.0.0"
47364736
spec:
47374737
documentationUrl: "https://docs.airbyte.com/integrations/sources/gitlab"
47384738
connectionSpecification:
47394739
$schema: "http://json-schema.org/draft-07/schema#"
4740-
title: "Source GitLab Singer Spec"
4740+
title: "Source Gitlab Spec"
47414741
type: "object"
47424742
required:
47434743
- "api_url"
4744-
- "private_token"
47454744
- "start_date"
4745+
- "credentials"
47464746
additionalProperties: true
47474747
properties:
4748-
private_token:
4749-
type: "string"
4750-
title: "Private Token"
4751-
description: "Log into your GitLab account and then generate a personal\
4752-
\ [Access Token](https://docs.gitlab.com/ee/user/profile/personal_access_tokens.html)."
4753-
airbyte_secret: true
4748+
credentials:
4749+
title: "Authorization Method"
4750+
type: "object"
47544751
order: 0
4752+
oneOf:
4753+
- type: "object"
4754+
title: "OAuth2.0"
4755+
required:
4756+
- "client_id"
4757+
- "client_secret"
4758+
- "refresh_token"
4759+
- "access_token"
4760+
- "token_expiry_date"
4761+
properties:
4762+
auth_type:
4763+
type: "string"
4764+
const: "oauth2.0"
4765+
client_id:
4766+
type: "string"
4767+
description: "The API ID of the Gitlab developer application."
4768+
airbyte_secret: true
4769+
client_secret:
4770+
type: "string"
4771+
description: "The API Secret the Gitlab developer application."
4772+
airbyte_secret: true
4773+
access_token:
4774+
type: "string"
4775+
description: "Access Token for making authenticated requests."
4776+
airbyte_secret: true
4777+
token_expiry_date:
4778+
type: "string"
4779+
description: "The date-time when the access token should be refreshed."
4780+
format: "date-time"
4781+
refresh_token:
4782+
type: "string"
4783+
description: "The key to refresh the expired access_token."
4784+
airbyte_secret: true
4785+
- title: "Private Token"
4786+
type: "object"
4787+
required:
4788+
- "access_token"
4789+
properties:
4790+
auth_type:
4791+
type: "string"
4792+
const: "access_token"
4793+
access_token:
4794+
type: "string"
4795+
title: "Private Token"
4796+
description: "Log into your Gitlab account and then generate a personal\
4797+
\ Access Token."
4798+
airbyte_secret: true
47554799
api_url:
47564800
type: "string"
47574801
examples:
47584802
- "gitlab.com"
47594803
title: "API URL"
4804+
default: "gitlab.com"
47604805
description: "Please enter your basic URL from GitLab instance."
47614806
order: 1
47624807
start_date:
@@ -4787,6 +4832,59 @@
47874832
supportsNormalization: false
47884833
supportsDBT: false
47894834
supported_destination_sync_modes: []
4835+
advanced_auth:
4836+
auth_flow_type: "oauth2.0"
4837+
predicate_key:
4838+
- "credentials"
4839+
- "auth_type"
4840+
predicate_value: "oauth2.0"
4841+
oauth_config_specification:
4842+
oauth_user_input_from_connector_config_specification:
4843+
type: "object"
4844+
properties:
4845+
domain:
4846+
type: "string"
4847+
path_in_connector_config:
4848+
- "api_url"
4849+
complete_oauth_output_specification:
4850+
type: "object"
4851+
properties:
4852+
access_token:
4853+
type: "string"
4854+
path_in_connector_config:
4855+
- "credentials"
4856+
- "access_token"
4857+
refresh_token:
4858+
type: "string"
4859+
path_in_connector_config:
4860+
- "credentials"
4861+
- "refresh_token"
4862+
token_expiry_date:
4863+
type: "string"
4864+
format: "date-time"
4865+
path_in_connector_config:
4866+
- "credentials"
4867+
- "token_expiry_date"
4868+
complete_oauth_server_input_specification:
4869+
type: "object"
4870+
properties:
4871+
client_id:
4872+
type: "string"
4873+
client_secret:
4874+
type: "string"
4875+
complete_oauth_server_output_specification:
4876+
type: "object"
4877+
properties:
4878+
client_id:
4879+
type: "string"
4880+
path_in_connector_config:
4881+
- "credentials"
4882+
- "client_id"
4883+
client_secret:
4884+
type: "string"
4885+
path_in_connector_config:
4886+
- "credentials"
4887+
- "client_secret"
47904888
- dockerImage: "airbyte/source-glassfrog:0.1.0"
47914889
spec:
47924890
documentationUrl: "https://docs.airbyte.com/integrations/sources/glassfrog"

airbyte-integrations/connectors/source-gitlab/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,5 @@ COPY main.py ./
1313

1414
ENTRYPOINT ["python", "/airbyte/integration_code/main.py"]
1515

16-
LABEL io.airbyte.version=0.1.12
16+
LABEL io.airbyte.version=1.0.0
1717
LABEL io.airbyte.name=airbyte/source-gitlab

airbyte-integrations/connectors/source-gitlab/acceptance-test-config.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,24 @@ acceptance_tests:
44
spec:
55
tests:
66
- spec_path: "source_gitlab/spec.json"
7+
backward_compatibility_tests_config:
8+
disable_for_version: "0.1.12"
79
connection:
810
tests:
911
- config_path: "secrets/config.json"
1012
status: "succeed"
13+
- config_path: "secrets/config_oauth.json"
14+
status: "succeed"
1115
- config_path: "integration_tests/invalid_config.json"
1216
status: "failed"
1317
discovery:
1418
tests:
1519
- config_path: "secrets/config.json"
20+
backward_compatibility_tests_config:
21+
disable_for_version: "0.1.12"
22+
- config_path: "secrets/config_oauth.json"
23+
backward_compatibility_tests_config:
24+
disable_for_version: "0.1.12"
1625
basic_read:
1726
tests:
1827
- config_path: "secrets/config.json"
@@ -26,6 +35,9 @@ acceptance_tests:
2635
bypass_reason: "Group in this config does not have epics issues. This stream is tested in the above TC."
2736
expect_records:
2837
path: "integration_tests/expected_records_with_ids.jsonl"
38+
- config_path: "secrets/config_oauth.json"
39+
expect_records:
40+
path: "integration_tests/expected_records.jsonl"
2941
incremental:
3042
tests:
3143
- config_path: "secrets/config_with_ids.json"

airbyte-integrations/connectors/source-gitlab/integration_tests/expected_records.jsonl

Lines changed: 152 additions & 152 deletions
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)