j3t / jenkins-pipeline-cache-plugin

A cloud native file cache for Jenkins build pipelines which uses an S3-Bucket as storage provider.
MIT License
15 stars 2 forks source link

cache items not contain `.git` dir #12

Closed wuhuizuo closed 2 years ago

wuhuizuo commented 2 years ago

I want using the plugin to cache git checkout speed, but I found it not store .git.

restore from cache object:

截屏2022-08-03 02 37 25
j3t commented 2 years ago

Thanks for bringing this up.

It seems that FilePath, which is used to create the tar archive, has default excludes (see https://ant.apache.org/manual/dirtasks.html#defaultexcludes) and .git is one of them. I'm not sure why, maybe because of sensitive data. We could disable the default excludes if the filter is set (e.g. */). I will create a PR and then we will see.

j3t commented 2 years ago

I'm still not sure about the final solution. Maybe it makes more sense to have includes and excludes as separate parameters and if excludes are not defined then the default excludes are used instead.

Any concerns/opinions?

j3t commented 2 years ago

@wuhuizuo It should be working now if you define a filter like **/*. BTW, what is your opinion about having includes and excludes as separate parameters?

wuhuizuo commented 2 years ago

I like it. glob may be high level, special file can exclude by excludes options. I think includes conflicts with filter.

I suggest filter support array to contain more glob patterns.