triangorithm
triangorithm

Reputation: 141

Why is Gradle Plugin not collecting build scan in Jenkins file

I have a Jenkinsfile based pipeline which does a build using gradle, which then produces build scan that goes in console output. I found a Jenkins plugin (https://wiki.jenkins.io/display/JENKINS/Gradle+Plugin) that scans the console and nicely displays all build scan links.

When I integrated in my Jenkinsfile based pipeline it does not work.

Here the Jenkins file:

node {
    // This displays colors using the 'xterm' ansi color map.

    try {
        wrap([$class: 'BuildScanBuildWrapper']) {
            stage "Create build output"
            println "Doing gradle build"
            sh "cd projects/ospackage-plugin/ && ./gradlew -I ./init.gradle tasks"
        }

    }
    catch (err) {
        println "FAILURE: ${err}"
        throw err
    }

}

Upvotes: 0

Views: 830

Answers (1)

wolfs42
wolfs42

Reputation: 816

Starting with the plugin version 1.33, it is now possible to collect build scan links from pipeline Jobs: https://plugins.jenkins.io/gradle#GradlePlugin-CapturingbuildscansfromJenkinsPipeline

Add findBuildScans() to the end of your pipeline script:

node {
    ...
}

findBuildScans()

Upvotes: 2

Related Questions