electric-it / minimart

MiniMart RubyGem for Chef cookbook mirroring and storage.
Apache License 2.0
52 stars 20 forks source link

unable to download cookbooks with nonstandard versioning conventions #52

Open borgified opened 7 years ago

borgified commented 7 years ago

how to reproduce problem:

root@d43d5405d23f:/# minimart mirror --inventory-config=test.yml
Fetching the universe for https://api.berkshelf.com ...
The cookbook erlang with the version 2.1.0 could not be found

this is the inventory file:

root@d43d5405d23f:/# more test.yml
sources:
  - "https://api.berkshelf.com"
cookbooks:
  erlang:
    versions:
      - "2.1"

this particular version actually does exist: https://supermarket.chef.io/cookbooks/erlang/versions/2.1

also it seems to get confused with this type of versioning: https://supermarket.chef.io/cookbooks/apache_vhosts/versions/20140110

tapickell commented 7 years ago

Thats interesting. Will have to investigate, thank you. Is the Erlang cookbook the onnly one you have had this issue with @borgified ??

borgified commented 7 years ago

actually there are more.. theres all sorts of versioning conventions present that apparently dont follow that semver.org regexp

root@d43d5405d23f:/# grep '#' inventory.yml
#  7dtd:
#    versions:
#      - "0.1"
#  apache_vhosts:
#    versions:
#      - "20140206"
#      - "20140108"
#      - "20140109"
#      - "20140110"
#  aws_rds:
#    versions:
#      - "1.4"
#  tomcat-solr:
#    versions:
#      - "0.1"
#      - "0.1"
#  spark-shark-cookbook:
#    versions:
#      - "0.1"
#      - "1.1"
#  CVE-2015-0235:
#    versions:
#      - "1.0"
#      - "1.1"
#  rolling_deploy:
#    versions:
#      - "0.00.5"
#      - "0.2"
#      - "1.1"
#      - "1.2"
#      - "1.3"
#      - "1.0"
#      - "1.2.02"
#      - "1.2.00"

it's not supercritical for me, i just noticed that these didnt work (the vast majority of cookbooks have sane versioning)

the last two.. i think it interprets them as 1.2.2 and 1.2.0. i guess it should treat them as strings to preserve the leading 0? then again, it's clunky to do logic with them to check for <, >, etc.

tapickell commented 7 years ago

@borgified Awesome, thank you. This is something we have not run into on our deployment of this yet.