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

Provided config file is sometimes not complete

    Details

    • Type: Bug
    • Status: Open (View Workflow)
    • Priority: Minor
    • Resolution: Unresolved
    • Labels:
      None
    • Environment:
      Jenkins LTS 2.83.1
      Config File Provider Plugin 2.16.4
    • Similar Issues:

      Description

      Sometimes when I tried to parse JSON config file I encountered following exception:

      net.sf.json.JSONException: Found starting '{' but missing '}' at the end. at character 0 of null

      It turns out that returned file was not complete. I reproduced the issue this way:

      node {
        for (int i = 0; i < 40; i++) {
          configFileProvider([configFile(fileId: 'file-id', variable: 'configfile')]) {
            readJSON(text: readFile(file: configfile))
          }
        }
      }

      Printing file content to console proves that it is readed to early. Adding file existance check helps:

      node {
        for (int i = 0; i < 40; i++) {
          configFileProvider([configFile(fileId: 'file-id', variable: 'configfile')]) {
            if (fileExists(file: configfile)) {
              readJSON(text: readFile(file: configfile))
            } else {
              error("File '$configfile' not found")
            }
          }
        }
      }
      

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                domi Dominik Bartholdi
                Reporter:
                abeben Adam Beben
              • Votes:
                1 Vote for this issue
                Watchers:
                4 Start watching this issue

                Dates

                • Created:
                  Updated: