Gitlab-runner on windows with docker never makes cache
Summary
I cannot get the cache to be made under any circumstances on windows, running with docker executor
Steps to reproduce
Install DockerDesktop & gitlab-runner in root at C:\Gitlab-Runner Install service Utilize the following toml file below Create a cache directory in the Gitlab-Runner directory on the windows side and create a file called TestFile.txt with some text in it. Give Docker access to your C Drive (or another drive, updating the toml file as necessary above) Run a pipeline with the yml file below.
.gitlab-ci.yml
image: maven:latest
variables:
MAVEN_CLI_OPTS: "-s .m2/settings.xml --batch-mode"
MAVEN_OPTS: "-Dmaven.repo.local=.m2/repository"
cache:
key: "test1234"
paths:
- .m2/repository/
- target/
test:
stage: test
script:
- pwd
- ls -a
- ls .m2
- mvn $MAVEN_CLI_OPTS -Dtest=BaseMapperTest test
- touch /cache/ThisIsATest.txt
- cat /cache/TestFile.txt
- pwd
- ls -a
- ls .m2
- ls .m2/repository
Actual Behavior
Maven repository files are never cached from run to run. target folder is never cached from run to run Zip files are never created in the cache directory in the Gitlab-Runner directory. ThisIsATest.txt IS created in the cache directory, confirming that the docker container has access to the directory. The job IS able to read TestFile.txt, also confirming that the docker container has access to the directory.
Expected behavior
I'd expect for the maven repo and target files to be cached. I'd expect to be able to see cache files populate the cache directory in C:\Gitlab-Runner\cache
Relevant logs and/or screenshots
job log
Running with gitlab-runner 12.5.0 (577f813d)
on <REMOVED>
Using Docker executor with image maven:latest ...
Pulling docker image maven:latest ...
Using docker image sha256:ccb0b002c4a62499bae0c573e388343d049dbd2522c358cba680a168c202c581 for maven:latest ...
Running on runner-a73dd55d-project-231-concurrent-0 via <REMOVED>...
Fetching changes...
Initialized empty Git repository in <REMOVED>
Created fresh repository.
From <REMOVED>
... listing of branches
Checking out 8bcc0359 as CICDTesting...
Skipping Git submodules setup
Checking cache for test1234-1...
No URL provided, cache will not be downloaded from shared cache server. Instead a local version of cache will be extracted.
Successfully extracted cache
$ pwd
/builds/soundcu/generic_controller
$ ls -a
.
..
.git
.gitignore
.gitlab
.gitlab-ci.yml
.m2
README.md
docs
pom.xml
src
$ ls .m2
settings.xml
$ mvn $MAVEN_CLI_OPTS -Dtest=BaseMapperTest test
[INFO] Scanning for projects...
... Maven successfully downloads dependencies, compiles, and tests
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 44.131 s
[INFO] Finished at: 2019-12-17T20:25:54Z
[INFO] ------------------------------------------------------------------------
$ touch /cache/ThisIsATest.txt
$ cat /cache/TestFile.txt
Test Text$ pwd
/builds/soundcu/generic_controller
$ ls -a
.
..
.git
.gitignore
.gitlab
.gitlab-ci.yml
.m2
README.md
docs
pom.xml
src
target
$ ls .m2
repository
settings.xml
$ ls .m2/repository
backport-util-concurrent
ch
classworlds
com
commons-io
io
javax
jaxen
junit
net
org
Creating cache test1234-1...
.m2/repository/: found 1693 matching files
target/: found 345 matching files
No URL provided, cache will be not uploaded to shared cache server. Cache will be stored only locally.
Created cache
Job succeeded
Environment description
Custom installation, see above details.
config.toml contents
concurrent = 1
check_interval = 0
[session_server]
session_timeout = 1800
[[runners]]
name = "<REMOVED>"
url = "<REMOVED>"
token = "<REMOVED>"
executor = "docker"
[runners.custom_build_dir]
[runners.docker]
tls_verify = false
image = "maven:latest"
privileged = false
disable_entrypoint_overwrite = false
oom_kill_disable = false
disable_cache = true
cache_dir = "/cache"
volumes = ["/c/GitLab-Runner/cache:/cache"]
shm_size = 0
[runners.cache]
[runners.cache.s3]
[runners.cache.gcs]
Used GitLab Runner version
Version: 12.5.0
Git revision: 577f813d
Git branch: 12-5-stable
GO version: go1.10.8
Built: 2019-11-20T09:14:34+0000
OS/Arch: windows/amd64```
Possible fixes
I've tried a variety of solutions debugging to find out why the cache wasn't working before settling on it looking like the cache is never created. I'm hoping that I've just made some dumb mistake, but I tried a variety of iterations and debugging steps to figure out what appears to be happening.