Skip to content

Commit

Permalink
Release v1.7.7 - Incident updates now show username. (#404)
Browse files Browse the repository at this point in the history
* Release v1.7.7 - Incident updates now show username.

* Fix test.
  • Loading branch information
echoboomer committed Jan 1, 2024
1 parent 9d85944 commit b741c9c
Show file tree
Hide file tree
Showing 7 changed files with 28 additions and 16 deletions.
4 changes: 3 additions & 1 deletion backend/bot/slack/modals.py
Original file line number Diff line number Diff line change
Expand Up @@ -529,6 +529,7 @@ def handle_submission(ack, body, client):
ack()
parsed = parse_modal_values(body)
channel_id = parsed.get("incident_update_modal_select_incident")
user_id = body.get("user").get("id")
# Extract the channel ID without extra characters
for character in "#<>":
channel_id = channel_id.replace(character, "")
Expand All @@ -540,6 +541,7 @@ def handle_submission(ack, body, client):
impacted_resources=parsed.get("impacted_resources"),
message=parsed.get("message"),
timestamp=tools.fetch_timestamp(),
user_id=user_id,
),
text="Incident update for incident <#{}>: {}".format(
channel_id, parsed.get("message")
Expand Down Expand Up @@ -1762,7 +1764,7 @@ def handle_submission(ack, body, client, view):
key=resp.get("key"),
summary=parsed.get("jira.summary_input"),
type=parsed.get("jira.type_select"),
link=issue_link
link=issue_link,
),
text="A Jira issue has been created for this incident: {}".format(
resp.get("self")
Expand Down
10 changes: 9 additions & 1 deletion backend/bot/templates/incident/updates.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,11 @@ def severity(channel: str, severity: str):

@staticmethod
def public_update(
incident_id: str, impacted_resources: str, message: str, timestamp: str
incident_id: str,
impacted_resources: str,
message: str,
timestamp: str,
user_id: str,
):
header = ":warning: Incident Update"
return [
Expand All @@ -103,6 +107,10 @@ def public_update(
"type": "mrkdwn",
"text": f"*Impacted Resources:*\n {impacted_resources}",
},
{
"type": "mrkdwn",
"text": f"*Sent By:*\n <@{user_id}>",
},
],
},
{
Expand Down
2 changes: 1 addition & 1 deletion backend/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
from iblog import logger, log_level
from typing import Dict, List

__version__ = "v1.7.6"
__version__ = "v1.7.7"

# .env parse
dotenv_path = os.path.join(os.path.dirname(__file__), ".env")
Expand Down
22 changes: 12 additions & 10 deletions backend/tests/test_incident.py
Original file line number Diff line number Diff line change
Expand Up @@ -687,39 +687,41 @@ def test_build_public_status_update(self):
impacted_resources="api",
message="foobar",
timestamp=timestamp,
user_id="1234",
) == [
{
"type": "header",
"text": {
"text": ":warning: Incident Update",
"type": "plain_text",
"text": ":warning: Incident Update",
},
"type": "header",
},
{
"type": "section",
"fields": [
{"text": "*Incident:*\n <#mock>", "type": "mrkdwn"},
{"type": "mrkdwn", "text": "*Incident:*\n <#mock>"},
{
"text": f"*Posted At:*\n {timestamp}",
"type": "mrkdwn",
"text": f"*Posted At:*\n {timestamp}",
},
{"text": "*Impacted Resources:*\n api", "type": "mrkdwn"},
{"type": "mrkdwn", "text": "*Impacted Resources:*\n api"},
{"type": "mrkdwn", "text": "*Sent By:*\n <@1234>"},
],
"type": "section",
},
{
"type": "section",
"text": {
"text": "*Current Status*\n foobar",
"type": "mrkdwn",
"text": "*Current Status*\n foobar",
},
"type": "section",
},
{
"type": "context",
"elements": [
{
"text": "This update was provided by the incident management team in response to an ongoing incident.",
"type": "mrkdwn",
"text": "This update was provided by the incident management team in response to an ongoing incident.",
}
],
"type": "context",
},
]
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ bases:

images:
- name: eb129/incident-bot
newTag: v1.7.6
newTag: v1.7.7

configMapGenerator:
- name: incident-bot-config
Expand Down
2 changes: 1 addition & 1 deletion docs/deploy/overlays/production/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ bases:

images:
- name: eb129/incident-bot-docs
newTag: v1.7.6
newTag: v1.7.7

generatorOptions:
disableNameSuffixHash: true
2 changes: 1 addition & 1 deletion version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v1.7.6
v1.7.7

0 comments on commit b741c9c

Please sign in to comment.