CircleCI-仅在未缓存时如何下载依赖项

时间:2019-11-01 04:37:47

标签: caching libreoffice circleci

简介

使用circleci运行unittest时,我必须下载并安装LibreOffice。仅在未缓存的情况下,我们才能如何进行下载?

p.s。也发布在circleci支持here

详细信息

LibreOffice下载和安装通常需要30秒钟以上的时间。

所以我打算使用 save_cache 功能here

对其进行缓存

我的google search引导我何时执行 here,尽管该指南尚不清楚如何检查缓存键是否存在。

我将代码HOW_TO放在代码段下方的.circleci / config.yml中

      - restore_cache:
          key: cache-libreoffice

      - when:
          condition: <<HOW_TO check if cache key exists >>
          steps:
            - run:
                name: install atlas Pipfile
                command: |
                  mkdir -p /tmp/libreoffice
                  cd /tmp/libreoffice
                    wget https://download.documentfoundation.org/libreoffice/stable/6.3.3/deb/x86_64/LibreOffice_6.3.3_Linux_x86-64_deb.tar.gz

      - save_cache:
          key: cache-libreoffice
          paths:  # the paths to save to cache entry
            - /tmp/libreoffice

1 个答案:

答案 0 :(得分:0)

由于Circleci官方支持似乎对该问题的帮助不大,因此我的解决方法是使用custom docker image并在那里安装这些依赖项。

相关问题