Skip to content
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

fix: Fixed krew installation messing up the path variable #106

Merged
merged 3 commits into from
Dec 19, 2023
Merged
Show file tree
Hide file tree
Changes from 2 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
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ on:
- pull_request

env:
GOSSVERSION: v0.3.21
GOSSVERSION: v0.4.4

jobs:
test:
Expand Down
2 changes: 2 additions & 0 deletions feature/krew/goss.fish/.env
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
KREW_PLUGINS=example
USE_fish=yes
Empty file.
17 changes: 17 additions & 0 deletions feature/krew/goss.fish/goss.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
command:
krew:
exec: "/home/cloudcontrol/.krew/bin/kubectl-krew version"
exit-status: 0
stdout:
- "/home/cloudcontrol/.krew"
krew-plugins:
exec: "/home/cloudcontrol/.krew/bin/kubectl-krew list"
exit-status: 0
stdout:
- "example"
path-includes-home:
exec: "PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/home/cloudcontrol/bin && fish -c 'echo $PATH'"
exit-status: 0
stdout:
- "/home/cloudcontrol/bin"
- "/home/cloudcontrol/.krew/bin"
6 changes: 6 additions & 0 deletions feature/krew/goss/goss.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,9 @@ command:
exit-status: 0
stdout:
- "example"
path-includes-home:
exec: "PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin && . /usr/local/bin/cloudcontrol run && . /home/cloudcontrol/.bashrc && echo $PATH"
exit-status: 0
stdout:
- "/home/cloudcontrol/bin"
- "/home/cloudcontrol/.krew/bin"
4 changes: 2 additions & 2 deletions feature/krew/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,11 @@ fi
if [[ $(cat /home/cloudcontrol/.shell) == "fish" ]]
then
cat <<EOF >> ~/.config/fish/conf.d/krew.fish
set -gx PATH $PATH $HOME/.krew/bin
set -gx PATH \$PATH \$HOME/.krew/bin
EOF
else
cat <<EOF >> /home/cloudcontrol/.bashrc
export PATH="${KREW_ROOT:-$HOME/.krew}/bin:$PATH"
export PATH="\${KREW_ROOT:-\$HOME/.krew}/bin:\$PATH"
EOF
fi

Expand Down
24 changes: 18 additions & 6 deletions internal/tests/lib/testRunner.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,12 @@ func TestFeature(feature Feature, testBed TestBed, containerAdapter container.Ad
return fmt.Errorf("error chmodding temporary directory to 0777: %w", err)
}
defer func() {
if err := os.RemoveAll(testDir); err != nil {
panic(fmt.Errorf("can not remove temporary directory: %w", err))
if cleanup || !hasProblems {
if err := os.RemoveAll(testDir); err != nil {
panic(fmt.Errorf("can not remove temporary directory: %w", err))
}
} else {
logrus.Infof("Not removing temporary directory %s because cleanup wasn't enabled.", testDir)
}
}()
logrus.Debugf("Preparing test suite in %s", testDir)
Expand Down Expand Up @@ -237,12 +241,16 @@ func TestFeature(feature Feature, testBed TestBed, containerAdapter container.Ad
containerId,
[]string{
"/goss/goss",
"-g",
"--gossfile",
"/goss/goss.yaml",
"--loglevel",
"DEBUG",
"validate",
"--color",
"--format",
"documentation",
"--format-options",
"verbose",
"--no-color",
},
); err != nil {
if mightFail {
Expand Down Expand Up @@ -480,12 +488,16 @@ func IntegrationTests(features []Feature, testBed TestBed, containerAdapter cont
containerId,
[]string{
"/goss/goss",
"-g",
"--gossfile",
"/goss/goss.yaml",
"--loglevel",
"DEBUG",
"validate",
"--color",
"--format",
"documentation",
"--format-options",
"verbose",
"--no-color",
},
); err != nil {
var runCommandError *container.RunCommandError
Expand Down
Loading