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

alwaysLinkToLastBuild not linking to last job result

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Major Major
    • htmlpublisher-plugin
    • None
    • Jenkins ver. 2.60.3
      HTML Publisher Plugin 1.14

      I`m using HTML Publisher Plugin on  kubernetes cluster slave in pipeline job

      stage('Publish HTML report') {
          publishHTML (target: [
                  allowMissing: false,
                  alwaysLinkToLastBuild: true,
                  keepAll: true,
                  reportDir: 'e2e-system-tests/target',
                  reportFiles: 'index.html',
                  reportName: "HTML Report"
                ])
      }

      When build fail i get folliwing result

       

      INFO] ------------------------------------------------------------------------
      [INFO] BUILD FAILURE
      [INFO] ------------------------------------------------------------------------
      [INFO] Total time: 01:05 min
      [INFO] Finished at: 2017-09-07T14:39:59+00:00
      [INFO] Final Memory: 38M/836M
      [INFO] ------------------------------------------------------------------------
      [ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.19.1:test (integration-test) on project e2e-system-tests: There are test failures.
      [ERROR] 
      [ERROR] Please refer to /home/jenkins/workspace/E2E-TEST-backend-userActivationErrorHandling/e2e-system-tests/target/surefire-reports for the individual test results.
      [ERROR] -> [Help 1]
      [ERROR] 
      [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
      [ERROR] Re-run Maven using the -X switch to enable full debug logging.
      [ERROR] 
      [ERROR] For more information about the errors and possible solutions, please read the following articles:
      [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException
      [Pipeline] }
      [Pipeline] // stage
      [Pipeline] stage
      [Pipeline] { (Publish HTML report)
      [Pipeline] publishHTML
      [htmlpublisher] Archiving HTML reports...
      [htmlpublisher] Archiving at BUILD level /home/jenkins/workspace/E2E-TEST-backend-userActivationErrorHandling/e2e-system-tests/target to /var/lib/jenkins/jobs/E2E-TEST-backend-userActivationErrorHandling/builds/10/htmlreports/HTML_Report
      [Pipeline] }
       
      

       

      When i go directly to job result
      http://jenkins:8080/job/E2E-TEST-backend-userActivationErrorHandling/10/console
      I see HTML Report but link also should be visible on the "main page" for job under url

      http://jenkins:8080/job/E2E-TEST-backend-userActivationErrorHandling/ but for some reason it`s not visible

      What can be a reason of this isssue ?

      Regards,

      Piotr

       

          [JENKINS-46722] alwaysLinkToLastBuild not linking to last job result

          It appears that the Pipeline version of the code has a slight difference than that of the Freestyle job version. The pipeline version will currently only display the Project level menu option if there has been a last successful build. I'm guessing that out of your 10 runs so far there hasn't been a successful one?

          This doesn't seem quite right so I'll look into fixing it so the behaviour is maintained between both the Freestyle and Pipeline versions.

          Richard Bywater added a comment - It appears that the Pipeline version of the code has a slight difference than that of the Freestyle job version. The pipeline version will currently only display the Project level menu option if there has been a last successful build. I'm guessing that out of your 10 runs so far there hasn't been a successful one? This doesn't seem quite right so I'll look into fixing it so the behaviour is maintained between both the Freestyle and Pipeline versions.

          Yes, r2b2_nz you have right. I made more test and if there is a successful build there will be linked on project level menu. If it`s fail then still  there will be  linked last successful  build.

          Piotr Chmielnik added a comment - Yes, r2b2_nz you have right. I made more test and if there is a successful build there will be linked on project level menu. If it`s fail then still  there will be  linked last successful  build.

          Mat Mor added a comment -

          Same behavior here.

          The report is only attached to last successful build, failed build do not publish the report to the project level. All pipeline behave as such.

          Any workaround / news ?

          Mat Mor added a comment - Same behavior here. The report is only attached to last successful build, failed build do not publish the report to the project level. All pipeline behave as such. Any workaround / news ?

          Jason Davis added a comment -

          Also seeing this issue. Workarounds appreciated!

          Jason Davis added a comment - Also seeing this issue. Workarounds appreciated!

          George Petrov added a comment -

          My workaround is to send exit code 0 even when there are failures in the tests.

          George Petrov added a comment - My workaround is to send exit code 0 even when there are failures in the tests.

          Martin Røssland added a comment - - edited

          I have a build monitor where I would like to display the last cucumber test report. I also experience this issue where only successfully builds get published to the project level.

          Are there a chance this will be fixed in version 1.19?

          Using pipelines with jenkins 2.161 and HTML publisher plugin 1.18.

          Workaround in my case:

          Initially I tried to load the project report since it was a static url (example url):
          http://jenkins/job/tests/job/master/report/report.html

          Since the build failed it was only accessible on the specific build (example url):
          http://jenkins/job/tests/job/master/123/report/report.html

          I figured out that I could access the latest build through this static url (example url):
          http://jenkins/job/tests/job/master/lastCompletedBuild/report/report.html

          Conclusion:

          This issue is not a show stopper for me, but it would still be convenient to find the latest pipeline build, despite successfully run or not, in the project menu.

          Martin Røssland added a comment - - edited I have a build monitor where I would like to display the last cucumber test report. I also experience this issue where only successfully builds get published to the project level. Are there a chance this will be fixed in version 1.19? Using pipelines with jenkins 2.161 and HTML publisher plugin 1.18. Workaround in my case: Initially I tried to load the project report since it was a static url (example url): http://jenkins/job/tests/job/master/report/report.html Since the build failed it was only accessible on the specific build (example url): http://jenkins/job/tests/job/master/123/report/report.html I figured out that I could access the latest build through this static url (example url): http://jenkins/job/tests/job/master/lastCompletedBuild/report/report.html Conclusion: This issue is not a show stopper for me, but it would still be convenient to find the latest pipeline build, despite successfully run or not, in the project menu.

          I'm seeing this issue. The workaround to access the report suggested by martin_rossland does not work for me.

          In the build log I see:

          [Pipeline] publishHTML
          [htmlpublisher] Archiving HTML reports...
          [htmlpublisher] Archiving at PROJECT level /var/lib/jenkins/workspace/project_code_master/clangScanBuildReports to /var/lib/jenkins/jobs/project/jobs/code/branches/master/htmlreports/clang_20scan-build_20Static_20Analysis_20Report
          

          and as mentioned in the this Jira ticket there is no link in the sidebar of the build. Trying to directly access the report results in:

          HTTP ERROR 404
          Problem accessing /jobs/project/jobs/code/branches/master/htmlreports/clang_20scan-build_20Static_20Analysis_20Report/index.html. Reason:
          
              Not Found
          

          The publishHTML step is being used in a post failure section of stage in a pipeline:

                      post {
                          failure {
                              publishHTML target: [
                                  allowMissing: false,
                                  alwaysLinkToLastBuild: false,
                                  keepAll: false,
                                  reportDir: 'clangScanBuildReports',
                                  reportFiles: 'index.html',
                                  reportTitles: 'clang scan-build Static Analysis',
                                  reportName: 'clang scan-build Static Analysis Report'
                              ]
                          }
          

          Nicholas Brown added a comment - I'm seeing this issue. The workaround to access the report suggested by martin_rossland does not work for me. In the build log I see: [Pipeline] publishHTML [htmlpublisher] Archiving HTML reports... [htmlpublisher] Archiving at PROJECT level /var/lib/jenkins/workspace/project_code_master/clangScanBuildReports to /var/lib/jenkins/jobs/project/jobs/code/branches/master/htmlreports/clang_20scan-build_20Static_20Analysis_20Report and as mentioned in the this Jira ticket there is no link in the sidebar of the build. Trying to directly access the report results in: HTTP ERROR 404 Problem accessing /jobs/project/jobs/code/branches/master/htmlreports/clang_20scan-build_20Static_20Analysis_20Report/index.html. Reason: Not Found The publishHTML step is being used in a post failure section of stage in a pipeline: post { failure { publishHTML target: [ allowMissing: false, alwaysLinkToLastBuild: false, keepAll: false, reportDir: 'clangScanBuildReports', reportFiles: 'index.html', reportTitles: 'clang scan-build Static Analysis', reportName: 'clang scan-build Static Analysis Report' ] }

          Senthilkumar Palanisamy added a comment - - edited

          Hi,

          We are also facing same issue for failed build HTML publish is not creating any link in Jenkins Project level, we have to enable
          alwaysLinkToLastBuild: true,
          keepAll: true,
          In order to see in particular build, Please can i know is there any other workaround to see HTML publish result in project level or any permanent fix.

          Thanks

          Senthilkumar Palanisamy added a comment - - edited Hi, We are also facing same issue for failed build HTML publish is not creating any link in Jenkins Project level, we have to enable alwaysLinkToLastBuild: true, keepAll: true, In order to see in particular build, Please can i know is there any other workaround to see HTML publish result in project level or any permanent fix. Thanks

          Is there any update? We are trying to use OWASP dependency check as quality gate in Jenkins. The (fancy) report is published using html-publisher, but if the quality gate hits the CVSS threshold (and breaks the build), the report containing all information is lost.
          Passing the pipeline is not a workaround option, and none of the others (alwaysLinkToLastBuild) did work.
          Linking to the workspace is also not an option, since the agents are based on Kubernetes Pods.

           

          Thanks in advance,

          Christian

          Christian Katzorke added a comment - Is there any update? We are trying to use OWASP dependency check as quality gate in Jenkins. The (fancy) report is published using html-publisher, but if the quality gate hits the CVSS threshold (and breaks the build), the report containing all information is lost. Passing the pipeline is not a workaround option, and none of the others (alwaysLinkToLastBuild) did work. Linking to the workspace is also not an option, since the agents are based on Kubernetes Pods.   Thanks in advance, Christian

            r2b2_nz Richard Bywater
            pchmielnik Piotr Chmielnik
            Votes:
            16 Vote for this issue
            Watchers:
            18 Start watching this issue

              Created:
              Updated: