forked from cloudflare/pint
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement regex matching for annotation keys
- Loading branch information
Rhys M
committed
Apr 27, 2023
1 parent
948facf
commit fee1dd5
Showing
6 changed files
with
149 additions
and
35 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
pint.ok --no-color lint rules | ||
! stdout . | ||
cmp stderr stderr.txt | ||
|
||
-- stderr.txt -- | ||
level=info msg="Loading configuration file" path=.pint.hcl | ||
-- rules/0001.yml -- | ||
- alert: Instance Is Down 1 | ||
expr: up == 0 | ||
annotations: | ||
annotation_foo: bar | ||
annotation_bar: bar | ||
|
||
-- .pint.hcl -- | ||
parser { | ||
relaxed = [".*"] | ||
} | ||
rule { | ||
annotation "annotation_.*" { | ||
required = true | ||
value = "bar" | ||
severity = "bug" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
pint.error --no-color lint rules | ||
! stdout . | ||
cmp stderr stderr.txt | ||
|
||
-- stderr.txt -- | ||
level=info msg="Loading configuration file" path=.pint.hcl | ||
rules/0001.yml:4 Bug: annotation_.* annotation value must match "^bar$" (alerts/annotation) | ||
4 | annotation_foo: foo | ||
|
||
level=info msg="Problems found" Bug=1 | ||
level=fatal msg="Fatal error" error="found 1 problem(s) with severity Bug or higher" | ||
-- rules/0001.yml -- | ||
- alert: Instance Is Down 1 | ||
expr: up == 0 | ||
annotations: | ||
annotation_foo: foo | ||
annotation_bar: bar | ||
|
||
-- .pint.hcl -- | ||
parser { | ||
relaxed = [".*"] | ||
} | ||
rule { | ||
annotation "annotation_.*" { | ||
required = true | ||
value = "bar" | ||
severity = "bug" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters