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

stash / unstash pipeline step is not preserving files timestamp

    XMLWordPrintable

    Details

    • Similar Issues:

      Description

      I'd like to checkout some source code once, and incrementally build it in parallel with different compilation options, using the following pipeline:

      node {
        checkout scm
        stash name: 'sources'
      }
      
      parallel (
          'release': {
            node() {
              unstash 'sources'
              make BUILD=release
            }
          },
      
          'debug': {
            node() {
              unstash 'sources'
              make BUILD=debug
            }
          }
      )  
         
      

      It is working almost fine. The issue is that at each build, the full source code is rebuild, even if running on the same node than previous compilation.
      The root cause is the untash step which is not preserving the initial file timestamp. Therefore my build system supposed every files has been modified since the last build.

        Attachments

          Activity

          Hide
          simaspenser Spenser Gilliland added a comment -

          Hi, just wanted to say that I'm seeing the same issue.  Please let me know of any workaround for this.

          Show
          simaspenser Spenser Gilliland added a comment - Hi, just wanted to say that I'm seeing the same issue.  Please let me know of any workaround for this.
          Hide
          simaspenser Spenser Gilliland added a comment -

          Here's a workaround to get good timestamps back and forth.  The --keep-newer-files option is very useful if you need to overwrite your workspace.  

          def stash_ws() {
            sh """#!/bin/bash -ex
          tar -c --keep-newer-files -f ws.tar --exclude ws.tar --exclude-vcs .
          """
            stash name: 'mystash', includes: 'ws.tar'
          }
          
          def unstash_ws() {
            unstash name: 'mystash'
            sh """#!/bin/bash -ex
          tar -x --keep-newer-files -f ws.tar
          """
          }
          
          Show
          simaspenser Spenser Gilliland added a comment - Here's a workaround to get good timestamps back and forth.  The --keep-newer-files option is very useful if you need to overwrite your workspace.   def stash_ws() { sh """#!/bin/bash -ex tar -c --keep-newer-files -f ws.tar --exclude ws.tar --exclude-vcs . """ stash name: 'mystash' , includes: 'ws.tar' } def unstash_ws() { unstash name: 'mystash' sh """#!/bin/bash -ex tar -x --keep-newer-files -f ws.tar """ }
          Hide
          smd Stefan Drissen added a comment - - edited

          Based on this workaround I thought I could just use the zip and unzip utility tasks. Unfortunately they also do not suffice. zip does store the file timestamps correctly but unzip ignores the timestamps when extracting (created JENKINS-64566).

          Show
          smd Stefan Drissen added a comment - - edited Based on this workaround I thought I could just use the zip and unzip utility tasks. Unfortunately they also do not suffice. zip does store the file timestamps correctly but unzip ignores the timestamps when extracting (created  JENKINS-64566 ).

            People

            Assignee:
            Unassigned Unassigned
            Reporter:
            jguigui Jean-Paul G
            Votes:
            2 Vote for this issue
            Watchers:
            3 Start watching this issue

              Dates

              Created:
              Updated: