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

Rename x plugin to exec #1137

Merged
merged 2 commits into from
Jul 12, 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
4 changes: 2 additions & 2 deletions .github/workflows/process-chart.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ env:
HELM_DOCS_VERSION: 1.11.0
CHART_REPOSITORY: https://charts.botkube.io/
LATEST_PLUGIN_INDEX_URL: https://storage.googleapis.com/botkube-plugins-latest/plugins-index.yaml
LATEST_X_PLUGIN_TPLS_URL: github.com/kubeshop/botkube//cmd/executor/x/templates?ref=main
LATEST_X_PLUGIN_TPLS_URL: github.com/kubeshop/botkube//cmd/executor/exec/templates?ref=main

on:
workflow_call:
Expand Down Expand Up @@ -54,7 +54,7 @@ jobs:
find ${HELM_FOLDER} -name "*.yaml" -exec sed -i "s/${CHART_CURRENT_VERSION}/${{ inputs.next-version }}/g" {} +
find ${HELM_FOLDER} -name "*.yaml" -exec sed -i "s/${CHART_DEV_VERSION}/${{ inputs.next-version }}/g" {} +
find ${HELM_FOLDER} -name "*.yaml" -exec sed -i "s~${LATEST_PLUGIN_INDEX_URL}~https://github.com/kubeshop/botkube/releases/download/${{ inputs.next-version }}/plugins-index.yaml~g" {} +
find ${HELM_FOLDER} -name "*.yaml" -exec sed -i "s~${LATEST_X_PLUGIN_TPLS_URL}~github.com/kubeshop/botkube//cmd/executor/x/templates?ref=${{ inputs.next-version }}~g" {} +
find ${HELM_FOLDER} -name "*.yaml" -exec sed -i "s~${LATEST_X_PLUGIN_TPLS_URL}~github.com/kubeshop/botkube//cmd/executor/exec/templates?ref=${{ inputs.next-version }}~g" {} +

- name: Set up chart-testing
uses: helm/chart-testing-action@v2.2.1
Expand Down
6 changes: 3 additions & 3 deletions .goreleaser.plugin.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,9 @@ builds:
goarch: *goarch
goarm: *goarm

- id: x
main: cmd/executor/x/main.go
binary: executor_x_{{ .Os }}_{{ .Arch }}
- id: exec
main: cmd/executor/exec/main.go
binary: executor_exec_{{ .Os }}_{{ .Arch }}

