| 1 | # Contributing |
| 2 | |
| 3 | When contributing to this repository, please first discuss the change you wish to make via issue, or any other method with the owners of this repository before making a change. |
| 4 | |
| 5 | ## Environment setup |
| 6 | |
| 7 | 1. Prepare the Azure configuration file at `tests/integration/cloud-config-azure.ini`, a template of which is available in [the Ansible repo](https://github.com/ansible/ansible/blob/23a84902cb9599fe958a86e7a95520837964726a/test/lib/ansible_test/config/cloud-config-azure.ini.template). Populate your appropriate credential and resource group information. |
| 8 | - The account or service principal must have permission (typically Owner) on the resource groups. |
| 9 | 1. Ensure the resource groups defined in your configuration file are already created. Recommended region: **East US** (not all regions support all Azure features). |
| 10 | 1. Prepare testing directory (necessary until [ansible/ansible#68499](https://github.com/ansible/ansible/issues/68499) is resolved): |
| 11 | ```bash |
| 12 | git init ansible_collections |
| 13 | ``` |
| 14 | 1. Unless you are running `ansible-test` inside a container (`--docker` flag), it is recommended you install Ansible and this repository's dependencies in a virtual environment: |
| 15 | ```bash |
| 16 | python3 -m venv venv |
| 17 | . venv/bin/activate |
| 18 | pip3 install -U pip |
| 19 | pip3 install ansible |
| 20 | pip3 install -r requirements.txt |
| 21 | pip3 install -r sanity-requirements.txt |
| 22 | ``` |
| 23 | |
| 24 | ## Running tests |
| 25 | |
| 26 | 1. Build/install the collection: |
| 27 | ```bash |
| 28 | rm -f azure-azcollection-*.tar.gz && ansible-galaxy collection build . --force && ansible-galaxy collection install azure-azcollection-*.tar.gz --force |
| 29 | ``` |
| 30 | 1. Switch to the test environment directory where the collection installed: |
| 31 | ```bash |
| 32 | cd ansible_collections/azure/azcollection/ |
| 33 | ``` |
| 34 | 1. Run tests for the desired module(s): |
| 35 | ```bash |
| 36 | ansible-test integration azure_rm_storageaccount --allow-destructive -v |
| 37 | ansible-test sanity azure_rm_storageaccount --color --junit -v |
| 38 | ``` |
| 39 | |
| 40 | Additional `ansible-test` resources: |
| 41 | * [Integration tests](https://docs.ansible.com/ansible/latest/dev_guide/testing_integration.html). |
| 42 | * [Testing Sanity](https://docs.ansible.com/ansible/latest/dev_guide/testing_sanity.html). |
| 43 | |
| 44 | ## Pull Request Process |
| 45 | |
| 46 | 1. Fork this project into your account if you are a first-time contributor. |
| 47 | 1. Create a branch based on the latest `dev` branch, commit your changes on this branch. |
| 48 | 1. You may merge the Pull Request in once you have the sign-off of two other developers, or if you do not have permission to do that, you may request the second reviewer to merge it for you. |
| 49 | |
| 50 | ## Tests / sanity checks |
| 51 | |
| 52 | 1. Please provide integration tests showing the changed behavior/functionality under `tests/integration/targets/<relevant-module>/tasks`. |
| 53 | 1. Think about updating the documentation and examples for the changed module. |
| 54 | 1. Please run a sanity check. Install prerequisites `pip install -r sanity-requirements.txt`, run with `ansible-test sanity --color -v --junit`. Read more at https://docs.ansible.com/ansible/latest/dev_guide/testing_sanity.html. |
| 55 | 1. There is a script `tests/utils/ado/ado.sh` for running tests inside an Azure DevOps pipeline. Unfortunately the pipeline and results are not visible for the public. You can perhaps adapt the parts of the script or use a small playbook to run the task list of the integration tests mentioned above. |
| 56 | |
| 57 | ## Release Process |
| 58 | |
| 59 | 1. Create a release branch from the target commit on dev branch. |
| 60 | 1. Update version in [galaxy.yml](galaxy.yml) and release logs in [CHANGELOG.md](CHANGELOG.md). |
| 61 | 1. Make sure the release branch is ready to release, merge the release branch into master branch. |
| 62 | 1. Tag the master branch with new version number like `v*.*.*`, push to origin. |
| 63 | 1. Release pipleline will automatically release the new version to galaxy. |
| 64 | 1. Merge released changes back to `dev` branch. |
| 65 | |
| 66 | ## Release status |
| 67 | |
| 68 | For each release details, you can refer to the [CHANGELOG](CHANGELOG.md) which contains the dates and significant changes in each minor release. |