devops-ai-agent 1.0.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- agent/__init__.py +1 -0
- agent/classifier.py +135 -0
- agent/core.py +658 -0
- agent/prompts.py +150 -0
- api/__init__.py +1 -0
- api/server.py +222 -0
- collectors/__init__.py +0 -0
- collectors/argocd.py +238 -0
- collectors/aws.py +741 -0
- collectors/azure.py +647 -0
- collectors/azure_devops.py +94 -0
- collectors/bamboo.py +98 -0
- collectors/cloud_registry.py +103 -0
- collectors/database_policy.py +72 -0
- collectors/docker.py +7 -0
- collectors/gcp.py +508 -0
- collectors/github.py +81 -0
- collectors/gitlab.py +81 -0
- collectors/jenkins.py +110 -0
- collectors/k8s.py +164 -0
- collectors/security_scanner.py +343 -0
- collectors/server.py +40 -0
- collectors/server_enhanced.py +265 -0
- devops_agent/__init__.py +3 -0
- devops_agent/cli.py +64 -0
- devops_ai_agent-1.0.0.dist-info/METADATA +952 -0
- devops_ai_agent-1.0.0.dist-info/RECORD +43 -0
- devops_ai_agent-1.0.0.dist-info/WHEEL +5 -0
- devops_ai_agent-1.0.0.dist-info/entry_points.txt +2 -0
- devops_ai_agent-1.0.0.dist-info/licenses/LICENSE +21 -0
- devops_ai_agent-1.0.0.dist-info/top_level.txt +5 -0
- tools/__init__.py +1 -0
- tools/argocd_tools.py +111 -0
- tools/cicd_tools.py +301 -0
- tools/cloud_tools.py +337 -0
- tools/documentation_generator.py +452 -0
- tools/email_notifier.py +453 -0
- tools/executor.py +142 -0
- tools/fix_verifier.py +349 -0
- tools/github_tools.py +107 -0
- tools/k8s_tools.py +123 -0
- tools/notify.py +133 -0
- tools/safe_executor_enhanced.py +423 -0
agent/__init__.py
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
# DevOps AI Agent
|
agent/classifier.py
ADDED
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Issue type classifier — maps alert names and labels to issue types.
|
|
3
|
+
Supports multiple CI/CD platforms, cloud providers, and ArgoCD.
|
|
4
|
+
"""
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
def classify_issue(alertname: str, labels: dict) -> str:
|
|
8
|
+
"""
|
|
9
|
+
Classify incident type based on alert name and labels.
|
|
10
|
+
|
|
11
|
+
Returns:
|
|
12
|
+
- k8s: Kubernetes/container issues
|
|
13
|
+
- cicd: CI/CD pipeline issues (GitHub, GitLab, Jenkins, Bamboo, Azure DevOps)
|
|
14
|
+
- server: Server/VM issues
|
|
15
|
+
- cloud_aws: AWS resource issues
|
|
16
|
+
- cloud_gcp: GCP resource issues
|
|
17
|
+
- cloud_azure: Azure resource issues
|
|
18
|
+
- argocd: ArgoCD deployment issues
|
|
19
|
+
"""
|
|
20
|
+
name = alertname.lower()
|
|
21
|
+
|
|
22
|
+
# CI/CD specific keywords (check first to avoid conflicts with k8s "deployment")
|
|
23
|
+
cicd_keywords = ["pipeline", "build", "ci", "release", "workflow", "job",
|
|
24
|
+
"jenkins", "gitlab", "bamboo", "azure-pipeline", "github-actions",
|
|
25
|
+
"buildfailed", "pipelinefailed", "pipelineerror", "deploymentfailed"]
|
|
26
|
+
|
|
27
|
+
k8s_keywords = ["pod", "container", "crash", "oom", "image", "evict",
|
|
28
|
+
"pending", "replicaset", "statefulset", "daemonset",
|
|
29
|
+
"nodepool", "crashloop"]
|
|
30
|
+
|
|
31
|
+
server_keywords = ["cpu", "memory", "disk", "load", "nginx", "apache",
|
|
32
|
+
"service", "host", "node", "network", "ssh", "systemd"]
|
|
33
|
+
|
|
34
|
+
argocd_keywords = ["argocd", "argo", "gitops", "sync"]
|
|
35
|
+
|
|
36
|
+
aws_keywords = [
|
|
37
|
+
"ec2", "ecs", "eks", "fargate", "lambda", "rds", "aws", "cloudwatch",
|
|
38
|
+
"elb", "alb", "ecr", "elasticache", "dynamodb", "sqs", "sns", "s3",
|
|
39
|
+
"autoscaling", "elasticbeanstalk", "apprunner", "batch",
|
|
40
|
+
]
|
|
41
|
+
|
|
42
|
+
gcp_keywords = [
|
|
43
|
+
"gce", "gke", "cloud-run", "cloud-function", "gcp", "google-cloud",
|
|
44
|
+
"compute-engine", "artifact-registry", "cloud-sql", "memorystore",
|
|
45
|
+
"pubsub", "cloud-storage", "load-balancer", "cloud-composer",
|
|
46
|
+
]
|
|
47
|
+
|
|
48
|
+
azure_keywords = [
|
|
49
|
+
"azure-vm", "aks", "app-service", "azure-function", "azure-sql",
|
|
50
|
+
"aci", "container-instance", "container-apps", "acr", "vmss",
|
|
51
|
+
"cosmosdb", "redis", "application-gateway", "service-bus",
|
|
52
|
+
]
|
|
53
|
+
|
|
54
|
+
# Check ArgoCD first (most specific)
|
|
55
|
+
if any(k in name for k in argocd_keywords):
|
|
56
|
+
return "argocd"
|
|
57
|
+
|
|
58
|
+
# Check CI/CD before K8s (to catch "deployment" in CICD context)
|
|
59
|
+
if any(k in name for k in cicd_keywords):
|
|
60
|
+
return "cicd"
|
|
61
|
+
|
|
62
|
+
# Check cloud providers
|
|
63
|
+
if any(k in name for k in aws_keywords):
|
|
64
|
+
return "cloud_aws"
|
|
65
|
+
if any(k in name for k in gcp_keywords):
|
|
66
|
+
return "cloud_gcp"
|
|
67
|
+
if any(k in name for k in azure_keywords):
|
|
68
|
+
return "cloud_azure"
|
|
69
|
+
|
|
70
|
+
# Check K8s
|
|
71
|
+
if any(k in name for k in k8s_keywords):
|
|
72
|
+
return "k8s"
|
|
73
|
+
|
|
74
|
+
# Check server
|
|
75
|
+
if any(k in name for k in server_keywords):
|
|
76
|
+
return "server"
|
|
77
|
+
|
|
78
|
+
# Fallback: check labels
|
|
79
|
+
if labels.get("namespace") or labels.get("pod"):
|
|
80
|
+
return "k8s"
|
|
81
|
+
if labels.get("cluster") and labels.get("cloud_provider"):
|
|
82
|
+
cloud = labels["cloud_provider"].lower()
|
|
83
|
+
if cloud in ("aws", "eks"):
|
|
84
|
+
return "cloud_aws"
|
|
85
|
+
if cloud in ("gcp", "gke", "google"):
|
|
86
|
+
return "cloud_gcp"
|
|
87
|
+
if cloud in ("azure", "aks"):
|
|
88
|
+
return "cloud_azure"
|
|
89
|
+
if labels.get("pipeline") or labels.get("job"):
|
|
90
|
+
return "cicd"
|
|
91
|
+
if labels.get("argocd_app"):
|
|
92
|
+
return "argocd"
|
|
93
|
+
if labels.get("cloud_provider"):
|
|
94
|
+
cloud = labels["cloud_provider"].lower()
|
|
95
|
+
if "aws" in cloud:
|
|
96
|
+
return "cloud_aws"
|
|
97
|
+
elif "gcp" in cloud or "google" in cloud:
|
|
98
|
+
return "cloud_gcp"
|
|
99
|
+
elif "azure" in cloud:
|
|
100
|
+
return "cloud_azure"
|
|
101
|
+
|
|
102
|
+
return "server"
|
|
103
|
+
|
|
104
|
+
|
|
105
|
+
def get_cicd_platform(labels: dict, context: dict) -> str:
|
|
106
|
+
"""
|
|
107
|
+
Determine the specific CI/CD platform from labels and context.
|
|
108
|
+
|
|
109
|
+
Returns: 'github', 'gitlab', 'jenkins', 'bamboo', 'azure_devops', or 'unknown'
|
|
110
|
+
"""
|
|
111
|
+
# Check labels first
|
|
112
|
+
if labels.get("cicd_platform"):
|
|
113
|
+
return labels["cicd_platform"].lower()
|
|
114
|
+
|
|
115
|
+
# Check context/source
|
|
116
|
+
source = context.get("source", "").lower()
|
|
117
|
+
if "github" in source:
|
|
118
|
+
return "github"
|
|
119
|
+
elif "gitlab" in source:
|
|
120
|
+
return "gitlab"
|
|
121
|
+
elif "jenkins" in source:
|
|
122
|
+
return "jenkins"
|
|
123
|
+
elif "bamboo" in source:
|
|
124
|
+
return "bamboo"
|
|
125
|
+
elif "azure" in source or "azuredevops" in source:
|
|
126
|
+
return "azure_devops"
|
|
127
|
+
|
|
128
|
+
# Check repo or job URL
|
|
129
|
+
repo_url = context.get("repo", "") or labels.get("repo_url", "")
|
|
130
|
+
if "github.com" in repo_url:
|
|
131
|
+
return "github"
|
|
132
|
+
elif "gitlab" in repo_url:
|
|
133
|
+
return "gitlab"
|
|
134
|
+
|
|
135
|
+
return "unknown"
|