Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions test/e2e/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,12 @@ SRC_DIR="$(cd $(dirname "${BASH_SOURCE[0]}") && pwd)"

${SRC_DIR}/cleanup.sh
${SRC_DIR}/setup-kubeflex.sh --release "${release}"
cfgfile="${KUBECONFIG:-$HOME/.kube/config}"
if [[ "$(yq -o=json .extensions "$cfgfile" )" =~ ^[[] ]]; then
Copy link

Copilot AI Dec 21, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The regex pattern ^[[] is incorrect for checking if extensions is an array. The pattern has an unmatched opening bracket and will only match a literal '[' at the start. Use ^\[ instead to properly escape the bracket, or use yq to check the type directly with a command like yq '.extensions | type' \"$cfgfile\".

Copilot uses AI. Check for mistakes.
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not seeing the alleged results from type. I will stick with string matching.

mspreitz@mjs13 kubeflex % yq '.extensions | type' ~/.kube/config
!!seq
mspreitz@mjs13 kubeflex % yq '.extensions ' ~/.kube/config 
[]
mspreitz@mjs13 kubeflex % yq '.extension | type ' ~/.kube/config
!!null

yq '.extensions |= [ .[] | select(.name != "kubeflex") ]' "$cfgfile" > $$
mv -f -- "$cfgfile" "${cfgfile}.bak"
mv -- $$ "$cfgfile"
Comment on lines +51 to +53
Copy link

Copilot AI Dec 21, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using $$ (current shell PID) as a temporary filename creates a potential race condition if multiple instances run concurrently. Consider using mktemp to create a unique temporary file instead.

Suggested change
yq '.extensions |= [ .[] | select(.name != "kubeflex") ]' "$cfgfile" > $$
mv -f -- "$cfgfile" "${cfgfile}.bak"
mv -- $$ "$cfgfile"
tmpfile="$(mktemp "${cfgfile}.XXXXXX")"
yq '.extensions |= [ .[] | select(.name != "kubeflex") ]' "$cfgfile" > "$tmpfile"
mv -f -- "$cfgfile" "${cfgfile}.bak"
mv -- "$tmpfile" "$cfgfile"

Copilot uses AI. Check for mistakes.
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are not multiple concurrent instaces. This is not a problem.

fi
${SRC_DIR}/manage-type-k8s.sh
${SRC_DIR}/manage-type-vcluster.sh
${SRC_DIR}/manage-type-external.sh
Expand Down