Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-46785

Add a way to disable all reporters (and selectively enable a few)

    Details

    • Similar Issues:

      Description

      Currently when you upgrade the plugin you are at risk that new reporters are added/integrated and these collide with existing pipeline code you have to parse these results.

      This leads to duplicate reports.

      On top of this you may want to get the version of the thing you are building by useing something like

      withMaven() {
        bsVersion = returnStdout: true, script: sh "mvn help:evaluate -Dexpression=project.version | grep -E '^[[:digit:]+.]+.*-SNAPSHOT' "
      }

       

      unfortunately using the above means that the taskScanner is currently invoked (which will then be invoked multiple times) which will cause unnecessary IO, fingerprinting is also involved - which again when you just want to run a simple maven command with no scanners is not good.  The workaround of adding 

      withMaven(options: [concordionPublisher(disabled: true), findbugsPublisher(disabled: true), dependenciesFingerprintPublisher(disabled: true), artifactsPublisher(disabled: true), invokerPublisher(disabled: true), junitPublisher(disabled: true, ignoreAttachments: false), openTasksPublisher(disabled: true), pipelineGraphPublisher(disabled: true)]) {
      // some block
      }

      is both verbose and will likely not do what is expected when a new publisher/reporter is integrated.

       

        Attachments

          Issue Links

            Activity

            Hide
            scm_issue_link SCM/JIRA link daemon added a comment -

            Code changed in jenkins
            User: Cyrille Le Clerc
            Path:
            jenkins-plugin/src/main/java/org/jenkinsci/plugins/pipeline/maven/MavenPublisher.java
            jenkins-plugin/src/main/java/org/jenkinsci/plugins/pipeline/maven/MavenPublisherStrategy.java
            jenkins-plugin/src/main/java/org/jenkinsci/plugins/pipeline/maven/MavenSpyLogProcessor.java
            jenkins-plugin/src/main/java/org/jenkinsci/plugins/pipeline/maven/WithMavenStep.java
            jenkins-plugin/src/main/java/org/jenkinsci/plugins/pipeline/maven/WithMavenStepExecution.java
            jenkins-plugin/src/main/resources/org/jenkinsci/plugins/pipeline/maven/WithMavenStep/config.jelly
            jenkins-plugin/src/main/resources/org/jenkinsci/plugins/pipeline/maven/WithMavenStep/help-publisherStrategy.html
            jenkins-plugin/src/test/java/org/jenkinsci/plugins/pipeline/maven/MavenPublisherStrategyTest.java
            jenkins-plugin/src/test/java/org/jenkinsci/plugins/pipeline/maven/MavenPublisherTest.java
            jenkins-plugin/src/test/java/org/jenkinsci/plugins/pipeline/maven/WithMavenStepTest.java
            http://jenkins-ci.org/commit/pipeline-maven-plugin/1d0617207186decf257afc2d8b08ad454c319109
            Log:
            JENKINS-46785 Strategy to enable / disable publishers in pipelines

            Compare: https://github.com/jenkinsci/pipeline-maven-plugin/compare/586c9f75a5f3...1d0617207186

            Show
            scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Cyrille Le Clerc Path: jenkins-plugin/src/main/java/org/jenkinsci/plugins/pipeline/maven/MavenPublisher.java jenkins-plugin/src/main/java/org/jenkinsci/plugins/pipeline/maven/MavenPublisherStrategy.java jenkins-plugin/src/main/java/org/jenkinsci/plugins/pipeline/maven/MavenSpyLogProcessor.java jenkins-plugin/src/main/java/org/jenkinsci/plugins/pipeline/maven/WithMavenStep.java jenkins-plugin/src/main/java/org/jenkinsci/plugins/pipeline/maven/WithMavenStepExecution.java jenkins-plugin/src/main/resources/org/jenkinsci/plugins/pipeline/maven/WithMavenStep/config.jelly jenkins-plugin/src/main/resources/org/jenkinsci/plugins/pipeline/maven/WithMavenStep/help-publisherStrategy.html jenkins-plugin/src/test/java/org/jenkinsci/plugins/pipeline/maven/MavenPublisherStrategyTest.java jenkins-plugin/src/test/java/org/jenkinsci/plugins/pipeline/maven/MavenPublisherTest.java jenkins-plugin/src/test/java/org/jenkinsci/plugins/pipeline/maven/WithMavenStepTest.java http://jenkins-ci.org/commit/pipeline-maven-plugin/1d0617207186decf257afc2d8b08ad454c319109 Log: JENKINS-46785 Strategy to enable / disable publishers in pipelines Compare: https://github.com/jenkinsci/pipeline-maven-plugin/compare/586c9f75a5f3...1d0617207186
            Hide
            cleclerc Cyrille Le Clerc added a comment - - edited

            Fixed in 3.4.0-beta-1: https://repo.jenkins-ci.org/releases/org/jenkins-ci/plugins/pipeline-maven/3.4.0-beta-1/pipeline-maven-3.4.0-beta-1.hpi

            James Nord Olivier Lamy can you please test?

            Sample:

            node {
                stage ('Build') {
                    git "https://github.com/cyrille-leclerc/my-jar.git"
                     // disable all publishers
                    withMaven(maven: 'maven-3.5.2', publisherStrategy: 'EXPLICIT') {
                       sh "mvn dependency:go-offline"
                    }
                    
                    withMaven(maven: 'maven-3.5.2') {
                       sh "mvn clean deploy"
                    }
                }
            }
            
            Show
            cleclerc Cyrille Le Clerc added a comment - - edited Fixed in 3.4.0-beta-1: https://repo.jenkins-ci.org/releases/org/jenkins-ci/plugins/pipeline-maven/3.4.0-beta-1/pipeline-maven-3.4.0-beta-1.hpi James Nord Olivier Lamy can you please test? Sample: node { stage ( 'Build' ) { git "https: //github.com/cyrille-leclerc/my-jar.git" // disable all publishers withMaven(maven: 'maven-3.5.2' , publisherStrategy: 'EXPLICIT' ) { sh "mvn dependency:go-offline" } withMaven(maven: 'maven-3.5.2' ) { sh "mvn clean deploy" } } }
            Hide
            cleclerc Cyrille Le Clerc added a comment -

            Olivier Lamy, James Nord friendly ping

            Show
            cleclerc Cyrille Le Clerc added a comment - Olivier Lamy , James Nord friendly ping
            Hide
            olamy Olivier Lamy added a comment -

            Cyrille Le Clerc sorry for the late reply but works fine! Thanks!

            Show
            olamy Olivier Lamy added a comment - Cyrille Le Clerc sorry for the late reply but works fine! Thanks!
            Hide
            cleclerc Cyrille Le Clerc added a comment -

            Solved in 3.4.0

            Show
            cleclerc Cyrille Le Clerc added a comment - Solved in 3.4.0

              People

              • Assignee:
                cleclerc Cyrille Le Clerc
                Reporter:
                teilo James Nord
              • Votes:
                2 Vote for this issue
                Watchers:
                9 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: