djoos-cookbooks / composer

Repository for composer cookbook
http://community.opscode.com/cookbooks/composer
MIT License
27 stars 38 forks source link

Artifact v2.5.1 from Supermarket is invalid #67

Closed legal90 closed 7 years ago

legal90 commented 7 years ago

Hi! Thanks for the cookbook. It looks really cool!

But I've noticed that the composer cookbook artifact v2.5.1 from supermarket.chef.io has a lot of redundant content which makes it invalid. That's probably caused by removing chefignore in https://github.com/djoos-cookbooks/composer/commit/ae2d100209d4a6e9248f77fb4c84400b30b54b79

How to reproduce:

1) Create Policyfile.rb:

name 'test-composer'
default_source :supermarket
run_list 'composer'
cookbook 'composer', '= 2.5.1'

2) Download the cookbook by running:

$ chef install Policyfile.rb

3) Look at the content of the cookbook cache:

$ tree ~/.chefdk/cache/cookbooks/composer-2.5.1-supermarket.chef.io
├── Berksfile
├── Berksfile.lock
├── CONTRIBUTING.md
├── PaxHeader
│   ├── Berksfile
│   ├── Berksfile.lock
│   ├── CONTRIBUTING.md
│   ├── README.md
│   ├── Rakefile
│   ├── TESTING.md
│   ├── attributes
│   ├── libraries
│   ├── metadata.json
│   ├── metadata.rb
│   ├── providers
│   ├── recipes
│   └── resources
├── README.md
├── Rakefile
├── TESTING.md
├── attributes
│   ├── PaxHeader
│   │   └── default.rb
│   └── default.rb
├── libraries
│   ├── PaxHeader
│   │   └── composer.rb
│   └── composer.rb
├── metadata.json
├── metadata.rb
├── providers
│   ├── PaxHeader
│   │   ├── install_global.rb
│   │   └── project.rb
│   ├── install_global.rb
│   └── project.rb
├── recipes
│   ├── PaxHeader
│   │   ├── default.rb
│   │   ├── global_configs.rb
│   │   ├── install.rb
│   │   └── self_update.rb
│   ├── default.rb
│   ├── global_configs.rb
│   ├── install.rb
│   └── self_update.rb
└── resources
    ├── PaxHeader
    │   ├── install_global.rb
    │   └── project.rb
    ├── install_global.rb
    └── project.rb

11 directories, 41 files

There are PaxHeader folder created in each subfolder with the content duplicating the content of its base dir. This makes the cookbook invalid and causes failures of Chef Client run on Recipe Compile step.

If we would use berks & Berksfile instead of chef & Policyfile.rb, then there will be the similar result in cache except the fact that all PaxHeader folders will be empty.

Just to compare - here is the content of v2.5.0 artifact, which is valid and works fine:

$ tree ~/.chefdk/cache/cookbooks/composer-2.5.0-supermarket.chef.io
├── README.md
├── attributes
│   └── default.rb
├── libraries
│   └── composer.rb
├── metadata.json
├── metadata.rb
├── providers
│   ├── install_global.rb
│   └── project.rb
├── recipes
│   ├── default.rb
│   ├── global_configs.rb
│   ├── install.rb
│   └── self_update.rb
└── resources
    ├── install_global.rb
    └── project.rb

5 directories, 13 files

Suggested solution:

Roll-back chefignore file and re-upload the artifact to the supermarket.

djoos commented 7 years ago

Hi Mikhail,

chefignore got removed form 2.4.0 onwards as it doesn't behave like you'd expect inside of a cookbook's directory...

2.5.1 got pushed out by a brand new contributor, without having a chefignore at the cookbook's parent directory, which I think is the root cause of the issue you flagged. I've just bumped the version and pushed version 2.5.2 to the Chef Supermarket; please let me know if that sorts the issue you were experiencing...

Thanks in advance for your feedback! Kind regards, David

legal90 commented 7 years ago

@djoos Yeah, now it's OK. Thank you!

$ tree ~/.chefdk/cache/cookbooks/composer-2.5.2-supermarket.chef.io

├── README.md
├── attributes
│   └── default.rb
├── libraries
│   └── composer.rb
├── metadata.json
├── metadata.rb
├── providers
│   ├── install_global.rb
│   └── project.rb
├── recipes
│   ├── default.rb
│   ├── global_configs.rb
│   ├── install.rb
│   └── self_update.rb
└── resources
    ├── install_global.rb
    └── project.rb

5 directories, 13 files
djoos commented 7 years ago

Perfect, thanks for flagging this!

daften commented 7 years ago

So this was my bad, my apologies! @djoos so i put the chefignore file in my chef-repo ?

djoos commented 7 years ago

No worries @daften! Yeah, just put the chefignore in the parent directory of the composer cookbook directory, ie.

chef-repo
├── ...
├── cookbooks
│   ├── composer
│   └── other-cookbook
│   chefignore
└── ...

Thanks!