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
- Overview
- What this gem does
- How it does that
- Module Dependency Closuresw it does that
- Setup
- Beginning with simp-module-repoclosure
- Methods
- Environment variables
- Examples
- 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 ofmods_dir/
as the fixture modules forspec_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)
-
(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
-
(optional, enclave-friendly) All modules in
mods_dir/
are built intotar.gz
archives to be served by the test Forge.
- The
mods_dir
can be changed with the environment variableTEST_FORGE_mods_dir
- If the
mods_dir
is defined, the upsteam dependency forge will not be contacted.
-
(enclave-friendly) A temporary Puppet Forge is started on
localhost
and serves modules fromtars_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 variableTEST_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 andmod_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