no_unique_dist_dir: true
env: *env
Expand Down
16 changes: 8 additions & 8 deletions cmd/executor/x/main.go → cmd/executor/exec/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,25 +24,25 @@ import (
// version is set via ldflags by GoReleaser.
var version = "dev"

const pluginName = "x"
const pluginName = "exec"

// XExecutor implements Botkube executor plugin.
type XExecutor struct{}

func (i *XExecutor) Help(_ context.Context) (api.Message, error) {
help := heredoc.Doc(`
Usage:
x run [COMMAND] [FLAGS] Run a specified command with optional flags
x install [SOURCE] Install a binary using the https://github.com/zyedidia/eget syntax.
exec run [COMMAND] [FLAGS] Run a specified command with optional flags
exec install [SOURCE] Install a binary using the https://github.com/zyedidia/eget syntax.

Usage Examples:
# Install the Helm CLI

x install https://get.helm.sh/helm-v3.10.3-linux-amd64.tar.gz --file helm
exec install https://get.helm.sh/helm-v3.10.3-linux-amd64.tar.gz --file helm

# Run the 'helm list -A' command.

x run helm list -A
exec run helm list -A

Options:
-h, --help Show this help message`)
Expand Down Expand Up @@ -151,7 +151,7 @@ func (i *XExecutor) Execute(ctx context.Context, in executor.ExecuteInput) (exec
case cmd.Install != nil:
var (
tool = Normalize(strings.Join(cmd.Install.Tool, " "))
command = x.Parse(fmt.Sprintf("x install %s", tool))
command = x.Parse(fmt.Sprintf("exec install %s", tool))
dir, isCustom = cfg.TmpDir.Get()
downloadCmd = fmt.Sprintf("eget %s", tool)
)
Expand Down Expand Up @@ -210,7 +210,7 @@ func jsonSchema() api.JSONSchema {
return api.JSONSchema{
Value: heredoc.Docf(`{
"$schema": "http://json-schema.org/draft-07/schema#",
"title": "x",
"title": "exec",
"description": "Install and run CLIs directly from the chat window without hassle. All magic included.",
"type": "object",
"properties": {
Expand Down Expand Up @@ -247,7 +247,7 @@ func getDefaultTemplateSource() string {
if ver == "dev" {
ver = "main"
}
return fmt.Sprintf("github.com/kubeshop/botkube//cmd/executor/x/templates?ref=%s", ver)
return fmt.Sprintf("github.com/kubeshop/botkube//cmd/executor/exec/templates?ref=%s", ver)
}

func Normalize(in string) string {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,12 @@ templates:

- trigger:
command:
prefix: "x install github.com/fluxcd/flux2"
prefix: "exec install github.com/fluxcd/flux2"
type: "wrapper"
message:
buttons:
- name: "Quickstart"
command: "{{BotName}} x run quickstart flux"
command: "{{BotName}} exec run quickstart flux"
style: "primary"

- trigger:
Expand All @@ -36,14 +36,14 @@ templates:
header: "Flux Quick Start tutorial"
buttons:
- name: "Check prerequisites"
command: "{{BotName}} x run flux check --pre"
command: "{{BotName}} exec run flux check --pre"
description: "{{BotName}} flux check --pre"
- name: "Install Flux"
command: "{{BotName}} x run flux install"
command: "{{BotName}} exec run flux install"
description: "{{BotName}} flux install"
- name: "Create Git source"
command: |
{{BotName}} x run flux create source git webapp-latest
{{BotName}} exec run flux create source git webapp-latest
--url=https://github.com/stefanprodan/podinfo
--branch=master
--interval=3m
Expand All @@ -53,17 +53,17 @@ templates:
--branch=master
--interval=3m
- name: "List Git sources"
command: "{{BotName}} x run flux get sources git"
command: "{{BotName}} exec run flux get sources git"
description: "{{BotName}} flux get sources git"
- name: "Reconcile Git source"
command: "{{BotName}} x run flux reconcile source git flux-system"
command: "{{BotName}} exec run flux reconcile source git flux-system"
description: "{{BotName}} flux reconcile source git flux-system"
- name: "Export Git sources"
command: "{{BotName}} x run flux export source git --all"
command: "{{BotName}} exec run flux export source git --all"
description: "{{BotName}} flux export source git --all"
- name: "Create Kustomization"
command: |
{{BotName}} x run flux create kustomization webapp-dev
{{BotName}} exec run flux create kustomization webapp-dev
--source=webapp-latest
--path='./deploy/webapp/'
--prune=true
Expand All @@ -72,7 +72,7 @@ templates:
--health-check='Deployment/frontend.webapp'
--health-check-timeout=2m
description: |
{{BotName}} x run flux create kustomization webapp-dev
{{BotName}} exec run flux create kustomization webapp-dev
--source=webapp-latest
--path='./deploy/webapp/'
--prune=true
Expand All @@ -81,29 +81,29 @@ templates:
--health-check='Deployment/frontend.webapp'
--health-check-timeout=2m
- name: "Reconcile Kustomization"
command: "{{BotName}} x run flux reconcile kustomization webapp-dev --with-source"
command: "{{BotName}} exec run flux reconcile kustomization webapp-dev --with-source"
description: "{{BotName}} flux reconcile kustomization webapp-dev --with-source"
- name: "Suspend Kustomization"
command: "{{BotName}} x run flux suspend kustomization webapp-dev"
command: "{{BotName}} exec run flux suspend kustomization webapp-dev"
description: "{{BotName}} flux suspend kustomization webapp-dev"
- name: "Export Kustomizations"
command: "{{BotName}} x run flux export kustomization --all"
command: "{{BotName}} exec run flux export kustomization --all"
description: "{{BotName}} flux export kustomization --all"
- name: "Resume Kustomization"
command: "{{BotName}} x run flux resume kustomization webapp-dev"
command: "{{BotName}} exec run flux resume kustomization webapp-dev"
description: "{{BotName}} flux resume kustomization webapp-dev"
- name: "Delete Kustomization"
command: "{{BotName}} x run flux delete kustomization webapp-dev"
command: "{{BotName}} exec run flux delete kustomization webapp-dev"
description: "{{BotName}} flux delete kustomization webapp-dev"
- name: "Delete Git source"
command: "{{BotName}} x run flux delete source git webapp-latest"
command: "{{BotName}} exec run flux delete source git webapp-latest"
description: "{{BotName}} flux delete source"
- name: "Delete Kustomization"
command: "{{BotName}} x run flux delete kustomization webapp-dev"
command: "{{BotName}} exec run flux delete kustomization webapp-dev"
description: "{{BotName}} flux delete kustomization webapp-dev"
- name: "Delete Git source"
command: "{{BotName}} x run flux delete source git webapp-latest --silent"
command: "{{BotName}} exec run flux delete source git webapp-latest --silent"
description: "{{BotName}} flux delete source git webapp-latest --silent"
- name: "Uninstall Flux"
command: "{{BotName}} x run flux uninstall"
command: "{{BotName}} exec run flux uninstall"
description: "{{BotName}} flux uninstall"
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,12 @@ templates:

- trigger:
command:
prefix: "x install https://get.helm.sh/helm-v"
prefix: "exec install https://get.helm.sh/helm-v"
type: "wrapper"
message:
buttons:
- name: "Quickstart"
command: "{{BotName}} x run quickstart helm"
command: "{{BotName}} exec run quickstart helm"
style: "primary"

- trigger:
Expand All @@ -38,31 +38,31 @@ templates:
buttons:
- name: "Global Help"
description: "{{BotName}} helm help"
command: "{{BotName}} x run helm help"
command: "{{BotName}} exec run helm help"
- name: "Version"
description: "{{BotName}} helm version"
command: "{{BotName}} x run helm version"
command: "{{BotName}} exec run helm version"
- name: "Install help"
description: "{{BotName}} helm install -h"
command: "{{BotName}} x run helm install -h"
command: "{{BotName}} exec run helm install -h"
- name: "Install by absolute URL"
description: "{{BotName}} helm install\n--repo https://charts.bitnami.com/bitnami psql postgresql\n--set clusterDomain='testing.local'"
command: "{{BotName}} x run helm install\n--repo https://charts.bitnami.com/bitnami psql postgresql\n--set clusterDomain='testing.local'"
command: "{{BotName}} exec run helm install\n--repo https://charts.bitnami.com/bitnami psql postgresql\n--set clusterDomain='testing.local'"
- name: "Install by chart reference:"
description: "{{BotName}} helm install https://charts.bitnami.com/bitnami/postgresql-12.1.0.tgz --create-namespace -n test --generate-name"
command: "{{BotName}} x run helm install https://charts.bitnami.com/bitnami/postgresql-12.1.0.tgz --create-namespace -n test --generate-name"
command: "{{BotName}} exec run helm install https://charts.bitnami.com/bitnami/postgresql-12.1.0.tgz --create-namespace -n test --generate-name"
- name: "List"
description: "{{BotName}} helm list -A"
command: "{{BotName}} x run helm list -A"
command: "{{BotName}} exec run helm list -A"
- name: "List with filter"
description: "{{BotName}} helm list -f 'p' -A"
command: "{{BotName}} x run helm list -f 'p' -A"
command: "{{BotName}} exec run helm list -f 'p' -A"
- name: "Status"
description: "{{BotName}} helm status psql"
command: "{{BotName}} x run helm status psql"
command: "{{BotName}} exec run helm status psql"
- name: "Upgrade"
description: "{{BotName}} helm upgrade --repo https://charts.bitnami.com/bitnami psql postgresql --set clusterDomain='cluster.local'"
command: "{{BotName}} x run helm upgrade --repo https://charts.bitnami.com/bitnami psql postgresql --set clusterDomain='cluster.local'"
command: "{{BotName}} exec run helm upgrade --repo https://charts.bitnami.com/bitnami psql postgresql --set clusterDomain='cluster.local'"
- name: "History"
description: "{{BotName}} helm history psql"
command: "{{BotName}} x run helm history psql"
command: "{{BotName}} exec run helm history psql"
Loading
Loading