Repo Grep Checks

Verify the existence or contents of files or folders in your repo.

After setting up a Git Repository Integration, OpsLevel can continuously scan your code repositories and verify all of the operational best practices you’ve defined.

Repo Grep Checks operate very similarly to Repo File Checks. As such, we recommend reading the docs on Repo File and Repo Search Checks before beginning to experiment further with Repo Grep Checks.

The Repo Grep Check

With Repo Grep Checks, you can verify the existence or contents of files or folders in your repo. While Repo File and Repo Search Checks can resolve most use-cases, there are certain circumstances with which Repo Grep Checks can offer additional capabilities. For example:

  • Searching multiple specific files
  • Searching using glob patterns
  • Searching for certain special characters
  • Repo Grep checks support exists, fixed-string, regex, and version constraints

Repo Grep Check Examples

Ensure services are declaring code ownership

You may have a mandate for all services to declare code owners within their repo. While these could exist in a /CODEOWNERS file, there might be situations where a legacy service define owners in a .github folder as well. If both of these are permissible, you can use Repo Grep Checks to ensure at least one the files exist:

PredicateFile Paths

Ensure JavaScript services lock their dependencies using yarn or npm

You may have a policy that all JavaScript services use yarn or npm. You can use Repo Grep Checks to make sure this policy is being followed:

PredicateFile Paths
Existspackage-lock.json, yarn.lock

Ensure Python services no longer use the deprecated "plank" library

Say you have a policy that all Python services can no longer use a deprecated library called plank. You can use Repo Grep Checks to enforce this policy:

PredicateSearch TermFile Paths
Does Not Containimport plank**/*.py

And More!

Those were just some examples to get the creative juices flowing. But there’s tons more you can do with Repo Grep Checks. If you have any questions, or just come up with some interesting checks you want to share, hit us up at [email protected].