Skip to content

Commit

Permalink
source-faker to Beta + Fix AllowedHosts Checks (#22117)
Browse files Browse the repository at this point in the history
* beta faker + no allowed hosts

* V2.0.1

* fixup python checks

* add back allowedHosts

* simplify

* simplify releaseStage

* bump expected records

* More mock logger methods

* auto-bump connector version

---------

Co-authored-by: Octavia Squidington III <[email protected]>
  • Loading branch information
evantahler and octavia-squidington-iii authored Jan 31, 2023
1 parent 1f2b6d6 commit e4f4412
Show file tree
Hide file tree
Showing 10 changed files with 149 additions and 142 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -504,11 +504,11 @@
- name: Sample Data (Faker)
sourceDefinitionId: dfd88b22-b603-4c3d-aad7-3701784586b1
dockerRepository: airbyte/source-faker
dockerImageTag: 2.0.0
dockerImageTag: 2.0.1
documentationUrl: https://docs.airbyte.com/integrations/sources/faker
icon: faker.svg
sourceType: api
releaseStage: alpha
releaseStage: beta
allowedHosts:
hosts: []
suggestedStreams:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4034,7 +4034,7 @@
supportsNormalization: false
supportsDBT: false
supported_destination_sync_modes: []
- dockerImage: "airbyte/source-faker:2.0.0"
- dockerImage: "airbyte/source-faker:2.0.1"
spec:
documentationUrl: "https://docs.airbyte.com/integrations/sources/faker"
connectionSpecification:
Expand Down
3 changes: 0 additions & 3 deletions airbyte-integrations/connectors/source-faker/CHANGELOG.md

This file was deleted.

2 changes: 1 addition & 1 deletion airbyte-integrations/connectors/source-faker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -34,5 +34,5 @@ COPY source_faker ./source_faker
ENV AIRBYTE_ENTRYPOINT "python /airbyte/integration_code/main.py"
ENTRYPOINT ["python", "/airbyte/integration_code/main.py"]

LABEL io.airbyte.version=2.0.0
LABEL io.airbyte.version=2.0.1
LABEL io.airbyte.name=airbyte/source-faker

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ def exception(a,b,**kwargs):
print(b)
return None

def isEnabledFor(a, b, **kwargs):
return False


logger = MockLogger()

Expand Down
1 change: 1 addition & 0 deletions docs/integrations/sources/faker.md
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ None!

| Version | Date | Pull Request | Subject |
| :------ | :--------- | :-------------------------------------------------------------------------------------------------------------------- | :-------------------------------------------------------------------------------------------------------------- |
| 2.0.1 | 2022-01-30 | [22117](https://github.com/airbytehq/airbyte/pull/22117) | `soruce-faker` goes beta |
| 2.0.0 | 2022-12-14 | [20492](https://github.com/airbytehq/airbyte/pull/20492) and [20741](https://github.com/airbytehq/airbyte/pull/20741) | Decouple stream states for better parallelism |
| 1.0.0 | 2022-11-28 | [19490](https://github.com/airbytehq/airbyte/pull/19490) | Faker uses the CDK; rename streams to be lower-case (breaking), add determinism to random purchases, and rename |
| 0.2.1 | 2022-10-14 | [19197](https://github.com/airbytehq/airbyte/pull/19197) | Emit `AirbyteEstimateTraceMessage` |
Expand Down
2 changes: 1 addition & 1 deletion tools/ci_connector_ops/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,4 @@ source .venv/bin/activate
pip install -e . # assuming you are in the ./tools/ci_connector_ops directory
```

pip will make binaries for all the commands in setup.py, so you can run `allowed-hosts-check` directly from the virtual-env
pip will make binaries for all the commands in setup.py, so you can run `allowed-hosts-checks` directly from the virtual-env
22 changes: 10 additions & 12 deletions tools/ci_connector_ops/ci_connector_ops/allowed_hosts_checks.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,22 +10,20 @@

RELEASE_STAGES_TO_CHECK = ["generally_available", "beta"]

def get_connectors_missing_allowed_hosts() -> List[str]:
connectors_missing_allowed_hosts = []
changed_connector_names = utils.get_changed_connector_names()

for connector_name in changed_connector_names:
connector_release_stage = utils.get_connector_release_stage(connector_name)
if connector_release_stage in RELEASE_STAGES_TO_CHECK:
missing = not connector_has_allowed_hosts(connector_name)
def get_connectors_missing_allowed_hosts() -> List[utils.Connector]:
connectors_missing_allowed_hosts: List[utils.Connector] = []
changed_connectors = utils.get_changed_connectors()

for connector in changed_connectors:
if connector.release_stage in RELEASE_STAGES_TO_CHECK:
missing = not connector_has_allowed_hosts(connector)
if missing:
connectors_missing_allowed_hosts.append(connector_name)
connectors_missing_allowed_hosts.append(connector)

return connectors_missing_allowed_hosts

def connector_has_allowed_hosts(connector_name: str) -> bool:
definition = utils.get_connector_definition(connector_name)
return definition.get("allowedHosts") is not None
def connector_has_allowed_hosts(connector: utils.Connector) -> bool:
return connector.allowed_hosts is not None


def check_allowed_hosts():
Expand Down
12 changes: 10 additions & 2 deletions tools/ci_connector_ops/ci_connector_ops/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from dataclasses import dataclass
import logging
from pathlib import Path
from typing import Dict, Optional, Set, Tuple
from typing import Dict, Optional, Set, Tuple, List
import os
import git
import requests
Expand Down Expand Up @@ -135,7 +135,15 @@ def definition(self) -> Optional[dict]:

@property
def release_stage(self) -> Optional[str]:
return self.definition["releaseStage"] if self.definition else None
return self.definition.get("releaseStage") if self.definition else None

@property
def allowed_hosts(self) -> Optional[List[str]]:
return self.definition.get("allowedHosts") if self.definition else None

@property
def suggested_streams(self) -> Optional[List[str]]:
return self.definition.get("suggestedStreams") if self.definition else None

@property
def acceptance_test_config_path(self) -> Path:
Expand Down

0 comments on commit e4f4412

Please sign in to comment.