From 7f2161bffae6c71e7da1a796dd8e2ea28b3c1c66 Mon Sep 17 00:00:00 2001 From: Niloth P <20315308+Niloth-p@users.noreply.github.com> Date: Wed, 30 Jul 2025 12:30:14 +0530 Subject: [PATCH] integrations: Add screenshot configs for fixtureless CI integrations. --- zerver/lib/integrations.py | 8 +++++++- zerver/webhooks/fixtureless_integrations.py | 16 ++++++++++++++++ 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/zerver/lib/integrations.py b/zerver/lib/integrations.py index ca3cacdba4..4c306e036c 100644 --- a/zerver/lib/integrations.py +++ b/zerver/lib/integrations.py @@ -66,6 +66,8 @@ CATEGORIES: dict[str, StrPromise] = { # avoid circular dependency FIXTURELESS_INTEGRATIONS_WITH_SCREENSHOTS: list[str] = [ "codebase", + "github-actions", + "jenkins", "mercurial", "perforce", "svn", @@ -609,7 +611,10 @@ INTEGRATIONS: dict[str, Integration] = { "errbot": Integration("errbot", ["meta-integration", "bots"]), "giphy": Integration("giphy", ["misc"], display_name="GIPHY"), "github-actions": Integration( - "github-actions", ["continuous-integration"], display_name="GitHub Actions" + "github-actions", + ["continuous-integration"], + display_name="GitHub Actions", + stream_name="github-actions updates", ), "hubot": Integration("hubot", ["meta-integration", "bots"]), "jenkins": Integration("jenkins", ["continuous-integration"]), @@ -869,6 +874,7 @@ for integration, screenshots_contents in FIXTURELESS_SCREENSHOT_CONTENT.items(): FIXTURELESS_SCREENSHOT_CONFIG_OPTIONAL_FIELDS = { "mercurial": {"image_dir": "hg"}, + "jenkins": {"image_name": "004.png"}, } for integration, fields in FIXTURELESS_SCREENSHOT_CONFIG_OPTIONAL_FIELDS.items(): diff --git a/zerver/webhooks/fixtureless_integrations.py b/zerver/webhooks/fixtureless_integrations.py index 3c69900dd8..49ce6697af 100644 --- a/zerver/webhooks/fixtureless_integrations.py +++ b/zerver/webhooks/fixtureless_integrations.py @@ -1,3 +1,4 @@ +from datetime import datetime, timezone from typing import TypedDict # For integrations that don't have example webhook fixtures/payloads, @@ -34,6 +35,10 @@ COMMIT_HASH_A = "a2e84e86ddf7e7f8a9b0c1d2e3f4a5b6c7d8e9f0" COMMIT_HASH_B = "9fceb02c0c4b8e4c1e7b43hd4e5f6a7b8c9d0e1f" 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") + class ScreenshotContent(TypedDict): topic: str @@ -49,6 +54,17 @@ CODEBASE = ScreenshotContent( """, ) +GITHUB_ACTIONS = ScreenshotContent( + topic="scheduled backups", + content=f"""Backup [failed]() at {DATETIME_STAMP}. +> Unable to connect.""", +) + +JENKINS = ScreenshotContent( + topic=PROJECT_NAME, + content=f"**Build:** [#{REVISION_NUMBER}](): FAILURE :cross_mark:", +) + MERCURIAL = ScreenshotContent( topic=BRANCH_MERCURIAL, content=f"""**{BO_NAME}** pushed [2 commits]() to **{BRANCH_MERCURIAL}** (`{REVISION_NUMBER}:{DEPLOYMENT_HASH[:12]}`):