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

No line break in text file to add $BUILD_NUMBER

    • Icon: Bug Bug
    • Resolution: Not A Defect
    • Icon: Minor Minor
    • core
    • Jenkins Version 5.6.2, Cent OS, JDK 1.8, Firefox

      Hi everyone. 

      I just wanna add build number in a new line at the end of a simple text file (name: version.property) after build step.

      Using shell console plugin in any job on Jenkins UI:  

      echo $BUILD_NUMBER >> version.property

      Unfortunately, this way doesnt work.

      Adding "\n" or "\n\" to the command dont work. 

      my current solution is: 

      echo  >> version.property

      echo $BUILD_NUMBER>> version.property

       

      If I add the new line with " echo blabla >> version.property" to the file on the batch server itself (using shh on Jenkins), then it works. It seems it does matter what shall you use. 

          [JENKINS-60120] No line break in text file to add $BUILD_NUMBER

          Constantin Kwiatkowski created issue -
          Constantin Kwiatkowski made changes -
          Description Original: Hi everyone. 

          I just wanna add a new line to a txt file (name: version.property) after build step.

          Using shell console in any job on Jenkins UI:  

          echo blabla >> version.property

           

          my current solution is: 

          echo  >> version.property

          echo blabla >> version.property

           

          If I add a new line with " echo blabla >> version.property" on the batch server, the bash on the server automatically add the new line to the end of the file. If I use the shell plugin on Jenkins, I change the file on Jenkins and send the file via ssh to the batch server, it doesn't work with only one line. 

          I guess shell plugin has an issue to format a .property file correctly. 
          New: Hi everyone. 

          I just wanna add build number in a new line at the end of a simple text file (name: version.property) after build step.

          Using shell console plugin in any job on Jenkins UI:  

          echo $BUILD_NUMBER >> version.property

          Unfortunately, this way doesnt work.

          Adding "\n" or "\n\" to the command dont work. 

          my current solution is: 

          echo  >> version.property

          echo $BUILD_NUMBER>> version.property

           

          If I add the new line with " echo blabla >> version.property" to the file on the batch server itself (using shh on Jenkins), then it works. It seems it does matter what shall you use. 
          Environment Original: Version 5.6.2 New: Jenkins Version 5.6.2, Cent OS, JDK 1.8, Firefox
          Summary Original: No line break in text file New: No line break in text file to add $BUILD_NUMBER
          Constantin Kwiatkowski made changes -
          Labels New: plugin shell-command
          Mark Waite made changes -
          Component/s New: core [ 15593 ]
          Component/s Original: shell-script-scm-plugin [ 15913 ]
          Mark Waite made changes -
          Resolution New: Not A Defect [ 7 ]
          Status Original: Open [ 1 ] New: Closed [ 6 ]

            richscze nobody
            constantinkwiatkowski Constantin Kwiatkowski
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: