Sto provando ad usare "cache" in .gitlab-ci.yml (http://doc.gitlab.com/ce/ci/yaml/README.html#cache). La mia versione è 8.2.1 gitlab e il mio Runner è:gitlab 8.2.1, Come usare la cache in .gitlab-ci.yml
$ docker exec -it gitlab-runner gitlab-runner -v
gitlab-runner version 0.7.2 (998cf5d)
Quindi, secondo il doc, tutto è aggiornato, ma sono in grado di utilizzare la cache ;-(Tutti i miei file sono sempre cancellato. . Sto facendo qualcosa di sbagliato?
viene creato un archivio di cache, ma non passò ai prossimi lavori.
Ecco il mio .gitlab-ci.yml
$ cat .gitlab-ci.yml
stages:
- createcache
- testcache
createcache:
type: createcache
cache:
untracked: true
paths:
- doc/
script:
- touch doc/cache.txt
testcache:
type: testcache
cache:
untracked: true
paths:
- doc/
script:
- find .
- ls doc/cache.txt
uscita del lavoro ' createcache '
Running on runner-141d90d4-project-2-concurrent-0 via 849d416b5994...
Fetching changes...
HEAD is now at 2ffbadb MUST BE REVERTED
[...]
$ touch doc/cache.txt
[...]
Archiving cache...
INFO[0000] Creating archive cache.tgz ...
INFO[0000] Done!
Build succeeded.
uscita del lavoro 'testcache'
Running on runner-141d90d4-project-2-concurrent-0 via 849d416b5994...
Fetching changes...
Removing doc/cache.txt
[...]
$ ls doc/cache.txt
ls: cannot access doc/cache.txt: No such file or directory
ERROR: Build failed with: exit code 1
mia soluzione
La mia soluzione è manualmente scompattare cosa c'è nella directory/cache ... Sono abbastanza sicuro che non è il modo corretto di utilizzare la cache ...
$ cat .gitlab-ci.yml
stages:
- build
- test
- deploy
image: ubuntu:latest
before_script:
- export CACHE_FILE=`echo ${CI_PROJECT_DIR}/createcache/${CI_BUILD_REF_NAME}/cache.tgz | sed -e "s|/builds|/cache|"`
createcache:
type: build
cache:
untracked: true
paths:
- doc/
script:
- find . | grep -v ".git"
- mkdir -p doc
- touch doc/cache.txt
testcache:
type: test
script:
- env
- find . | grep -v ".git"
- tar xvzf ${CACHE_FILE}
- ls doc/cache.txt
CI linter dice 'test: cache config contiene chiavi sconosciute: gruppo' – Kyslik
@Kyslik E 'stato sostituito da' cache: key'. Controlla https://gitlab.com/gitlab-org/gitlab-runner/commit/d34f76f86a7c2fc4d399e9922175bcc614434016 e https://docs.gitlab.com/ee/ci/yaml/#cache-key –