如何在Bitbucket Pipelines中运行的Docker容器中使用sbt和ivy2缓存

时间:2019-04-09 14:52:25

标签: docker sbt ivy bitbucket-pipelines

BB管道使您可以在构建之间保留SBT和Ivy缓存: https://confluence.atlassian.com/bitbucket/caching-dependencies-895552876.html

,您可以使用Docker服务从测试中动态运行容器:https://confluence.atlassian.com/bitbucket/run-docker-commands-in-bitbucket-pipelines-879254331.html

尽管如此,如果您尝试使用在构建设置步骤中下载的缓存来运行容器,即:

Cache "sbt": Downloading
...
Cache "ivy2": Downloaded 363.2 MiB in 9 seconds
Cache "ivy2": Extracted in 2 seconds 

在您使用Docker服务的步骤中,该服务在bitbucket-pipelines.yml中定义,类似于

  - step:
      name: My integration steps with Docker
      image: docker/compose:1.24.0
      size: 2x
      caches:
        - sbt
        - ivy2
      services:
        - docker
      script:
        - docker run -it -v ~/.ivy2:/root/.ivy2 alpine sh -c 'ls ~/.ivy2'

您收到一个错误:

docker: Error response from daemon: authorization denied by plugin pipelines: -v only supports $BITBUCKET_CLONE_DIR and its subdirectories.

~.ivy2复制到克隆目录看起来并不理想。在BB Pipelines上运行的自己的Docker映像中使用这些缓存的假定方法是什么?

0 个答案:

没有答案