我应该如何缓存gitlab中的scala项目的coursier依赖项。我用的是码头执行器。
*Gitlab - 8.4.2
Gitlab runner - 1.0.4*
my /etc/gitlab-runner/config.toml
[runners.docker]
image = "docker.**.com/docker:latest"
privileged = false
disable_cache = false
volumes = [
"/cache",
"/var/run/docker.sock:/var/run/docker.sock",
"/data/gitlab-runner/ansible_vault_password.txt:/etc/ansible_vault_password.txt:ro",
]gitlab-ci.yml文件包含
stages:
- build
- test
- publish
- cleanup
create:
type: build
script:
- docker build --rm --pull -t docker.**.com/sbt:latest -f Dockerfile .
- docker images
lint:
type: test
image: docker.***.com/sbt
script:
- sbt scalastyle
- sbt scalafmtTest
unit tests:
type: test
image: docker.**.com/sbt
script:
- sbt test
publish jar:
type: publish
image: docker.**.com/sbt
script:
- sbt assembly
- sbt publish
only:
- master
remove containers:
type: cleanup
script:
- docker rmi -f docker.**.com/sbt:latest
when: always插件文件包含
addSbtPlugin("com.geirsson" % "sbt-scalafmt" % "0.4.8")
addSbtPlugin("org.scalastyle" %% "scalastyle-sbt-plugin" % "0.8.0")
addSbtPlugin("io.get-coursier" % "sbt-coursier" % "1.0.0-M14")
addSbtPlugin("com.eed3si9n" % "sbt-assembly" % "0.14.1")有什么建议或提示吗?
发布于 2017-01-04 22:13:53
您需要在Gitlab Runner上启用缓存(它看起来已经启用了)。从那里开始,您将需要在您的cache文件中添加一个.gitlab-ci.yml密钥。我不确定sbt默认将其缓存目录放在何处,但您几乎肯定必须更改它,使其位于工作区目录中。
请参阅https://docs.gitlab.com/ce/ci/yaml/#cache以获得完整的指南,但我可以想象您会这样做:
stages:
- build
- test
- publish
- cleanup
cache:
paths:
- cache/sbt
create:
type: build
script:
- docker build --rm --pull -t docker.xxx.com/sbt:latest -f Dockerfile .
- docker images
...其中cache/sbt是相对于包含sbt缓存的源文件夹的路径。只能使用项目工作区中的路径进行缓存。
https://stackoverflow.com/questions/41231960
复制相似问题