overview icon indicating copy to clipboard operation
overview copied to clipboard

[2d] Galaxy build ignore file - tests/output? Others from gitignore

Open gundalow opened this issue 4 years ago • 9 comments

ansible-galaxy collection build has support for an ignore list to prevent files ending up in the built tarball.

Although ideally Collection builds should be happening in a sandbox (CI) their is still the chance that they may include incorrect files.

Also people do build and publish collections locally, where their checkouts maybe dirty.

Posisble entries

  • tests/ (check ansible-base's .gitignore
  • ignore .gitignore

Once agreed

  • update collections under https://github.com/ansible-collections/
  • Raise PR to update the default ignore file in https://github.com/ansible/ansible/tree/devel/lib/ansible/galaxy/data/default

gundalow avatar Apr 28 '20 15:04 gundalow

I also added the collection build artifacts to build_ignore for a test collection after almost including one into the next version:

build_ignore:
  - '<namespace>-<name>-*.tar.gz'
  - .gitignore

felixfontein avatar May 01 '20 16:05 felixfontein

I wonder if ansible-galaxy collection,role init should add a default gitignore https://github.com/ansible/ansible/tree/devel/lib/ansible/galaxy/data/default

gundalow avatar May 01 '20 20:05 gundalow

A default .gitignore to prevent uploading collection build tar.gz would be nice. I can see a lot of people not deleting those when they do git push after local builds, having it stop *.pyc would probably be nice too

ericsysmin avatar May 07 '20 15:05 ericsysmin

@ericsysmin is it caused by missing entries in .gitignore, or in build_ignore, or both?

felixfontein avatar May 07 '20 15:05 felixfontein

.gitignore would prevent people from uploading the .tar.gz to github repeatedly, build already ignores it

*.pyc would be uploaded if not in .gitignore, and not sure if the build already excludes pyc, but you do get those in git if they aren't in your .gitignore, and are created when testing python scripts, or running molecule tests

ericsysmin avatar May 07 '20 15:05 ericsysmin

I am running ansible 2.9.6, but still getting [WARNING]: Found unknown keys in collection galaxy.yml at '/Users/adn/workspaces/nazare/operator-collections/ims/galaxy.yml': build_ignore

build_ignore:
  - yamllint.yaml
  - .gitignore
  - gh-pages
  - dist
  - run
  - '*.tar.gz'

and the build still pick ups everything in the build_ignore list.

adn1107 avatar Oct 20 '21 18:10 adn1107

@adn1107 Ansible 2.9 does not support ignore stuff. You will need to update to at least ansible-base-2.10 or ansible-core.

tadeboro avatar Oct 20 '21 18:10 tadeboro

@adn1107 also please note that Ansible 2.9.6 is really, really old and has security issues that were fixed a long time ago. You should really upgrade, even if just to the latest 2.9.x release.

felixfontein avatar Oct 20 '21 18:10 felixfontein

Thanks all. Upgrading to latest Ansible solved the problem.

adn1107 avatar Oct 20 '21 21:10 adn1107