Skip to content

Commit

Permalink
[Backport 5.x] Fix return for build Failure messages (#277)
Browse files Browse the repository at this point in the history
Signed-off-by: Sayali Gaikawad <[email protected]>
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
  • Loading branch information
1 parent df636cd commit e96b5de
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 7 deletions.
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ jacocoTestReport {
}
}

String version = '5.4.1'
String version = '5.5.0'

task updateVersion {
doLast {
Expand Down
9 changes: 4 additions & 5 deletions vars/buildMessage.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
* this file be licensed under the Apache-2.0 license or a
* compatible open source license.
*/
/** Library to find a pattern in jenkins build log.
/** Library to search string in jenkins build log.
@param Map args = [:] args A map of the following parameters
@param args.search <required> - Use 'pass' to get the components passed and 'fail' for components failed.
@param args.search <required> - String to be searched in build logs.
*/
import com.cloudbees.groovy.cps.NonCPS
import org.apache.commons.io.IOUtils
Expand All @@ -29,9 +29,8 @@ def call(Map args = [:]){
message.add(line)
}
}
//if no match returns as Build failed
if(message.isEmpty()){
message=["The search QUERY_STRING not identified in build log"]
if (message.isEmpty()) {
message = null
}
return message
}
2 changes: 1 addition & 1 deletion vars/createBuildFailureGithubIssue.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ void call(Map args = [:]) {
def failureMessages = args.message
List<String> failedComponents = []

if (failureMessages.size() == 1 && failureMessages[0] == 'Build failed') {
if (failureMessages == null) {
println('No component failed, skip creating github issue.')
}
else {
Expand Down

0 comments on commit e96b5de

Please sign in to comment.