tehmaspc / puppet-magnum

https://rubygems.org/gems/puppet-magnum
Other
30 stars 13 forks source link

Sepulworld/adding puppetfile source #6

Closed sepulworld closed 6 years ago

sepulworld commented 9 years ago

Purpose of this option

To remove the need to manage .fixtures.yml files in every puppet module manually. This manual management of .fixtures.yml will lead to a broken puppet environment. Allows modules to test against the 'master' branch of dependent modules before they merge into the environments r10k manages. Allowing us to catch broken dependencies sooner.

Problem Scenario it helps solve

Let A be a module with a dependency B. A has recently been updated, and it is working. The rspec tests are passing when using module B version 2.1.0, which is the version defined in .fixtures.yml; this is also the version in the current Puppetfile. We tag A with version 1.1.0. Everything works great for 2 months. Module B is updated to perform new tasks, and a release 3.0.0 is tagged, which introduces new variables and removed old ones. All tests are working well. Puppetfile is updated to use Module B version 3.0.0. All spec tests pass in the module build environment. Module B version 3.0.0 is added to the production Puppetfile All subsequent puppet runs fail.

Example fixtures.yml using Puppetfile for reference
fixtures:
  repositories:
    stdlib: 'Puppetfile'
    zookeeper: 'Puppetfile'
    mycompany_software_api: 'Puppetfile'
    mycompany_web_server: 'Puppetfile'

    # If yumclient exists in the Puppetfile, the repo listed here will be ignored.
    yumclient: 'git@gitlab.mygitserver.com:puppet/yumclient.git'

    # If a repo is not found in the Puppetfile, then the repo will be cloned from the indicated repo branch/tag.
    epel:
      repo: 'https://github.com/stahnma/puppet-module-epel.git'
      ref: '1.0.2'
    java:
      repo: 'git://github.com/puppetlabs/puppetlabs-java'
      ref: '1.3.0'
Example cli command w/ puppetfile_git_source provided
magnum module create testmodule --puppetfile_git_source gitlab.mygitserver.com:puppet/puppetfile.git
$ magnum module help create
Usage:
  magnum module create [MODULE_NAME]

Options:
  [--puppetfile-git-source=PUPPETFILE_GIT_SOURCE]

Creates a new Puppet module.
tehmaspc commented 9 years ago

@sepulworld - thanks for your PR; I'm going to have to look at this more closely when I find some spare time - but I want to do it justice. Luckily, I'm back doing Puppet stuff at a new gig and I do want to give Magnum a big upgrade at some point to make my life and everyone else's easier :)

sepulworld commented 9 years ago

Sounds good to me! I have other pull requests for Magnum too, that I believe would be useful for all.

If you want me to write some unit tests, I can do this too.

sepulworld commented 9 years ago

Have you considered adding gem builds to the Travis job? Looks like puppet-magnum is an available name for a Gem on Rubygems.org