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

newline character is missing after import the config.xml

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Not A Defect
    • Icon: Minor Minor
    • core
    • None
    • OS: CentOS Linux release 7.1.1503
      Jenkins version: 1.625
      Browser: Firefox ESR 38.3.0

      I did some google search for how to import/export Jenkins jobs. Basically, I follow their suggestion. First, export the config.xml, and then import back to the Jenkins with a different Jenkins job name.

      After importing the config.xml, the newline characters inside the "Execute Shell" are removed.
      For example, I have
      echo AAA
      echo BBB
      inside the "Execute Shell".

      // Some comments here
      public String getFoo()
      {
          return foo;
      }
      

      After the import, it became
      echoAAAechoBBB

      Therefore, I need to manually update the content of "Execute Shell".
      I had checked the content of config.xml. It looks fine; the newline character is intact.

      Following is my steps to repro this issue:

      curl http://<username>:<api-token>@<jenkins-server>/job/testbackup/config.xml
      

      where testbackup is my Jenkins job

      cat config.xml | curl -X POST 'http://NEW_JENKINS/createItem?name=testbackup2' --header "Content-Type: application/xml" -d @-
      

      where testbackup2 is my new Jenkins job name

      thanks

            csimons Christopher Simons
            anthonyc Anthony Chan
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: