-
Notifications
You must be signed in to change notification settings - Fork 4.5k
airbyte-ci: format perf improvement + exit 1 when modified files #33097
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: format perf improvement + exit 1 when modified files #33097
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎ 1 Ignored Deployment
|
Current dependencies on/for this PR: This stack of pull requests is managed by Graphite. |
8369ede
to
cef58a8
Compare
if: always() | ||
run: git ls-files -i -c --exclude-from=.gitignore | xargs -r git rm --cached | ||
|
||
- name: Commit Formatting Changes (PR) | ||
uses: stefanzweifel/git-auto-commit-action@v5 | ||
# do not commit if master branch | ||
if: github.ref != 'refs/heads/master' | ||
if: github.ref != 'refs/heads/master' && always() | ||
with: | ||
commit_message: Automated Commit - Formatting Changes | ||
commit_user_name: Octavia Squidington III | ||
commit_user_email: [email protected] | ||
|
||
- name: Run airbyte-ci format check all | ||
if: always() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We have to add this condition now that airbyte-ci format fix all
exits with status code 1 if files were modified.
We'll soon only run check
on PRs so this file will likely be removed and replaced by format_check.yml
on PRs
airbyte-ci/connectors/pipelines/pipelines/airbyte_ci/format/containers.py
Outdated
Show resolved
Hide resolved
airbyte-ci/connectors/pipelines/pipelines/airbyte_ci/format/containers.py
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Replaced by commands.py
a level higher.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM modulo fixing a very minor bug that adds *.groovy source files instead of *.grade.
My review is somewhat superficial and doesn't look into the airbyte-ci structure changes too much, but I didn't notice anything shocking. I figure that the correctness of this change is straightforward for you to validate on your end.
airbyte-ci/connectors/pipelines/pipelines/airbyte_ci/format/configuration.py
Outdated
Show resolved
Hide resolved
2b2f3b9
to
be9d671
Compare
a4bd53a
to
346c554
Compare
e3ace0e
to
e92b61d
Compare
e92b61d
to
37f2b9c
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a great improvement!
There are only a few small changes I think we should make.
The only blocking one is how we define our cache keys.
airbyte-ci/connectors/pipelines/pipelines/airbyte_ci/format/configuration.py
Show resolved
Hide resolved
airbyte-ci/connectors/pipelines/pipelines/airbyte_ci/format/configuration.py
Show resolved
Hide resolved
airbyte-ci/connectors/pipelines/pipelines/airbyte_ci/format/containers.py
Outdated
Show resolved
Hide resolved
airbyte-ci/connectors/pipelines/pipelines/airbyte_ci/format/containers.py
Outdated
Show resolved
Hide resolved
airbyte-ci/connectors/pipelines/pipelines/airbyte_ci/format/format_command.py
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great refactor. Nothing blocking from me!
airbyte-ci/connectors/pipelines/pipelines/airbyte_ci/format/format_command.py
Outdated
Show resolved
Hide resolved
airbyte-ci/connectors/pipelines/pipelines/airbyte_ci/format/configuration.py
Outdated
Show resolved
Hide resolved
airbyte-ci/connectors/pipelines/tests/test_format/test_commands.py
Outdated
Show resolved
Hide resolved
Thanks for the review @erohmensing ! I'll push the your suggestions
I created https://github.com/airbytehq/airbyte-internal-issues/issues/2763 . I agree it's indeed something we shall consider. I don't think it's pressing though and we could revisit the interface when we'll want to add linting. |
@bnchrch about the cache keys:
|
c753e8f
to
b55ef13
Compare
b55ef13
to
e1d8e65
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
airbyte-ci/connectors/pipelines/pipelines/airbyte_ci/format/containers.py
Outdated
Show resolved
Hide resolved
e1d8e65
to
8c7d2f0
Compare
089465f
to
b078259
Compare
Will merge without CI checks as the binary used for them is the one from
The |
Suspect IssuesThis pull request was deployed and Sentry observed the following issues:
Did you find this useful? React with a 👍 or 👎 |
What
Relates to #32935
As we want developers to adopt
airbyte-ci format fix
locally it has to:How
This PR refactors the
format
command significantly:fix
andcheck
run the same command in containers: it will guarantee that formatting errors thrown by check can always be fixed. We also improve caching, as it's the same command afix
following acheck
will reuse the same docker layer. The single difference betweencheck
andfix
is thatfix
exports modified files back to the file system.Avoid code duplication at subcommand declaration and centralize the formatters configurations in a single module
Only exports back to the host the modified files by diffing the original repo dir state and the formatted code. It makes the
export
operation fasterExit with
1
status code whenfix
is modifying files: this is a requirement to wrap this command in a future pre-push hook to avoid pushing unformatted codeLeverage internal caching in formatters with caching abilities (
prettier
andblack
): it leads to a significant boost for prettier: 8seconds vs 30s.Outcome
airbyte-ci format fix all
runs in ~30s once you pulled the images.NB
airbyte-ci test
command to run the formatting tests.