berkshelf/ridley

Not respecting chefignore?

Closed this issue · 5 comments

ivey commented

berkshelf/berkshelf#587 indicates chefignore isn't being respected, and we call straight to ridley for upload.

Okay. I traced this down. We actually are respecting chefignores. The problem is that File.fnmatch is getting passed the entire filepath (expanded path). In short:

File.fnmatch?("README.md", "README.md") #=> true
File.fnmatch?("README.md", "/Users/sethvargo/cookbooks/foo/README.md") #=> false

So we'll need to generate the relative pathnames and then apply File#fnmatch. I'm working on this now.

Just updated to 2.0.14:

  • berkshelf (2.0.14)
  • ridley (1.5.3)

And it looks like chefignore is being ignored again:

mycookbook $ bundle list | grep -E 'ridley|berkshelf'
  * berkshelf (2.0.14)
  * ridley (1.5.3)

Uploading with chef works fine:

mycookbook $ knife cookbook upload mycookbook -o ../
Uploading mycookbook   [0.1.23]
Uploaded 1 cookbook.

mycookbook $ knife diff
mycookbook $ 

Uploading with berks/ridley ingores chefignore:

mycookbook $ bundle exec berks upload --no-freeze
Uploading mycookbook (0.1.23) to: 'chef-server'
...

mycookbook $  knife diff --name-only
.gitignore
Berksfile
CHANGELOG.md

mycookbook $ grep -Ei 'gitignore|berksfile|changelog' chefignore
.gitignore
Berksfile
Berksfile.lock
CHANGELOG*

What about on the master branch?

Not using berkshelf 3.0 for uploading cookbooks, needs a bunch of work to get it rolled everywhere. Stable berkshelf 2.0 is still doing a bunch of work here

@sethvargo I'll consider switching to Berkshelf 3.0 in this case if it's not a quick fix. (looks like ridley (1.5.3) should have the fix, not sure why it's not working)