From 24eab61ab01530cfbddc013f75a88d0ece3881e5 Mon Sep 17 00:00:00 2001 From: Niloth P <20315308+Niloth-p@users.noreply.github.com> Date: Wed, 30 Jul 2025 12:33:38 +0530 Subject: [PATCH] integrations: Add screenshot configs for deployment integrations. that do not have fixtures. --- zerver/lib/integrations.py | 3 +++ zerver/webhooks/fixtureless_integrations.py | 19 +++++++++++++++++++ 2 files changed, 22 insertions(+) diff --git a/zerver/lib/integrations.py b/zerver/lib/integrations.py index 4c306e036c..67f0581fd4 100644 --- a/zerver/lib/integrations.py +++ b/zerver/lib/integrations.py @@ -65,11 +65,14 @@ CATEGORIES: dict[str, StrPromise] = { # WEBHOOK_INTEGRATIONS and NO_SCREENSHOT_CONFIG, but defined explicitly to # avoid circular dependency FIXTURELESS_INTEGRATIONS_WITH_SCREENSHOTS: list[str] = [ + "capistrano", "codebase", "github-actions", "jenkins", "mercurial", + "openshift", "perforce", + "puppet", "svn", ] FIXTURELESS_SCREENSHOT_CONTENT: dict[str, list[fixtureless_integrations.ScreenshotContent]] = { diff --git a/zerver/webhooks/fixtureless_integrations.py b/zerver/webhooks/fixtureless_integrations.py index 49ce6697af..abeb29282d 100644 --- a/zerver/webhooks/fixtureless_integrations.py +++ b/zerver/webhooks/fixtureless_integrations.py @@ -19,7 +19,9 @@ BO_GIT_NAME = "bo-williams" # Example project content PROJECT_NAME = "Example Project" PROJECT_PATH_PERFORCE = "//depot/zerver/example-project/*" +PROJECT_STAGE = "production" +VERSION_NUMBER = "v9.2.3" REVISION_NUMBER = THREE_DIGIT_NUMBER # Example branch content @@ -38,6 +40,8 @@ DEPLOYMENT_HASH = "e494a5be3393" # Example datetime content _DT = datetime(2025, 5, 30, 2, 0, 0, tzinfo=timezone.utc) DATETIME_STAMP = _DT.strftime("%Y-%m-%d %H:%M:%S") +DATETIME_GLOBAL = f"" +DATE_ISO_8601 = _DT.strftime("%Y-%m-%d") class ScreenshotContent(TypedDict): @@ -45,6 +49,11 @@ class ScreenshotContent(TypedDict): content: str +CAPISTRANO = ScreenshotContent( + topic=PROJECT_NAME, + content=f"The [deployment]() to **{PROJECT_STAGE}** (version {VERSION_NUMBER}) has been completed successfully! :rocket:", +) + CODEBASE = ScreenshotContent( topic=f"Push to {BRANCH_GIT} on {PROJECT_NAME}", content=f"""{BO_NAME} pushed 2 commit(s) to `{BRANCH_GIT}` in project {PROJECT_NAME}: @@ -73,6 +82,11 @@ MERCURIAL = ScreenshotContent( """, ) +OPENSHIFT = ScreenshotContent( + topic=PROJECT_NAME, + content=f"""Deployment [{REVISION_NUMBER}]() triggered by a push to **{BRANCH_GIT}** by commit [{COMMIT_HASH_A[:7]}]() at {DATETIME_STAMP} has **failed**.""", +) + PERFORCE = ScreenshotContent( topic=PROJECT_PATH_PERFORCE, content=f""" @@ -84,6 +98,11 @@ PERFORCE = ScreenshotContent( """, ) +PUPPET = ScreenshotContent( + topic="Reports", + content=f"""Puppet production run for web-server-01 completed at {DATETIME_GLOBAL}. [GitHub Gist]() | [Report URL]()""", +) + SVN = ScreenshotContent( topic=PROJECT_NAME, content=f"""**{BO_GIT_NAME}** committed revision r{REVISION_NUMBER} to `{BRANCH_SVN}`.