[GitLab CI] Unexpected behaviour with cache and symlinks
Summary
Unexpected behaviour with cache and symlinks.
.gitlab-ci.yml
)
Steps to reproduce (cache:
paths:
- cache-1/
- cache-2/
key: "${CI_BUILD_REF}"
test:
stage: test
image: alpine:latest
tags:
- docker
script:
- mkdir -p /tmp/1
- mkdir -p /tmp/2
- ln -sf /tmp/1 cache-1
- ln -sf /tmp/2 cache-2
- touch /tmp/1/test
- touch /tmp/2/test
- mkdir -p /tmp/2/1
- mkdir -p /tmp/2/2
- touch /tmp/2/1/test
- touch /tmp/2/2/test
Expected behavior
Cache all files in the paths defined in the cache
section.
Actual behavior
Creating cache ea18418281877a383e3cc703bfef167ae0050895...
WARNING: cache-1/: no matching files
WARNING: cache-2/: no matching files
Relevant logs and/or screenshots
$ mkdir -p /tmp/1
$ mkdir -p /tmp/2
$ ln -sf /tmp/1 cache-1
$ ln -sf /tmp/2 cache-2
$ touch /tmp/1/test
$ touch /tmp/2/test
$ mkdir -p /tmp/2/1
$ mkdir -p /tmp/2/2
$ touch /tmp/2/1/test
$ touch /tmp/2/2/test
$ ls -l
total 8
lrwxrwxrwx 1 root root 6 Sep 3 06:25 cache-1 -> /tmp/1
lrwxrwxrwx 1 root root 6 Sep 3 06:25 cache-2 -> /tmp/2
$ ls -Rl cache-1/
cache-1/:
total 4
-rw-r--r-- 1 root root 0 Sep 3 06:25 test
$ find cache-1/ -type f | wc -l
1
$ ls -Rl cache-2/
cache-2/:
total 20
drwxr-xr-x 2 root root 4096 Sep 3 06:25 1
drwxr-xr-x 2 root root 4096 Sep 3 06:25 2
-rw-r--r-- 1 root root 0 Sep 3 06:25 test
cache-2/1:
total 4
-rw-r--r-- 1 root root 0 Sep 3 06:25 test
cache-2/2:
total 4
-rw-r--r-- 1 root root 0 Sep 3 06:25 test
$ find cache-2/ -type f | wc -l
3
Creating cache ea18418281877a383e3cc703bfef167ae0050895...
WARNING: cache-1/: no matching files
WARNING: cache-2/: no matching files
Uploading cache.zip to http://10.128.12.23:34233/runner/runner/8a2f473d/project/1566665/ea18418281877a383e3cc703bfef167ae0050895
Build succeeded