-
Notifications
You must be signed in to change notification settings - Fork 2k
fix: ensure all retry.sh failures fail exit 1 #4037
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
Conversation
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.
Hello @glasnt, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!
Summary of Changes
This pull request addresses an issue where the retry.sh script was not exiting with a non-zero exit code when the maximum number of retries was exceeded. This could lead to incorrect behavior in automated systems that rely on the exit code to determine the success or failure of a command. To fix this, I've updated the retry.sh script in two different directories to explicitly exit with code 1 when the maximum number of retries is reached.
Highlights
- Bug Fix: Ensures
retry.shscript exits with a non-zero exit code (1) when retries are exhausted. - Improved Reliability: Corrects the exit behavior of
retry.shto properly signal failures in automated processes.
Changelog
- run/markdown-preview/editor/test/retry.sh
- Modified the script to exit with code 1 when the maximum number of retries is reached. Specifically, line 62 was changed from
exittoexit 1.
- Modified the script to exit with code 1 when the maximum number of retries is reached. Specifically, line 62 was changed from
- run/markdown-preview/renderer/test/retry.sh
- Modified the script to exit with code 1 when the maximum number of retries is reached. Specifically, line 62 was changed from
exittoexit 1.
- Modified the script to exit with code 1 when the maximum number of retries is reached. Specifically, line 62 was changed from
Using Gemini Code Assist
The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.
Invoking Gemini
You can request assistance from Gemini at any point in your pull request via creating an issue comment (i.e. comment on the pull request page) using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands.
| Feature | Command | Description |
|---|---|---|
| Code Review | /gemini review |
Performs a code review for the current pull request in its current state. |
| Pull Request Summary | /gemini summary |
Provides a summary of the current pull request in its current state. |
| Comment | @gemini-code-assist | Responds in comments when explicitly tagged, both in issue comments and review comments. |
| Help | /gemini help |
Displays a list of available commands. |
Customization
To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.
Limitations & Feedback
Gemini Code Assist is currently in preview and may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments to provide feedback.
You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.
Did you know?
The #!/bin/sh shebang line at the beginning of a shell script tells the operating system which interpreter to use to execute the script. It's not just for sh; you can use #!/usr/bin/python3 or #!/usr/bin/env node for Python or Node.js scripts, respectively.
Footnotes
-
Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution. ↩
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.
Code Review
This pull request ensures that the retry.sh script exits with a non-zero exit code when the maximum number of retries is exceeded. This is crucial for proper error handling in automated scripts and build pipelines. The change is straightforward and addresses the identified issue.
Merge Readiness
The changes are simple and effective in addressing the identified issue. The pull request is ready to be merged, as it ensures correct error handling in the retry.sh script. I am unable to directly approve the pull request, and recommend that others review and approve this code before merging.
| echo "Attempt $attempt_num / $max_attempts failed! No more retries left!" | ||
| exit | ||
| exit 1 |
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.
Adding exit 1 here ensures that the script returns a failure status when all retries are exhausted. This is important for signaling to calling scripts that the operation failed after multiple attempts.
Consider adding a comment explaining why exit 1 is used here for clarity.
| echo "Attempt $attempt_num / $max_attempts failed! No more retries left!" | |
| exit | |
| exit 1 | |
| exit 1 # Exit with a non-zero status code to indicate failure after max retries |
| echo "Attempt $attempt_num / $max_attempts failed! No more retries left!" | ||
| exit | ||
| exit 1 |
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.
Similar to the other retry.sh file, adding exit 1 here is essential for proper error signaling. A non-zero exit code indicates that the retried operation ultimately failed.
Consider adding a comment explaining why exit 1 is used here for clarity.
| echo "Attempt $attempt_num / $max_attempts failed! No more retries left!" | |
| exit | |
| exit 1 | |
| exit 1 # Exit with a non-zero status code to indicate failure after max retries |
iennae
left a comment
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.
noticing linting is failing for unchanged files; is that intentional behavior?
|
It's running lint on the entire changed packages. Looks like both The previous linter ran gts lint fix first and then ran the linter, so all the automatically fixable lint issues were hidden. So a lot of packages actually have lint issues, it's just that the previous linter basically ignored them. We can bring back the behavior of lint fix first, but those fixes will not get merged, they will just mask actual existing issues before actually checking. It might be easier to just run |
* fix: ensure all retry.sh failures fail exit 1 * auto format * Format Document * revert Format Document (does not match gts) * manual gts lint --------- Co-authored-by: Jennifer Davis <[email protected]>
Description
Identified in https://github.com/GoogleCloudPlatform/nodejs-docs-samples/pull/3985/files#diff-86f605e760c2507e13cf901bc344431a78deb5dbd16c6e94726a76affe9a9bb1R62
Ensures all copies of
retry.shuse the correct exit code to correctly fail when retries exceeded.