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

Metadata: Ensure we run upload validate on the overrode metadata file #28583

Merged
merged 3 commits into from
Jul 24, 2023

Conversation

bnchrch
Copy link
Contributor

@bnchrch bnchrch commented Jul 21, 2023

What

Fixes an issue where if you havent published the overrode version of the connector and go to run a prerelease then the prelease will fail because it cant find the regular docker image on dockerhub

@bnchrch bnchrch requested a review from erohmensing July 21, 2023 23:56
Copy link
Contributor

@erohmensing erohmensing left a comment

Choose a reason for hiding this comment

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

Good catch! I see how we got into this sitch

Most comments are just for my review/posterity of what's going on. Only concern is the return statement of upload_metadata_to_gcs.

latest_uploaded = False

if prerelease:
metadata_file_path = create_prerelease_metadata_file(metadata_file_path, prerelease)
Copy link
Contributor

Choose a reason for hiding this comment

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

nice, easier to understand now - no chance of using the existing metadata file


def create_prerelease_metadata_file(metadata_file_path: Path, prerelease_tag: str) -> Path:
metadata, error = validate_and_load(metadata_file_path, [])
Copy link
Contributor

Choose a reason for hiding this comment

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

👍🏻 don't validate when we load the initial file before we've overwritten it

Copy link
Contributor

Choose a reason for hiding this comment

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

this will still run it through the object validator, but not perform any extra validation (like if the docker image exists). i think that's fine


def _prerelease_upload(metadata: ConnectorMetadataDefinitionV0, bucket: storage.bucket.Bucket, prerelease_tag: str) -> Tuple[bool, str]:
# replace any dockerImageTag references with the actual tag
# this includes metadata.data.dockerImageTag, metadata.data.registries[].dockerImageTag
Copy link
Contributor

Choose a reason for hiding this comment

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

Not requied, just a suggestion: i wonder if we should have a constant list of these somewhere instead of encoding them here, in case we add something later that alwo has docker image tags?

or at least maybe pull out a method overwrite_image_tags

if not prerelease:
latest_uploaded, _latest_blob_id = _latest_upload(metadata, bucket, metadata_file_path)

return version_uploaded or latest_uploaded, version_blob_id
Copy link
Contributor

Choose a reason for hiding this comment

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

Will we ever see latest_uploaded here? in the case that we upload it, we'll have already uploaded the version too

Copy link
Contributor

Choose a reason for hiding this comment

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

I.e. for a non prerelease, if version upload failed, we want to know about it even it latest_uploaded succeeded, and the other way around. I guess we need separate return statements for the 2 cases?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good callout.

It was bugging me to.

Updated to have a more robust return value

@bnchrch bnchrch force-pushed the bnchrch/metadata-fix-upload-validation branch from bdb8424 to aad0061 Compare July 24, 2023 21:34
@bnchrch bnchrch enabled auto-merge (squash) July 24, 2023 21:35
@bnchrch bnchrch merged commit e530349 into master Jul 24, 2023
@bnchrch bnchrch deleted the bnchrch/metadata-fix-upload-validation branch July 24, 2023 21:35
efimmatytsin pushed a commit to scentbird/airbyte that referenced this pull request Jul 27, 2023
…airbytehq#28583)

* Ensure we do an upload validate on the overrode metadata file

* Change return value of upload

* Format
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants