|
| 1 | +# Contributing to Ansible DVLS Collection |
| 2 | +Thank you for considering contributing to the Ansible DVLS Collection! This document provides guidelines for setting up your development environment, debugging, and contributing effectively. |
| 3 | + |
| 4 | +## Development Environment Setup |
| 5 | + |
| 6 | +### Folder Structure |
| 7 | + |
| 8 | +The folder structure must match the following format to ensure proper imports: |
| 9 | + |
| 10 | + ./ansible_collections/devolutions/dvls/<Project Files> |
| 11 | + |
| 12 | +This means the content of this repository should be placed directly in the dvls folder, not in a subfolder like ansible-dvls. For example this file would be: |
| 13 | + |
| 14 | + ./ansible_collections/devolutions/dvls/CONTRIBUTING.md |
| 15 | + |
| 16 | +### Debugging with Visual Studio Code |
| 17 | + |
| 18 | +To debug the project in Visual Studio Code, follow these steps: |
| 19 | + |
| 20 | +1. Copy the content from ```vscode/**``` into your local ```.vscode``` folder. |
| 21 | +2. Update the launch.json file with the appropriate environment variables: |
| 22 | +```json |
| 23 | +"env": { |
| 24 | + "DVLS_SERVER_BASE_URL": "<url>", |
| 25 | + "DVLS_APP_KEY": "<app-key>", |
| 26 | + "DVLS_APP_SECRET": "<app-secret>", |
| 27 | + "DVLS_VAULT_ID": "<vault-id>", |
| 28 | + "PYTHONPATH": "/Users/<user>/dev/git/ansible" |
| 29 | +} |
| 30 | +``` |
| 31 | + - Replace ```<url>```, ```<app-key>```, ```<app-secret>```, and ```<vault-id>``` with your actual values. |
| 32 | + - Ensure PYTHONPATH points to the directory just before the folder structure mentioned above. |
| 33 | + |
| 34 | +### Python Environment |
| 35 | + |
| 36 | +1. Create a Python virtual environment: |
| 37 | +```bash |
| 38 | + python3 -m venv venv |
| 39 | + source venv/bin/activate # On Windows, use venv\Scripts\activate |
| 40 | +``` |
| 41 | +1. Install the required dependencies: |
| 42 | +```bash |
| 43 | + pip install -r requirements.txt |
| 44 | +``` |
| 45 | +## Contributing Guidelines |
| 46 | + |
| 47 | +### Reporting Issues |
| 48 | + |
| 49 | +If you encounter a bug or have a feature request, please open an issue in the repository. Include as much detail as possible, such as: |
| 50 | + |
| 51 | +- Steps to reproduce the issue. |
| 52 | +- Expected behavior. |
| 53 | +- Actual behavior. |
| 54 | +- Relevant logs or error messages. |
| 55 | +- Version of the project. |
| 56 | + |
| 57 | +### Submitting Changes |
| 58 | + |
| 59 | +1. Fork the Repository: Create a fork of this repository in your GitHub account. |
| 60 | +2. Create a Branch: Create a new branch for your changes. |
| 61 | +3. Make Changes: Implement your changes and ensure they follow the project's coding standards. |
| 62 | +4. Write Tests: Add or update tests to cover your changes. |
| 63 | +5. Submit a Pull Request: Push your branch to your fork and open a pull request. Provide a clear description of your changes and why they are necessary. |
| 64 | + |
| 65 | +We use [ruff](https://docs.astral.sh/ruff/) as a lint, hence the ```.ruff.toml``` |
| 66 | + |
| 67 | +## Test locally |
| 68 | +You can also run integration tests locally before opening a pull request. |
| 69 | + |
| 70 | +1. Building the collection: |
| 71 | +```bash |
| 72 | + ansible-galaxy collection build |
| 73 | +``` |
| 74 | +2. Install it as a dependency |
| 75 | +```bash |
| 76 | + ansible-galaxy collection install ./path/to/devolutions-dvls-<version>.tar.gz # --force flag may be necessary to overwrite a previous build |
| 77 | +``` |
| 78 | +3. Run an integration test |
| 79 | +```bash |
| 80 | + ansible-playbook tests/integration/test_manage_secrets.yml |
| 81 | +``` |
| 82 | + |
| 83 | +## License |
| 84 | +By contributing to this project, you agree that your contributions will be licensed under the same license as this repository. |
0 commit comments