如何删除 Travis CI 上的缓存?
How to remove caches on Travis CI?
我在 travis-ci 上缓存了一个 docker 图像。 docker 图像是从 docker 文件创建的。现在我的 docker 文件已更改,我需要删除缓存并重建 docker 图像。如何删除 travis-ci?
上的缓存
我现在的 .travis.yml
是这样的:
language: C
services:
- docker
cache:
directories:
- docker_cache
before_script:
- |
echo Now loading...
filename=docker_cache/saved_images.tar
if [[ -f "$filename" ]]; then
echo "Got one from cache."
docker load < "$filename"
else
echo "Got one from scratch";
docker build -t $IMAGE .
docker save -o "$filename" $IMAGE
fi
script:
- docker run -it ${IMAGE} /bin/bash -c "pwd"
env:
- IMAGE=test04
根据 the docs 共有三种方法:
- 使用 UI:存储库页面上的“更多选项”->“缓存”
- 使用 CLI:
travis cache --delete
- 使用 API:
DELETE /repos/{repository.id}/caches
也就是说,Docker 图像是明确称为 thing not to cache:
的示例之一
Large files that are quick to install but slow to download do not
benefit from caching, as they take as long to download from the cache
as from the original source
在您的示例中,不清楚 Docker 文件之外的管道中涉及什么 - 即使文件本身没有更改,任何 进入 [=32] 的东西=] 它(基本图像、源代码等)可能有。缓存图像意味着您可能会得到误报,即使 docker build
会失败,构建也会通过。
我在 travis-ci 上缓存了一个 docker 图像。 docker 图像是从 docker 文件创建的。现在我的 docker 文件已更改,我需要删除缓存并重建 docker 图像。如何删除 travis-ci?
上的缓存我现在的 .travis.yml
是这样的:
language: C
services:
- docker
cache:
directories:
- docker_cache
before_script:
- |
echo Now loading...
filename=docker_cache/saved_images.tar
if [[ -f "$filename" ]]; then
echo "Got one from cache."
docker load < "$filename"
else
echo "Got one from scratch";
docker build -t $IMAGE .
docker save -o "$filename" $IMAGE
fi
script:
- docker run -it ${IMAGE} /bin/bash -c "pwd"
env:
- IMAGE=test04
根据 the docs 共有三种方法:
- 使用 UI:存储库页面上的“更多选项”->“缓存”
- 使用 CLI:
travis cache --delete
- 使用 API:
DELETE /repos/{repository.id}/caches
也就是说,Docker 图像是明确称为 thing not to cache:
的示例之一Large files that are quick to install but slow to download do not benefit from caching, as they take as long to download from the cache as from the original source
在您的示例中,不清楚 Docker 文件之外的管道中涉及什么 - 即使文件本身没有更改,任何 进入 [=32] 的东西=] 它(基本图像、源代码等)可能有。缓存图像意味着您可能会得到误报,即使 docker build
会失败,构建也会通过。