Arvind2006 commited on
Commit
0365678
·
verified ·
1 Parent(s): 2ff3ed9

Upload folder using huggingface_hub

Browse files
Files changed (2) hide show
  1. README.md +2 -2
  2. index.html +296 -85
README.md CHANGED
@@ -3,8 +3,8 @@ title: Jenkins Error Explainer
3
  emoji: 🔧
4
  colorFrom: blue
5
  colorTo: green
6
- sdk: docker
7
- app_file: app.py
8
  pinned: false
9
  ---
10
 
 
3
  emoji: 🔧
4
  colorFrom: blue
5
  colorTo: green
6
+ sdk: static
7
+ app_file: index.html
8
  pinned: false
9
  ---
10
 
index.html CHANGED
@@ -6,112 +6,323 @@
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>
 
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: linear-gradient(135deg, #667eea 0%, #764ba2 100%); min-height: 100vh; padding: 40px 20px; }
10
+ .container { max-width: 800px; margin: 0 auto; background: white; border-radius: 16px; box-shadow: 0 20px 60px rgba(0,0,0,0.3); overflow: hidden; }
11
+ .header { background: linear-gradient(135deg, #4a90d9 0%, #5c3cb8 100%); color: white; padding: 30px; text-align: center; }
12
+ .header h1 { font-size: 28px; margin-bottom: 8px; }
13
+ .header p { opacity: 0.9; font-size: 14px; }
14
+ .content { padding: 30px; }
15
+ textarea { width: 100%; height: 200px; padding: 15px; border: 2px solid #e0e0e0; border-radius: 12px; font-family: 'Monaco', 'Menlo', monospace; font-size: 13px; resize: vertical; transition: border-color 0.3s; }
16
+ textarea:focus { outline: none; border-color: #667eea; }
17
+ .btn { display: block; width: 100%; background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); color: white; border: none; padding: 16px; font-size: 16px; font-weight: 600; border-radius: 12px; cursor: pointer; margin-top: 20px; transition: transform 0.2s, box-shadow 0.2s; }
18
+ .btn:hover { transform: translateY(-2px); box-shadow: 0 8px 20px rgba(102, 126, 234, 0.4); }
19
+ .btn:disabled { opacity: 0.7; cursor: not-allowed; transform: none; }
20
+ #result { margin-top: 30px; display: none; }
21
+ #result.show { display: block; animation: fadeIn 0.4s ease; }
22
+ @keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
23
+ .error-category { display: inline-block; background: linear-gradient(135deg, #ff6b6b 0%, #ee5a5a 100%); color: white; padding: 8px 16px; border-radius: 20px; font-weight: 600; font-size: 14px; margin-bottom: 15px; }
24
+ .section { margin: 20px 0; }
25
+ .section h3 { color: #333; font-size: 16px; margin-bottom: 10px; }
26
+ .summary { background: #f8f9fa; padding: 15px; border-radius: 10px; line-height: 1.6; color: #555; }
27
+ .causes { background: #fff3e0; padding: 15px; border-radius: 10px; }
28
+ .causes ul { margin-left: 20px; color: #e65100; }
29
+ .causes li { margin: 8px 0; }
30
+ .references { background: #e8f5e9; padding: 15px; border-radius: 10px; }
31
+ .references ul { margin-left: 20px; color: #2e7d32; }
32
+ .references li { margin: 5px 0; }
33
+ .footer { background: #f5f5f5; padding: 20px; text-align: center; color: #888; font-size: 12px; }
34
  </style>
35
  </head>
36
  <body>
37
  <div class="container">
38
+ <div class="header">
39
+ <h1>🔧 Jenkins Error Explainer</h1>
40
+ <p>AI-powered Jenkins pipeline error diagnosis</p>
41
+ </div>
42
 
43
+ <div class="content">
44
+ <textarea id="logInput" placeholder="Paste your Jenkins error log here...
45
+
46
+ Example:
47
+ Started by user admin
48
+ org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:
49
+ WorkflowScript: 10: expecting '}', found '' @ line 10, column 1
50
+ "></textarea>
51
+ <button class="btn" onclick="explainError()" id="submitBtn">Analyze Error</button>
52
+
53
+ <div id="result">
54
+ <span class="error-category" id="category"></span>
55
+
56
+ <div class="section">
57
+ <h3>📝 Summary</h3>
58
+ <div class="summary" id="summary"></div>
59
+ </div>
60
+
61
+ <div class="section">
62
+ <h3>🔍 Likely Causes</h3>
63
+ <div class="causes"><ul id="causes"></ul></div>
64
+ </div>
65
+
66
+ <div class="section">
67
+ <h3>📚 References</h3>
68
+ <div class="references"><ul id="references"></ul></div>
69
+ </div>
70
+ </div>
71
+ </div>
72
 
73
+ <div class="footer">
74
+ Built with ❤️ for Jenkins Developers
75
+ </div>
76
  </div>
77
 
78
  <script>
79
+ const ERROR_DATABASE = {
80
+ groovy_syntax_error: {
81
+ category: "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: [
84
+ "Missing or mismatched braces in the Jenkinsfile",
85
+ "Invalid declarative pipeline structure",
86
+ "Incorrect string quotes or special characters",
87
+ "Missing required keywords like 'pipeline', 'stages', or 'steps'"
88
+ ],
89
+ references: [
90
+ "Pipeline Syntax Reference (Jenkins.io)",
91
+ "Declarative Pipeline Documentation",
92
+ "Groovy Language Documentation"
93
+ ]
94
+ },
95
+ missing_agent: {
96
+ category: "Missing Agent",
97
+ summary: "The pipeline attempted to execute a step that requires a node, but no agent was allocated.",
98
+ causes: [
99
+ "Using 'agent none' without defining a stage-level agent",
100
+ "Executing node-dependent steps (like 'sh', 'node') without a workspace",
101
+ "Missing agent directive in declarative pipeline"
102
+ ],
103
+ references: [
104
+ "Agent Directive (Jenkins.io)",
105
+ "Pipeline Steps Documentation"
106
+ ]
107
+ },
108
+ no_node_available: {
109
+ category: "No Node Available",
110
+ summary: "The pipeline could not be scheduled because no Jenkins node matched the requested label.",
111
+ causes: [
112
+ "The specified node label does not exist",
113
+ "All matching nodes are offline or busy",
114
+ "No executors available on matching nodes",
115
+ "Node label typo or case mismatch"
116
+ ],
117
+ references: [
118
+ "Distributed Builds (Jenkins.io)",
119
+ "Node Label Plugin Documentation",
120
+ "Label Selector Plugin"
121
+ ]
122
+ },
123
+ missing_plugin: {
124
+ category: "Missing Plugin",
125
+ summary: "The pipeline referenced a step that is not available, indicating a missing or uninstalled plugin.",
126
+ causes: [
127
+ "Required plugin is not installed",
128
+ "Plugin is installed but not enabled",
129
+ "Incorrect step name in the Jenkinsfile",
130
+ "Plugin version mismatch"
131
+ ],
132
+ references: [
133
+ "Plugin Index",
134
+ "Pipeline Steps Reference",
135
+ "Managing Plugins Documentation"
136
+ ]
137
+ },
138
+ missing_credentials: {
139
+ category: "Missing Credentials",
140
+ summary: "The pipeline referenced credentials that do not exist in Jenkins.",
141
+ causes: [
142
+ "Credentials ID is incorrect or misspelled",
143
+ "Credentials were not configured in Jenkins",
144
+ "Credentials have expired or been deleted",
145
+ "User does not have permission to use the credentials"
146
+ ],
147
+ references: [
148
+ "Credentials Plugin Documentation",
149
+ "Using Credentials in Pipelines",
150
+ "Credential Binding Plugin"
151
+ ]
152
+ },
153
+ file_not_found: {
154
+ category: "File Not Found",
155
+ summary: "The pipeline attempted to access a file that does not exist in the workspace.",
156
+ causes: [
157
+ "File path is incorrect or has typos",
158
+ "File was not generated in previous build step",
159
+ "File was not checked out from version control",
160
+ "Working directory mismatch"
161
+ ],
162
+ references: [
163
+ "Pipeline Basic Steps",
164
+ "Workspace Plugin Documentation",
165
+ "File Operations Plugin"
166
+ ]
167
+ },
168
+ git_authentication_error: {
169
+ category: "Git Authentication Error",
170
+ summary: "Jenkins failed to authenticate with the Git repository during checkout.",
171
+ causes: [
172
+ "Invalid or missing Git credentials",
173
+ "SSH key not configured properly",
174
+ "Repository URL authentication method mismatch",
175
+ "Token has expired or been revoked"
176
+ ],
177
+ references: [
178
+ "Git Plugin Documentation",
179
+ "Credential Binding Plugin",
180
+ "SSH Credentials Plugin"
181
+ ]
182
+ },
183
+ timeout_error: {
184
+ category: "Timeout Error",
185
+ summary: "The pipeline or a step took too long to complete and was terminated.",
186
+ causes: [
187
+ "Step execution time exceeded timeout limit",
188
+ "Network latency or connection issues",
189
+ "External service not responding",
190
+ "Build queue is too long causing delays"
191
+ ],
192
+ references: [
193
+ "Timeout Step Documentation",
194
+ "Pipeline Timeout Configuration",
195
+ "Jenkins Queue Management"
196
+ ]
197
+ },
198
+ out_of_memory: {
199
+ category: "Out of Memory",
200
+ summary: "The build failed due to insufficient memory allocation.",
201
+ causes: [
202
+ "JVM heap size too small for the build",
203
+ "Memory leak in the application",
204
+ "Too many parallel builds consuming memory",
205
+ "Large file processing exceeding limits"
206
+ ],
207
+ references: [
208
+ "JVM Memory Tuning",
209
+ "Pipeline Resource Management",
210
+ "Kubernetes Memory Limits"
211
+ ]
212
+ },
213
+ permission_denied: {
214
+ category: "Permission Denied",
215
+ summary: "The pipeline attempted an operation without sufficient permissions.",
216
+ causes: [
217
+ "Insufficient file system permissions",
218
+ "Missing role-based access control (RBAC) permissions",
219
+ "Pipeline lacks required approval or authorization",
220
+ "Security realm authentication failure"
221
+ ],
222
+ references: [
223
+ "Matrix Authorization Strategy",
224
+ "Role-Based Access Control Plugin",
225
+ "Pipeline Security Documentation"
226
+ ]
227
+ },
228
+ docker_error: {
229
+ category: "Docker Error",
230
+ summary: "The pipeline failed while building or running Docker containers.",
231
+ causes: [
232
+ "Docker daemon not running or not accessible",
233
+ "Invalid Docker image name or tag",
234
+ "Dockerfile syntax errors",
235
+ "Insufficient permissions to pull images"
236
+ ],
237
+ references: [
238
+ "Docker Pipeline Plugin",
239
+ "Dockerfile Reference",
240
+ "Kaniko vs Docker Build"
241
+ ]
242
+ },
243
+ unknown: {
244
+ category: "Unknown Error",
245
+ summary: "The error could not be confidently identified. Please check the error message for more details.",
246
+ causes: [
247
+ "Review the full error log for specific details",
248
+ "Check Jenkins system logs for more information",
249
+ "Search Jenkins community forums for the error",
250
+ "Contact Jenkins administrators for help"
251
+ ],
252
+ references: [
253
+ "Jenkins Pipeline Troubleshooting Guide",
254
+ "Jenkins Users Mailing List",
255
+ "Jenkins Community Forum"
256
+ ]
257
+ }
258
+ };
259
+
260
+ function detectErrorCategory(log) {
261
+ const lower = log.toLowerCase();
262
+
263
+ if (lower.includes('groovy') && (lower.includes('syntax') || lower.includes('expecting') || lower.includes('failed'))) {
264
+ return 'groovy_syntax_error';
265
+ }
266
+ if (lower.includes('agent') && (lower.includes('none') || lower.includes('null'))) {
267
+ return 'missing_agent';
268
+ }
269
+ if (lower.includes('no node') || lower.includes('no such agent') || lower.includes('label')) {
270
+ return 'no_node_available';
271
+ }
272
+ if (lower.includes('no such dsl') || lower.includes('undefined method') || lower.includes('not a valid step')) {
273
+ return 'missing_plugin';
274
+ }
275
+ if (lower.includes('credentials') && (lower.includes('not found') || lower.includes('null') || lower.includes('missing'))) {
276
+ return 'missing_credentials';
277
+ }
278
+ if (lower.includes('file not found') || lower.includes('no such file') || lower.includes('does not exist')) {
279
+ return 'file_not_found';
280
+ }
281
+ if ((lower.includes('git') || lower.includes('checkout')) && (lower.includes('authentication') || lower.includes('failed') || lower.includes('permission'))) {
282
+ return 'git_authentication_error';
283
+ }
284
+ if (lower.includes('timeout') || lower.includes('timed out') || lower.includes('deadline exceeded')) {
285
+ return 'timeout_error';
286
+ }
287
+ if (lower.includes('outofmemory') || lower.includes('out of memory') || lower.includes('heap space') || lower.includes('oom')) {
288
+ return 'out_of_memory';
289
+ }
290
+ if (lower.includes('permission denied') || lower.includes('access denied') || lower.includes('unauthorized')) {
291
+ return 'permission_denied';
292
+ }
293
+ if (lower.includes('docker') && (lower.includes('error') || lower.includes('failed') || lower.includes('not found'))) {
294
+ return 'docker_error';
295
+ }
296
+ return 'unknown';
297
+ }
298
+
299
  function explainError() {
300
  const logText = document.getElementById('logInput').value;
301
  const resultDiv = document.getElementById('result');
302
  const btn = document.getElementById('submitBtn');
303
 
304
  if (!logText.trim()) {
305
+ alert('Please provide a Jenkins error log.');
306
  return;
307
  }
308
 
309
  btn.disabled = true;
310
  btn.textContent = 'Analyzing...';
311
 
312
+ setTimeout(() => {
313
+ const category = detectErrorCategory(logText);
314
+ const info = ERROR_DATABASE[category];
315
+
316
+ document.getElementById('category').textContent = info.category;
317
+ document.getElementById('summary').textContent = info.summary;
318
+ document.getElementById('causes').innerHTML = info.causes.map(c => `<li>${c}</li>`).join('');
319
+ document.getElementById('references').innerHTML = info.references.map(r => `<li>${r}</li>`).join('');
320
+
321
+ resultDiv.classList.add('show');
322
+
323
+ btn.disabled = false;
324
+ btn.textContent = 'Analyze Error';
325
+ }, 500);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
326
  }
327
  </script>
328
  </body>