How to test a collection PR

Reviewers and issue authors can verify a PR fixes the reported bug by testing the PR locally.

Prepare your environment

We assume that you use Linux as a work environment (you can use a virtual machine as well) and have git installed.

  1. Install Ansible or ansible-core.

  2. Create the following directories in your home directory:

mkdir -p ~/ansible_collections/NAMESPACE/COLLECTION_NAME

For example, if the collection is community.general:

mkdir -p ~/ansible_collections/community/general

If the collection is ansible.posix:

mkdir -p ~/ansible_collections/ansible/posix
  1. Clone the forked repository from the author profile to the created path:

git clone https://github.com/AUTHOR_ACC/COLLECTION_REPO.git ~/ansible_collections/NAMESPACE/COLLECTION_NAME
  1. Go to the cloned repository.

cd ~/ansible_collections/NAMESPACE/COLLECTION_NAME
  1. Checkout the PR branch (it can be retrieved from the PR’s page):

git checkout pr_branch

Test the Pull Request

  1. Include ~/ansible_collections in COLLECTIONS_PATHS. See COLLECTIONS_PATHS for details.

  2. Run your playbook using the PR branch and verify the PR fixed the bug.

  3. Give feedback on the pull request or the linked issue(s).