When using gitlab ci runner and sbt, I want to avoid downloading all the sbt jar files each time there is a build. Is there any way I can cache this? Here's my .gitlab-ci.yml file which does not cache successfully the .ivy2 files.
image: openjdk:8-jre-alpine
services:
- docker:dind
variables:
SBT_VERSION: "0.13.13"
SBT_HOME: "/usr/local/sbt"
SBT_JAR: "http://dl.bintray.com/sbt/native- packages/sbt/${SBT_VERSION}/sbt-${SBT_VERSION}.tgz"
cache:
paths:
- ~/.ivy2
stages:
- setup
setup:
stage: setup
script:
- export PATH="${SBT_HOME}/bin:$PATH"
- apk --update add bash wget curl tar git
- wget ${SBT_JAR}
- mkdir /usr/local/sbt
- tar -xf sbt-${SBT_VERSION}.tgz -C /usr/local/sbt --strip-components=1
- echo -ne "- with sbt sbt-${SBT_VERSION}\n" >> /root/.built
- rm sbt-${SBT_VERSION}.tgz
- echo "$PATH"
- cat /root/.built
- ls -als /usr/local/sbt
- sbt sbt-version
- ls -als ~/.ivy2
Assuming you are using a docker runner, then you need to update the config.toml
file and make /root/.ivy2
persistent with a volume
here is mine:
concurrent = 1
check_interval = 0
[[runners]]
name = xxx
url = yyy
token = zzz
executor = "docker"
[runners.docker]
tls_verify = false
image = "ruby:2.1"
privileged = false
disable_cache = false
volumes = ["/cache", "/srv/home:/root/" ]
[runners.cache]
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.