|
@@ -1,184 +1,180 @@
|
|
|
-# How to contribute
|
|
|
+# 如何贡献
|
|
|
|
|
|
-We're really glad you're reading this, because we need volunteer developers to help this project come to fruition.
|
|
|
+很高兴你能读到这篇文章,欢迎加入项目社区,帮助项目成长。
|
|
|
|
|
|
-## Did you find a bug?
|
|
|
+## 发现 bug ?
|
|
|
|
|
|
-- **Ensure the bug was not already reported** by searching on GitHub under [Issues](https://github.com/lf-edge/ekuiper/issues).
|
|
|
-- If you're unable to find an open issue addressing the problem, [open a new one](https://github.com/lf-edge/ekuiper/issues/new). Be sure to include a **title and clear description**, as much relevant information as possible, and a **code sample** or an **executable test case** demonstrating the expected behavior that is not occurring.
|
|
|
+- **通过在 GitHub 的[问题](https://github.com/lf-edge/ekuiper/issues)下搜索,确保该错误尚未被报告**。
|
|
|
+- 如果你找不到解决该问题的公开问题,[开一个新问题](https://github.com/lf-edge/ekuiper/issues/new)。请确保**标题和清晰的描述**,尽可能多的相关信息,以及**代码样本**或**可执行的测试案例**,以明确问题。
|
|
|
|
|
|
-## Code and doc contribution
|
|
|
+## 代码和文档贡献
|
|
|
|
|
|
-Welcome to contribute code to provide features or fix bugs.
|
|
|
+欢迎贡献代码以提供功能或修复错误。
|
|
|
|
|
|
-### One time setup
|
|
|
+### 一次性设置
|
|
|
|
|
|
-We use GitHub pull request to review proposed code changes. So you'll need to obtain a GitHub account before making code contribution.
|
|
|
+我们使用 GitHub pull request 来审查提议的代码修改。所以你需要在做出代码贡献之前拥有一个 GitHub 账户。
|
|
|
|
|
|
-1. **Fork** eKuiper to your private repository. Click the `Fork` button in the top right corner of eKuiper repository.
|
|
|
-2. **Clone** the repository locally from your personal fork. `git clone https://github.com/<Github_user>/ekuiper.git`.
|
|
|
-3. Add eKuiper repo as additional Git remote so that you can sync between local repo and eKuiper.
|
|
|
- ```shell
|
|
|
- git remote add upstream https://github.com/lf-edge/ekuiper.git
|
|
|
- ```
|
|
|
+1. **Fork** eKuiper到你的私人仓库。点击 eKuiper 仓库右上角的 "Fork "按钮。
|
|
|
+2. 从你的个人分叉中**克隆**版本库。 `git clone https://github.com/<Github_user>/ekuiper.git` 。
|
|
|
+3. 添加 eKuiper repo 作为额外的 Git 远程仓库,这样你就可以在本地 repo 和eKuiper 之间进行同步。
|
|
|
+ ```shell
|
|
|
+ git remote add upstream https://github.com/lf-edge/ekuiper.git
|
|
|
+ ```
|
|
|
|
|
|
-You can use your favorite IDE or editor to develop. You can find information in editor support for Go tools in [Editors and IDEs for GO](https://github.com/golang/go/wiki/IDEsAndTextEditorPlugins).
|
|
|
+你可以使用你喜欢的IDE或编辑器来开发。你可以在 [Editors and IDEs for GO](https://github.com/golang/go/wiki/IDEsAndTextEditorPlugins) 中找到编辑器对Go工具的支持信息。
|
|
|
|
|
|
-### Create a branch in your fork
|
|
|
+### 创建一个分支
|
|
|
|
|
|
-You’ll work on your contribution in a branch in your own (forked) repository. Create a local branch, initialized with the state of the branch you expect your changes to be merged into. The `master` branch is active development branch, so it's recommended to set `master` as base branch.
|
|
|
+你将在你自己的 repo 中的一个分支中进行你的代码开发。创建一个本地分支,初始化为你希望合并到的分支的状态。`master`分支是活跃的开发分支,所以建议将`master`设为基础分支。
|
|
|
|
|
|
```shell
|
|
|
$ git fetch upstream
|
|
|
$ git checkout -b <my-branch> upstream/master
|
|
|
```
|
|
|
|
|
|
-### Code conventions
|
|
|
+### 代码惯例
|
|
|
|
|
|
-- Use `go fmt` to format your code before commit code change. eKuiper Github Action CI pipeline reports error if it's
|
|
|
- not format by `go fmt`.
|
|
|
-- Configuration key in config files uses camel case format.
|
|
|
+- 在提交代码变更之前,使用 `go fmt` 来格式化你的代码。
|
|
|
+- 配置文件中的配置键使用 camel 大小写格式。
|
|
|
|
|
|
-### Debug your code
|
|
|
+### 调试你的代码
|
|
|
|
|
|
-Take GoLand as an example, developers can debug the code:
|
|
|
+以 GoLand 为例,开发者可以对代码进行调试。
|
|
|
|
|
|
-1. Debug the whole program. Make sure all directories mentioned in [Makefile](../../Makefile) build_prepare sections are created in your eKuiper root path. Add your breakpoints. Open `cmd/kuiperd/main.go`. In the main function, you'll find a green triangle in the ruler, click it and select debug. Then create your stream/rule that would run through your breakpoint, the debugger will pause there.
|
|
|
-2. To debug a small portion of code, we recommend writing a unit test and debug it. You can go to any test file and find the same green triangle to run in debug mode. For example, `pkg/cast/cast_test.go` TestMapConvert_Funcs can run as debug.
|
|
|
+1. 调试整个程序。确保 [Makefile](../../Makefile) build_prepare 部分提到的所有目录都在你的eKuiper根路径中创建。添加你的断点。打开 `cmd/kuiperd/main.go` 。在主函数中,你会发现标尺上有一个绿色的三角形,点击它并选择调试。然后创建你的流/规则,让它运行到你的断点,调试器会在那里暂停。
|
|
|
+2. 要调试一小部分代码,我们建议写一个单元测试并调试它。你可以到任何一个测试文件中,找到同样的绿色三角形,在调试模式下运行。例如,`pkg/cast/cast_test.go` TestMapConvert_Funcs 可以作为调试运行。
|
|
|
|
|
|
-### Testing
|
|
|
+### 测试
|
|
|
|
|
|
-The eKuiper project leverages Github actions to run unit test & FVT (functional verification test), so please take a
|
|
|
-look at the PR status result, and make sure that all of testcases run successfully.
|
|
|
+eKuiper 项目利用 Github actions 来运行单元测试和 FVT(功能验证测试),所以请看一下 PR 状态的运行结果,并确保所有的测试用例都能成功运行。
|
|
|
|
|
|
-- Write Golang unit testcases to test your code if necessary.
|
|
|
-- A set of [FVT testcases](../../test/README.md) will be triggered with any PR submission, so please make sure that these
|
|
|
- testcases can be run successfully.
|
|
|
+- 如果有必要,请编写 Golang 单元测试案例来测试你的代码。
|
|
|
+- [FVT测试案例](../../test/README.md) 将随着任何PR提交而被触发,所以请确保这些测试案例能够成功运行。
|
|
|
|
|
|
-### Licensing
|
|
|
+### 许可
|
|
|
|
|
|
-All code contributed to eKuiper will be licensed under Apache License V2. You need to ensure every new files you are adding have the right license header.
|
|
|
+所有贡献给eKuiper的代码都将在Apache License V2下授权。你需要确保你添加的每个新文件都有正确的许可证头。
|
|
|
|
|
|
-### Sign-off commit
|
|
|
+### Signoff
|
|
|
|
|
|
-The sign-off is to certify the origin of the commit. It is required to commit to this project. If you set
|
|
|
-your `user.name` and `user.email` git configs, you can sign your commit automatically with `git commit -s`. Each commit must be signed off.
|
|
|
+Sifnoff 是为了证明提交的来源。它是提交给这个项目的必要条件。如果你设置了
|
|
|
+你的`user.name`和`user.email`的 git 配置,你可以用`git commit -s`自动签署你的提交。每次提交都必须签名。
|
|
|
|
|
|
-### Syncing
|
|
|
+### 同步
|
|
|
|
|
|
-Periodically while you work, and certainly before submitting a pull request, you should update your branch with the most recent changes to the target branch. We prefer rebase than merge to avoid extraneous merge commits.
|
|
|
+在提交 PR 之前,你应该用目标分支的最新改动来更新你的分支。我们倾向于使用 rebase 而不是 merge,以避免不必要的合并提交。
|
|
|
|
|
|
```shell
|
|
|
git fetch upstream
|
|
|
git rebase upstream/master
|
|
|
```
|
|
|
|
|
|
-Then you can push to your forked repo. Assume the remove name for your forked is the default `origin`. If you have rebased the git history before the last push, add `-f` to force pushing the changes.
|
|
|
+假设你 forked repo 名称是默认的`origin`, 使用如下指令推送改动到你的 forked repo。假设你 forked repo 名称是默认的`origin`。如果你在最后一次推送前重新建立了 git 历史,请添加 `-f` 来强制推送这些变化。
|
|
|
|
|
|
```shell
|
|
|
git push origin -f
|
|
|
```
|
|
|
|
|
|
-### Submitting changes
|
|
|
+### 提交修改
|
|
|
|
|
|
-The `master` branch is active development branch, so it's recommended to set `master` as base branch, and also create PR
|
|
|
-against `master` branch.
|
|
|
+`master` 分支是活跃的开发分支,所以建议将 `master` 设为基础分支,并在 `master` 分支下创建PR
|
|
|
|
|
|
-Organize your commits to make a committer’s job easier when reviewing. Committers normally prefer multiple small pull requests, instead of a single large pull request. Within a pull request, a relatively small number of commits that break the problem into logical steps is preferred. For most pull requests, you'll squash your changes down to 1 commit. You can use the following command to re-order, squash, edit, or change description of individual commits.
|
|
|
+组织你的提交,使提交者在审查时更容易。提交者通常喜欢多个小的拉动请求,而不是一个大的拉动请求。在一个拉动请求中,最好有相对较少的提交,将问题分解成合理的步骤。对于大多数 PR ,你可以将你的修改压缩到一个提交。你可以使用下面的命令来重新排序、合并、编辑或改变单个提交的描述。
|
|
|
|
|
|
```shell
|
|
|
git rebase -i upstream/master
|
|
|
```
|
|
|
|
|
|
-Make sure all your commits comply to the [commit message guidelines](#commit-message-guidelines).
|
|
|
+确保你的所有提交都符合[提交信息指南](#提交信息指南)。
|
|
|
|
|
|
-You'll then push to your branch on your forked repo and then navigate to eKuiper repo to create a pull request. Our GitHub repo provides automatic testing with GitHub action. Please make sure those tests pass. We will review the code after all tests passed.
|
|
|
+然后你会推送到你 forked 的 repo 上的分支,然后导航到 eKuiper repo 创建一个 PR 。我们的 GitHub repo 提供了基于 GitHub actions的自动化测试。请确保这些测试通过。我们将在所有测试通过后审查代码。
|
|
|
|
|
|
-### Commit Message Guidelines
|
|
|
+### 提交信息指南
|
|
|
|
|
|
-Each commit message consists of a **header**, a **body** and a **footer**. The header has a special format that includes a **type**, a **scope** and a **subject**:
|
|
|
+每条提交信息都由一个 **header** ,一个 **body** 和一个 **footer** 组成。header 包含三个部分:**类型**,**范围**和**主题**。
|
|
|
|
|
|
```
|
|
|
-<type>(<scope>): <subject>
|
|
|
-<BLANK LINE>
|
|
|
+<类型>(<范围>): <主题>
|
|
|
+<空行>
|
|
|
<body>
|
|
|
-<BLANK LINE>
|
|
|
+<空行>
|
|
|
<footer>
|
|
|
```
|
|
|
|
|
|
-The **header** with **type** is mandatory. The **scope** of the header is optional. This repository has no predefined scopes. A custom scope can be used for clarity if desired.
|
|
|
+**header** 的**类型**为必填项。header 的**范围**是可选的。没有预定义的范围选项,可以使用一个自定义的范围。
|
|
|
|
|
|
-Any line of the commit message cannot be longer 100 characters! This allows the message to be easier to read on GitHub as well as in various git tools.
|
|
|
+提交信息的任何一行都不能超过100个字符,这样可以使信息在 GitHub 以及各种 git 工具中更容易阅读。
|
|
|
|
|
|
-The footer should contain a [closing reference to an issue](https://help.github.com/articles/closing-issues-via-commit-messages/) if any.
|
|
|
+如果有的话,footer 应该包含一个 [对问题的关闭引用](https://help.github.com/articles/closing-issues-via-commit-messages/)。
|
|
|
|
|
|
-Example 1:
|
|
|
+例子1:
|
|
|
|
|
|
```
|
|
|
-feat: add Fuji release compose files
|
|
|
+feat: 添加编译文件
|
|
|
```
|
|
|
|
|
|
```
|
|
|
-fix(script): correct run script to use the right ports
|
|
|
+fix(script): 纠正运行脚本以使用正确的端口
|
|
|
|
|
|
-Previously device services used wrong port numbers. This commit fixes the port numbers to use the latest port numbers.
|
|
|
+以前的设备服务使用了错误的端口号。这个提交修正了端口号,使用最新的端口号。
|
|
|
|
|
|
-Closes: #123, #245, #992
|
|
|
+关闭。#123, #245, #992
|
|
|
```
|
|
|
|
|
|
#### Revert
|
|
|
|
|
|
-If the commit reverts a previous commit, it should begin with `revert: `, followed by the header of the reverted commit. In the body it should say: `This reverts commit <hash>.`, where the hash is the SHA of the commit being reverted.
|
|
|
+如果该提交是为了恢复之前的提交,它应该以 `revert: `开头,然后是被恢复的提交的标题。在正文中,应该说:"这是对提交 hash 的恢复",其中的 hash 是被恢复的提交的 SHA 值。
|
|
|
|
|
|
-#### Type
|
|
|
+#### 类型
|
|
|
|
|
|
-Must be one of the following:
|
|
|
+必须是以下类型之一:
|
|
|
|
|
|
-- **feat**: New feature for the user, not a new feature for build script
|
|
|
-- **fix**: Bug fix for the user, not a fix to a build script
|
|
|
-- **docs**: Documentation only changes
|
|
|
-- **style**: Formatting, missing semi colons, etc; no production code change
|
|
|
-- **refactor**: Refactoring production code, eg. renaming a variable
|
|
|
-- **chore**: Updating grunt tasks etc; no production code change
|
|
|
-- **perf**: A code change that improves performance
|
|
|
-- **test**: Adding missing tests, refactoring tests; no production code change
|
|
|
-- **build**: Changes that affect the CI/CD pipeline or build system or external dependencies (example scopes: travis, jenkins, makefile)
|
|
|
-- **ci**: Changes provided by DevOps for CI purposes.
|
|
|
-- **revert**: Reverts a previous commit.
|
|
|
+- **feat**。为用户提供的新功能,而不是构建脚本的新功能
|
|
|
+- **fix**: 为用户提供的错误修复,而不是对构建脚本的修复
|
|
|
+- **docs**: 只对文档进行修改
|
|
|
+- **style**: 格式化,缺少分号,等等;没有生产代码的变化
|
|
|
+- **refactor**: 重构生产代码,例如重命名一个变量。
|
|
|
+- **chore**: 更新脚本任务等;不改变生产代码
|
|
|
+- **perf**: 提高性能的代码变化
|
|
|
+- **test**: 添加缺失的测试,重构测试;不改变生产代码
|
|
|
+- **build**: 影响 CI/CD 管道或构建系统或外部依赖的变化(例如 makefile)。
|
|
|
+- **ci**: 由 DevOps 提供的用于 CI 目的的改变。
|
|
|
+- **revert**: 恢复先前的提交。
|
|
|
|
|
|
-#### Scope
|
|
|
+#### 范围
|
|
|
|
|
|
-There are no predefined scopes for this repository. A custom scope can be provided for clarity.
|
|
|
+这个版本库没有预定义的范围。为了清晰起见,可以提供一个自定义的范围。
|
|
|
|
|
|
-#### Subject
|
|
|
+#### 主题
|
|
|
|
|
|
-The subject contains a succinct description of the change:
|
|
|
+主题包含对修改的简洁描述。
|
|
|
|
|
|
-- use the imperative, present tense: "change" not "changed" nor "changes"
|
|
|
-- don't capitalize the first letter
|
|
|
-- no dot (.) at the end
|
|
|
+- 使用祈使句、现在时:"改变 "而不是 "改变 "或 "变化"
|
|
|
+- 不要把第一个字母大写
|
|
|
+- 结尾不加点(...)。
|
|
|
|
|
|
-#### Body
|
|
|
+#### body
|
|
|
|
|
|
-Just as in the **subject**, use the imperative, present tense: "change" not "changed" nor "changes". The body should include the motivation for the change and contrast this with previous behavior.
|
|
|
+与主题一样,使用祈使句、现在时:"改变 "而不是 "改变 "或 "变化"。主体应该包括改变的动机,并与以前的行为进行对比。
|
|
|
|
|
|
-#### Footer
|
|
|
+#### footer
|
|
|
|
|
|
-The footer should contain any information about **Breaking Changes** and is also the place to reference GitHub issues that this commit **Closes**.
|
|
|
+页脚应该包含任何关于**突破性变化的信息,同时也是引用此提交**关闭的 GitHub 问题的地方。
|
|
|
|
|
|
-**Breaking Changes** should start with the word `BREAKING CHANGE:` with a space or two newlines. The rest of the commit message is then used for this.
|
|
|
+**Breaking Changes** 应该以 "BREAKING CHANGE: "开头,并加上一个空格或两个换行。提交信息的其余部分就用于此了。
|
|
|
|
|
|
-## Community Promotion
|
|
|
+## 社区推广
|
|
|
|
|
|
-Besides coding, other types of contributions are a great way to get involved. Welcome to contribute to this project by
|
|
|
-promoting it to the open source community and the world.
|
|
|
+除了编码,其他类型的贡献也是参与的好方法。欢迎通过以下方式为这个项目做出贡献
|
|
|
+向开源社区和世界推广它。
|
|
|
|
|
|
-The promotion contributions include but not limit to:
|
|
|
+推广贡献包括但不限于。
|
|
|
|
|
|
-- Integrate of eKuiepr to your open source project
|
|
|
-- Organize workshops or meetups about the project
|
|
|
-- Answer questions about the project on issues, slack or maillist
|
|
|
-- Write tutorials for how project can be used
|
|
|
-- Offer to mentor another contributor
|
|
|
+- 将 eKuiepr 整合到你的开源项目中。
|
|
|
+- 组织关于本项目的研讨会或聚会
|
|
|
+- 在 issues、slack 或 maillist 上回答关于本项目的问题
|
|
|
+- 撰写项目的使用教程
|
|
|
+- 为其他贡献者提供指导
|
|
|
|
|
|
-Thank you for taking the time to contribute!
|
|
|
+感谢你的贡献!
|