-
Notifications
You must be signed in to change notification settings - Fork 5
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
fix: added packer plugin section & improved error handling logic #26
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.
Just a minor concern but not a show stopper.
|
||
if [ -z "$CACHE_EXISTS" ]; then | ||
if [[ $CACHE_OUTPUT == *"/packer_cache was not found"* ]]; then |
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 feels a bit too brittle. I thought we were using $?
to check the command's exit code 🤔
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.
The exit code approach unfortunately doesn't work as it would just generically return a 1 when it cannot find packer cache. Nor does the error itself have an error code :/ :
69879bff6947:/# govc datastore.ls -ds=$vcenter_datastore /packer_cache
govc: file [vsanDatastore2]/packer_cache was not found
69879bff6947:/# echo $?
1
I also tried listing the output of govc datastore.ls -ds=$vcenter_datastore
and see if we can find packer pache in the output, but that doesn't work either because it does not return the actual directory names and only UIDs:
govc datastore.ls -ds=$vcenter_datastore
a34c2465-4c1b-0503-107a-0cc47a7e0192
16643364-3f04-2d05-33ba-0cc47a92e4f2
fd763664-3f6d-d105-bc5e-0cc47a92e4f2
I can't really think another way now to distinguish a not found error versus other errors besides using the error message now
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.
I decided to have the user access the datastore first and if they have problem listing directories then it must be other issues. and if they can list directories but just cannot find the packer cache directory, then it must be that the directory doesn't exist.
🎉 This PR is included in version 1.0.10 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |
Describe the Change
This PR added the packer plugin section to the address a build error arising from a packer feature deprecation. Also improves the bash script error handling logic so that the build process does not error out when it shouldn't.
Review Changes
🎫 Jira Ticket