Infrastructure Pipeline: Monorepo HelpersView SourceRelease Notes
This module contains scripts that help with adapting CI/CD pipelines for infrastructure code to monorepo setups. These scripts can be used to setup pipelines that only run tests on the infrastructure modules that changed, as opposed to always running all tests on every change. By only running the relevant tests for each commit, you can drastically reduce the runtime of your CI/CD pipelines (as only a subset of the tests run each time).
NOTE: - These scripts are built for running Go tests, such as [Terratest](https://terratest.gruntwork.io/). - The scripts rely on certain heuristics and assumptions to decide which tests should or shouldn’t run. If you follow Gruntwork conventions, those heuristics will work for you; otherwise, they may not detect the correct tests to run.
Identify infrastructure (terraform, terragrunt, packer, docker, terratest, etc) modules that changed.
Identify the minimal tests that should be run for the modules that changed.
Specify and ignore changes that don’t have any tests (e.g., documentation updates).
Specify groups of tests that should be run for specific changes.
Setup precommit hooks that ensure every module has a corresponding test.
This repo is a part of the Gruntwork Infrastructure as Code Library, a collection of reusable, battle-tested, production ready infrastructure code. If you’ve never used the Infrastructure as Code Library before, make sure to read How to use the Gruntwork Infrastructure as Code Library!
- Overview of scripts: An overview of the scripts included in this module, including how they work.
modules: the main implementation code for this repo, broken down into multiple standalone, orthogonal submodules.
examples: This folder contains working examples of how to use the submodules.
test: Automated tests for the modules and examples.
Non-production deployment (quick start for learning)
If you just want to try this module out for experimenting and learning, check out the following resources:
- CircleCI Quickstart: Quickstart guide for integrating the scripts into CircleCI to setup dynamic test selection.
- terraform-aws-service-catalog: The
terraform-aws-service-catalogmodule uses the scripts in this module to setup dynamic test selection.