Skip to content

Conversation

@MikeSpreitzer
Copy link
Contributor

Summary

Work around #597

Related issue(s)

Fixes #

@kubestellar-prow kubestellar-prow bot added dco-signoff: yes Indicates the PR's author has signed the DCO. size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. labels Dec 20, 2025
@MikeSpreitzer MikeSpreitzer force-pushed the ctx-workaround-in-e2e branch 2 times, most recently from 3c0457e to 78b51c3 Compare December 20, 2025 23:56
@MikeSpreitzer
Copy link
Contributor Author

/cc @pdettori

@kubestellar-prow kubestellar-prow bot requested a review from pdettori December 21, 2025 00:06
@MikeSpreitzer
Copy link
Contributor Author

@shivansh-source

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR adds a workaround to the E2E test suite to address a context-related bug (#597) by cleaning up kubeflex extensions from the kubeconfig file before running tests.

Key Changes

  • Adds kubeconfig manipulation logic to remove kubeflex extensions from the config file
  • Includes a commented-out alternative command for context management

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +39 to +53
yq '.extensions |= [ .[] | select(.name != "kubeflex") ]' "$cfgfile" > $$
mv -f -- "$cfgfile" "${cfgfile}.bak"
mv -- $$ "$cfgfile"
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.

test/e2e/run.sh Outdated

${SRC_DIR}/cleanup.sh
${SRC_DIR}/setup-kubeflex.sh
kubectl config current-context
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.

This command's output is not captured or used. If this is for debugging purposes, consider redirecting to stderr or removing if not needed.

Suggested change
kubectl config current-context
kubectl config current-context >&2

Copilot uses AI. Check for mistakes.
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated 1 comment.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

${SRC_DIR}/cleanup.sh
${SRC_DIR}/setup-kubeflex.sh
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

@MikeSpreitzer MikeSpreitzer force-pushed the ctx-workaround-in-e2e branch from 1765514 to b7b5954 Compare January 5, 2026 07:55
@kubestellar-prow kubestellar-prow bot added the lgtm Indicates that a PR is ready to be merged. label Jan 5, 2026
@kubestellar-prow
Copy link
Contributor

LGTM label has been added.

DetailsGit tree hash: 28f6b10aeefbde17f05e6b2c5f5eb6757714650a

@MikeSpreitzer
Copy link
Contributor Author

/approve

@kubestellar-prow
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: MikeSpreitzer

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@kubestellar-prow kubestellar-prow bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jan 6, 2026
@kubestellar-prow kubestellar-prow bot merged commit ec5e731 into kubestellar:main Jan 6, 2026
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. dco-signoff: yes Indicates the PR's author has signed the DCO. lgtm Indicates that a PR is ready to be merged. size/XS Denotes a PR that changes 0-9 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants