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

airbyte-ci: productionize up-to-date 🧹 + 🚀 #39600

Merged

Conversation

alafanechere
Copy link
Contributor

@alafanechere alafanechere commented Jun 19, 2024

What

Closes https://github.com/airbytehq/airbyte-internal-issues/issues/8319
Closes https://github.com/airbytehq/airbyte-internal-issues/issues/7418

👀 : A loom is worth a thousand words.

We originally had multiple command we used manually and locally to ship mass connector updates.
These commands had optional bumping/PR creation logic with a lot of shared but duplicate logic.

This PR cleans things up and productionizes the up-to-date command so that it can run automatically in a cronjob.

How

  • Adopt the "unix philosophy" for migration commands made to be use locally. Developers are expected to run the migration commands (like migrate-to-poetry) and then execute bump-version and pull-request commands to update the connector versions and open a PR. This allows keeping "simple" and isolated steps with less potential side effects.
  • As the up-to-date command is meant to be automated in GHA this command is not "unix style". It:
    • Updates the connector base image to the latest base image version
    • Run poetry update to update Python dependencies
    • Bump the connector version
    • Create a up-to-date/<connector-name> branch and force pushes the modified files to it. (CI disabled)
    • Open/update a PR .
    • Update the connector changelog with the created PR numbers
    • Force pushes all the modified files on the connector (with CI enabled + auto-merge label if the --auto-merge option is passed).

Review guide

* The up-to-date pipeline logic is the most important part of this PR. Everything else is basically code cleaning and slight re-architecture.

  • The workflow which will automatically create the PRs is there. It's meant to run on a daily basis. We have ~300 python connectors that we want to auto update. A single connector update flow takes ~2mn. So I expect this workflow to run in ~10 hours. This is why I plan to schedule it daily. But there might be some scheduling adjustment to make so that it coordinates well with the auto-merge daily run.

Demo

I manually ran the workflow from this branch. (It's not done yet and I'll monitor if it can correctly open PRs for our 300 connectors in a reasonable amount of time).
It created these PRs.
I disabled the auto-merge label for testing.

User Impact

Not much. Some command names (using kebab case) and options changed but the documentation has been updated.

Can this PR be safely reverted and rolled back?

  • YES 💚
  • NO ❌

Copy link

vercel bot commented Jun 19, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
airbyte-docs ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jun 21, 2024 9:07am

@octavia-squidington-iii octavia-squidington-iii added the area/documentation Improvements or additions to documentation label Jun 19, 2024
Copy link
Contributor Author

This stack of pull requests is managed by Graphite. Learn more about stacking.

Join @alafanechere and the rest of your teammates on Graphite Graphite

@alafanechere alafanechere force-pushed the augustin/06-17-airbyte-ci_productionize_up_to_date branch from c7631da to b8aba10 Compare June 19, 2024 17:26
@octavia-squidington-iii octavia-squidington-iii removed the area/documentation Improvements or additions to documentation label Jun 19, 2024
@alafanechere alafanechere force-pushed the augustin/06-17-airbyte-ci_productionize_up_to_date branch 2 times, most recently from 9c874f5 to eb5b545 Compare June 19, 2024 21:04
@@ -58,11 +58,11 @@ def download_catalog(catalog_url):


OSS_CATALOG = download_catalog(OSS_CATALOG_URL)
METADATA_FILE_NAME = "metadata.yaml"
Copy link
Contributor Author

Choose a reason for hiding this comment

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

It was declared twice

@@ -58,7 +56,6 @@ async def bump_version(
ctx.obj["execute_timeout"],
bump_type,
changelog_entry,
pull_request_number,
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Going "unix style" here: the bump command just bumps version / changelog, it does not open PRs; the pull requests command can be used sequentially following a version bump.

from pipelines.models.steps import Step, StepResult, StepStatus

if TYPE_CHECKING:
from anyio import Semaphore


def get_bumped_version(version: str | None, bump_type: str) -> str:
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Moved this to the BumpConnectorVersion step

@@ -79,202 +60,11 @@ async def _cleanup(self) -> StepResult:
return StepResult(step=self, status=StepStatus.SUCCESS)


class AddChangelogEntry(Step):
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Moved this to pipelines.airbyte_ci.steps.changelog as it's a step reused between multiple commands.

)


class SetConnectorVersion(Step):
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Moved to pipelines.airbyte_ci.steps.bump_version

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Adopting consistent kebab casing for connectors subcommands

Comment on lines -82 to -84
pull_request_number,
changelog,
bump,
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Going unix style: the bump and pull request pr can be used after this command if needed.


from anyio import Semaphore


class UpgradeBaseImageMetadata(Step):
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Moved to pipelines.airbyte_ci.steps.base_image

@alafanechere alafanechere force-pushed the augustin/06-17-airbyte-ci_productionize_up_to_date branch 3 times, most recently from 6af37db to f648f51 Compare June 20, 2024 07:14
@alafanechere alafanechere force-pushed the augustin/06-17-airbyte-ci_productionize_up_to_date branch 7 times, most recently from 51a7203 to e431f7b Compare June 20, 2024 08:18
changelog.add_entry(semver.VersionInfo.parse("3.4.0"), datetime.date.fromisoformat("2024-03-01"), 123456, "test1")
changelog.add_entry(semver.VersionInfo.parse("3.4.0"), datetime.date.fromisoformat("2024-03-01"), 123457, "test2")
check_result(changelog, "dupicate_version_date_" + filename)
# This test is disabled because the current implementation allows inserting non number PR numbers.
Copy link
Contributor Author

Choose a reason for hiding this comment

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

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 made the command name casing consistent: use kebab-case everywhere instead of a mix of kebab and snake.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Import cleaning following poe lint --fix

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Simplified this command: it does not bump the connector version. Use bump-version command for that

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 was a set of checks performed on the connector following updates. Now that updates are automated I believe it's CI role to validate the updates are valid, it should not be done by the up-to-date pipeline itself

@alafanechere alafanechere changed the title airbyte-ci: productionize up to date airbyte-ci: productionize up-to-date 🧹 + 🚀 Jun 20, 2024
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Deleted as upgrade_base_image is now part of the up-to-date command

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Deleted as upgrade_base_image is now part of the up-to-date command

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Deleted as upgrade_base_image is now part of the up-to-date command

@alafanechere alafanechere force-pushed the augustin/06-17-airbyte-ci_productionize_up_to_date branch from e431f7b to edc9da8 Compare June 20, 2024 08:59
@alafanechere alafanechere marked this pull request as ready for review June 20, 2024 09:00
@alafanechere alafanechere requested a review from a team as a code owner June 20, 2024 09:00
@alafanechere alafanechere force-pushed the augustin/06-17-airbyte-ci_productionize_up_to_date branch 3 times, most recently from a0f72b1 to e781c80 Compare June 20, 2024 10:45
@octavia-squidington-iii octavia-squidington-iii added the area/documentation Improvements or additions to documentation label Jun 20, 2024
Copy link
Contributor

@bleonard bleonard left a comment

Choose a reason for hiding this comment

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

exciting. I'm a bit curious to see it to:

  • make a PR
  • master changes in lots of ways
  • update the PR

I expected to see something like a force push or using the master branch as the base_ref in the PR code. I had some crazy-long comment about that before that I can't find.

Anyway, be on the lookout for that.

@alafanechere
Copy link
Contributor Author

I had some crazy-long comment about that before that I can't find.

@bleonard I removed it because I "resolved" it:

  • When the worfklow runs it checkouts the current master head.
  • If an up-to-date branch / PR exists for the connector it will force push modification to it and update titles.

@alafanechere alafanechere force-pushed the augustin/06-17-airbyte-ci_productionize_up_to_date branch from e781c80 to dc398e9 Compare June 21, 2024 09:03
@alafanechere alafanechere enabled auto-merge (squash) June 21, 2024 09:15
@alafanechere alafanechere merged commit 9eb248f into master Jun 21, 2024
30 checks passed
@alafanechere alafanechere deleted the augustin/06-17-airbyte-ci_productionize_up_to_date branch June 21, 2024 09:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/documentation Improvements or additions to documentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants