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

alwaysLinkToLastBuild not linking to last job result

    Details

    • Type: Bug
    • Status: Open (View Workflow)
    • Priority: Major
    • Resolution: Unresolved
    • Component/s: htmlpublisher-plugin
    • Labels:
      None
    • Environment:
      Jenkins ver. 2.60.3
      HTML Publisher Plugin 1.14
    • Similar Issues:

      Description

      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

       

        Attachments

          Activity

          Hide
          r2b2_nz 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.

          Show
          r2b2_nz 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.
          Hide
          pchmielnik Piotr Chmielnik added a comment -

          Yes, Richard Bywater 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.

          Show
          pchmielnik Piotr Chmielnik added a comment - Yes, Richard Bywater 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.
          Hide
          rethdakair 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 ?

          Show
          rethdakair 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 ?
          Hide
          jedavis Jason Davis added a comment -

          Also seeing this issue. Workarounds appreciated!

          Show
          jedavis Jason Davis added a comment - Also seeing this issue. Workarounds appreciated!
          Hide
          mrge_org George Petrov added a comment -

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

          Show
          mrge_org George Petrov added a comment - My workaround is to send exit code 0 even when there are failures in the tests.
          Hide
          martin_rossland 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.

          Show
          martin_rossland 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.
          Hide
          nickbrown Nicholas Brown added a comment -

          I'm seeing this issue. The workaround to access the report suggested by Martin Røssland 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'
                              ]
                          }
          
          Show
          nickbrown Nicholas Brown added a comment - I'm seeing this issue. The workaround to access the report suggested by Martin Røssland 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' ] }
          Hide
          spalani 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

          Show
          spalani 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

            People

            • Assignee:
              r2b2_nz Richard Bywater
              Reporter:
              pchmielnik Piotr Chmielnik
            • Votes:
              12 Vote for this issue
              Watchers:
              14 Start watching this issue

              Dates

              • Created:
                Updated: