-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmodels.py
More file actions
62 lines (48 loc) · 1.58 KB
/
models.py
File metadata and controls
62 lines (48 loc) · 1.58 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
#!/usr/bin/env python3
"""
Data models for GitLab-Jira Webhook Bot
This module contains Pydantic models and data structures used throughout the application.
"""
from typing import Dict, Any, Optional
from pydantic import BaseModel
class GitLabWebhookPayload(BaseModel):
"""GitLab webhook payload structure for pipeline events"""
object_kind: str
object_attributes: Dict[str, Any]
project: Dict[str, Any]
commit: Optional[Dict[str, Any]] = None
builds: Optional[list] = None
class PipelineInfo(BaseModel):
"""Extracted pipeline information from webhook payload"""
pipeline_id: str
pipeline_status: str
branch_name: str
repo_name: str
project_id: str
project_name: str
project_url: str
pipeline_url: str
commit_message: str
commit_author_name: str
commit_author_email: str
class JiraTicketData(BaseModel):
"""Data structure for creating Jira tickets"""
summary: str
description: Dict[str, Any]
project_key: str
issue_type_id: str
# PLACEHOLDER: Removed the hardcoded accountId. Assignee should be handled manually or via a known variable.
assignee_account_id: str = "YOUR_JIRA_ACCOUNT_ID_HERE"
class JiraCommentData(BaseModel):
"""Data structure for Jira comments"""
body: Dict[str, Any]
class JiraTransitionData(BaseModel):
"""Data structure for Jira transitions"""
transition: Dict[str, str]
class WebhookResponse(BaseModel):
"""Standard response structure for webhook endpoints"""
message: str
status: str
branch: str
repo: str
ticket_key: Optional[str] = None