Skip to content

Add support for archived plugins (#1202) #405

Add support for archived plugins (#1202)

Add support for archived plugins (#1202) #405

Workflow file for this run

name: Branch build
on:
push:
branches:
- main
repository_dispatch:
types: [ trigger-e2e-tests ]
env:
HELM_VERSION: v3.9.0
K3D_VERSION: v5.4.6
IMAGE_REGISTRY: "ghcr.io"
IMAGE_REPOSITORY: "kubeshop/botkube"
CFG_EXPORTER_IMAGE_REPOSITORY: "kubeshop/botkube-config-exporter"
IMAGE_TAG: v9.99.9-dev # TODO: Use commit hash tag to make the predictable builds for each commit on branch
jobs:
build:
runs-on: ubuntu-latest
env:
GO111MODULE: on
GOPATH: /home/runner/work/botkube
GOBIN: /home/runner/work/botkube/bin
DOCKER_CLI_EXPERIMENTAL: "enabled"
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup Go
uses: actions/setup-go@v3
with:
go-version-file: 'go.mod'
cache: true
- name: Set up QEMU
uses: docker/setup-qemu-action@v1
- name: Docker Login
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Install GoReleaser
uses: goreleaser/goreleaser-action@v2
with:
install-only: true
version: latest
- name: Run GoReleaser
run: make release-snapshot
env:
ANALYTICS_API_KEY: ${{ secrets.ANALYTICS_API_KEY }}
- name: Install Helm
uses: azure/setup-helm@v1
with:
version: ${{ env.HELM_VERSION }}
migration-e2e-test:
name: Migration e2e test
runs-on: ubuntu-latest
needs: [ build ]
concurrency:
group: e2e-migration
cancel-in-progress: false
permissions:
contents: read
packages: read
strategy:
fail-fast: false
matrix:
e2e:
- discord
steps:
- name: Checkout code
uses: actions/checkout@v3
with:
persist-credentials: false
- name: Install GoReleaser
uses: goreleaser/goreleaser-action@v2
with:
install-only: true
version: latest
- name: Setup Go
uses: actions/setup-go@v3
with:
go-version-file: 'go.mod'
cache: true
- name: Run GoReleaser
run: make release-snapshot-cli
- name: Add botkube alias
run: |
echo BOTKUBE_BINARY_PATH="$PWD/dist/botkube-cli_linux_amd64_v1/botkube" >> $GITHUB_ENV
- name: Install Helm
uses: azure/setup-helm@v1
with:
version: ${{ env.HELM_VERSION }}
- name: Download k3d
run: "wget -q -O - https://raw.githubusercontent.com/k3d-io/k3d/main/install.sh | TAG=${K3D_VERSION} bash"
- name: Create k3d cluster
run: "k3d cluster create migration-test-cluster --wait --timeout=5m"
- name: Run e2e tests for botkube client
env:
DISCORD_BOT_ID: ${{ secrets.DISCORD_BOT_ID }}
DISCORD_BOT_TOKEN: ${{ secrets.DISCORD_BOT_TOKEN }}
DISCORD_GUILD_ID: ${{ secrets.DISCORD_GUILD_ID }}
DISCORD_TESTER_APP_TOKEN: ${{ secrets.DISCORD_TESTER_APP_TOKEN }}
BOTKUBE_CLOUD_DEV_GQL_ENDPOINT: ${{ secrets.BOTKUBE_CLOUD_DEV_GQL_ENDPOINT }}
BOTKUBE_CLOUD_DEV_REFRESH_TOKEN: ${{ secrets.BOTKUBE_CLOUD_DEV_REFRESH_TOKEN }}
BOTKUBE_CLOUD_DEV_AUTH0_CLIENT_ID: ${{ secrets.BOTKUBE_CLOUD_DEV_AUTH0_CLIENT_ID }}
run: |
KUBECONFIG=$(k3d kubeconfig write migration-test-cluster) \
make test-migration-tool
integration-tests:
name: Integration tests
runs-on: ubuntu-latest
needs: [ build ]
if: github.event_name != 'repository_dispatch' # skip if triggered by repository_dispatch
permissions:
contents: read
packages: read
strategy:
# make the jobs independent
fail-fast: false
matrix:
integration:
- slack
- discord
steps:
- name: Checkout code
uses: actions/checkout@v3
with:
persist-credentials: false
- name: Setup Go
uses: actions/setup-go@v3
with:
go-version-file: 'go.mod'
cache: true
- name: Install Helm
uses: azure/setup-helm@v1
with:
version: ${{ env.HELM_VERSION }}
- name: Download k3d
run: "wget -q -O - https://raw.githubusercontent.com/k3d-io/k3d/main/install.sh | TAG=${K3D_VERSION} bash"
- name: Create cluster to test ${{ matrix.integration }}
run: "k3d cluster create ${{ matrix.integration }}-test-cluster --wait --timeout=5m"
- name: Install Botkube to test ${{ matrix.integration }}
env:
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }}
DISCORD_BOT_TOKEN: ${{ secrets.DISCORD_BOT_TOKEN }}
DISCORD_BOT_ID: ${{ secrets.DISCORD_BOT_ID }}
run: |
helm install botkube --namespace botkube ./helm/botkube --wait --create-namespace \
-f ./helm/botkube/e2e-test-values.yaml \
--set communications.default-group.slack.token="${SLACK_BOT_TOKEN}" \
--set communications.default-group.discord.token="${DISCORD_BOT_TOKEN}" \
--set communications.default-group.discord.botID="${DISCORD_BOT_ID}" \
--set image.registry="${IMAGE_REGISTRY}" \
--set image.repository="${IMAGE_REPOSITORY}" \
--set image.tag="${IMAGE_TAG}" \
- name: Install GoReleaser
uses: goreleaser/goreleaser-action@v2
with:
install-only: true
version: latest
- name: Build all plugins into dist directory
env:
# we hardcode plugins version, so it's predictable in e2e tests
GORELEASER_CURRENT_TAG: "v0.0.0-latest"
OUTPUT_MODE: "archive"
run: |
make build-plugins
- name: Run ${{ matrix.integration }} tests
env:
SLACK_TESTER_APP_TOKEN: ${{ secrets.SLACK_TESTER_APP_TOKEN }}
SLACK_ADDITIONAL_CONTEXT_MESSAGE: "Branch test - commit SHA: ${{github.sha}} - https://github.com/kubeshop/botkube/commit/${{github.sha}}"
DISCORD_TESTER_APP_TOKEN: ${{ secrets.DISCORD_TESTER_APP_TOKEN }}
DISCORD_GUILD_ID: ${{ secrets.DISCORD_GUILD_ID }}
DISCORD_ADDITIONAL_CONTEXT_MESSAGE: "Branch test - commit SHA: ${{github.sha}} - https://github.com/kubeshop/botkube/commit/${{github.sha}}"
PLUGINS_BINARIES_DIRECTORY: ${{ github.workspace }}/plugin-dist
run: |
KUBECONFIG=$(k3d kubeconfig write ${{ matrix.integration }}-test-cluster) \
make test-integration-${{ matrix.integration }}
slackNotification:
name: Slack Notification
runs-on: ubuntu-latest
needs: [ migration-e2e-test ]
if: failure()
steps:
- name: Slack Notification
uses: rtCamp/action-slack-notify@v2
env:
SLACK_USERNAME: Botkube Cloud CI
SLACK_COLOR: 'red'
SLACK_TITLE: 'Message'
SLACK_CHANNEL: 'botkube-cloud-ci-alerts'
SLACK_MESSAGE: 'CLI Migration E2E tests failed :scream:'
SLACK_ICON_EMOJI: ':this-is-fine-fire:'
SLACK_FOOTER: "Fingers crossed it's just an outdated/flaky test..."
SLACK_WEBHOOK: ${{ secrets.SLACK_CI_ALERTS_WEBHOOK }}