-
Notifications
You must be signed in to change notification settings - Fork 325
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
hack/bin/integration-cleanup.sh: Use jq magic instead of bash #1432
Conversation
For some reason the the bash expression to calculate time fails in CI and helm now supports outputting json, so I swapped bash magic with jq magic. It more robust, hopefully it is also more understandable.
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
) | ||
| select ( .parsedTime < (now - 3 * 60 * 60)) | ||
| [.name, .namespace] | ||
| @tsv |
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.
question: why tabs?
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 think jq can either output a json array, a csv or a tsv. Out of these I thought tsv was the most compatible with bash as I can awk '{print $1}'
. Do you have a better idea?
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 just stumbled upon it and was curious, as FS
usually defaults to space.
date_s=$(date_seconds "$date_str") | ||
diff=$(( $date_now - $date_s )) | ||
if [ $diff -ge 7200 ]; then | ||
echo "test release '$name' older than 2 hours; deleting..." |
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.
wanna keep that echo statement in some modified form?
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.
There were some problems with the script still
- it errors if
releases
is an empty string:
./hack/bin/integration-cleanup.sh
test release '' older than 2 hours; deleting...
Error: uninstall: Release name is invalid:
I added a commit which should fix that.
The tests are failing because this incorrectly deletes releases deployed less than 2 hours ago, I will look into that. |
Maybe I was a fool to assume jq is safer than bash 😢 c225f41 |
All green now, it seems! |
For some reason the the bash expression to calculate time fails in CI and helm
now supports outputting json, so I swapped bash magic with jq magic. It more
robust, hopefully it is also more understandable.