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

Remove custom install for brew formula, fix Helm plugin formatting #1150

Merged
merged 2 commits into from
Jul 17, 2023
Merged
Show file tree
Hide file tree
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
2 changes: 0 additions & 2 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -161,8 +161,6 @@ brews:
- name: botkube
ids:
- botkube-cli
install:
bin.install "botkube"
tap:
owner: "{{.Env.HOMEBREW_REPO_OWNER}}"
name: "{{.Env.HOMEBREW_REPO_NAME}}"
Expand Down
8 changes: 4 additions & 4 deletions internal/executor/helm/executor.go
Original file line number Diff line number Diff line change
Expand Up @@ -152,12 +152,12 @@ func (e *Executor) Execute(ctx context.Context, in executor.ExecuteInput) (execu
return e.handleHelmCommand(ctx, helmCmd.Get.Values, cfg, wasHelpRequested, in.Command, kubeConfigPath)
default:
return executor.ExecuteOutput{
Data: helmCmd.Get.Help(),
Message: api.NewCodeBlockMessage(helmCmd.Get.Help(), true),
}, nil
}
default:
return executor.ExecuteOutput{
Data: "Helm command not supported",
Message: api.NewCodeBlockMessage("Helm command not supported", true),
}, nil
}
}
Expand All @@ -171,7 +171,7 @@ func (*Executor) Help(context.Context) (api.Message, error) {
func (e *Executor) handleHelmCommand(ctx context.Context, cmd command, cfg Config, wasHelpRequested bool, rawCmd, kubeConfig string) (executor.ExecuteOutput, error) {
if wasHelpRequested {
return executor.ExecuteOutput{
Data: cmd.Help(),
Message: api.NewCodeBlockMessage(cmd.Help(), true),
}, nil
}

Expand All @@ -193,7 +193,7 @@ func (e *Executor) handleHelmCommand(ctx context.Context, cmd command, cfg Confi
}

return executor.ExecuteOutput{
Message: api.NewPlaintextMessage(out.Stdout, true),
Message: api.NewCodeBlockMessage(out.Stdout, true),
}, nil
}

Expand Down
8 changes: 6 additions & 2 deletions internal/executor/helm/executor_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package helm

import (
"context"
"encoding/json"
"fmt"
"testing"

Expand Down Expand Up @@ -79,7 +80,7 @@ func TestExecutorHelmInstall(t *testing.T) {
// then
require.NoError(t, err)

assert.Equal(t, api.NewPlaintextMessage(execOutput.Stdout, true), out.Message)
assert.Equal(t, api.NewCodeBlockMessage(execOutput.Stdout, true), out.Message)

assert.Equal(t, tc.expCommand, gotCmd)

Expand Down Expand Up @@ -174,7 +175,10 @@ func TestExecutorHelmInstallHelp(t *testing.T) {

// then
require.NoError(t, err)
golden.Assert(t, out.Data, goldenFilepath)
gotOut, err := json.MarshalIndent(out.Message, "", " ")
require.NoError(t, err)

golden.AssertBytes(t, gotOut, goldenFilepath)
})
}
}
Expand Down
48 changes: 12 additions & 36 deletions internal/executor/helm/testdata/TestExecutorHelmInstallHelp.txt
Original file line number Diff line number Diff line change
@@ -1,36 +1,12 @@
Installs a chart archive.

There are two different ways you to install a Helm chart:
1. By absolute URL: helm install mynginx https://example.com/charts/nginx-1.2.3.tgz
2. By chart reference and repo url: helm install --repo https://example.com/charts/ mynginx nginx

Usage:
helm install [NAME] [CHART] [flags]

Flags:
--create-namespace
--generate-name,-g
--dependency-update
--description
--devel
--disable-openapi-validation
--dry-run
--insecure-skip-tls-verify
--name-template
--no-hooks
--pass-credentials
--password
--post-renderer
--post-renderer-args
--render-subchart-notes
--replace
--repo
--set
--set-json
--set-string
--skip-crds
--timeout
--username
--verify
--version
-o,--output
{
"Type": "baseBodyWithFilter",
"BaseBody": {
"CodeBlock": "Installs a chart archive.\n\nThere are two different ways you to install a Helm chart:\n1. By absolute URL: helm install mynginx https://example.com/charts/nginx-1.2.3.tgz\n2. By chart reference and repo url: helm install --repo https://example.com/charts/ mynginx nginx\n\nUsage:\n helm install [NAME] [CHART] [flags]\n\nFlags:\n --create-namespace\n --generate-name,-g\n --dependency-update\n --description\n --devel\n --disable-openapi-validation\n --dry-run\n --insecure-skip-tls-verify\n --name-template\n --no-hooks\n --pass-credentials\n --password\n --post-renderer\n --post-renderer-args\n --render-subchart-notes\n --replace\n --repo\n --set\n --set-json\n --set-string\n --skip-crds\n --timeout\n --username\n --verify\n --version\n -o,--output\n",
"Plaintext": ""
},
"Timestamp": "0001-01-01T00:00:00Z",
"Sections": null,
"PlaintextInputs": null,
"OnlyVisibleForYou": false,
"ReplaceOriginal": false
}