diff --git a/examples/reqs_v2/requirements.yml b/examples/reqs_v2/requirements.yml index 83fef396..190dc397 100644 --- a/examples/reqs_v2/requirements.yml +++ b/examples/reqs_v2/requirements.yml @@ -9,3 +9,13 @@ roles: name: geerlingguy.mysql collections: - name: community-molecule-0.1.0.tar.gz + # Also needed for testing purposes as this should trigger addition of --pre + # argument as this is required due to + # https://github.com/ansible/ansible-lint/issues/3686 + # https://github.com/ansible/ansible/issues/79109 + - name: https://github.com/ansible-collections/amazon.aws.git + type: git + version: main + - name: https://github.com/ansible-collections/community.aws.git + type: git + version: main diff --git a/src/ansible_compat/runtime.py b/src/ansible_compat/runtime.py index a13d5148..9d921587 100644 --- a/src/ansible_compat/runtime.py +++ b/src/ansible_compat/runtime.py @@ -555,6 +555,13 @@ def install_requirements( # noqa: C901 "install", "-v", ] + for collection in reqs_yaml["collections"]: + if isinstance(collection, dict) and collection.get("type", "") == "git": + _logger.info( + "Adding '--pre' to ansible-galaxy collection install because we detected one collection being sourced from git.", + ) + cmd.append("--pre") + break if offline: _logger.warning( "Skipped installing collection dependencies due to running in offline mode.",