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

HMTL Publisher Plugin duplicating reports rather than updating on build page

XMLWordPrintable

    • Blue Ocean - Candidates

      I am trying to use the PublishHTML plugin in jenkins. At different stages throughout my build pipeline I want to update a published HTML report by using the pipeline syntax below.

       

      void publishBootstrapReport() {    
      publishHTML([            
      allowMissing: true,            
      alwaysLinkToLastBuild: true,            
      keepAll: true,            
      reportDir: 'allure-bootstrap-report',            
      reportFiles: 'index.html',            
      reportName: 'Allure Bootstrap Report'        
      ])  
      }
      
      void publishFunctionalReport() {    
      publishHTML([            
      allowMissing: true,            
      alwaysLinkToLastBuild: true,            
      keepAll: true,            
      reportDir: 'allure-functional-report',            
      reportFiles: 'index.html',            
      reportName: 'Allure Functional Report'        
      ])  
      } 
      
      boolean setupPassed=true  
      boolean flowInterrupted = false
      
      
      stage('Test setup') {
        try {
          yarnBuilder.yarn('test:setup:playwright-install')
              yarnBuilder.yarn('test:setup:ci')
        } catch (Exception error) {
          if (error instanceof
              org.jenkinsci.plugins.workflow.steps.FlowInterruptedException) {
            flowInterrupted = true
          }
          setupPassed =
              false unstable(message
                             : "${STAGE_NAME} is unstable: " + error.toString())
        } finally {
          yarnBuilder.yarn('test:bootstrap:generate-report') publishBootstrapReport()
        }
      }
      
      if (setupPassed) {
        stage('Chrome full functional test') {
          try {
            if (flowInterrupted) {
              throw new org.jenkinsci.plugins.workflow.steps
                  .FlowInterruptedException()
            }
            yarnBuilder.yarn('test:functional:chrome:ci')
          } catch (Exception error) {
            if (error instanceof
                org.jenkinsci.plugins.workflow.steps.FlowInterruptedException) {
              flowInterrupted = true
            }
            unstable(message : "${STAGE_NAME} is unstable: " + error.toString())
          } finally {
            yarnBuilder.yarn('test:functional:generate-report')
                publishFunctionalReport()
          }
        }  
      
      stage('Firefox full functional test') {
          try {
            if (flowInterrupted) {
              throw new org.jenkinsci.plugins.workflow.steps
                  .FlowInterruptedException()
            }
            yarnBuilder.yarn('test:functional:firefox:ci')
          } catch (Exception error) {
            if (error instanceof
                org.jenkinsci.plugins.workflow.steps.FlowInterruptedException) {
              flowInterrupted = true
            }
            unstable(message : "${STAGE_NAME} is unstable: " + error.toString())
          } finally {
            yarnBuilder.yarn('test:functional:generate-report')
                publishFunctionalReport()
          }
        }  
      
      stage('Edge full functional test') {
          try {
            if (flowInterrupted) {
              throw new org.jenkinsci.plugins.workflow.steps
                  .FlowInterruptedException()
            }
            yarnBuilder.yarn('test:functional:edge:ci')
          } catch (Exception error) {
            if (error instanceof
                org.jenkinsci.plugins.workflow.steps.FlowInterruptedException) {
              flowInterrupted = true
            }
            unstable(message : "${STAGE_NAME} is unstable: " + error.toString())
          } finally {
            yarnBuilder.yarn('test:functional:generate-report')
                publishFunctionalReport()
          }
        }  
      
      stage('Safari full functional test') {
          try {
            if (flowInterrupted) {
              throw new org.jenkinsci.plugins.workflow.steps
                  .FlowInterruptedException()
            }
            yarnBuilder.yarn('test:functional:safari:ci')
          } catch (Exception error) {
            if (error instanceof
                org.jenkinsci.plugins.workflow.steps.FlowInterruptedException) {
              flowInterrupted = true
            }
            unstable(message : "${STAGE_NAME} is unstable: " + error.toString())
          } finally {
            yarnBuilder.yarn('test:functional:generate-report')
                publishFunctionalReport()
          }
        }
      }
      
      stage('Test teardown') {
        try {
          yarnBuilder.yarn('test:teardown:ci')
        } catch (Exception error) {
          unstable(message : "${STAGE_NAME} is unstable: " + error.toString())
        } finally {
          yarnBuilder.yarn('test:bootstrap:generate-report') publishBootstrapReport()
        }
      }
      
      
      

      But in the end I am seeing the following reports being generated in the build page of my pipeline.

      How would I prevent this from happening and just have the report update rather than generate a new one.

       

            r2b2_nz Richard Bywater
            kda100 Kiyrean
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: