diff --git a/airbyte-config-oss/init-oss/src/main/resources/seed/oss_catalog.json b/airbyte-config-oss/init-oss/src/main/resources/seed/oss_catalog.json index 4626e256f375..85a3bfc60355 100644 --- a/airbyte-config-oss/init-oss/src/main/resources/seed/oss_catalog.json +++ b/airbyte-config-oss/init-oss/src/main/resources/seed/oss_catalog.json @@ -13719,7 +13719,7 @@ "sourceDefinitionId": "5e6175e5-68e1-4c17-bff9-56103bbb0d80", "name": "Gitlab", "dockerRepository": "airbyte/source-gitlab", - "dockerImageTag": "1.0.3", + "dockerImageTag": "1.0.4", "documentationUrl": "https://docs.airbyte.com/integrations/sources/gitlab", "icon": "gitlab.svg", "sourceType": "api", diff --git a/airbyte-config-oss/init-oss/src/main/resources/seed/source_definitions.yaml b/airbyte-config-oss/init-oss/src/main/resources/seed/source_definitions.yaml index 4b12b3a6dc96..cef3da3fb1bc 100644 --- a/airbyte-config-oss/init-oss/src/main/resources/seed/source_definitions.yaml +++ b/airbyte-config-oss/init-oss/src/main/resources/seed/source_definitions.yaml @@ -754,7 +754,7 @@ - name: Gitlab sourceDefinitionId: 5e6175e5-68e1-4c17-bff9-56103bbb0d80 dockerRepository: airbyte/source-gitlab - dockerImageTag: 1.0.3 + dockerImageTag: 1.0.4 documentationUrl: https://docs.airbyte.com/integrations/sources/gitlab icon: gitlab.svg sourceType: api diff --git a/airbyte-config-oss/init-oss/src/main/resources/seed/source_specs.yaml b/airbyte-config-oss/init-oss/src/main/resources/seed/source_specs.yaml index 5539082c6f5a..6730bdb4bf81 100644 --- a/airbyte-config-oss/init-oss/src/main/resources/seed/source_specs.yaml +++ b/airbyte-config-oss/init-oss/src/main/resources/seed/source_specs.yaml @@ -5284,7 +5284,7 @@ path_in_connector_config: - "credentials" - "client_secret" -- dockerImage: "airbyte/source-gitlab:1.0.3" +- dockerImage: "airbyte/source-gitlab:1.0.4" spec: documentationUrl: "https://docs.airbyte.com/integrations/sources/gitlab" connectionSpecification: diff --git a/airbyte-integrations/connectors/source-gitlab/Dockerfile b/airbyte-integrations/connectors/source-gitlab/Dockerfile index d0f91af2d290..73f37579b39a 100644 --- a/airbyte-integrations/connectors/source-gitlab/Dockerfile +++ b/airbyte-integrations/connectors/source-gitlab/Dockerfile @@ -13,5 +13,5 @@ COPY main.py ./ ENTRYPOINT ["python", "/airbyte/integration_code/main.py"] -LABEL io.airbyte.version=1.0.3 +LABEL io.airbyte.version=1.0.4 LABEL io.airbyte.name=airbyte/source-gitlab diff --git a/airbyte-integrations/connectors/source-gitlab/setup.py b/airbyte-integrations/connectors/source-gitlab/setup.py index 4db808da2682..562cc42c530e 100644 --- a/airbyte-integrations/connectors/source-gitlab/setup.py +++ b/airbyte-integrations/connectors/source-gitlab/setup.py @@ -7,7 +7,7 @@ MAIN_REQUIREMENTS = ["airbyte-cdk", "vcrpy==4.1.1"] -TEST_REQUIREMENTS = ["pytest~=6.1", "connector-acceptance-test", "requests_mock"] +TEST_REQUIREMENTS = ["pytest~=6.1", "connector-acceptance-test", "requests_mock", "pytest-mock"] setup( name="source_gitlab", diff --git a/airbyte-integrations/connectors/source-gitlab/source_gitlab/streams.py b/airbyte-integrations/connectors/source-gitlab/source_gitlab/streams.py index b0aa44b26513..7f6b91490e4b 100644 --- a/airbyte-integrations/connectors/source-gitlab/source_gitlab/streams.py +++ b/airbyte-integrations/connectors/source-gitlab/source_gitlab/streams.py @@ -5,6 +5,7 @@ import datetime from abc import ABC from typing import Any, Dict, Iterable, List, Mapping, MutableMapping, Optional, Tuple +from urllib.parse import urlparse import pendulum import requests @@ -51,7 +52,13 @@ def request_params( @property def url_base(self) -> str: - return f"https://{self.api_url}/api/v4/" + parse_result = urlparse(self.api_url) + # Default scheme to "https" if URL doesn't contain + scheme = parse_result.scheme if parse_result.scheme else "https" + # hostname without a scheme will result in `path` attribute + # Use path if netloc is not detected + host = parse_result.netloc if parse_result.netloc else parse_result.path + return f"{scheme}://{host}/api/v4/" @property def availability_strategy(self) -> Optional["AvailabilityStrategy"]: diff --git a/airbyte-integrations/connectors/source-gitlab/unit_tests/conftest.py b/airbyte-integrations/connectors/source-gitlab/unit_tests/conftest.py index 18d8d4a58ee4..f589f2a6b7cf 100644 --- a/airbyte-integrations/connectors/source-gitlab/unit_tests/conftest.py +++ b/airbyte-integrations/connectors/source-gitlab/unit_tests/conftest.py @@ -5,11 +5,11 @@ import pytest -@pytest.fixture -def config(mocker): +@pytest.fixture(params=["gitlab.com", "https://gitlab.com", "https://gitlab.com/api/v4"]) +def config(request): return { "start_date": "2021-01-01T00:00:00Z", - "api_url": "gitlab.com", + "api_url": request.param, "credentials": { "auth_type": "access_token", "access_token": "token" diff --git a/connectors.md b/connectors.md index a93fd2777b08..59ed6baca735 100644 --- a/connectors.md +++ b/connectors.md @@ -88,7 +88,7 @@ | **Genesys** | Genesys icon | Source | airbyte/source-genesys:0.1.0 | unknown | [docs](https://docs.airbyte.com/integrations/sources/genesys) | [connectors/source/genesys](https://github.com/airbytehq/airbyte/issues?q=is:open+is:issue+label:connectors/source/genesys) | [source-genesys](https://github.com/airbytehq/airbyte/tree/master/airbyte-integrations/connectors/source-genesys) | `5ea4459a-8f1a-452a-830f-a65c38cc438d` | | **GetLago** | GetLago icon | Source | airbyte/source-getlago:0.1.0 | alpha | [docs](https://docs.airbyte.com/integrations/sources/getlago) | [connectors/source/getlago](https://github.com/airbytehq/airbyte/issues?q=is:open+is:issue+label:connectors/source/getlago) | [source-getlago](https://github.com/airbytehq/airbyte/tree/master/airbyte-integrations/connectors/source-getlago) | `e1a3866b-d3b2-43b6-b6d7-8c1ee4d7f53f` | | **GitHub** | GitHub icon | Source | airbyte/source-github:0.4.8 | generally_available | [docs](https://docs.airbyte.com/integrations/sources/github) | [connectors/source/github](https://github.com/airbytehq/airbyte/issues?q=is:open+is:issue+label:connectors/source/github) | [source-github](https://github.com/airbytehq/airbyte/tree/master/airbyte-integrations/connectors/source-github) | `ef69ef6e-aa7f-4af1-a01d-ef775033524e` | -| **Gitlab** | Gitlab icon | Source | airbyte/source-gitlab:1.0.3 | beta | [docs](https://docs.airbyte.com/integrations/sources/gitlab) | [connectors/source/gitlab](https://github.com/airbytehq/airbyte/issues?q=is:open+is:issue+label:connectors/source/gitlab) | [source-gitlab](https://github.com/airbytehq/airbyte/tree/master/airbyte-integrations/connectors/source-gitlab) | `5e6175e5-68e1-4c17-bff9-56103bbb0d80` | +| **Gitlab** | Gitlab icon | Source | airbyte/source-gitlab:1.0.4 | beta | [docs](https://docs.airbyte.com/integrations/sources/gitlab) | [connectors/source/gitlab](https://github.com/airbytehq/airbyte/issues?q=is:open+is:issue+label:connectors/source/gitlab) | [source-gitlab](https://github.com/airbytehq/airbyte/tree/master/airbyte-integrations/connectors/source-gitlab) | `5e6175e5-68e1-4c17-bff9-56103bbb0d80` | | **Glassfrog** | Glassfrog icon | Source | airbyte/source-glassfrog:0.1.0 | alpha | [docs](https://docs.airbyte.com/integrations/sources/glassfrog) | [connectors/source/glassfrog](https://github.com/airbytehq/airbyte/issues?q=is:open+is:issue+label:connectors/source/glassfrog) | [source-glassfrog](https://github.com/airbytehq/airbyte/tree/master/airbyte-integrations/connectors/source-glassfrog) | `cf8ff320-6272-4faa-89e6-4402dc17e5d5` | | **GoCardless** | GoCardless icon | Source | airbyte/source-gocardless:0.1.0 | alpha | [docs](https://docs.airbyte.com/integrations/sources/gocardless) | [connectors/source/gocardless](https://github.com/airbytehq/airbyte/issues?q=is:open+is:issue+label:connectors/source/gocardless) | [source-gocardless](https://github.com/airbytehq/airbyte/tree/master/airbyte-integrations/connectors/source-gocardless) | `ba15ac82-5c6a-4fb2-bf24-925c23a1180c` | | **Gong** | Gong icon | Source | airbyte/source-gong:0.1.0 | alpha | [docs](https://docs.airbyte.com/integrations/sources/gong) | [connectors/source/gong](https://github.com/airbytehq/airbyte/issues?q=is:open+is:issue+label:connectors/source/gong) | [source-gong](https://github.com/airbytehq/airbyte/tree/master/airbyte-integrations/connectors/source-gong) | `32382e40-3b49-4b99-9c5c-4076501914e7` | diff --git a/docs/integrations/sources/gitlab.md b/docs/integrations/sources/gitlab.md index d9d8e5a4c8c7..ab46243ac296 100644 --- a/docs/integrations/sources/gitlab.md +++ b/docs/integrations/sources/gitlab.md @@ -105,6 +105,7 @@ Gitlab has the [rate limits](https://docs.gitlab.com/ee/user/gitlab_com/index.ht | Version | Date | Pull Request | Subject | |:--------|:-----------|:---------------------------------------------------------|:-------------------------------------------------------------------------------------------| +| 1.0.4 | 2023-04-20 | [21373](https://github.com/airbytehq/airbyte/pull/21373) | Accept api_url with or without scheme | | 1.0.3 | 2023-02-14 | [22992](https://github.com/airbytehq/airbyte/pull/22992) |Specified date formatting in specification | | 1.0.2 | 2023-01-27 | [22001](https://github.com/airbytehq/airbyte/pull/22001) | Set `AvailabilityStrategy` for streams explicitly to `None` | | 1.0.1 | 2023-01-23 | [21713](https://github.com/airbytehq/airbyte/pull/21713) | Fix missing data issue |