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

问题描述 投票:0回答:1

简要

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

ps.s。也发布在circleci支持上here

详细信息

LibreOffice下载和安装通常需要30秒钟以上才能完成。

所以我打算使用save_cache功能here]对其进行缓存

我的google search使我转到[执行步骤

] here,尽管该指南尚不清楚如何检查缓存键是否存在。

我在代码段下面的.circleci / config.yml中放置了标记HOW_TO

      - 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

简介当使用circleci运行unittest时,我必须下载并安装LibreOffice。仅当未缓存时,我们如何才能进行下载? ps。也发布在circleci支持上,这里的详细信息...

caching libreoffice circleci
1个回答
0
投票

由于circleci官方支持似乎对该问题没有帮助,我的解决方法是使用custom docker image并在其中安装那些依赖项。

© www.soinside.com 2019 - 2024. All rights reserved.