ansible / mazer

Experimental Ansible Galaxy Content Manager
GNU General Public License v3.0
114 stars 18 forks source link

Read SCM ignore files to add to dir excludes and pattern ignores #195

Open ironfroggy opened 5 years ago

ironfroggy commented 5 years ago

Feature Request

Use Case

Some patterns and directories are excluded by default (like *.pyc files and the .git directory) but any ignored files in my repo are still included, and ignored files often include sensitive information.

Proposed Solution

Read .gitignore, .hgignore, etc not ignored patterns for mazer build's collection consumption.

Alternatives

Alternatively, if there is any strong case to ignore/exclude different files between the repo and the build, add an ignore file for mazer itself, like a .galaxyignore or something?

Implementation

It looks like there was some intention of this, given that the skipped patterns are described in the variable names as defaults here: https://github.com/ansible/mazer/blob/23ba54acf45a5d411ff75b402db33064a5894ef1/ansible_galaxy/collection_members.py

but there's currently no ticket tracking anything about extending beyond those defaults, and a default without a way to change is just a hardcode.

alikins commented 5 years ago

Good idea to add a issue for tracking requested changes to the default 'ignores' used by 'mazer build'

As of

bd8af9853be4b07abae909a2cc0e1d2b56bbe8de:

# No mechanism for configuring or overriding these defaults for any case.
DEFAULT_IGNORE_DIRS = ['releases', 'CVS', '.bzr', '.hg', '.git', 
                       '.svn', '__pycache__','.tox']
DEFAULT_IGNORE_PATTERNS = ['*.pyc', '*.retry']

In the future, could make it configurable, possibly per user or per collection. Could also revisit supporting scm ignore file formats (ie, .gitignore etc)