-
Notifications
You must be signed in to change notification settings - Fork 9.7k
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
Exit CD when fail for a variety of reasons #34128
Conversation
@jaykishanmutkawoa thanks for this submission! We do not normally accept contributions to the build scripts. However, I will check in the triage meeting if this is something we would want to change. Just a reminder to please sign the CLA to have your submission considered for a potential merge. Thanks! |
Hi @jaykishanmutkawoa, if you sign the CLA we are willing to merge this change. Thanks! |
49bea2c
to
f21d34a
Compare
done.. thanks |
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, after conversation with @liamcervante
Reminder for the merging maintainer: if this is a user-visible change, please update the changelog on the appropriate release branch. |
@jaykishanmutkawoa Are you using this script in your Terraform workflow? |
I'm going to lock this pull request because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active contributions. |
cd
can fail for a variety of reasons: misspelled paths, missing directories, missing permissions, broken symlinks and more.If/when it does, the script will keep going and do all its operations in the wrong directory. This can be messy, especially if the operations involve creating or deleting a lot of files. To avoid this, make sure you handle the cases when cd fails. Ways to do this include:
cd foo || exit
as suggested to abort immediately, using exit code from failed cd command