Caching using Docker executor under Docker for Windows doesn't work.
Summary
I am trying to run a pipeline on my own PC using the Docker executor under Docker for Windows. When I execute the pipeline it runs as expected, completing the build successfully and reporting that there are lots of files in the directory I asked it to cache.
On a subsequent run of the pipeline, the log reports that it successfully extracted the cache, but the cache directory listed in the gitlab-ci.yml
is empty.
I setup a VM running Ubuntu and Docker, ran the same pipeline there and the caching worked perfectly. Both the gitlab-ci.yml
and config.toml
are identical between the Docker for Windows instance and the instance running under the VM.
The pipeline also works perfectly fine using the Gitlab Shared Runners.
I do often see an error in the Event Viewer
that might be related to the issue
[31;1mERROR: Could not create cache adapter [0;m [31;1merror[0;m=cache factory not found: factory for cache adapter "" was not registered
Steps to reproduce
- Install Docker for Windows (Using Hyper-V, not VirtualBox Version)
- Install and register Gitlab-Runner
- Attempt to run pipeline
- Pipeline completes succesfully, files are found and cache directory and cache is created
- Attempt to run pipeline again, cache is reported as extracted
Actual behavior
Cache is not present.
Expected behavior
Cached files should be present.
Relevant logs and/or screenshots
gitlab-ci.yml
build:
stage: build
cache:
key: "$CI_COMMIT_REF_SLUG"
paths:
- ccache/
artifacts:
paths:
- build/app/wg-ui
- build/lib/libproject-lib.so*
- build/tests/tests
script:
- echo "Starting build"
- ls
- ls ccache
- mkdir -p build && cd build
- qmake ../
- make -j$(nproc) -Oline CXX="ccache ${CXX}"
config.toml
concurrent = 1
check_interval = 0
[session_server]
session_timeout = 1800
[[runners]]
name = "Dylans-Laptop"
url = "https://gitlab.com"
token = "[redacted]"
executor = "docker"
[runners.docker]
tls_verify = false
image = "alpine:latest"
privileged = false
disable_entrypoint_overwrite = false
oom_kill_disable = false
disable_cache = false
volumes = ["/cache"]
shm_size = 0
[[runners]]
name = "Dylan-Laptop-Metix-Embedded"
url = "https://gitlab.com/"
token = "[redacted]"
executor = "docker"
[runners.docker]
tls_verify = false
image = "alpine:latest"
privileged = false
disable_entrypoint_overwrite = false
oom_kill_disable = false
disable_cache = false
volumes = ["/cache"]
shm_size = 0
pull_policy = "if-not-present"
Output of pipeline job
[0KRunning with gitlab-runner 11.9.0 (692ae235)
[0;m[0K on Dylan-Laptop-Metix-Embedded [redacted]
[0;m[0KUsing Docker executor with image registry.gitlab.com/[redacted] ...
[0;m[0KUsing locally found image version due to if-not-present pull policy
[0;m[0KUsing docker image sha256:00d486d701208f2d049de6bf22a9a7d09fdb7144325761c83c0fc8919c0892f0 for registry.gitlab.com/[redacted] ...
[0;msection_start:1553599788:prepare_script
[0KRunning on runner-[redacted]-project-11375094-concurrent-0 via Dylans-Laptop...
section_end:1553599790:prepare_script
[0Ksection_start:1553599790:get_sources
[0KReinitialized existing Git repository in /builds/DylanBartlett/[redacted].git
[32;1mFetching changes...[0;m
fatal: remote origin already exists.
Removing build/
Removing ccache/
[0;mClean repository
From https://gitlab.com/DylanBartlett/[redacted]
fac8d506..1e98eb14 R03S39-db-CI -> origin/R03S39-db-CI
[32;1mChecking out 1e98eb14 as R03S39-db-CI...[0;m
[32;1mUpdating/initializing submodules recursively...[0;m
[REMOVED FOR BREVITY]
section_end:1553599793:get_sources
[0Ksection_start:1553599793:restore_cache
[0K[32;1mChecking cache for build-r03s39-db-ci-2...[0;m
No URL provided, cache will not be downloaded from shared cache server. Instead a local version of cache will be extracted.[0;m
[32;1mSuccessfully extracted cache[0;m
section_end:1553599795:restore_cache
[0Ksection_start:1553599795:download_artifacts
[0Ksection_end:1553599796:download_artifacts
[0Ksection_start:1553599796:build_script
[0K[32;1m$ mkdir -p ccache[0;m
[32;1m$ export CCACHE_BASEDIR=${PWD}[0;m
[32;1m$ export CCACHE_DIR=${PWD}/ccache[0;m
[32;1m$ export CCACHE_NOHASHDIR=true[0;m
[32;1m$ echo "Starting build"[0;m
Starting build
[32;1m$ mkdir -p build && cd build[0;m
[32;1m$ qmake ../[0;m
[32;1m$ make -j$(nproc) -Oline CXX="ccache ${CXX}"[0;m
[REMOVED FOR BREVITY]
section_end:1553600633:build_script
[0Ksection_start:1553600633:after_script
[0Ksection_end:1553600635:after_script
[0Ksection_start:1553600635:archive_cache
[0K[32;1mCreating cache build-r03s39-db-ci-2...[0;m
ccache/: found 1903 matching files [0;m
No URL provided, cache will be not uploaded to shared cache server. Cache will be stored only locally.[0;m
[32;1mCreated cache[0;m
section_end:1553600639:archive_cache
[0Ksection_start:1553600639:upload_artifacts_on_success
[0K[32;1mUploading artifacts...[0;m
build/app/wg-ui: found 1 matching files[0;m
build/lib/libproject-lib.so*: found 4 matching files[0;m
build/tests/tests: found 1 matching files[0;m
Uploading artifacts to coordinator... ok [0;m id[0;m=184327089 responseStatus[0;m=201 Created token[0;m=YAHvyC21
section_end:1553600648:upload_artifacts_on_success
[0K[32;1mJob succeeded
[0;m
Environment description
I am running Gitlab-Runner on Windows using Docker for Windows
Here is my docker info
Containers: 1
Running: 0
Paused: 0
Stopped: 1
Images: 16
Server Version: 18.09.2
Storage Driver: overlay2
Backing Filesystem: extfs
Supports d_type: true
Native Overlay Diff: true
Logging Driver: json-file
Cgroup Driver: cgroupfs
Plugins:
Volume: local
Network: bridge host ipvlan macvlan null overlay
Log: awslogs fluentd gcplogs gelf journald json-file local logentries splunk syslog
Swarm: inactive
Runtimes: runc
Default Runtime: runc
Init Binary: docker-init
containerd version: 9754871865f7fe2f4e74d43e2fc7ccd237edcbce
runc version: 09c8266bf2fcf9519a651b04ae54c967b9ab86ec
init version: fec3683
Security Options:
seccomp
Profile: default
Kernel Version: 4.9.125-linuxkit
Operating System: Docker for Windows
OSType: linux
Architecture: x86_64
CPUs: 4
Total Memory: 2.915GiB
Name: linuxkit-00155d64d02f
ID: IXXK:3JK6:N73Z:OJI2:VNHY:JVCK:WG5S:UKKC:DYPZ:7BNS:ZRFI:JSQI
Docker Root Dir: /var/lib/docker
Debug Mode (client): false
Debug Mode (server): true
File Descriptors: 22
Goroutines: 47
System Time: 2019-03-27T12:09:36.1278099Z
EventsListeners: 1
Registry: https://index.docker.io/v1/
Labels:
Experimental: true
Insecure Registries:
127.0.0.0/8
Live Restore Enabled: false
Product License: Community Engine
Used GitLab Runner version
C:\Gitlab-Runner> .\gitlab-runner.exe --version
Version: 11.9.0
Git revision: 692ae235
Git branch: 11-9-stable
GO version: go1.8.7
Built: 2019-03-22T12:02:57+0000
OS/Arch: windows/amd64