This should work:

node {
    git 'your_repo_url'
    stash name: 'repo', useDefaultExcludes: false
}

node {
    ws {
        unstash 'repo'
        sh 'ls -la'
    }
}

The `ws` step is just to unstash in a clean directory, it's not really
necessary.

On Thu, Jun 16, 2016 at 2:25 PM, Sverre Moe <[email protected]> wrote:

> I found I could use useDefaultExcludes=false with stash
>
> stash includes: '**/*', name: 'root', useDefaultExcludes: false
>
> Will stash the entire git repository
> However it fails after trying to unstash
> java.io.IOException: remote file operation failed:
> /home/build/jenkins/workspace/projectA/master at
> hudson.remoting.Channel@67b96d99:master-sles11-x86_64:
> java.io.IOException: Failed to extract input stream
> at hudson.FilePath.act(FilePath.java:1014)
> at hudson.FilePath.act(FilePath.java:996)
> at hudson.FilePath.untarFrom(FilePath.java:728)
> at
> org.jenkinsci.plugins.workflow.flow.StashManager.unstash(StashManager.java:114)
> at
> org.jenkinsci.plugins.workflow.support.steps.stash.UnstashStep$Execution.run(UnstashStep.java:64)
> at
> org.jenkinsci.plugins.workflow.support.steps.stash.UnstashStep$Execution.run(UnstashStep.java:54)
> at
> org.jenkinsci.plugins.workflow.steps.AbstractSynchronousNonBlockingStepExecution$1$1.call(AbstractSynchronousNonBlockingStepExecution.java:49)
> at hudson.security.ACL.impersonate(ACL.java:213)
> at
> org.jenkinsci.plugins.workflow.steps.AbstractSynchronousNonBlockingStepExecution$1.run(AbstractSynchronousNonBlockingStepExecution.java:47)
> at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
> at java.util.concurrent.FutureTask.run(FutureTask.java:266)
> at
> java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
> at
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
> at java.lang.Thread.run(Thread.java:745)
> Suppressed: java.io.IOException: remote file operation failed:
> /home/build/jenkins/workspace/projectA/master at
> hudson.remoting.Channel@5c465123:master-sles11-i686: java.io.IOException:
> Failed to extract input stream
> ... 14 more
> Caused by: java.io.IOException: Failed to extract input stream
> at hudson.FilePath.readFromTar(FilePath.java:2328)
> at hudson.FilePath.access$400(FilePath.java:195)
> at hudson.FilePath$10.invoke(FilePath.java:730)
> at hudson.FilePath$10.invoke(FilePath.java:728)
> at hudson.FilePath$FileCallableWrapper.call(FilePath.java:2772)
> at hudson.remoting.UserRequest.perform(UserRequest.java:152)
> at hudson.remoting.UserRequest.perform(UserRequest.java:50)
> at hudson.remoting.Request$2.run(Request.java:332)
> at
> hudson.remoting.InterceptingExecutorService$1.call(InterceptingExecutorService.java:68)
> at java.util.concurrent.FutureTask.run(FutureTask.java:266)
> at
> java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
> at
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
> at java.lang.Thread.run(Thread.java:745)
> at ......remote call to master-sles11-i686(Native Method)
> at hudson.remoting.Channel.attachCallSiteStackTrace(Channel.java:1416)
> at hudson.remoting.UserResponse.retrieve(UserRequest.java:252)
> at hudson.remoting.Channel.call(Channel.java:781)
> at hudson.FilePath.act(FilePath.java:1007)
> ... 13 more
> Caused by: java.io.FileNotFoundException:
> /home/build/jenkins/workspace/projectA/master/.git/objects/pack/pack-dc9fd69196e6d0296658954add908b642e5b18f9.idx
> (Permission denied)
> at java.io.FileOutputStream.open0(Native Method)
> at java.io.FileOutputStream.open(FileOutputStream.java:270)
> at java.io.FileOutputStream.<init>(FileOutputStream.java:213)
> at java.io.FileOutputStream.<init>(FileOutputStream.java:162)
> at hudson.util.IOUtils.copy(IOUtils.java:38)
> at hudson.FilePath.readFromTar(FilePath.java:2318)
> at hudson.FilePath.access$400(FilePath.java:195)
> at hudson.FilePath$10.invoke(FilePath.java:730)
> at hudson.FilePath$10.invoke(FilePath.java:728)
> at hudson.FilePath$FileCallableWrapper.call(FilePath.java:2772)
> at hudson.remoting.UserRequest.perform(UserRequest.java:152)
> at hudson.remoting.UserRequest.perform(UserRequest.java:50)
> at hudson.remoting.Request$2.run(Request.java:332)
> at
> hudson.remoting.InterceptingExecutorService$1.call(InterceptingExecutorService.java:68)
> ... 4 more
> Caused by: java.io.IOException: Failed to extract input stream
> at hudson.FilePath.readFromTar(FilePath.java:2328)
> at hudson.FilePath.access$400(FilePath.java:195)
> at hudson.FilePath$10.invoke(FilePath.java:730)
> at hudson.FilePath$10.invoke(FilePath.java:728)
> at hudson.FilePath$FileCallableWrapper.call(FilePath.java:2772)
> at hudson.remoting.UserRequest.perform(UserRequest.java:152)
> at hudson.remoting.UserRequest.perform(UserRequest.java:50)
> at hudson.remoting.Request$2.run(Request.java:332)
> at
> hudson.remoting.InterceptingExecutorService$1.call(InterceptingExecutorService.java:68)
> at java.util.concurrent.FutureTask.run(FutureTask.java:262)
> at
> java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
> at
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
> at java.lang.Thread.run(Thread.java:745)
> at ......remote call to master-sles11-x86_64(Native Method)
> at hudson.remoting.Channel.attachCallSiteStackTrace(Channel.java:1416)
> at hudson.remoting.UserResponse.retrieve(UserRequest.java:252)
> at hudson.remoting.Channel.call(Channel.java:781)
> at hudson.FilePath.act(FilePath.java:1007)
> ... 13 more
> Caused by: java.io.FileNotFoundException:
> /home/build/jenkins/workspace/projectA/master/.git/objects/pack/pack-dc9fd69196e6d0296658954add908b642e5b18f9.idx
> (Permission denied)
> at java.io.FileOutputStream.open(Native Method)
> at java.io.FileOutputStream.<init>(FileOutputStream.java:221)
> at java.io.FileOutputStream.<init>(FileOutputStream.java:171)
> at hudson.util.IOUtils.copy(IOUtils.java:38)
> at hudson.FilePath.readFromTar(FilePath.java:2318)
> at hudson.FilePath.access$400(FilePath.java:195)
> at hudson.FilePath$10.invoke(FilePath.java:730)
> at hudson.FilePath$10.invoke(FilePath.java:728)
> at hudson.FilePath$FileCallableWrapper.call(FilePath.java:2772)
> at hudson.remoting.UserRequest.perform(UserRequest.java:152)
> at hudson.remoting.UserRequest.perform(UserRequest.java:50)
> at hudson.remoting.Request$2.run(Request.java:332)
> at
> hudson.remoting.InterceptingExecutorService$1.call(InterceptingExecutorService.java:68)
> at java.util.concurrent.FutureTask.run(FutureTask.java:262)
> at
> java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
> at
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
> ... 1 more
>
>
>
> torsdag 16. juni 2016 09.59.16 UTC+2 skrev Sverre Moe følgende:
>>
>> I need the git directory stashed because I need git archive, which does
>> not work unless the git repository is present.
>>
>> I have tried several patterns, but been unsuccessful.
>> stash includes: '**', name: 'root'
>> stash includes: '**/*', name: 'root'
>> stash includes: '**/.*, **/*', name: 'root'
>> stash includes: '**/.git, **/*', name: 'root'
>>
> --
> You received this message because you are subscribed to the Google Groups
> "Jenkins Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/jenkinsci-users/9bdbc5ab-e47f-4080-aa4e-69b76716b446%40googlegroups.com
> <https://groups.google.com/d/msgid/jenkinsci-users/9bdbc5ab-e47f-4080-aa4e-69b76716b446%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>
> For more options, visit https://groups.google.com/d/optout.
>



-- 
Antonio Muñiz
Software Engineer
CloudBees, Inc.

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/CAJc7kzSYYzdZERxdTZPQPq%3D28WDzv46xut23LJFGXFecBpzNxQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to