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.
Merge pull request cloudflare#548 from cloudflare/fail-on
Add pint ci --fail-on flag
- Loading branch information
Showing
8 changed files
with
147 additions
and
13 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
http method github GET /api/v3/repos/cloudflare/pint/pulls/1/reviews 200 [] | ||
http method github POST /api/v3/repos/cloudflare/pint/pulls/1/reviews 200 {} | ||
http method github GET /api/v3/repos/cloudflare/pint/pulls/1/comments 200 [] | ||
http method github POST /api/v3/repos/cloudflare/pint/pulls/1/comments 200 {} | ||
http start github 127.0.0.1:6119 | ||
|
||
mkdir testrepo | ||
cd testrepo | ||
exec git init --initial-branch=main . | ||
|
||
cp ../src/v1.yml rules.yml | ||
cp ../src/.pint.hcl . | ||
env GIT_AUTHOR_NAME=pint | ||
env GIT_AUTHOR_EMAIL=pint@example.com | ||
env GIT_COMMITTER_NAME=pint | ||
env GIT_COMMITTER_EMAIL=pint@example.com | ||
exec git add . | ||
exec git commit -am 'import rules and config' | ||
|
||
exec git checkout -b v2 | ||
cp ../src/v2.yml rules.yml | ||
exec git commit -am 'v2' | ||
|
||
env GITHUB_AUTH_TOKEN=12345 | ||
env GITHUB_PULL_REQUEST_NUMBER=1 | ||
pint.error -l debug --offline --no-color ci --fail-on=warning | ||
! stdout . | ||
stderr 'level=info msg="Pull request review created" status="200 OK"' | ||
|
||
-- src/v1.yml -- | ||
- alert: rule1 | ||
expr: sum(foo) by(job) | ||
- alert: rule2 | ||
expr: sum(foo) by(job) | ||
for: 0s | ||
|
||
-- src/v2.yml -- | ||
- alert: rule1 | ||
expr: sum(foo) by(job) | ||
for: 0s | ||
- alert: rule2 | ||
expr: sum(foo) by(job) | ||
for: 0s | ||
|
||
-- src/.pint.hcl -- | ||
ci { | ||
baseBranch = "main" | ||
} | ||
parser { | ||
relaxed = [".*"] | ||
} | ||
repository { | ||
github { | ||
baseuri = "http://127.0.0.1:6119" | ||
uploaduri = "http://127.0.0.1:6119" | ||
owner = "cloudflare" | ||
repo = "pint" | ||
} | ||
} | ||
rule { | ||
label "severity" { | ||
value = "critical|warning|info" | ||
required = true | ||
} | ||
} |
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,53 @@ | ||
mkdir testrepo | ||
cd testrepo | ||
exec git init --initial-branch=main . | ||
|
||
cp ../src/v1.yml rules.yml | ||
cp ../src/.pint.hcl . | ||
env GIT_AUTHOR_NAME=pint | ||
env GIT_AUTHOR_EMAIL=pint@example.com | ||
env GIT_COMMITTER_NAME=pint | ||
env GIT_COMMITTER_EMAIL=pint@example.com | ||
exec git add . | ||
exec git commit -am 'import rules and config' | ||
|
||
exec git checkout -b v2 | ||
cp ../src/v2.yml rules.yml | ||
exec git commit -am 'v2' | ||
|
||
env GITHUB_AUTH_TOKEN=12345 | ||
env GITHUB_PULL_REQUEST_NUMBER=1 | ||
pint.error -l debug --offline --no-color ci --fail-on=bogus | ||
! stdout . | ||
stderr 'level=fatal msg="Fatal error" error="invalid --fail-on value: unknown severity: bogus"' | ||
|
||
-- src/v1.yml -- | ||
- alert: rule1 | ||
expr: sum(foo) by(job) | ||
- alert: rule2 | ||
expr: sum(foo) by(job) | ||
for: 0s | ||
|
||
-- src/v2.yml -- | ||
- alert: rule1 | ||
expr: sum(foo) by(job) | ||
for: 0s | ||
- alert: rule2 | ||
expr: sum(foo) by(job) | ||
for: 0s | ||
|
||
-- src/.pint.hcl -- | ||
ci { | ||
baseBranch = "main" | ||
} | ||
parser { | ||
relaxed = [".*"] | ||
} | ||
repository { | ||
github { | ||
baseuri = "http://127.0.0.1:6120" | ||
uploaduri = "http://127.0.0.1:6120" | ||
owner = "cloudflare" | ||
repo = "pint" | ||
} | ||
} |
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