From b741c9c0c65e1158a065a8c2a9dcd292e401ac09 Mon Sep 17 00:00:00 2001 From: Scott Hawkins Date: Sun, 31 Dec 2023 19:41:41 -0500 Subject: [PATCH] Release v1.7.7 - Incident updates now show username. (#404) * Release v1.7.7 - Incident updates now show username. * Fix test. --- backend/bot/slack/modals.py | 4 +++- backend/bot/templates/incident/updates.py | 10 ++++++++- backend/config.py | 2 +- backend/tests/test_incident.py | 22 ++++++++++--------- .../overlays/production/kustomization.yaml | 2 +- .../overlays/production/kustomization.yaml | 2 +- version | 2 +- 7 files changed, 28 insertions(+), 16 deletions(-) diff --git a/backend/bot/slack/modals.py b/backend/bot/slack/modals.py index d2c61c00..92dd3974 100644 --- a/backend/bot/slack/modals.py +++ b/backend/bot/slack/modals.py @@ -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, "") @@ -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") @@ -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") diff --git a/backend/bot/templates/incident/updates.py b/backend/bot/templates/incident/updates.py index e37525b0..8c6994d1 100644 --- a/backend/bot/templates/incident/updates.py +++ b/backend/bot/templates/incident/updates.py @@ -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 [ @@ -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}>", + }, ], }, { diff --git a/backend/config.py b/backend/config.py index 15789596..d944d368 100644 --- a/backend/config.py +++ b/backend/config.py @@ -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") diff --git a/backend/tests/test_incident.py b/backend/tests/test_incident.py index d904b0ce..7882848a 100644 --- a/backend/tests/test_incident.py +++ b/backend/tests/test_incident.py @@ -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", }, ] diff --git a/deploy/kustomize/incident-bot/overlays/production/kustomization.yaml b/deploy/kustomize/incident-bot/overlays/production/kustomization.yaml index f44d260c..b83725bd 100755 --- a/deploy/kustomize/incident-bot/overlays/production/kustomization.yaml +++ b/deploy/kustomize/incident-bot/overlays/production/kustomization.yaml @@ -7,7 +7,7 @@ bases: images: - name: eb129/incident-bot - newTag: v1.7.6 + newTag: v1.7.7 configMapGenerator: - name: incident-bot-config diff --git a/docs/deploy/overlays/production/kustomization.yaml b/docs/deploy/overlays/production/kustomization.yaml index 583d031f..7725f8df 100755 --- a/docs/deploy/overlays/production/kustomization.yaml +++ b/docs/deploy/overlays/production/kustomization.yaml @@ -7,7 +7,7 @@ bases: images: - name: eb129/incident-bot-docs - newTag: v1.7.6 + newTag: v1.7.7 generatorOptions: disableNameSuffixHash: true diff --git a/version b/version index 12751ca7..f0b77c19 100644 --- a/version +++ b/version @@ -1 +1 @@ -v1.7.6 +v1.7.7