Repo Search Checks
Verify that a service's repo does / does not contain a file matching some criteria.
With our Git Repository Integration, OpsLevel can continuously scan your code repositories and verify all of the operational best practices you’ve defined.
Previously, we’ve shown you a Repo File Check, which can be used to verify that a given file exists in your repo, or verify that it contains some specific text.
This article goes over something subtly different and equally powerful: a Repo Search Check.
The Repo Search Check
Instead of looking at a specific file, Repo Search Checks can be used to scan over all files in your repo to determine whether any of them contain (or do not contain) specific text. You can also restrict the search to files of a given extension.
Repo Search Check Examples
Verify that a deprecated Scala library is no longer in use
Scala’s sbt build system is very flexible, but due to this flexibility can be hard to parse. To be absolutely sure a deprecated package is no longer in use by any of your Scala services, you can use a Repo Search Check to look at all files. Omit the extension for extra coverage.
Predicate | Contents |
---|---|
does not contain | lib.platform.janky |
When to use a Repo Search Check
Simply speaking, if you can use a Repo File Check instead of a Search Check, you should. The Search check is much more computationally expensive to run and is throttled on the integration’s side, so should be used sparingly.
There are some other limitations with the Repo Search Check:
- It doesn’t work with forked repositories.
- It can’t limit the search to a specific file. If you need that, use a Repo File Check.
- It runs after a 2 minute delay for Github integrations due to limitations with their API.
If you have any questions, or just come up with some interesting checks you want to share, hit us up at [email protected].
Updated almost 2 years ago