-
Notifications
You must be signed in to change notification settings - Fork 40
Add a check to the frontend to make sure that generated files are tracked or fails the build #1761
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
Add a check to the frontend to make sure that generated files are tracked or fails the build #1761
Conversation
…e build Signed-off-by: Peter Nied <[email protected]>
Signed-off-by: Peter Nied <[email protected]>
…racked Signed-off-by: Peter Nied <[email protected]>
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.
Thank you for these changes. I have a few minor NITs
|
||
commandLine 'bash', '-c', ''' | ||
changed=$(git diff --name-only -- frontend/src/generated/) | ||
untracked=$(git ls-files --others --exclude-standard -- frontend/src/generated/) |
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.
Script will check for diff
and untracked
files, which is good. How will we handle cases where new generated files are added ?
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.
If the are part of a commit on the branch they will not fail in either of these checks. The nature of the problem is that there were api changes and they didn't got through code review but instead were automatically picked up during the auto-generation process.
changed=$(git diff --name-only -- frontend/src/generated/) | ||
untracked=$(git ls-files --others --exclude-standard -- frontend/src/generated/) | ||
if [ -n "$changed$untracked" ]; then | ||
echo "Error: Unstaged or untracked files under frontend/src/generated/:" |
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.
Can we modify the error message to be something like "Please commit the following generated files:..."
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.
Updated response to include resolution message
> Task :frontend:checkGeneratedFilesTracked FAILED
Error: Unstaged or untracked files under frontend/src/generated/:
frontend/src/generated/api/types.gen.ts
Please run ./gradlew frontend:generateBackendClient and commit the updated files
Signed-off-by: Peter Nied <[email protected]>
…racked Signed-off-by: Peter Nied <[email protected]>
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.
Thank you for these changes
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1761 +/- ##
============================
============================
☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Description
Add a check to the frontend to make sure that generated files are tracked or fails the build
Issues
Check List
Public documentation issue/PR created, if applicable.By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.