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

[DO NOT MERGE] Upload all docs script #30603

Closed
wants to merge 6 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import pathlib

import click
from connector_ops.utils import get_all_connectors_in_repo
from metadata_service.constants import METADATA_FILE_NAME
from metadata_service.gcs_upload import MetadataUploadInfo, upload_metadata_to_gcs
from metadata_service.validators.metadata_validator import PRE_UPLOAD_VALIDATORS, ValidatorOptions, validate_and_load
Expand Down Expand Up @@ -60,3 +61,27 @@ def upload(metadata_file_path: pathlib.Path, docs_path: pathlib.Path, bucket_nam
else:
click.secho(f"The metadata file {metadata_file_path} was not uploaded.", color="yellow")
exit(5)


@metadata_service.command(help="Upload docs for all connectors to a GCS bucket.")
@click.argument("airbyte-repo-path", type=click.Path(exists=True, path_type=pathlib.Path))
@click.argument("docs-dir", type=click.Path(exists=True, path_type=pathlib.Path))
@click.argument("bucket-name", type=click.STRING)
def upload_all_metadata(airbyte_repo_path: pathlib.Path, docs_dir: pathlib.Path, bucket_name: str):
connectors = get_all_connectors_in_repo()
failed_connectors = []
for connector in connectors:
# failed_connectors.append(str(connector))
try:
print(f"~~~~~~ Uploading metadata for {connector}")
metadata_file_path = airbyte_repo_path / connector.metadata_file_path
upload_metadata_to_gcs(bucket_name, metadata_file_path, ValidatorOptions(docs_path=str(docs_dir)))
# This break just makes the script upload docs for a single connector. Comment it out to upload docs for all connectors.
# break
# raise Exception("This is a test exception")
except Exception as e:
failed_connectors.append([str(connector), str(e)])
pass
# break
print(f"Failed to upload metadata for the following connectors: {failed_connectors}")
exit(0)
Loading
Loading