Skip to content

Commit

Permalink
Make Botkube Cloud plugins open-source (#49)
Browse files Browse the repository at this point in the history
- Open source all plugins which were private for Botkube Cloud
- Publish plugins via GitHub releases
- Rename repository to `botkube-plugins`
  • Loading branch information
pkosiec authored Nov 4, 2024
1 parent 98f6df9 commit 67c5038
Show file tree
Hide file tree
Showing 69 changed files with 869 additions and 797 deletions.
31 changes: 0 additions & 31 deletions .github/workflows/ai-assistant-reconfigure.yml

This file was deleted.

54 changes: 0 additions & 54 deletions .github/workflows/branch-pr-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -86,57 +86,3 @@ jobs:
run: |
make build-plugins-archives
USE_ARCHIVE=true make gen-plugin-index
release-latest-plugins:
if: github.event_name != 'pull_request' && github.ref == 'refs/heads/main'
name: Build and release latest plugins
timeout-minutes: 60
runs-on: ubuntu-latest
needs: [lint, test]
steps:
- name: Checkout
uses: actions/checkout@v4

- name: GCP auth
uses: 'google-github-actions/auth@v2'
with:
credentials_json: ${{ secrets.CLOUD_PLUGINS_LATEST_BUCKET_CREDS }}

- name: 'Set up Cloud SDK'
uses: 'google-github-actions/setup-gcloud@v2'

- name: Set up Go
uses: actions/setup-go@v5
with:
go-version-file: 'go.mod'
cache: true

- name: Install GoReleaser
uses: goreleaser/goreleaser-action@v5
with:
install-only: true
version: latest

- name: Build plugins and generate plugins index.yaml
env:
PLUGIN_DOWNLOAD_URL_BASE_PATH: ""
run: |
make build-plugins-archives
USE_ARCHIVE=true make gen-dev-plugin-index
- name: Upload plugins to GCS
uses: google-github-actions/upload-cloud-storage@v2
with:
path: 'dist'
destination: '${{ env.BUCKET_NAME }}/'
glob: '*.tar.gz'
parent: false

- name: Upload plugin index to GCS
uses: google-github-actions/upload-cloud-storage@v2
with:
path: 'plugins-index.yaml'
destination: '${{ env.BUCKET_NAME }}/'

- name: 'Disable GCS caching'
run: 'gsutil -m setmeta -h "Cache-Control: no-cache, no-store" gs://${{ env.BUCKET_NAME }}/*'
27 changes: 5 additions & 22 deletions .github/workflows/tag-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ on:

env:
BUCKET_NAME: botkube-cloud-plugins
GITHUB_TOKEN: ${{ secrets.RELEASE_GH_DEV_ACCOUNT_PAT }}
VERSION: "${{ github.ref_name }}"

jobs:
Expand All @@ -20,14 +21,6 @@ jobs:
- name: Checkout
uses: actions/checkout@v4

- name: GCP auth
uses: 'google-github-actions/auth@v2'
with:
credentials_json: ${{ secrets.CLOUD_PLUGINS_BUCKET_CREDS }}

- name: 'Set up Cloud SDK'
uses: 'google-github-actions/setup-gcloud@v2'

- name: Set up Go
uses: actions/setup-go@v5
with:
Expand All @@ -44,19 +37,9 @@ jobs:
env:
PLUGIN_DOWNLOAD_URL_BASE_PATH: "${{ env.VERSION }}"
run: |
make build-plugins-archives
make publish-plugins
USE_ARCHIVE=true make gen-plugin-index
- name: Upload plugins to GCS
uses: google-github-actions/upload-cloud-storage@v2
with:
path: 'dist'
destination: '${{ env.BUCKET_NAME }}/${{ env.VERSION }}'
glob: '*.tar.gz'
parent: false

- name: Upload plugin index to GCS
uses: google-github-actions/upload-cloud-storage@v2
with:
path: 'plugins-index.yaml'
destination: '${{ env.BUCKET_NAME }}/${{ env.VERSION }}'
- name: Upload plugins index
run: |
gh release upload ${{ env.VERSION }} ./plugins-index.yaml --clobber
8 changes: 8 additions & 0 deletions .goreleaser.plugin.tpl.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,11 @@ archives:

snapshot:
name_template: 'v{{ .Version }}'

release:
# If set to true, will not auto-publish the release.
draft: true
prerelease: auto

changelog:
skip: false
8 changes: 8 additions & 0 deletions .goreleaser.plugin.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -242,3 +242,11 @@ archives:

snapshot:
name_template: 'v{{ .Version }}'

release:
# If set to true, will not auto-publish the release.
draft: true
prerelease: auto

changelog:
skip: false
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2024 Kubeshop

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
7 changes: 6 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,12 @@ build-plugins-single: ## Builds specified plugins in binary format only for curr

build-plugins-archives: ## Builds all plugins for all defined platforms in form of archives
goreleaser release -f .goreleaser.plugin.yaml --clean --snapshot
.PHONY: build-plugins
.PHONY: build-plugins-archives

publish-plugins: ## Builds all plugins for all defined platforms in form of archives
goreleaser release -f .goreleaser.plugin.yaml
.PHONY: publish-plugins


##############
# Generating #
Expand Down
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Botkube Cloud Plugins
# Botkube Plugins

This repository shows Botkube Cloud plugins.
This repository contains additional Botkube plugins.

## Requirements

Expand Down Expand Up @@ -31,12 +31,12 @@ This repository shows Botkube Cloud plugins.
export BOTKUBE_PLUGINS_CACHE__DIR="/tmp/plugins"
```

3. Add a `cloud-plugins` entry for your Agent plugins repository:
3. Add a `additional-plugins` entry for your Agent plugins repository:

```yaml
plugins:
repositories:
cloud-plugins:
additional-plugins:
url: http://localhost:3010/botkube.yaml
```

Expand Down
7 changes: 3 additions & 4 deletions cmd/executor/ai/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,7 @@ import (
"strings"

"github.com/hashicorp/go-plugin"
"github.com/kubeshop/botkube-cloud-plugins/internal/auth"
aibrain "github.com/kubeshop/botkube-cloud-plugins/internal/source/ai-brain"
aibrain "github.com/kubeshop/botkube-plugins/internal/source/ai-brain"
"github.com/kubeshop/botkube/pkg/api"
"github.com/kubeshop/botkube/pkg/api/executor"
"github.com/kubeshop/botkube/pkg/config"
Expand Down Expand Up @@ -131,9 +130,9 @@ func (*AIFace) Help(context.Context) (api.Message, error) {
func main() {
executor.Serve(map[string]plugin.Plugin{
pluginName: &executor.Plugin{
Executor: auth.NewProtectedExecutor(&AIFace{
Executor: &AIFace{
httpClient: httpx.NewHTTPClient(),
}),
},
},
})
}
12 changes: 5 additions & 7 deletions cmd/executor/exec/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,15 @@ import (
"fmt"
"strings"

"github.com/kubeshop/botkube-cloud-plugins/internal/auth"

"github.com/MakeNowJust/heredoc"
"github.com/alexflint/go-arg"
"github.com/hashicorp/go-plugin"
"github.com/sirupsen/logrus"

"github.com/kubeshop/botkube-cloud-plugins/internal/executor/x"
"github.com/kubeshop/botkube-cloud-plugins/internal/executor/x/getter"
"github.com/kubeshop/botkube-cloud-plugins/internal/executor/x/output"
"github.com/kubeshop/botkube-cloud-plugins/internal/executor/x/state"
"github.com/kubeshop/botkube-plugins/internal/executor/x"
"github.com/kubeshop/botkube-plugins/internal/executor/x/getter"
"github.com/kubeshop/botkube-plugins/internal/executor/x/output"
"github.com/kubeshop/botkube-plugins/internal/executor/x/state"
"github.com/kubeshop/botkube/pkg/api"
"github.com/kubeshop/botkube/pkg/api/executor"
"github.com/kubeshop/botkube/pkg/formatx"
Expand Down Expand Up @@ -204,7 +202,7 @@ func (i *XExecutor) getKubeconfig(ctx context.Context, log logrus.FieldLogger, i
func main() {
executor.Serve(map[string]plugin.Plugin{
pluginName: &executor.Plugin{
Executor: auth.NewProtectedExecutor(&XExecutor{}),
Executor: &XExecutor{},
},
})
}
Expand Down
2 changes: 1 addition & 1 deletion cmd/executor/flux/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
"github.com/allegro/bigcache/v3"
"github.com/hashicorp/go-plugin"

"github.com/kubeshop/botkube-cloud-plugins/internal/executor/flux"
"github.com/kubeshop/botkube-plugins/internal/executor/flux"
"github.com/kubeshop/botkube/pkg/api/executor"
"github.com/kubeshop/botkube/pkg/loggerx"
)
Expand Down
4 changes: 1 addition & 3 deletions cmd/executor/gh/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@ import (
"fmt"
"text/template"

"github.com/kubeshop/botkube-cloud-plugins/internal/auth"

"github.com/hashicorp/go-plugin"

"github.com/kubeshop/botkube/pkg/api"
Expand Down Expand Up @@ -163,7 +161,7 @@ var depsDownloadLinks = map[string]api.Dependency{
func main() {
executor.Serve(map[string]plugin.Plugin{
pluginName: &executor.Plugin{
Executor: auth.NewProtectedExecutor(&GHExecutor{}),
Executor: &GHExecutor{},
},
})
}
Expand Down
2 changes: 1 addition & 1 deletion cmd/executor/helm/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package main
import (
"github.com/hashicorp/go-plugin"

"github.com/kubeshop/botkube-cloud-plugins/internal/executor/helm"
"github.com/kubeshop/botkube-plugins/internal/executor/helm"

"github.com/kubeshop/botkube/pkg/api/executor"
)
Expand Down
2 changes: 1 addition & 1 deletion cmd/executor/thread-mate/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import (
"k8s.io/client-go/kubernetes"
"k8s.io/client-go/tools/clientcmd"

thmate "github.com/kubeshop/botkube-cloud-plugins/internal/executor/thread-mate"
thmate "github.com/kubeshop/botkube-plugins/internal/executor/thread-mate"
"github.com/kubeshop/botkube/pkg/api"
"github.com/kubeshop/botkube/pkg/api/executor"
pluginx "github.com/kubeshop/botkube/pkg/plugin"
Expand Down
6 changes: 2 additions & 4 deletions cmd/source/ai-brain/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,9 @@ package main
import (
_ "embed"

"github.com/kubeshop/botkube-cloud-plugins/internal/auth"

"github.com/hashicorp/go-plugin"

aibrain "github.com/kubeshop/botkube-cloud-plugins/internal/source/ai-brain"
aibrain "github.com/kubeshop/botkube-plugins/internal/source/ai-brain"
"github.com/kubeshop/botkube/pkg/api/source"
)

Expand All @@ -17,7 +15,7 @@ var version = "dev"
func main() {
source.Serve(map[string]plugin.Plugin{
aibrain.PluginName: &source.Plugin{
Source: auth.NewProtectedSource(aibrain.NewSource(version)),
Source: aibrain.NewSource(version),
},
})
}
2 changes: 1 addition & 1 deletion cmd/source/argocd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package main
import (
"github.com/hashicorp/go-plugin"

"github.com/kubeshop/botkube-cloud-plugins/internal/source/argocd"
"github.com/kubeshop/botkube-plugins/internal/source/argocd"
"github.com/kubeshop/botkube/pkg/api/source"
)

Expand Down
2 changes: 1 addition & 1 deletion cmd/source/github-events/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package main
import (
"github.com/hashicorp/go-plugin"

"github.com/kubeshop/botkube-cloud-plugins/internal/source/github_events"
"github.com/kubeshop/botkube-plugins/internal/source/github_events"
"github.com/kubeshop/botkube/pkg/api/source"
)

Expand Down
2 changes: 1 addition & 1 deletion cmd/source/keptn/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package main
import (
"github.com/hashicorp/go-plugin"

"github.com/kubeshop/botkube-cloud-plugins/internal/source/keptn"
"github.com/kubeshop/botkube-plugins/internal/source/keptn"
"github.com/kubeshop/botkube/pkg/api/source"
)

Expand Down
2 changes: 1 addition & 1 deletion cmd/source/prometheus/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package main
import (
"github.com/hashicorp/go-plugin"

"github.com/kubeshop/botkube-cloud-plugins/internal/source/prometheus"
"github.com/kubeshop/botkube-plugins/internal/source/prometheus"
"github.com/kubeshop/botkube/pkg/api/source"
)

Expand Down
Loading

0 comments on commit 67c5038

Please sign in to comment.