gitlab runner don't restore cache as expected
Summary
I use "cache" to keep "Library" folder to speed up Unity build process, but before every job/pipeline, gitlab runner will remove "Library" folder first by git clean, and will not restore it.
Steps to reproduce
My ci configuration:
stages:
- build
- test
cache:
paths:
- Library/
build_android:
stage: build
variables:
UNITY: /Applications/Unity/Unity.app/Contents/MacOS/Unity
script:
- if [ -d outcome ]; then rm -rf outcome; fi
- mkdir outcome
- ${UNITY} -quit -batchmode -executeMethod ProjectBuilder.BuildAndroid -projectPath `pwd` -logFile outcome/build_log.txt
only:
- master
tags:
- macmini
test:
stage: test
script:
- ls -l
tags:
- macmini
My gitlab-runner config.toml
concurrent = 1
check_interval = 0
[[runners]]
name = "localhost.localdomain"
url = "http://git.example.com/ci"
token = "[token]"
cache_dir = "/root/caches"
executor = "ssh"
[runners.ssh]
user = "user"
password = "password"
host = "host"
port = "22"
identity_file = "/root/.ssh/id_rsa"
[runners.cache]
Actual behavior
When pipeline is triggerd by a merge request, the "build_android" job will remove "Library" folder and won't restore "cache", the same as "test" job.
Expected behavior
"Library" folder will cache between Pipelines and Jobs, which means whenever a build pipeline is triggered by a merge request, "Library" folder generated by last build will preserved by "cache".
And within a pipeline, "Library" folder will preserved by "cache", so the script in "test" job will print "Library" folder.
Relevant logs and/or screenshots
Environment description
gitlab version: community edition 9.1.2 gitlab runner version: 9.1.1 OS: MacOS 10.12.4