Skip to content

Commit

Permalink
feat: Better message on policy failure
Browse files Browse the repository at this point in the history
Include the specific command `approve_policies` in the message.
  • Loading branch information
dupuy26 committed Nov 15, 2021
1 parent 7d6a0a9 commit cbe44ce
Show file tree
Hide file tree
Showing 7 changed files with 21 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ FAIL - <redacted plan file> - main - WARNING: Null Resource creation is prohibit
1 test, 0 passed, 0 warnings, 1 failure, 0 exceptions

```
* :heavy_check_mark: To **approve** failing policies either request an approval from approvers or address the failure by modifying the codebase.
* :heavy_check_mark: To **approve** failing policies an authorized approver can comment:
* `atlantis approve_policies`
* :repeat: Or, address the policy failure by modifying the codebase and re-planning.


Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ FAIL - <redacted plan file> - main - WARNING: Null Resource creation is prohibit
1 test, 0 passed, 0 warnings, 1 failure, 0 exceptions

```
* :heavy_check_mark: To **approve** failing policies either request an approval from approvers or address the failure by modifying the codebase.
* :heavy_check_mark: To **approve** failing policies an authorized approver can comment:
* `atlantis approve_policies`
* :repeat: Or, address the policy failure by modifying the codebase and re-planning.


Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ FAIL - <redacted plan file> - null_resource_policy - WARNING: Null Resource crea
1 test, 0 passed, 0 warnings, 1 failure, 0 exceptions

```
* :heavy_check_mark: To **approve** failing policies either request an approval from approvers or address the failure by modifying the codebase.
* :heavy_check_mark: To **approve** failing policies an authorized approver can comment:
* `atlantis approve_policies`
* :repeat: Or, address the policy failure by modifying the codebase and re-planning.


Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,9 @@ FAIL - <redacted plan file> - main - WARNING: Forbidden Resource creation is pro
1 test, 0 passed, 0 warnings, 1 failure, 0 exceptions

```
* :heavy_check_mark: To **approve** failing policies either request an approval from approvers or address the failure by modifying the codebase.
* :heavy_check_mark: To **approve** failing policies an authorized approver can comment:
* `atlantis approve_policies`
* :repeat: Or, address the policy failure by modifying the codebase and re-planning.


---
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ FAIL - <redacted plan file> - main - WARNING: Null Resource creation is prohibit
1 test, 0 passed, 0 warnings, 1 failure, 0 exceptions

```
* :heavy_check_mark: To **approve** failing policies either request an approval from approvers or address the failure by modifying the codebase.
* :heavy_check_mark: To **approve** failing policies an authorized approver can comment:
* `atlantis approve_policies`
* :repeat: Or, address the policy failure by modifying the codebase and re-planning.


5 changes: 3 additions & 2 deletions server/events/markdown_renderer.go
Original file line number Diff line number Diff line change
Expand Up @@ -371,8 +371,9 @@ var unwrappedErrTmplText = "**{{.Command}} Error**\n" +
"{{.Error}}\n" +
"```" +
"{{ if eq .Command \"Policy Check\" }}" +
"\n* :heavy_check_mark: To **approve** failing policies either request an approval from approvers or address the failure by modifying the codebase.\n" +
"{{ end }}"
"\n* :heavy_check_mark: To **approve** failing policies an authorized approver can comment:\n" +
" * `atlantis approve_policies`\n" +
"* :repeat: Or, address the policy failure by modifying the codebase and re-planning.{{end}}"
var wrappedErrTmplText = "**{{.Command}} Error**\n" +
"<details><summary>Show Output</summary>\n\n" +
"```\n" +
Expand Down
4 changes: 3 additions & 1 deletion server/events/markdown_renderer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,9 @@ func TestRenderErr(t *testing.T) {
models.PolicyCheckCommand,
err,
"**Policy Check Error**\n```\nerr\n```" +
"\n* :heavy_check_mark: To **approve** failing policies either request an approval from approvers or address the failure by modifying the codebase.\n\n",
"\n* :heavy_check_mark: To **approve** failing policies an authorized approver can comment:\n" +
" * `atlantis approve_policies`\n" +
"* :repeat: Or, address the policy failure by modifying the codebase and re-planning.\n\n"
},
}

Expand Down

0 comments on commit cbe44ce

Please sign in to comment.