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

Normalize and validate channel names and IDs #1142

Merged
merged 3 commits into from
Jul 14, 2023

Conversation

pkosiec
Copy link
Member

@pkosiec pkosiec commented Jul 13, 2023

Description

Changes proposed in this pull request:

  • Normalize and validate channel names and IDs

Testing

No need to test it - validation and normalization is covered by tests. But if you want to:

Use this config:

communications:
  "default-group":
    socketSlack:
      enabled: true
      appToken: "xapp-..."
      botToken: "xoxb-...."
      channels:
        "default":
          name: "AWdaDAsad" # <-- you can do here a mistake
          bindings:
            executors:
              - k8s-default-tools
            sources:
              - k8s-all-events
        "secondary":
          name: priv-channel
          bindings:
            executors: []
            sources: []

    discord:
      enabled: true
      botID: "..."
      token: "..."
      channels:
        'default':
          id: "..."
          bindings:
            executors:
              -  k8s-default-tools
            sources:
              - k8s-all-events
        'test':
          id: "..."
          bindings:
            executors:
              - k8s-default-tools
            sources:
              - k8s-all-events
        'test2':
          id: "..."
          bindings:
            executors:
              -  k8s-default-tools
            sources:
              - k8s-all-events

    mattermost:
      enabled: true
      botName: Botkube
      team: team
      token: ...
      url: https://team.cloud.mattermost.com
      channels:
        'default':
          name: "general"
          bindings:
            executors:
              - k8s-default-tools
            sources:
              - k8s-all-events
              - k8s-recommendation-events
      notification:
        type: short
export KUBECONFIG="/path/to/kubeconfig"
export BOTKUBE_SETTINGS_LOG_LEVEL=info
export BOTKUBE_PLUGINS_CACHE__DIR="/tmp/plugins"
export BOTKUBE_SETTINGS_KUBECONFIG=$KUBECONFIG
export BOTKUBE_CONFIG_PATHS="$(pwd)/helm/botkube/values.yaml,$(pwd)/comm_config.yaml"
go run ./cmd/botkube-agent/main.go

@pkosiec pkosiec added the enhancement New feature or request label Jul 13, 2023
@pkosiec pkosiec marked this pull request as ready for review July 13, 2023 17:22
@pkosiec pkosiec requested review from a team and PrasadG193 as code owners July 13, 2023 17:22
@pkosiec pkosiec requested review from huseyinbabal and mszostok and removed request for huseyinbabal July 13, 2023 17:22
Copy link
Contributor

@mszostok mszostok left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@pkosiec pkosiec enabled auto-merge (squash) July 14, 2023 06:08
@pkosiec pkosiec merged commit b0b6b2f into kubeshop:main Jul 14, 2023
13 checks passed
@pkosiec pkosiec deleted the add-channel-validation branch July 14, 2023 06:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants