diff --git a/Jenkinsfile b/Jenkinsfile index af3e211aef..ce88294567 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -12,14 +12,6 @@ def show_node_info() { """ } -// Error patterns to scan build logs for specific failure types and send detailed notifications. -def failurePatterns = [ - [pattern: /login attempt to .* failed with status: 401 Unauthorized/, description: "Docker registry authentication failed"], - [pattern: /docker login failed/, description: "Docker login failed"], - [pattern: /HTTP request sent .* 404 Not Found/, description: "HTTP request failed with 404"], - [pattern: /cat: .* No such file or directory/, description: "GPU not found"], -] - // Given a pattern, check if the log contains the pattern and return the context. def checkForPattern(pattern, log) { def lines = log.split('\n') @@ -42,8 +34,18 @@ def checkForPattern(pattern, log) { return [found: false, matchedLine: "", context: ""] } -// Scan build logs and send notifications +// Scan the build logs for failures and send notifications. def sendFailureNotifications() { + // Error patterns to scan build logs for specific failure types and send detailed notifications. + def failurePatterns = [ + [pattern: /login attempt to .* failed with status: 401 Unauthorized/, description: "Docker registry authentication failed"], + [pattern: /docker login failed/, description: "Docker login failed"], + [pattern: /HTTP request sent .* 404 Not Found/, description: "HTTP request failed with 404"], + [pattern: /cat: .* No such file or directory/, description: "GPU not found"], + [pattern: /GPU not found/, description: "GPU not found"], + [pattern: /Could not connect to Redis at .* Connection timed out/, description: "Redis connection timed out"] + ] + // Get the build log. def buildLog = sh(script: 'wget -q --no-check-certificate -O - ' + BUILD_URL + 'consoleText', returnStdout: true) // Check for patterns in the log.