Skip to content

Commit 1977e4b

Browse files
authored
Adding new alert failure patterns (#3122)
* Adding GPU not found pattern Also, failurePatterns does not need to be global. Moved variable to live in the failure notifications function scope. * Testing new failure type * Testing failure * Removing the forced failure test * Adding an additional failure pattern
1 parent 3f996ee commit 1977e4b

File tree

1 file changed

+11
-9
lines changed

1 file changed

+11
-9
lines changed

Jenkinsfile

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,6 @@ def show_node_info() {
1212
"""
1313
}
1414

15-
// Error patterns to scan build logs for specific failure types and send detailed notifications.
16-
def failurePatterns = [
17-
[pattern: /login attempt to .* failed with status: 401 Unauthorized/, description: "Docker registry authentication failed"],
18-
[pattern: /docker login failed/, description: "Docker login failed"],
19-
[pattern: /HTTP request sent .* 404 Not Found/, description: "HTTP request failed with 404"],
20-
[pattern: /cat: .* No such file or directory/, description: "GPU not found"],
21-
]
22-
2315
// Given a pattern, check if the log contains the pattern and return the context.
2416
def checkForPattern(pattern, log) {
2517
def lines = log.split('\n')
@@ -42,8 +34,18 @@ def checkForPattern(pattern, log) {
4234
return [found: false, matchedLine: "", context: ""]
4335
}
4436

45-
// Scan build logs and send notifications
37+
// Scan the build logs for failures and send notifications.
4638
def sendFailureNotifications() {
39+
// Error patterns to scan build logs for specific failure types and send detailed notifications.
40+
def failurePatterns = [
41+
[pattern: /login attempt to .* failed with status: 401 Unauthorized/, description: "Docker registry authentication failed"],
42+
[pattern: /docker login failed/, description: "Docker login failed"],
43+
[pattern: /HTTP request sent .* 404 Not Found/, description: "HTTP request failed with 404"],
44+
[pattern: /cat: .* No such file or directory/, description: "GPU not found"],
45+
[pattern: /GPU not found/, description: "GPU not found"],
46+
[pattern: /Could not connect to Redis at .* Connection timed out/, description: "Redis connection timed out"]
47+
]
48+
4749
// Get the build log.
4850
def buildLog = sh(script: 'wget -q --no-check-certificate -O - ' + BUILD_URL + 'consoleText', returnStdout: true)
4951
// Check for patterns in the log.

0 commit comments

Comments
 (0)