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

HTML publisher argument reportTitles is marked as optional in PipelineSyntax editor, but it's required

    Details

    • Similar Issues:

      Description

      When using PipelineSyntax editor to setup htmlPublisher step, "reportTitles" argument is marked as optional:

      The optional title(s) for the report files, which will be used as the tab names. If this is not provided, file names will be used instead.

      However, pipeline build will fail if I omit it:
      WorkflowScript: 30: Missing required parameter: "reportTitles" @ line 30, column 17.
      publishHTML([allowMissing: true, alwaysLinkToLastBuild: false, keepAll: false, reportDir: 'reports', reportFiles: 'index.html', reportName: 'Coverage reports'])
       

      HTML publisher plugin version : 1.14

      Jenkins version : 2.73.3

       

        Attachments

          Activity

          Hide
          r2b2_nz Richard Bywater added a comment -

          Are you able to provide a bit of context about where you are seeing the error? I've just tried a Pipeline script of:

           

          node {
            publishHTML([allowMissing: true, alwaysLinkToLastBuild: false, keepAll: false, reportDir: 'reports', reportFiles: 'index.html', reportName: 'Coverage reports'])
          }
          

          And the build finishes with a success (i.e. no errors). If you could provide the full pipeline you are using (minus any sensitive info) then I can try reproduce again.

           

          Show
          r2b2_nz Richard Bywater added a comment - Are you able to provide a bit of context about where you are seeing the error? I've just tried a Pipeline script of:   node { publishHTML([allowMissing: true , alwaysLinkToLastBuild: false , keepAll: false , reportDir: 'reports' , reportFiles: 'index.html' , reportName: 'Coverage reports' ]) } And the build finishes with a success (i.e. no errors). If you could provide the full pipeline you are using (minus any sensitive info) then I can try reproduce again.  
          Hide
          r2b2_nz Richard Bywater added a comment -

          Hi - this issue has been without comment for some time so closing for now. Please feel free to re-open / re-report should this still be an issue for you based on the information provided. Thanks

          Show
          r2b2_nz Richard Bywater added a comment - Hi - this issue has been without comment for some time so closing for now. Please feel free to re-open / re-report should this still be an issue for you based on the information provided. Thanks
          Hide
          shadamik Stephan Hadamik added a comment - - edited

          I came across this issue using declarative. Here is how to reproduce:

          pipeline {
            agent any
              stages {
                stage('Publish') {
                  steps {
                    publishHTML([allowMissing: true, alwaysLinkToLastBuild: false, keepAll: false, reportDir: 'reports', reportFiles: 'index.html', reportName: 'Coverage reports'])
                  }
                }
             }
          }

          Try to convert to json:

          $ curl -F "jenkinsfile=<Jenkinsfile" -X POST http://localhost:8080/pipeline-model-converter/validate
          Errors encountered validating Jenkinsfile:
          WorkflowScript: 6: Missing required parameter: "reportTitles" @ line 6, column 15.
                           publishHTML([allowMissing: true, alwaysLinkToLastBuild: false, keepAll: false, reportDir: 'reports', reportFiles: 'index.html', reportName: 'Coverage reports'])
                           ^
          
          Show
          shadamik Stephan Hadamik added a comment - - edited I came across this issue using declarative. Here is how to reproduce: pipeline { agent any stages { stage( 'Publish' ) { steps { publishHTML([allowMissing: true , alwaysLinkToLastBuild: false , keepAll: false , reportDir: 'reports' , reportFiles: 'index.html' , reportName: 'Coverage reports' ]) } } } } Try to convert to json: $ curl -F "jenkinsfile=<Jenkinsfile" -X POST http://localhost:8080/pipeline-model-converter/validate Errors encountered validating Jenkinsfile: WorkflowScript: 6: Missing required parameter: "reportTitles" @ line 6, column 15. publishHTML([allowMissing: true, alwaysLinkToLastBuild: false, keepAll: false, reportDir: 'reports' , reportFiles: 'index.html' , reportName: 'Coverage reports' ]) ^
          Hide
          shadamik Stephan Hadamik added a comment -

          A bit more testing: If you use a named parameter like on https://jenkins.io/blog/2017/02/10/declarative-html-publisher/ validation succeeds.
          However: if you try to roundtrip convert you'll get this issue, too.

          pipeline {
             agent any
             stages {
                 stage('Publish') {
                     steps {
                       publishHTML target: [allowMissing: true, alwaysLinkToLastBuild: false, keepAll: false, reportDir: 'reports', reportFiles: 'index.html', reportName: 'Coverage reports']
                     }
                 }
             }
          }
          
          $ curl -F "jenkinsfile=<Jenkinsfile" -X POST http://localhost:8080/pipeline-model-converter/validate
          Jenkinsfile successfully validated.
          $ curl -F "jenkinsfile=<Jenkinsfile" -X POST http://localhost:8080/pipeline-model-converter/toJson | jq ".data.json" | curl -F "json=<-" -X POST http://localhost:8080/pipeline-model-converter/toJenkinsfile
          
          {
            "status": "ok",
            "data": {
              "result": "failure",
              "errors": [
                {
                  "jenkinsfileErrors": {
                    "result": "failure",
                    "errors": [
                      {
                        "error": [
                          "Missing required parameter: \"reportTitles\" @ line 18, column 9.",
                          "Missing required parameter: \"reportTitles\" @ line 18, column 9.",
                          "Missing required parameter: \"reportTitles\" @ line 18, column 9.",
                          "Missing required parameter: \"reportTitles\" @ line 18, column 9.",
                          "Missing required parameter: \"reportTitles\" @ line 18, column 9.",
                          "Missing required parameter: \"reportTitles\" @ line 18, column 9."
                        ]
                      }
                    ]
                  }
                }
              ]
            }
          }
          
          Show
          shadamik Stephan Hadamik added a comment - A bit more testing: If you use a named parameter like on https://jenkins.io/blog/2017/02/10/declarative-html-publisher/ validation succeeds. However: if you try to roundtrip convert you'll get this issue, too. pipeline { agent any stages { stage( 'Publish' ) { steps { publishHTML target: [allowMissing: true , alwaysLinkToLastBuild: false , keepAll: false , reportDir: 'reports' , reportFiles: 'index.html' , reportName: 'Coverage reports' ] } } } } $ curl -F "jenkinsfile=<Jenkinsfile" -X POST http://localhost:8080/pipeline-model-converter/validate Jenkinsfile successfully validated. $ curl -F "jenkinsfile=<Jenkinsfile" -X POST http://localhost:8080/pipeline-model-converter/toJson | jq ".data.json" | curl -F "json=<-" -X POST http://localhost:8080/pipeline-model-converter/toJenkinsfile { "status" : "ok" , "data" : { "result" : "failure" , "errors" : [ { "jenkinsfileErrors" : { "result" : "failure" , "errors" : [ { "error" : [ "Missing required parameter: \" reportTitles\ " @ line 18, column 9." , "Missing required parameter: \" reportTitles\ " @ line 18, column 9." , "Missing required parameter: \" reportTitles\ " @ line 18, column 9." , "Missing required parameter: \" reportTitles\ " @ line 18, column 9." , "Missing required parameter: \" reportTitles\ " @ line 18, column 9." , "Missing required parameter: \" reportTitles\ " @ line 18, column 9." ] } ] } } ] } }
          Hide
          shadamik Stephan Hadamik added a comment -

          Jenkins ver. 2.129-SNAPSHOT
          org.jenkins-ci.plugins:htmlpublisher:1.17

          Show
          shadamik Stephan Hadamik added a comment - Jenkins ver. 2.129-SNAPSHOT org.jenkins-ci.plugins:htmlpublisher:1.17

            People

            • Assignee:
              r2b2_nz Richard Bywater
              Reporter:
              rkosegi Richard Kosegi
            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated: