Arvind2006 commited on
Commit
c2fe8c6
·
verified ·
1 Parent(s): 0adc5b7

Upload folder using huggingface_hub

Browse files
Files changed (3) hide show
  1. README.md +1 -2
  2. index.html +118 -0
  3. requirements.txt +1 -1
README.md CHANGED
@@ -3,8 +3,7 @@ title: Jenkins Error Explainer
3
  emoji: 🔧
4
  colorFrom: blue
5
  colorTo: green
6
- sdk: gradio
7
- sdk_version: "5.0.0"
8
  app_file: app.py
9
  pinned: false
10
  ---
 
3
  emoji: 🔧
4
  colorFrom: blue
5
  colorTo: green
6
+ sdk: static
 
7
  app_file: app.py
8
  pinned: false
9
  ---
index.html ADDED
@@ -0,0 +1,118 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="UTF-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
+ <title>Jenkins Error Explainer</title>
7
+ <style>
8
+ * { box-sizing: border-box; margin: 0; padding: 0; }
9
+ body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; background: #f5f5f5; padding: 20px; }
10
+ .container { max-width: 800px; margin: 0 auto; }
11
+ h1 { color: #333; margin-bottom: 10px; }
12
+ .description { color: #666; margin-bottom: 20px; }
13
+ textarea { width: 100%; height: 200px; padding: 15px; border: 1px solid #ddd; border-radius: 8px; font-family: monospace; font-size: 14px; resize: vertical; }
14
+ button { background: #4CAF50; color: white; border: none; padding: 12px 24px; font-size: 16px; border-radius: 8px; cursor: pointer; margin-top: 10px; }
15
+ button:hover { background: #45a049; }
16
+ button:disabled { background: #ccc; cursor: not-allowed; }
17
+ #result { margin-top: 20px; padding: 20px; background: white; border-radius: 8px; box-shadow: 0 2px 4px rgba(0,0,0,0.1); }
18
+ .error-category { color: #e74c3c; font-weight: bold; }
19
+ .summary { margin: 15px 0; }
20
+ .causes ul { margin-left: 20px; }
21
+ .references { margin-top: 15px; font-size: 14px; color: #666; }
22
+ .loading { color: #666; font-style: italic; }
23
+ </style>
24
+ </head>
25
+ <body>
26
+ <div class="container">
27
+ <h1>🔧 Jenkins Error Explainer</h1>
28
+ <p class="description">AI-powered Jenkins pipeline error diagnosis</p>
29
+
30
+ <textarea id="logInput" placeholder="Paste your Jenkins error log here..."></textarea>
31
+ <br>
32
+ <button onclick="explainError()" id="submitBtn">Explain Error</button>
33
+
34
+ <div id="result"></div>
35
+ </div>
36
+
37
+ <script>
38
+ function explainError() {
39
+ const logText = document.getElementById('logInput').value;
40
+ const resultDiv = document.getElementById('result');
41
+ const btn = document.getElementById('submitBtn');
42
+
43
+ if (!logText.trim()) {
44
+ resultDiv.innerHTML = '<p class="loading">Please provide a Jenkins error log.</p>';
45
+ return;
46
+ }
47
+
48
+ btn.disabled = true;
49
+ btn.textContent = 'Analyzing...';
50
+
51
+ const category = detectError(logText);
52
+ const explanations = getExplanation(category);
53
+
54
+ resultDiv.innerHTML = `
55
+ <p class="error-category">Error Category: ${category}</p>
56
+ <p class="summary"><strong>Summary:</strong> ${explanations.summary}</p>
57
+ <div class="causes">
58
+ <strong>Likely Causes:</strong>
59
+ <ul>${explanations.causes.map(c => `<li>${c}</li>`).join('')}</ul>
60
+ </div>
61
+ `;
62
+
63
+ btn.disabled = false;
64
+ btn.textContent = 'Explain Error';
65
+ }
66
+
67
+ function detectError(log) {
68
+ const lower = log.toLowerCase();
69
+ if (lower.includes('groovy') || lower.includes('syntax') || lower.includes("expecting '}'")) return 'groovy_syntax_error';
70
+ if (lower.includes('agent') && lower.includes('none')) return 'missing_agent';
71
+ if (lower.includes('no node') || lower.includes('no such agent')) return 'no_node_available';
72
+ if (lower.includes('no such DSL') || lower.includes('undefined method')) return 'missing_plugin';
73
+ if (lower.includes('credentials') || lower.includes('not found')) return 'missing_credentials';
74
+ if (lower.includes('file not found') || lower.includes('no such file')) return 'file_not_found';
75
+ if (lower.includes('authentication') || lower.includes('git')) return 'git_authentication_error';
76
+ return 'unknown';
77
+ }
78
+
79
+ function getExplanation(category) {
80
+ const explanations = {
81
+ groovy_syntax_error: {
82
+ summary: 'The pipeline failed due to a Groovy syntax error, most likely caused by an invalid or incomplete Jenkinsfile.',
83
+ causes: ['Missing or mismatched braces in the Jenkinsfile', 'Invalid declarative pipeline structure']
84
+ },
85
+ missing_agent: {
86
+ summary: 'The pipeline attempted to execute a step that requires a node, but no agent was allocated.',
87
+ causes: ["Using 'agent none' without defining a stage-level agent", "Executing node-dependent steps without a workspace"]
88
+ },
89
+ no_node_available: {
90
+ summary: 'The pipeline could not be scheduled because no Jenkins node matched the requested label.',
91
+ causes: ['The specified node label does not exist', 'All matching nodes are offline or busy']
92
+ },
93
+ missing_plugin: {
94
+ summary: 'The pipeline referenced a step that is not available, indicating a missing or uninstalled plugin.',
95
+ causes: ['Required plugin is not installed', 'Incorrect step name in the Jenkinsfile']
96
+ },
97
+ missing_credentials: {
98
+ summary: 'The pipeline referenced credentials that do not exist in Jenkins.',
99
+ causes: ['Credentials ID is incorrect or misspelled', 'Credentials were not configured in Jenkins']
100
+ },
101
+ file_not_found: {
102
+ summary: 'The pipeline attempted to access a file that does not exist in the workspace.',
103
+ causes: ['File path is incorrect', 'File was not generated or checked out']
104
+ },
105
+ git_authentication_error: {
106
+ summary: 'Jenkins failed to authenticate with the Git repository during checkout.',
107
+ causes: ['Invalid or missing Git credentials', 'Repository requires token-based authentication']
108
+ },
109
+ unknown: {
110
+ summary: 'The error could not be confidently identified. Please check the error message for more details.',
111
+ causes: ['Review the full error log', 'Check Jenkins system logs']
112
+ }
113
+ };
114
+ return explanations[category] || explanations.unknown;
115
+ }
116
+ </script>
117
+ </body>
118
+ </html>
requirements.txt CHANGED
@@ -4,4 +4,4 @@ sentence-transformers
4
  faiss-cpu
5
  numpy
6
  pydantic
7
- gradio==4.44.1
 
4
  faiss-cpu
5
  numpy
6
  pydantic
7
+ gradio