Skip to content

Commit

Permalink
Update regex for fail parser
Browse files Browse the repository at this point in the history
Signed-off-by: KeisukeYamashita <[email protected]>
  • Loading branch information
KeisukeYamashita committed Jan 20, 2022
1 parent b364d7a commit 823ebf5
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions terraform/parser.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ func NewFmtParser() *FmtParser {
func NewPlanParser() *PlanParser {
return &PlanParser{
Pass: regexp.MustCompile(`(?m)^(Plan: \d|No changes.)`),
Fail: regexp.MustCompile(`(?m)^(Error: )`),
Fail: regexp.MustCompile(`(?m)^(\|\s{1})?(Error: )`),
// "0 to destroy" should be treated as "no destroy"
HasDestroy: regexp.MustCompile(`(?m)([1-9][0-9]* to destroy.)`),
HasNoChanges: regexp.MustCompile(`(?m)^(No changes. Infrastructure is up-to-date.)`),
Expand All @@ -73,7 +73,7 @@ func NewPlanParser() *PlanParser {
func NewApplyParser() *ApplyParser {
return &ApplyParser{
Pass: regexp.MustCompile(`(?m)^(Apply complete!)`),
Fail: regexp.MustCompile(`(?m)^(Error: )`),
Fail: regexp.MustCompile(`(?m)^(\|\s{1})?(Error: )`),
}
}

Expand Down
8 changes: 4 additions & 4 deletions terraform/parser_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -368,7 +368,7 @@ google_dns_record_set.dev_tfnotifyapps_com: Refreshing state...
| Error: Batch "project/tfnotify-jp-tfnotify-prod/services:batchEnable" for request "Enable Project Services tfnotify-jp-tfnotify-prod: map[logging.googleapis.com:{}]" returned error: failed to send enable services request: googleapi: Error 403: The caller does not have permission, forbidden
|
|
| on .terraform/modules/tfnotify-jp-tfnotify-prod/google_project_service.tf line 6, in resource "google_project_service" "gcp_api_service":
| 6: resource "google_project_service" "gcp_api_service" {
|
Expand Down Expand Up @@ -612,10 +612,10 @@ func TestApplyParserParse(t *testing.T) {
result: ParseResult{
Result: `| Error: Batch "project/tfnotify-jp-tfnotify-prod/services:batchEnable" for request "Enable Project Services tfnotify-jp-tfnotify-prod: map[logging.googleapis.com:{}]" returned error: failed to send enable services request: googleapi: Error 403: The caller does not have permission, forbidden
|
| on .terraform/modules/tfnotify-jp-tfnotify-prod/google_project_service.tf line 6, in resource "google_project_service" "gcp_api_service":
| 6: resource "google_project_service" "gcp_api_service" {
| on .terraform/modules/tfnotify-jp-tfnotify-prod/google_project_service.tf line 6, in resource "google_project_service" "gcp_api_service":
| 6: resource "google_project_service" "gcp_api_service" {
|
`,
|`,
ExitCode: 1,
Error: nil,
},
Expand Down

0 comments on commit 823ebf5

Please sign in to comment.