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

Exit CD when fail for a variety of reasons #34128

Merged
merged 1 commit into from
Oct 27, 2023

Conversation

jaykishanmutkawoa
Copy link
Contributor

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

@hashicorp-cla
Copy link

hashicorp-cla commented Oct 24, 2023

CLA assistant check
All committers have signed the CLA.

@crw
Copy link
Contributor

crw commented Oct 24, 2023

@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!

@crw
Copy link
Contributor

crw commented Oct 27, 2023

Hi @jaykishanmutkawoa, if you sign the CLA we are willing to merge this change. Thanks!

@crw crw added the waiting-response An issue/pull request is waiting for a response from the community label Oct 27, 2023
@jaykishanmutkawoa
Copy link
Contributor Author

Hi @jaykishanmutkawoa, if you sign the CLA we are willing to merge this change. Thanks!

done.. thanks

Copy link
Contributor

@crw crw left a 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

@crw crw merged commit 2867f63 into hashicorp:main Oct 27, 2023
@crw crw removed the waiting-response An issue/pull request is waiting for a response from the community label Oct 27, 2023
@github-actions
Copy link
Contributor

Reminder for the merging maintainer: if this is a user-visible change, please update the changelog on the appropriate release branch.

@kmoe
Copy link
Member

kmoe commented Dec 4, 2023

@jaykishanmutkawoa Are you using this script in your Terraform workflow?

Copy link
Contributor

github-actions bot commented Jan 4, 2024

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.
If you have found a problem that seems related to this change, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jan 4, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants