@@ -185,6 +185,118 @@ spec:
185185 comment_strategy: "disable_all"
186186` ` `
187187
188+ # # Error Detection
189+
190+ Error detection scans container logs for error patterns and creates inline
191+ annotations on Pull Requests. This feature is currently **only supported for
192+ GitHub Apps**.
193+
194+ By default, error detection uses the global pattern configured in the
195+ ` pipelines-as-code` ConfigMap via the `error-detection-simple-regexp` setting.
196+ However, you can customize error detection patterns on a per-repository basis
197+ using the Repository CR.
198+
199+ # ## Configuring Error Detection Patterns
200+
201+ You can specify multiple regex patterns to detect different error formats in
202+ your repository :
203+
204+ ` ` ` yaml
205+ apiVersion: "pipelinesascode.tekton.dev/v1alpha1"
206+ kind: Repository
207+ metadata:
208+ name: my-repo
209+ spec:
210+ url: "https://github.com/owner/repo"
211+ settings:
212+ error_detection:
213+ enabled: true
214+ patterns:
215+ - "^(?P<filename>[^:]*):(?P<line>[0-9]+):(?P<column>[0-9]+)?([ ]*)?(?P<error>.*)"
216+ - "^ERROR: (?P<filename>[^ ]+) line (?P<line>[0-9]+): (?P<error>.*)"
217+ max_number_of_lines: 100
218+ ` ` `
219+
220+ **Pattern Requirements:**
221+
222+ Each pattern must use [named groups](https://www.regular-expressions.info/named.html) to capture :
223+
224+ - `filename` : The file path where the error occurred
225+ - `line` : The line number
226+ - `error` : The error message
227+ - `column` : (optional) The column number
228+
229+ **Configuration Options:**
230+
231+ - `enabled` : **Required** boolean flag to enable or disable error detection for this
232+ repository. Set to `true` to enable or `false` to disable error detection.
233+ This field must be explicitly specified when configuring error detection settings.
234+ - `patterns` : Array of regex patterns. Repository-specific patterns are tried
235+ first, followed by global patterns. If not specified or empty, only the
236+ global patterns are used. **Note:** Providing an empty array does not disable
237+ error detection; it falls back to using only the global patterns defined in
238+ the `pipelines-as-code` ConfigMap.
239+ - `max_number_of_lines` : Number of log lines to scan (overrides global
240+ setting). Default is 50. Use -1 for unlimited.
241+
242+ # ## Examples
243+
244+ **Multiple error formats:**
245+
246+ ` ` ` yaml
247+ spec:
248+ settings:
249+ error_detection:
250+ enabled: true
251+ patterns:
252+ # Standard format (make, gcc, eslint, etc.)
253+ - "^(?P<filename>[^:]*):(?P<line>[0-9]+):(?P<column>[0-9]+)?([ ]*)?(?P<error>.*)"
254+ # Python traceback format
255+ - 'File "(?P<filename>[^"]+)", line (?P<line>[0-9]+).*\n .*(?P<error>.*)'
256+ # Custom CI format
257+ - "^\\ [(?P<filename>[^\\ ]]+)\\ ]:(?P<line>[0-9]+) - (?P<error>.*)"
258+ max_number_of_lines: 200
259+ ` ` `
260+
261+ **Disabling error detection for a repository:**
262+
263+ You can explicitly disable error detection for a specific repository, even if
264+ it's enabled globally :
265+
266+ ` ` ` yaml
267+ spec:
268+ settings:
269+ error_detection:
270+ enabled: false
271+ ` ` `
272+
273+ **Using only global patterns:**
274+
275+ If you want to use only the global patterns defined in the `pipelines-as-code`
276+ ConfigMap with custom settings, provide an empty `patterns` array :
277+
278+ ` ` ` yaml
279+ spec:
280+ settings:
281+ error_detection:
282+ enabled: true
283+ patterns: [] # Uses only global patterns
284+ max_number_of_lines: 100 # Can still override line count
285+ ` ` `
286+
287+ If you don't need to customize error detection at all, simply omit the
288+ entire `error_detection` field and the global settings will be used.
289+
290+ {{< hint info >}}
291+ **Pattern Priority:** When repository-specific patterns are defined, they are
292+ tried first for each log line. If no repository pattern matches, the global
293+ patterns are then tried. This allows you to add repository-specific patterns
294+ while still benefiting from the global patterns as a fallback.
295+ {{< /hint >}}
296+
297+ For more information about error detection and log snippets, see the
298+ [Status documentation]({{< relref "/docs/guide/statuses.md" >}}).
299+
188300# # Concurrency
189301
190302` concurrency_limit` allows you to define the maximum number of PipelineRuns running at any time for a Repository.
0 commit comments