|
1 | 1 | # Contributing Guide |
2 | 2 |
|
3 | | -We would love for you to contribute to this project and help make it even better than it is today! |
4 | | -As a contributor, here are the guidelines we would like you to follow: |
| 3 | +We would love for you to contribute to this project and help make it even better than it is today! 💎 |
5 | 4 |
|
6 | | - - [Code of Conduct](#coc) |
| 5 | +As a contributor, here are the guidelines we would like you to follow: |
| 6 | + - [Code of Conduct](https://github.com/permitio/opal/blob/master/CODE_OF_CONDUCT.md) |
7 | 7 | - [Question or Problem?](#question) |
8 | 8 | - [Issues and Bugs](#issue) |
9 | 9 | - [Feature Requests](#feature) |
10 | | - - [Submission Guidelines](#submit) |
11 | | - |
12 | | - |
13 | | -## <a name="coc"></a> Code of Conduct |
14 | | -Help us keep this community open and inclusive. |
15 | | - |
16 | | -[Our code of conduct is located here.](https://github.com/permitio/opal/blob/master/CODE_OF_CONDUCT.md) |
| 10 | + - [Development Guidelines](#development) |
17 | 11 |
|
18 | 12 | ## <a name="question"></a> Got a Question or Problem? |
19 | 13 | Come talk to us about OPAL, or authorization in general - we would love to hear from you ❤️ |
20 | 14 |
|
21 | 15 | You can: |
22 | | -- Raise questions in our [Github discussions](https://github.com/permitio/opal/discussions) |
23 | | -- Report issues and ask for features in [Github issues](https://github.com/permitio/opal/issues) |
24 | | -- Follow us on [Twitter](follow-twitter-link) to get the latest OPAL updates |
25 | | -- Join our [Slack community](join-slack-link) to chat about authorization, open-source, realtime communication, tech or anything else! We are super available on slack ;) |
26 | | - |
| 16 | +- Raise questions in our [GitHub discussions](https://github.com/permitio/opal/discussions) |
| 17 | +- Report issues and ask for features in [GitHub issues](https://github.com/permitio/opal/issues) |
| 18 | +- Follow us on [Twitter](https://twitter.com/opal_ac) to get the latest OPAL updates |
| 19 | +- Join our [Slack community](https://io.permit.io/slack) to chat about authorization, open-source, realtime communication, tech or anything else! We are super available on Slack ;) |
27 | 20 |
|
28 | 21 | If you are using our project, please consider giving us a ⭐️ |
29 | 22 | </br> |
30 | 23 | </br> |
31 | 24 |
|
32 | | -[![Button][join-slack-link]][badge-slack-link] </br> [![Button][follow-twitter-link]][badge-twitter-link] |
| 25 | +[](https://bit.ly/opal-slack)</br> [](https://twitter.com/opal_ac) |
| 26 | + |
| 27 | +### <a name="issue"></a> Found a Bug? |
| 28 | +If you find a bug in the source code, you can help us by [submitting an issue](https://github.com/permitio/opal/issues) or even better, you can [submit a Pull Request](#submit-pr) with a fix. |
| 29 | + |
| 30 | +Before you submit an issue, please search the issue tracker; maybe an issue for your problem already exists, and the discussion might inform you of workarounds readily available. |
33 | 31 |
|
| 32 | +We want to fix all the issues as soon as possible, but before fixing a bug, we need to reproduce and confirm it. |
| 33 | +In order to reproduce bugs, we require that you provide: |
| 34 | +- Full logs of OPAL server and OPAL client |
| 35 | +- Your configuration for OPAL server and OPAL client |
| 36 | + - i.e.: Docker Compose, Kubernetes YAMLs, environment variables, etc. |
| 37 | + - Redact any secrets/tokens/API keys in your config |
34 | 38 |
|
35 | | -[join-slack-link]: https://i.ibb.co/wzrGHQL/Group-749.png |
36 | | -[badge-slack-link]: https://bit.ly/opal-slack |
37 | | -[follow-twitter-link]: https://i.ibb.co/k4x55Lr/Group-750.png |
38 | | -[badge-twitter-link]: https://twitter.com/opal_ac |
| 39 | +### <a name="feature"></a> Missing a Feature? |
| 40 | +You can *request* a new feature by [submitting an issue](https://github.com/permitio/opal/issues) to our GitHub Repository. |
| 41 | +Please provide as much detail and context as possible, along with examples or references to similar features, as this will help us understand your request better. |
39 | 42 |
|
40 | | -## <a name="issue"></a> Found a Bug? |
41 | | -If you find a bug in the source code, you can help us by [submitting an issue](#submit-issue) or even better, you can [submit a Pull Request](#submit-pr) with a fix. |
| 43 | +We encourage you to contribute to OPAL by submitting a [Pull Request](#submit-pr) with your feature implementation and are happy to guide you through the process. |
42 | 44 |
|
43 | | -## <a name="feature"></a> Missing a Feature? |
44 | | -You can *request* a new feature by [submitting an issue](#submit-issue) to our GitHub Repository. |
| 45 | +Custom Fetch Providers are a great way to extend OPAL, and we would love to see your implementation of a new fetch provider! |
| 46 | +To get started, you can check out the tutorial on how to [Write Your Own Fetch Provider](https://opal.ac/tutorials/write_your_own_fetch_provider). |
45 | 47 |
|
46 | | -## <a name="submit"></a> Submission Guidelines |
| 48 | +We are always looking to improve OPAL and would love to hear your ideas! |
47 | 49 |
|
48 | | -### <a name="submit-issue"></a> Submitting an Issue |
| 50 | +### <a name="submit-pr"></a> Submitting a Pull Request (PR) |
49 | 51 |
|
50 | | -Issues are submitted to our [Github issues](https://github.com/permitio/opal/issues). |
| 52 | +Pull requests are welcome! 🙏 |
| 53 | + |
| 54 | +Please follow these guidelines: |
| 55 | + |
| 56 | +1. **Create an Issue**: Open a [GitHub Issue](https://github.com/permitio/opal/issues) for your feature or bug fix. |
| 57 | +2. **Fork & Branch**: Fork this repository and create a new branch based on `master`. Name your branch descriptively (e.g., `fix/issue-123`, `feature/new-fetch-provider`). |
| 58 | +3. **Write Tests**: If your changes affect functionality, include tests. |
| 59 | +4. **Update Documentation**: Ensure any new features or configurations are documented. |
| 60 | +5. **Check Quality**: Run all tests and linters: |
| 61 | + ```bash |
| 62 | + pytest |
| 63 | + pre-commit run --all-files |
| 64 | + ``` |
| 65 | +6. **Submit PR**: Open a pull request, linking to the issue and explaining your changes clearly. |
| 66 | + |
| 67 | +We aim to review all PRs promptly. After you submit a PR, here’s what you can expect: |
| 68 | +1. **Initial Review:** A maintainer will review your PR within a few days. If there are any issues, they will provide feedback. |
| 69 | +2. **Feedback:** If changes are needed, please make the necessary updates and push them to your branch. The PR will be updated automatically. |
| 70 | +3. **Approval:** Once your PR is approved, it will be merged into the main branch. |
| 71 | +4. **Release:** Your changes will be included in the next release of OPAL. We will update the changelog and release notes accordingly. |
| 72 | +5. **Announcement:** We will announce your contribution in our community channels and give you a shoutout! 🎉 |
| 73 | + |
| 74 | +### Contributor Checklist |
| 75 | + |
| 76 | +Before submitting your contribution, ensure the following: |
| 77 | + |
| 78 | +- [ ] Issue created and linked in the PR |
| 79 | +- [ ] Branch created from `master` and appropriately named |
| 80 | +- [ ] Tests written and passing |
| 81 | +- [ ] Documentation updated (if applicable) |
| 82 | +- [ ] Code formatted and linted |
| 83 | +- [ ] Changes thoroughly explained in the PR description |
| 84 | + |
| 85 | +## <a name="development"></a> Development Guidelines |
| 86 | + |
| 87 | +We are excited to have you onboard as a contributor to OPAL! 🎉 |
| 88 | + |
| 89 | +### Setting up Your Development Environment |
| 90 | + |
| 91 | +#### Prerequisites |
| 92 | +- [Python](https://www.python.org/downloads/) |
| 93 | +- [Docker](https://docs.docker.com/get-docker/) |
| 94 | +- [OPA](https://www.openpolicyagent.org/docs/latest/#running-opa) |
| 95 | + |
| 96 | +1. Fork the repository and clone it to your local machine. |
| 97 | +2. Create a virtual environment and install the dependencies: |
| 98 | + ```bash |
| 99 | + python3 -m venv venv |
| 100 | + source venv/bin/activate |
| 101 | + pip install -r requirements.txt |
| 102 | + ``` |
| 103 | +3. Install the pre-commit hooks: |
| 104 | + ```bash |
| 105 | + pre-commit install |
| 106 | + ``` |
| 107 | + |
| 108 | +### Running OPAL Servers and Clients |
| 109 | + |
| 110 | +You can run the OPAL server and client locally using the OPAL CLI or using uvicorn directly. |
| 111 | +### Configuring OPAL |
| 112 | +Configure OPAL by setting environment variables: |
| 113 | +```bash |
| 114 | +export OPAL_POLICY_REPO_URL=https://github.com/permitio/opal-example-policy-repo |
| 115 | +export OPAL_DATA_CONFIG_SOURCES={"config":{"entries":[{"url":"http://localhost:7002/policy-data","topics":["policy_data"],"dst_path":"/static"}]}} |
| 116 | +export OPAL_SERVER_URL=http://localhost:7002 |
| 117 | +``` |
| 118 | + |
| 119 | +More information about the available configurations can be found in the [OPAL documentation](https://opal.ac/getting-started/configuration). |
| 120 | + |
| 121 | +#### Using OPAL CLI |
| 122 | +```bash |
| 123 | +opal-server run |
| 124 | +opal-client run |
| 125 | +``` |
| 126 | + |
| 127 | +#### Using uvicorn |
| 128 | +```bash |
| 129 | +uvicorn opal_server.main:app --reload |
| 130 | +uvicorn opal_client.main:app --reload |
| 131 | +``` |
| 132 | + |
| 133 | +### Building the Docker Images |
| 134 | + |
| 135 | +You can build the Docker images for the OPAL server and client using the following commands: |
| 136 | +```bash |
| 137 | +make docker-build-server |
| 138 | +make docker-build-client # with inline OPA engine |
| 139 | +make docker-build-client-cedar # with inline cedar agent engine |
| 140 | +make docker-build-client-standalone # without inline engine |
| 141 | +``` |
| 142 | + |
| 143 | +### Running the Documentation Locally |
| 144 | + |
| 145 | +When contributing to the documentation, you can run the documentation locally and preview your changes live. |
| 146 | + |
| 147 | +#### Prerequisites |
| 148 | +- [Node.js](https://nodejs.org/en/download/) |
| 149 | + |
| 150 | +#### Setting Up |
| 151 | +1. Navigate to the `docs` directory: |
| 152 | + ```bash |
| 153 | + cd documentation |
| 154 | + ``` |
| 155 | +2. Install the dependencies: |
| 156 | + ```bash |
| 157 | + npm install |
| 158 | + ``` |
| 159 | + |
| 160 | +#### Running the Documentation Live |
| 161 | + |
| 162 | +You can run the documentation live using the following command: |
| 163 | +```bash |
| 164 | +npm run start |
| 165 | +``` |
51 | 166 |
|
52 | | -Before you submit an issue, please search the issue tracker, maybe an issue for your problem already exists and the discussion might inform you of workarounds readily available. |
| 167 | +### Linting and Formatting |
53 | 168 |
|
54 | | -We want to fix all the issues as soon as possible, but before fixing a bug we need to reproduce and confirm it. |
55 | | -In order to reproduce bugs, we require that you provide: |
56 | | -- Full logs of opal server and opal client |
57 | | -- Your configuration for OPAL server and OPAL client |
58 | | - - i.e: docker compose, Kubernetes YAMLs, environment variables, etc. |
59 | | - - you should redact any secrets/tokens/api keys in your config |
| 169 | +You can run the linting and formatting checks using the following command: |
| 170 | +```bash |
| 171 | +pre-commit run --all-files |
| 172 | +``` |
60 | 173 |
|
61 | | -### <a name="submit-pr"></a> Submitting a Pull Request (PR) |
| 174 | +### Running the Tests |
| 175 | + |
| 176 | +You can run the tests using the following command: |
| 177 | +```bash |
| 178 | +pytest |
| 179 | +``` |
| 180 | + |
| 181 | +### Running E2E Tests |
62 | 182 |
|
63 | | -PRs are submitted [here](https://github.com/permitio/opal/pulls). |
| 183 | +The E2E tests run OPAL Server and Client in a docker-compose environment and test the core features of OPAL. |
| 184 | +They are external to the OPAL packages and are located in the `app-tests` directory. |
64 | 185 |
|
65 | | -- Pull requests are welcome! (please make sure to include *passing* tests and docs) |
66 | | -- Prior to submitting a PR - open an issue on GitHub, or make sure your PR addresses an existing issue well. |
| 186 | +Read more about how to run the E2E tests in the [app-tests README](app-tests/README.md). |
| 187 | + |
| 188 | +--- |
| 189 | + |
| 190 | +We’re excited to see your contributions and will do our best to support you through the process! 👏 |
0 commit comments