-
Type:
Bug
-
Resolution: Unresolved
-
Priority:
Minor
-
Component/s: htmlpublisher-plugin
-
None
-
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.
Â