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

file permissions are lost after unstashing on windows node

    XMLWordPrintable

    Details

    • Similar Issues:

      Description

      Consider the following script:

      node( 'macos' ) {
        sh 'rm -rf *'
        sh 'echo "int main() { return 0; }" > test.cpp'
        sh 'mkdir bin && gcc test.cpp -o bin/test'
        sh "ls -l bin"
        stash name:'test', includes: "bin/*"
      }node( 'windows' ) {
          unstash 'test'
          stash name:'test2', includes: 'bin/*'
      }node( 'linux' ) {
        sh 'rm -rf *'
        unstash 'test2'
        sh "ls -l bin"
      }
      

      It produces the following output:

      Started by user Nenad Mikša
      Running in Durability level: PERFORMANCE_OPTIMIZED
      [Pipeline] node
      Running on macpro2 in /opt/jenkins/workspace/Test
      [Pipeline] {
      [Pipeline] sh
      [Test] Running shell script
      + rm -rf bin test.cpp
      [Pipeline] sh
      [Test] Running shell script
      + echo 'int main() { return 0; }'
      [Pipeline] sh
      [Test] Running shell script
      + mkdir bin
      + gcc test.cpp -o bin/test
      [Pipeline] sh
      [Test] Running shell script
      + ls -l bin
      total 16
      -rwxr-xr-x  1 pero  staff  4248 Aug 31 20:40 test
      [Pipeline] stash
      Stashed 1 file(s)
      [Pipeline] }
      [Pipeline] // node
      [Pipeline] node
      Running on Jabba in C:\Jenkins\workspace\Test
      [Pipeline] {
      [Pipeline] unstash
      [Pipeline] stash
      Stashed 1 file(s)
      [Pipeline] }
      [Pipeline] // node
      [Pipeline] node
      Running on blade in /opt/jenkins/root/workspace/Test
      [Pipeline] {
      [Pipeline] sh
      [Test] Running shell script
      + rm -rf test.sh
      [Pipeline] unstash
      [Pipeline] sh
      [Test] Running shell script
      + ls -l bin
      total 8
      -rw-r--r-- 1 jenkins users 4248 Aug 31 20:40 test
      [Pipeline] }
      [Pipeline] // node
      [Pipeline] End of Pipeline
      Finished: SUCCESS
      

      So, after unstashing the unix binary on windows node and stashing it back, it loses its unix file permissions.

       

      Since windows does not have unix file permissions, I would expect that on windows would treat all files in 777 mode, especially after stashing back.

       

      In case if you are wondering why is this important to me, here is the explanation:

      I use Jenkins to build Conan packages of my software. The binaries are first built on various nodes for various platforms (windows, linux, macos, android and ios) and after binaries for every platform have been built successfully, they are all collected on first available node using the stash/unstash mechanism and there they are packaged and uploaded to Conan repository.

      Due to this issue this causes for binaries that are built on unix nodes lose their file permissions if they are packaged on windows node. A possible workaround would be to enforce packaging on unix node or to perform some partial packaging on nodes that have created the binaries. As these workarounds work for me, I've set priority of this issue as "minor".

        Attachments

          Activity

          Hide
          mdahlke0 Mike Dahlke added a comment - - edited

          I am also affected by this issue, use case is:

          • repo is cloned on Windows
          • project is built
          • build/tests/scripts are stashed
          • files are unstashed on a Linux node
          • automation is executed via a script

          The last step fails because the scripts no longer have the execute bit set.

           

          Show
          mdahlke0 Mike Dahlke added a comment - - edited I am also affected by this issue, use case is: repo is cloned on Windows project is built build/tests/scripts are stashed files are unstashed on a Linux node automation is executed via a script The last step fails because the scripts no longer have the execute bit set.  

            People

            • Assignee:
              Unassigned
              Reporter:
              dodoent Nenad Miksa
            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated: