cloudflare/pint
Publicmirrored fromhttps://github.com/cloudflare/pintAvailable
docs/examples/labels.hcl
37lines · modecode
| 1 | # This example shows how to enforce labels where the label value itself can |
| 2 | # be a string with one or more sub-strings in it. |
| 3 | # For example when you have a 'components' label that can be any of these: |
| 4 | # components: 'db' |
| 5 | # components: 'api' |
| 6 | # components: 'proxy' |
| 7 | # components: 'db api' |
| 8 | # components: 'db api proxy' |
| 9 | # components: 'proxy api db' |
| 10 | # components: 'proxy db' |
| 11 | |
| 12 | rule { |
| 13 | # Only run these checks on alerting rules. |
| 14 | # Ignore recording rules. |
| 15 | match { |
| 16 | kind = "alerting" |
| 17 | } |
| 18 | label "components" { |
| 19 | # Every alerting rule must have this label set. |
| 20 | required = true |
| 21 | # If any alerting rule fails our check pint will report his as a 'Bug' |
| 22 | # severity problem, which will fail (exit with non-zero exit code) |
| 23 | # when running 'pint lint' or 'pint ci'. |
| 24 | # Set it to 'warning' if you don't want to fail pint runs. |
| 25 | severity = "bug" |
| 26 | # Split label value into sub-strings using the 'token' regexp. |
| 27 | # \w is an alias for [0-9A-Za-z_] match. |
| 28 | # Notice that we must escape '\' in HCL config files. |
| 29 | token = "\\w+" |
| 30 | # This is the list of allowed values. |
| 31 | values = [ |
| 32 | "db", |
| 33 | "api", |
| 34 | "proxy", |
| 35 | ] |
| 36 | } |
| 37 | } |