You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In one of my CI jobs, I noticed that the plugin was able to upload an empty/non-existent file/folder to S3.
[2023-06-27T23:17:34Z] [typescript-cache] - 🔍 Locating cache: my_project/some_cacheable_folder
[2023-06-27T23:17:34Z] tar: my_project/some_cacheable_folder: Warning: Cannot stat: No such file or directory
upload: ./cacheable_folder-v1-checksum123.tar.gz to s3://bucket/caches/cacheable_folder-v1-checksum123.tar.gz
This has consequences for CI jobs that have the same cache key because those jobs end up downloading and using an empty cache. For example, this might lead to slower build times (e.g. imagine a bundler like Webpack trying to read from an empty cache which causes bundling time to be slower compared to not using a cache).
Ideally the build would complete but not upload the cache if the cache file is not found. Maybe we can add an option to do this.
if [ -d"$TAR_TARGETS" ]
thenif [ "$(ls -A $TAR_TARGETS)" ];then
info "Caching... (hit)"else
warning "Root exist but empty (exist-but-empty)"fielseecho"Root dir not found (non-existent)"fi
However, this will work on your example above but will ultimately fail on most users because many of them uses multiple paths. Globs will be fine, however, giving multiple dirs. to cache can fail. One of them could be empty but other is not.
So, this is still doable, but we need to think better on how to properly implement those checks.
Probably making a loop and excluding paths that's empty or non-existents then cache what remains.
In case when there are multiple paths and some empty, some non-empty, it's still ok to cache as cache will have smth at least. In case when everything's empty, it doesn't make sense at all to create an empty cache.
PS Not sure if using multiple paths that common as well, as usually there is one cache per tool (e.g. lint cache for linter, prettier cache for prettier and so on)
In one of my CI jobs, I noticed that the plugin was able to upload an empty/non-existent file/folder to S3.
This has consequences for CI jobs that have the same cache key because those jobs end up downloading and using an empty cache. For example, this might lead to slower build times (e.g. imagine a bundler like Webpack trying to read from an empty cache which causes bundling time to be slower compared to not using a cache).
Ideally the build would complete but not upload the cache if the cache file is not found. Maybe we can add an option to do this.
e.g.
The text was updated successfully, but these errors were encountered: