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

Not a git repository after unstash when useDefaultExcludes: false

XMLWordPrintable

       

      Not a git repository after unstash when useDefaultExcludes: false

      Jenkins ver. 2.150.2

        Pipeline: Basic Steps
      Commonly used steps for Pipelines.
      2.14

      Pipeline:

      pipeline {
          agent none    
          stages {
              stage('Checkout') {
                  agent {
                      label('node1')
                  }
                  steps {
                      checkout()
                      sh("ls -la .git")
                      sh("git whatchanged -n 1")
                  }
                  post {
                      success {
                          stash(name: 'workspace', useDefaultExcludes: false)
                      }
                  }
              }        
          stage('Unstash') {
                  agent {
                      label('node2')
                  }
                  steps {
                      unstash('workspace')
                      sh("ls -la .git")
                      sh("git whatchanged -n 1")
                  }
              }
          }
      }
      
      

      Output:

       

       > git rev-parse FETCH_HEAD^{commit} # timeout=10
       > git config core.sparsecheckout # timeout=10
       > git checkout -f fefba0cbdef04b2c80b8fa6bdd3ba660c5fe8937
       > git rev-parse FETCH_HEAD^{commit} # timeout=10
       > git rev-list --no-walk d4ff6fe4a6b83cc332774f18630ab5caacabe970 # timeout=10
      [Pipeline] sh
       + ls -la .git
       total 656
       drwxrwxr-x 8 jenkins jenkins   4096 Feb 11 12:21 .
       drwxrwxr-x 6 jenkins jenkins   4096 Feb 11 12:21 ..
       drwxrwxr-x 2 jenkins jenkins   4096 Feb 11 12:21 branches
       -rw-rw-r-- 1 jenkins jenkins    212 Feb 11 12:21 config
       -rw-rw-r-- 1 jenkins jenkins     73 Feb 11 12:21 description
       -rw-rw-r-- 1 jenkins jenkins    133 Feb 11 12:21 FETCH_HEAD
       -rw-rw-r-- 1 jenkins jenkins     41 Feb 11 12:21 HEAD
       drwxrwxr-x 2 jenkins jenkins   4096 Feb 11 12:21 hooks
       -rw-rw-r-- 1 jenkins jenkins 619636 Feb 11 12:21 index
       drwxrwxr-x 2 jenkins jenkins   4096 Feb 11 12:21 info
       drwxrwxr-x 2 jenkins jenkins   4096 Feb 11 12:21 logs
       drwxrwxr-x 4 jenkins jenkins   4096 Feb 11 12:21 objects
       drwxrwxr-x 4 jenkins jenkins   4096 Feb 11 12:21 refs
      [Pipeline] sh
       + git whatchanged -n 1
       commit fefba0cbdef04b2c80b8fa6bdd3ba660c5fe8937
       Author: user <user@domain.com>
       Date:   Tue Feb 5 09:55:01 2019 +0100
      
           NOGM test
      
           Change-Id: I6c734ddf56ff950f44e43225a97e0dec997eebf7
      :100644 100644 023b364... dd5f106... M SysConf/OverCurrentDetectorTest.cp
      :100644 100644 5a4ccd2... 75ef104... M SysConf/PhoneUIHandlerMock.h
      :100644 100644 0342fd4... 11394f8... M SysConf/RebootServiceTest.cpp
      Post stage
      [Pipeline] stash
       Stashed 5065 file(s)
      [Pipeline] }
      [Pipeline] // node
      [Pipeline] }
      [Pipeline] // stage
      [Pipeline] stage
      [Pipeline] { (Stash)
      [Pipeline] node
      [Pipeline] {
      [Pipeline] unstash
      [Pipeline] sh
       + ls -la .git
       total 648
       drwxrwxr-x 6 jenkins jenkins   4096 Feb 11 12:21 .
       drwxrwxr-x 6 jenkins jenkins   4096 Feb 11 12:22 ..
       -rw-rw-r-- 1 jenkins jenkins    212 Feb 11 12:21 config
       -rw-rw-r-- 1 jenkins jenkins     73 Feb 11 12:21 description
       -rw-rw-r-- 1 jenkins jenkins    133 Feb 11 12:21 FETCH_HEAD
       -rw-rw-r-- 1 jenkins jenkins     41 Feb 11 12:21 HEAD
       drwxrwxr-x 2 jenkins jenkins   4096 Feb 11 12:21 hooks
       -rw-rw-r-- 1 jenkins jenkins 619636 Feb 11 12:21 index
       drwxrwxr-x 2 jenkins jenkins   4096 Feb 11 12:21 info
       drwxrwxr-x 2 jenkins jenkins   4096 Feb 11 12:21 logs
       drwxrwxr-x 3 jenkins jenkins   4096 Feb 11 12:21 objects
      [Pipeline] dir
      [Pipeline] {
      [Pipeline] sh
       + git whatchanged -n 1
       fatal: Not a git repository (or any of the parent directories): .git
      

            rsandell rsandell
            grzzie Grzegorz Zieba
            Votes:
            6 Vote for this issue
            Watchers:
            8 Start watching this issue

              Created:
              Updated: