-
Notifications
You must be signed in to change notification settings - Fork 665
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix: Update default globbing pattern for collection matching #4177
Conversation
Label error. Requires exactly 1 of: bug, enhancement, major, minor, patch, skip-changelog. Found: |
So I was curious why $ MOLECULE_GLOB="./extensions/molecule/*/molecule.yml" molecule test
$ MOLECULE_GLOB="$(pwd)/extensions/molecule/*/molecule.yml" molecule test
|
1ad85d7
to
bed6bff
Compare
e090dbe
to
2a4542b
Compare
f8d3d87
to
2ee3123
Compare
This update:
molecule test
MOLECULE_GLOB="**/molecule/*/molecule.yml"
This allows:
.cache/molecule/COLLECTION_NAME
.WARNING:
If working within the ANSIBLE_COLLECTIONS_PATH directory, e.g.
~/.ansible/collections/ansible_collections/COLLECTION_NAME
(default), using the new default settingMOLECULE_GLOB="**/molecule/*/molecule.yml"
will globber clobber and delete the collection folder. This occurs in the presence of agalaxy.yml
- as molecule callsansible_compat.runtime(isolate=False)
and will runansible_compat.runtime.prepare_environment
. However, if you delete thegalaxy.yml
OR chdir intoCOLLECTION_NAME/extensions
and it will not delete the collection folder.Currently (v24.2.1):
Calling
molecule list
will find all molecule.yml files within a collection folder that use a nested dir structure, i.eCOLLECTION_NAME/extensions/molecule/SCENARIO_NAME/molecule.yml
. As it callsbase.get_configs
and sets the argumentglob=str"**/molecule/*/molecule.yml"
.This does not occur with
molecule test
, as it calls tobase.execute_cmdline_scenarios
and usesMOLECULE_GLOB = os.environ.get("MOLECULE_GLOB", "molecule/*/molecule.yml")
.Attempting to set an env var
MOLECULE_GLOB="**/molecule/*/molecule.yml"
will fail, astest
attempts to insert the scenario name into every wild-card. But, this fuzzy matching acts as a safe guard against deleting the collection when working within the same ANSIBLE_COLLECTIONS_PATH directory: