-
Notifications
You must be signed in to change notification settings - Fork 33
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
feat(KONFLUX-4136): new reduce-snapshot script #1968
feat(KONFLUX-4136): new reduce-snapshot script #1968
Conversation
scoheb
commented
Sep 17, 2024
- add new script to ec-cli image
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #1968 +/- ##
=======================================
Coverage 74.11% 74.11%
=======================================
Files 88 88
Lines 5729 5729
=======================================
Hits 4246 4246
Misses 1483 1483
Flags with carried forward coverage won't be shown. Click here to find out more. |
SNAPSHOT=$(echo "$REDUCED_SNAPSHOT" | tr -d ' ' | tr -d '\n') | ||
echo "$SNAPSHOT" > "${SNAPSHOT_PATH}" |
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.
Might be dangerous if any of the keys or values in the JSON contain the space character, why not something like this:
SNAPSHOT=$(echo "$REDUCED_SNAPSHOT" | tr -d ' ' | tr -d '\n') | |
echo "$SNAPSHOT" > "${SNAPSHOT_PATH}" | |
echo "$SNAPSHOT" | jq -c . > "${SNAPSHOT_PATH}" |
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.
fixed. 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.
I see this now:
echo "$REDUCED_SNAPSHOT" | jq .
SNAPSHOT=$(echo "$REDUCED_SNAPSHOT" | tr -d ' ' | tr -d '\n')
echo "$SNAPSHOT" | jq -c . > "${SNAPSHOT_PATH}"
I think @zregvart meant this:
# for displaying
echo "$REDUCED_SNAPSHOT" | jq .
# for saving
echo "$REDUCED_SNAPSHOT" | jq -c . > "${SNAPSHOT_PATH}"
Honestly, I would just do something like this:
echo "$REDUCED_SNAPSHOT" | jq '.' | tee "${SNAPSHOT_PATH}"
I don't really think we need to save the reduced snapshot as a compacted json.
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.
ok adjusted. but I seem to remember an issue whereby I needed to remove the line feeds...
- add new script to ec-cli image Signed-off-by: Scott Hebert <[email protected]>
433ef38
to
1e10232
Compare
/ok-to-test |
@@ -72,6 +72,9 @@ COPY --from=build "/build/dist/ec_${TARGETOS}_${TARGETARCH}" /usr/local/bin/ec | |||
# Copy the one kubectl binary that can run in this container | |||
COPY --from=build "/build/dist/kubectl_${TARGETOS}_${TARGETARCH}" /usr/local/bin/kubectl | |||
|
|||
# Copt reduce-snapshot script needed for single component mode | |||
COPY hack/reduce-snapshot.sh /usr/local/bin |
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.
For tidiness I'd probably suggest:
COPY --from=build /build/hack/reduce-snapshot.sh /usr/local/bin
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.
(Not super important, also I realize I'm too slow and its merged already.)