Repository is archived
No commit activity in last 3 years
No release in over 3 years
~~Stupidly~~ Admirably direct repoclosure for a Puppet module's `metadata.json`
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 1.7
~> 10.0
~> 3.0
~> 0.8

Runtime

 Project Readme

Build Status License

simp-module-repoclosure

A stupidly admirably direct dependency validator for a Puppet module's metadata.json. Use a tiny dedicated Puppet Forge to stage your modules' dependences with puppet module install!

Table of Contents

  1. Overview
  • What this gem does
  • How it does that
  • Module Dependency Closuresw it does that
  1. Setup
  • Beginning with simp-module-repoclosure
  1. Methods
  2. Environment variables
  3. Examples
  4. License

Overview

What this gem does

For each Module-under-test (or MUT):

  • Validate that the MUT will install from the Puppet Forge without breaking on dep-solving problems (such as version conflicts or missing dependencies).
  • Enable as much of this validation as possible within network-isolated enclaves.
  • TODO: Detect if dependencies are missing from metadata.json by using the contents of mods_dir/ as the fixture modules for spec_standalone tests.
  • TODO: Once missing dependencies are established, use the contents of mods_dir/ to identify missing modules in the .fixtures.yaml file.

How it does that

The MUT + dependencies are loaded into a local Puppet Forge and running puppet module install <MUT> against it. If the installation succeeds, the dependencies covered to publish on the live Puppet Forge.

Basic flow

![design](docs/img/simp-module-repoclosure design.png)

  1. (optional) An upstream Puppet Forge can be used to install the dependencies for the MUT into a mods_dir/ directory.
  • The forge server can be changed with the environment variable TEST_FORGE_deps_forge
  • With internet access and a single
  1. (optional, enclave-friendly) All modules in mods_dir/ are built into tar.gz archives to be served by the test Forge.
  • The mods_dir can be changed with the environment variable TEST_FORGE_mods_dir
  • If the mods_dir is defined, the upsteam dependency forge will not be contacted.
  1. (enclave-friendly) A temporary Puppet Forge is started on localhost and serves modules from tars_dir/. In a separate process, puppet module install is run for each MUT against the localhost Puppet Forge (modules are installed into a temporary directory). The test passes if all installs succeed.
  • The tars_dir can be changed with the environment variable TEST_FORGE_tars_dir

Each step of the process can be modified or skipped using environment variables prefixed with TEST_FORGE_ (noted in maroon text on the diagram above).

Module dependency scenarios

![design](docs/img/simp-module-repoclosure tests.png)

Setup

Beginning with simp-module-repoclosure

Add this to your project's Gemfile:

gem 'simp-module-repoclosure'

Environment variables

You can set the environment variables TEST_FORGE_tars_dir and TEST_FORGE_mods_dir to use pre-existing diretories of modules for the local forge.

TEST_FORGE_deps_forge

The upstream Puppet Forge to download MUT dependencies from.

TEST_FORGE_mods_dir

(enclave-friendly) Customize the path of the mods_dir/ directory of unarchived module dependencies.

  • If TEST_FORGE_mods_dir is not set, mods_dir/ is a temporary directory.
  • If TEST_FORGE_mods_dir is customized, deps Puppet forge is no longer used

TEST_FORGE_tars_dir

(enclave-friendly) Customize the path of the tars_dir/ directory or archived .tar.gz modules. By the time the test Forge starts, tars_dir/ should include the MUT(s) and all dependencies.

  • If TEST_FORGE_tars_dir is not set, tars_dir/ is a temporary directory.
  • If TEST_FORGE_tars_dir is customized, the Puppet Forge and mod_path/ compilation steps will be skipped.

TEST_FORGE_port

The TCP port on localhost or the temporary test Forge to use.

  • If TEST_FORGE_port is no set the port will default to 8080.

Examples

TEST_FORGE_port=8888 bundle exec rake spec

License

See LICENSE