From 2eb7770519c7dff2d5e803c73197b840f153dc71 Mon Sep 17 00:00:00 2001 From: Oliver Simons Date: Fri, 26 Sep 2025 06:05:35 +0200 Subject: [PATCH] fix(devcontainer): Export KREW_PATH to fish shell (#40021) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit **Description** This allow us to actually use krew and installed plugins from fish shells inside our devcontainer **โš™๏ธ Type of change** - [ ] โš™๏ธ Feature/App addition - [x] ๐Ÿช› Bugfix - [ ] โš ๏ธ Breaking change (fix or feature that would cause existing functionality to not work as expected) - [ ] ๐Ÿ”ƒ Refactor of current code - [ ] ๐Ÿ“œ Documentation Changes **๐Ÿงช How Has This Been Tested?** On local vs-code install, I was hitting ``` talos_clustertool on ๎‚  main [$] โฌข [Docker] โฏ kubectl krew error: unknown command "krew" for "kubectl" talos_clustertool on ๎‚  main [$] โฌข [Docker] โฏ kubectl pv-mounter error: unknown command "pv-mounter" for "kubectl" ``` before fix inside a devcontainer. After exporting the krew path to fish, we can find the installed plugins. ``` talos_clustertool on ๎‚  main [!] โฌข [Docker] โฏ kubectl pv-mounter pv-mounter is a kubectl plugin that allows you to easily mount and unmount Kubernetes PersistentVolumeClaims (PVCs) locally via SSHFS. It transparently manages proxy pods, ephemeral containers, port-forwarding, and SSHFS connections. ... ``` **๐Ÿ“ƒ Notes:** Not sure if relevant, but I used: ``` (base) โžœ truecharts git:(orippler/export_krew_path_to_fish) code --version 1.104.1 0f0d87fa9e96c856c5212fc86db137ac0d783365 x64 ``` on Ubuntu 22.04 **โœ”๏ธ Checklist:** - [ ] โš–๏ธ My code follows the style guidelines of this project - [x] ๐Ÿ‘€ I have performed a self-review of my own code - [ ] #๏ธโƒฃ I have commented my code, particularly in hard-to-understand areas - [ ] ๐Ÿ“„ I have made changes to the documentation - [ ] ๐Ÿงช I have added tests to this description that prove my fix is effective or that my feature works - [ ] โฌ†๏ธ I increased versions for any altered app according to semantic versioning - [x] I made sure the title starts with `feat(chart-name):`, `fix(chart-name):`, `chore(chart-name):`, `docs(chart-name):` or `fix(docs):` **โž• App addition** If this PR is an app addition please make sure you have done the following. - [ ] ๐Ÿ–ผ๏ธ I have added an icon in the Chart's root directory called `icon.png` --- _Please don't blindly check all the boxes. Read them and only check those that apply. Those checkboxes are there for the reviewer to see what is this all about and the status of this PR with a quick glance._ --- .devcontainer/postCreateCommand.sh | 5 ++++- .../generic/root/DOTREPLACEdevcontainer/postCreateCommand.sh | 5 ++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/.devcontainer/postCreateCommand.sh b/.devcontainer/postCreateCommand.sh index 0ec4bff56ab..a9fd3ab7ae2 100755 --- a/.devcontainer/postCreateCommand.sh +++ b/.devcontainer/postCreateCommand.sh @@ -22,7 +22,10 @@ fisher install PatrickF1/fzf.fish ./"${KREW}" install krew ) -export PATH="${KREW_ROOT:-$HOME/.krew}/bin:$PATH" +KREW_PATH="${KREW_ROOT:-$HOME/.krew}/bin" +export PATH="$KREW_PATH:$PATH" +# add KREW_PATH to fish shell path +/usr/bin/fish -c "fish_add_path $KREW_PATH" kubectl krew install pv-mounter kubectl krew install cnpg diff --git a/clustertool/embed/generic/root/DOTREPLACEdevcontainer/postCreateCommand.sh b/clustertool/embed/generic/root/DOTREPLACEdevcontainer/postCreateCommand.sh index 0ec4bff56ab..a9fd3ab7ae2 100755 --- a/clustertool/embed/generic/root/DOTREPLACEdevcontainer/postCreateCommand.sh +++ b/clustertool/embed/generic/root/DOTREPLACEdevcontainer/postCreateCommand.sh @@ -22,7 +22,10 @@ fisher install PatrickF1/fzf.fish ./"${KREW}" install krew ) -export PATH="${KREW_ROOT:-$HOME/.krew}/bin:$PATH" +KREW_PATH="${KREW_ROOT:-$HOME/.krew}/bin" +export PATH="$KREW_PATH:$PATH" +# add KREW_PATH to fish shell path +/usr/bin/fish -c "fish_add_path $KREW_PATH" kubectl krew install pv-mounter kubectl krew install cnpg