Skip to content

Commit

Permalink
Update CONTRIBUTE.md to work with the latest changes
Browse files Browse the repository at this point in the history
Signed-off-by: Prasad Ghangal <prasad.ghangal@gmail.com>
  • Loading branch information
PrasadG193 committed Dec 23, 2019
1 parent f1bf640 commit 51a0805
Showing 1 changed file with 64 additions and 53 deletions.
117 changes: 64 additions & 53 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,36 +2,33 @@

We'd love your help!

BotKube is [MIT Licensed](LICENSE) and accepts contributions via
GitHub pull requests. This document outlines some of the conventions
on development workflow, commit message formatting, contact points and
other resources to make it easier to get your contributions accepted.
BotKube is [MIT Licensed](LICENSE) and accepts contributions via GitHub pull requests. This document outlines some of the conventions on development workflow, commit message formatting, contact points and other resources to make it easier to get your contributions accepted.

We gratefully welcome improvements to
[documentation](https://www.botkube.io/ "Go to documentation site") as
well as to code.
We gratefully welcome improvements to [documentation](https://www.botkube.io/ "Go to documentation site") as well as to code.

## Contributing to documentation
You can contribute to documentation by following [these
instructions](https://github.com/infracloudio/botkube-docs#contributing
"Contributing to BotKube Docs")

You can contribute to documentation by following [these instructions](https://github.com/infracloudio/botkube-docs#contributing "Contributing to BotKube Docs")

## Compile BotKube from source code

Before you proceed, make sure you have installed BotKube Slack/Mattermost app and copied required token as per the steps documented [here](https://www.botkube.io/installation/)

### Prerequisite
* Make sure you have `go` compiler installed.
* BotKube uses [`dep`](https://github.com/golang/dep) to manage
dependencies.
* You will also need `make` and
[`docker`](https://docs.docker.com/install/) installed on your

* Make sure you have `go 1.11+` installed with go module activated. (You can set env var with `export GO111MODULE=on` to activate)

* You will also need `make` and [`docker`](https://docs.docker.com/install/) installed on your
machine.
* Clone the source code
```sh
$ git clone https://github.com/infracloudio/botkube.git $GOPATH/src/github.com/infracloudio/botkube
$ cd $GOPATH/src/github.com/infracloudio/botkube
$ git clone https://github.com/infracloudio/botkube.git
```

Now you can build and run BotKube by one of the following ways

### Build the container image

1. This will build BotKube and create a new container image tagged as `infracloudio/botkube:latest`
```sh
$ make build
Expand All @@ -41,43 +38,61 @@ Now you can build and run BotKube by one of the following ways
```
Where `<your_account>` is Docker hub account to which you can push the image

2. Follow the [instructions from
README.md](https://github.com/infracloudio/botkube#using-helm) to
deploy newly created image in your cluster.
2. Deploy newly created image in your cluster.

a. Using helm (v3)

```sh
# Set the container image
$ helm install --name botkube --namespace botkube \
... other options ...
--set image.repository=your_account/botkube \
--set image.tag=latest
...
helm/botkube
$ helm repo add infracloudio https://infracloudio.github.io/charts
$ helm repo update
$ kubectl create namespace botkube
$ helm install --version v9.99.9-dev botkube --namespace botkube \
--set communicationConfig.communications.slack.enabled=true \
--set communicationConfig.communications.slack.channel=<SLACK_CHANNEL_NAME> \
--set communicationConfig.communications.slack.token=<SLACK_API_TOKEN_FOR_THE_BOT> \
--set resourceConfig.settings.clustername=<CLUSTER_NAME> \
--set resourceConfig.settings.allowkubectl=<ALLOW_KUBECTL> \
--set image.repository=<your_account>/botkube \
--set image.tag=latest \
infracloudio/botkube
```

Check [values.yaml](https://github.com/infracloudio/botkube/blob/develop/helm/botkube/values.yaml) for default options

> Note:
>
> If you are using helm version < 3.0.0, use following command
>
> helm install --version v9.99.9-dev --name botkube --namespace botkube --set \<options\> infracloudio/botkube
b. Using kubectl

1. Edit deploy-all-in-one.yaml and update the configuration.
Set SLACK_ENABLED, SLACK_CHANNEL, SLACK_API_TOKEN, clustername, allowkubectl and update the resource events configuration you want to receive notifications for in the configmap.
2. Create botkube namespace and deploy resources
```sh
$ kubectl create ns botkube && kubectl create -f deploy-all-in-one.yaml -n botkube
```

### Build and run BotKube locally
1. Build BotKube binary
If you don't want to build the container image, you can build the
binary like this,

For faster development, you can also build and run BotKube outside K8s cluster.

1. Build BotKube binary if you don't want to build the container image, you can build the binary like this,
```sh
# Fetch the dependencies
$ dep ensure
$ go mod download
# Build the binary
$ go build ./cmd/botkube/
```
2. Modify `config.yaml` according to your needs. Please refer
[configuration section](https://www.botkube.io/configuration/) from
documentation for more details
```sh
# From project root directory
$ xdg-open config.yaml
```
2. Edit `./resource_config.yaml` and `./comm_config.yaml` to configure resource and set communication credentials.
3. Export the path to directory of `config.yaml`
```sh
# From project root directory
$ export CONFIG_PATH=$(pwd)
```
4. Make sure that correct context is set and you are able to access
your Kubernetes cluster
4. Make sure that correct context is set and you are able to access your Kubernetes cluster
```console
$ kubectl config current-context
minikube
Expand All @@ -93,16 +108,9 @@ Now you can build and run BotKube by one of the following ways
## Making A Change
* *Before making any significant changes, please [open an
issue](https://github.com/infracloudio/botkube/issues).* Discussing
your proposed changes ahead of time will make the contribution process
smooth for everyone.
* Before making any significant changes, please [open an issue](https://github.com/infracloudio/botkube/issues). Discussing your proposed changes ahead of time will make the contribution process smooth for everyone.
* Once we've discussed your changes and you've got your code ready,
make sure that build steps mentioned above pass. Open your pull
request against
[`develop`](http://github.com/infracloudio/botkube/tree/develop)
branch.
* Once we've discussed your changes and you've got your code ready, make sure that build steps mentioned above pass. Open your pull request against [`develop`](http://github.com/infracloudio/botkube/tree/develop) branch.
* To avoid build failures in CI, run
```sh
Expand All @@ -111,8 +119,12 @@ branch.
```
This will check if the code is properly formatted, linted & vendor directory is present.
* Make sure your pull request has [good commit
messages](https://chris.beams.io/posts/git-commit/):
* Run e2e tests
```sh
$ ./hack/runtests.sh
```
* Make sure your pull request has [good commit messages](https://chris.beams.io/posts/git-commit/):
* Separate subject from body with a blank line
* Limit the subject line to 50 characters
* Capitalize the subject line
Expand All @@ -121,5 +133,4 @@ messages](https://chris.beams.io/posts/git-commit/):
* Wrap the body at 72 characters
* Use the body to explain _what_ and _why_ instead of _how_
* Try to squash unimportant commits and rebase your changes on to
develop branch, this will make sure we have clean log of changes.
* Try to squash unimportant commits and rebase your changes on to develop branch, this will make sure we have clean log of changes.

0 comments on commit 51a0805

Please sign in to comment.