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

connectors-ci: new checks to validate connector version #25609

Merged
merged 4 commits into from
Apr 28, 2023

Conversation

alafanechere
Copy link
Contributor

What

Closes #25329

When a connector is modified we want to enforce a connector version increment in the metadata.yaml file in the dockerImageTag field.
The version that will eventually be published on merge is pulled from the metadata file, it's why we want to check the version is bumped in this file.

How

If the CI context is not master and connectors files were modified:

  • Check that the dockerImageTag in the metadata.yaml file follows semantic versionning
  • Pull the master version of metadata.yaml from raw.github.com
  • Check that the current connector version is an increment of the master version.


@cached_property
def master_metadata(self) -> dict:
response = requests.get(self.github_master_metadata_url)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@bnchrch I considered reading the metadata from the GCS bucket using the latest key. I decided to use GitHub as this check would not rely on the orchestrator job runs, but let me know if you think otherwise.

Copy link
Contributor

Choose a reason for hiding this comment

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

I think this was the right call :)

Comment on lines +169 to +172
for not_committed_change in status_output.split("\n"):
file_path = not_committed_change.strip().split(" ")[-1]
if file_path:
modified_files.append(file_path)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This new change is to not force developers to commit their code to detect locally modified files.

@@ -16,6 +16,7 @@ This documentation should be helpful for both local and CI use of the CLI. We in
### Install
```bash
# Make sure that the current Python version is >= 3.10
pyenv shell 3.10
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Unrelated doc addition 😄

@alafanechere alafanechere requested review from bnchrch and a team April 27, 2023 13:03
@@ -108,6 +109,11 @@ Test connectors changed on the current branch:
```mermaid
flowchart TD
entrypoint[[For each selected connector]]
subgraph version ["Connector version checks"]
Copy link
Contributor

Choose a reason for hiding this comment

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

<3

Copy link
Contributor

@bnchrch bnchrch left a comment

Choose a reason for hiding this comment

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

Only real question I have is about using run_steps for our fail early logic :)

If thats not a good idea though lmk and we can merge

List[StepResult]: The results of the version checks steps.
"""
context.logger.info("Run version checks.")
return [await VersionFollowsSemverCheck(context).run(), await VersionIncrementCheck(context).run()]
Copy link
Contributor

Choose a reason for hiding this comment

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

Like this pattern!

@@ -87,13 +100,18 @@ async def run_connector_test_pipeline(context: ConnectorContext, semaphore: anyi
"""
async with semaphore:
async with context:
version_checks_results = await run_version_checks(context)
Copy link
Contributor

Choose a reason for hiding this comment

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

Just thinking about the skip on failure login in run_tests, could we use that here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I agree but in in this context I think run_steps is not immediately compatible as I wrapped steps executions inside function like run_versions_checks, run_qa_checks etc.
I think we might eventually want to make these function Steps themselves (or Pipeline). And a Pipeline could nest multiple other pipelines execution.


@cached_property
def master_metadata(self) -> dict:
response = requests.get(self.github_master_metadata_url)
Copy link
Contributor

Choose a reason for hiding this comment

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

I think this was the right call :)

@alafanechere
Copy link
Contributor Author

@bnchrch I did the following changes:

  • I discarded the fail early logic because this check is likely to fail on a lot of connectors and I'd like other tests to run to monitor the health of running pipelines . We might reconsider it once the test pipelines are ready for production
  • I use semver lib as suggested
  • I added the logic to not require a version bump if only a specific set of files were modified.

I also realize that we'll probably soon want to migrate the QA checks into specific pipeline steps because the pipelines have awareness on the modified files and it'll help add smarter static code analysis checks.

Finally, I opened #25661 to encourage connector developers to bump the version in the metadata before we discard /test.

Copy link
Contributor

@bnchrch bnchrch left a comment

Choose a reason for hiding this comment

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

Thanks for the explanation!

Lets merge!

@alafanechere alafanechere merged commit 9e785e5 into master Apr 28, 2023
@alafanechere alafanechere deleted the augustin/connectors-ci/check-version-bump branch April 28, 2023 15:57
marcosmarxm pushed a commit to natalia-miinto/airbyte that referenced this pull request Jun 8, 2023
)

* connectors-ci: new checks to validate connector version

* tmp ref attempt wip

* Revert "tmp ref attempt wip"

This reverts commit 0950d39.

* use semver and bypass increment check for specific files + no early fail
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants