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

Failed to prepare configFileProvider step

    XMLWordPrintable

    Details

    • Similar Issues:

      Description

      Within a freestyle job (setup using the above environment), am able to read the contents of the config file (it's JSON formatted).

      However, using the pipeline scripts, build fails with this error.

      Snippet of the error from build log:

      java.lang.IllegalArgumentException: Failed to prepare configFileProvider step
      at org.jenkinsci.plugins.workflow.cps.DSL.invokeDescribable(DSL.java:315)
      at org.jenkinsci.plugins.workflow.cps.DSL.invokeMethod(DSL.java:129)

      And, this is the Jenkinsfile:

      stage(' == Capitals == ') {
      configFileProvider([configFile(field: 'capital_jsoncfg', variable: 'capitals_info')])

      { echo "$capitals_info" echo " == content of json cfg == " sh "cat $capitals_info" }

      }

      I did use snippet generator made available within the context of "Pipeline Syntax" to verify this piece of code. So, I presume (from reading the plugin documentation) script syntax should be okay.

        Attachments

          Activity

          Hide
          imod Dominik Bartholdi added a comment - - edited

          are you doing a declarative pipeline definition? which version of the plugin [1]?

          please paste complete pipeline definition

          [1] https://wiki.jenkins-ci.org/display/JENKINS/Pipeline+Model+Definition+Plugin

          Show
          imod Dominik Bartholdi added a comment - - edited are you doing a declarative pipeline definition? which version of the plugin [1] ? please paste complete pipeline definition [1] https://wiki.jenkins-ci.org/display/JENKINS/Pipeline+Model+Definition+Plugin
          Hide
          mramanathan Ramanathan M added a comment -

          Pipelline model definition plugin version used, 0.7.1

          Am using the regular pipeline scripting syntax in Jenkinsfile, here is the complete dump.

          node('master') {
            stage(' == Capitals == ') {
              configFileProvider([configFile(field: 'capital_jsoncfg', variable: 'capitals_info')]) {
                echo "$capitals_info"
              }
            }
          }
          
          Show
          mramanathan Ramanathan M added a comment - Pipelline model definition plugin version used, 0.7.1 Am using the regular pipeline scripting syntax in Jenkinsfile, here is the complete dump. node( 'master' ) { stage( ' == Capitals == ' ) { configFileProvider([configFile(field: 'capital_jsoncfg' , variable: 'capitals_info' )]) { echo "$capitals_info" } } }
          Hide
          imod Dominik Bartholdi added a comment - - edited

          there is a typo in your script: field should be fileId

            configFileProvider([configFile(fileId: 'my_file', variable: 'capitals_info')])
              { 
                  echo "${env.capitals_info}" 
                  sh "cat ${env.capitals_info}" 
              }
          

          but this showed my an other issue which I will fix now and then a better message will be displayed to you...

          Show
          imod Dominik Bartholdi added a comment - - edited there is a typo in your script: field should be fileId configFileProvider([configFile(fileId: 'my_file', variable: 'capitals_info')]) { echo "${env.capitals_info}" sh "cat ${env.capitals_info}" } but this showed my an other issue which I will fix now and then a better message will be displayed to you...
          Hide
          scm_issue_link SCM/JIRA link daemon added a comment -

          Code changed in jenkins
          User: imod
          Path:
          src/main/java/org/jenkinsci/plugins/configfiles/GlobalConfigFiles.java
          http://jenkins-ci.org/commit/config-file-provider-plugin/b430942cd81054dbe992cedb722232e3bdc5146e
          Log:
          [FIXED JENKINS-40973] prevent NPE if Id is not given

          Show
          scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: imod Path: src/main/java/org/jenkinsci/plugins/configfiles/GlobalConfigFiles.java http://jenkins-ci.org/commit/config-file-provider-plugin/b430942cd81054dbe992cedb722232e3bdc5146e Log: [FIXED JENKINS-40973] prevent NPE if Id is not given
          Hide
          scm_issue_link SCM/JIRA link daemon added a comment -

          Code changed in jenkins
          User: imod
          Path:
          src/main/java/org/jenkinsci/plugins/configfiles/folder/FolderConfigFileProperty.java
          http://jenkins-ci.org/commit/config-file-provider-plugin/55c13098025a471ea284a1b4bf221491166082ec
          Log:
          JENKINS-40973 prevent NPE if Id is not given

          Show
          scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: imod Path: src/main/java/org/jenkinsci/plugins/configfiles/folder/FolderConfigFileProperty.java http://jenkins-ci.org/commit/config-file-provider-plugin/55c13098025a471ea284a1b4bf221491166082ec Log: JENKINS-40973 prevent NPE if Id is not given
          Hide
          mramanathan Ramanathan M added a comment -

          Tried verbatim code snippet from your response and failed at the same step with the exact error as reported in the issue description.

          Show
          mramanathan Ramanathan M added a comment - Tried verbatim code snippet from your response and failed at the same step with the exact error as reported in the issue description.
          Hide
          imod Dominik Bartholdi added a comment - - edited

          Ramanathan M in that case, please provide more information about your environment. Can you reproduce the same issue with a clean/new jenkins installation? and please attache the support information generated by this plugin https://wiki.jenkins-ci.org/display/JENKINS/Support+Core+Plugin to this issue.

          you should also include the complete config.xml of the job having this issue

          Show
          imod Dominik Bartholdi added a comment - - edited Ramanathan M in that case, please provide more information about your environment. Can you reproduce the same issue with a clean/new jenkins installation? and please attache the support information generated by this plugin https://wiki.jenkins-ci.org/display/JENKINS/Support+Core+Plugin to this issue. you should also include the complete config.xml of the job having this issue
          Hide
          mramanathan Ramanathan M added a comment -

          Dominik Bartholdi It was a typo in the Pipeline script that tripped me. I have verified this to be working in three different Jenkins installations / setups.

          Thanks for your help and the change to display a better error message from this plugin.

          Show
          mramanathan Ramanathan M added a comment - Dominik Bartholdi It was a typo in the Pipeline script that tripped me. I have verified this to be working in three different Jenkins installations / setups. Thanks for your help and the change to display a better error message from this plugin.

            People

            • Assignee:
              domi Dominik Bartholdi
              Reporter:
              mramanathan Ramanathan M
            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: