|
| 1 | +# Contributing to Scylla Operator |
| 2 | + |
| 3 | +## Initial Setup |
| 4 | + |
| 5 | +### Fork the repository |
| 6 | + |
| 7 | +Follow GitHub's official documentation on [forking a repository](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/working-with-forks/fork-a-repo). |
| 8 | + |
| 9 | +## Development |
| 10 | + |
| 11 | +To add a feature or to make a bug fix, you will need to create a branch in your fork and then submit a pull request (PR) from the branch. |
| 12 | +A subset of useful commands: |
| 13 | +* `make build` - build project binaries |
| 14 | +* `make test-unit` - run unit tests |
| 15 | +* `make update` - run all code generators |
| 16 | +* `make verify` - verify if all autogenerated changes are generated. |
| 17 | + |
| 18 | +Check `make help` for more. |
| 19 | + |
| 20 | +## Coding convention |
| 21 | + |
| 22 | +Follow these guidelines for writing and structuring your code: |
| 23 | +* [Effective Go](https://go.dev/doc/effective_go) |
| 24 | +* [Go Code Review Comments](https://go.dev/wiki/CodeReviewComments) |
| 25 | +* [API changes](https://github.com/kubernetes/community/blob/master/contributors/devel/sig-architecture/api_changes.md) |
| 26 | +* [API conventions](https://github.com/kubernetes/community/blob/master/contributors/devel/sig-architecture/api-conventions.md) |
| 27 | + |
| 28 | + |
| 29 | +In cases where the existing code doesn't fully follow these conventions, try to be consistent with what's already there. Make sure to familiarize yourself with these resources before making changes. |
| 30 | + |
| 31 | +## Enhancement proposals |
| 32 | + |
| 33 | +For significant features or API changes, you might be required to prepare an enhancement proposal beforehand, as these usually involve broader discussions. If unsure, please consult the [maintainers of the project](https://github.com/scylladb/scylla-operator/blob/master/OWNERS) to learn if your contribution falls into these categories before you start working on the implementation. |
| 34 | +For further details, see [Enhancement Proposals directory](https://github.com/scylladb/scylla-operator/tree/master/enhancements). |
| 35 | + |
| 36 | +## Submitting a Pull Request |
| 37 | + |
| 38 | +Once you have implemented the feature or bug fix in your branch, open a PR to the upstream repository. Before doing so, ensure the following: |
| 39 | +- Unit tests are included. |
| 40 | +- End-to-end tests are passing. |
| 41 | +- Your commit history is clean. |
| 42 | + |
| 43 | +### Commit History |
| 44 | + |
| 45 | +To maintain a clean commit history, aim for a minimal number of logical commits. Typically, this means a single commit that contains all the changes, with a separate commit for autogenerated parts. |
| 46 | + |
| 47 | +### Commits and PRs |
| 48 | + |
| 49 | +The **subject line** of your commit message **and the PR title** should summarize the change in one clear sentence that would be meaningful to a user of the Operator. The sentence should be **written in the imperative**, i.e. written as if giving a command or instruction, e.g. "Add support for XYZ". A properly formed Git commit subject line should always be able to complete the sentence "If applied, this commit will...", e.g. "If applied, this commit will **Add support for XYZ**". |
| 50 | +Changelog entries are verbatim PR titles, so make them concise yet informative. |
| 51 | + |
| 52 | +Further details should be added after a blank line. Explain why the change was necessary, not just what was changed. In the general case, extensive descriptions are well-received. Comparing the behavior before and after the change is especially helpful. Write the message with the mindset that you’ll need to revisit the code in the future. |
| 53 | +If your PR fixes an issue, include "Resolves #1234" in the description, replacing "1234" with the issue number. |
| 54 | + |
| 55 | +``` |
| 56 | +**Description of your changes:** |
| 57 | +Add new XYZ field to ScyllaCluster CRD. |
| 58 | +The new field allows for configuration of ZYX feature of ScyllaDB. |
| 59 | +<more details> |
| 60 | +API change was discussed in the following enhancement: <link>. |
| 61 | +
|
| 62 | +**Which issue is resolved by this Pull Request:** |
| 63 | +Resolves #1234 |
| 64 | +``` |
| 65 | + |
| 66 | +### Code review |
| 67 | + |
| 68 | +Refer to [The Standard of Code Review](https://github.com/golang/go/wiki/CodeReviewComments) for best practices when conducting peer reviews or responding to feedback. |
| 69 | + |
| 70 | +### Submitting |
| 71 | + |
| 72 | +After addressing the review feedback, squash your changes into the original commits. Avoid adding new commits. Your PR should always be in a mergeable state. |
0 commit comments