【发布时间】:2019-07-28 00:11:36
【问题描述】:
我目前正在尝试使用 CircleCI 2.1 版中提供的commands 功能,以便我可以重用一些常用命令。我正在使用 CLI 命令进行测试:
circleci config process ./.circleci/config.latest.yaml > ./.circleci/config.yml
但我收到以下错误:
Error: Error calling workflow: 'main'
Error calling job: 'build'
Error calling command: 'build_source'
Cannot find a definition for command named restore-cache
似乎restore-cache 在直接的版本 2 配置文件中工作得很好,但是当我尝试使用 process 处理 2.1 文件时,它会大惊小怪。
下面是我的config.yaml 文件的编辑版本,希望对它有一些用处。如果有任何其他有用的信息,请告诉我。
version: 2.1
defaults: &defaults
/**
* Unimportant stuff
*/
aliases:
- &restore-root-cache
keys:
- v1-deps-{{ .Branch }}-{{ checksum "package.json" }}
- v1-deps-{{ .Branch }}
- v1-deps
commands:
build_source:
description: 'Installs dependencies, then builds src, builds documentation, and runs tests'
steps:
- restore-cache: *restore-root-cache
- other-commands...
jobs:
build:
<<: *defaults
steps:
- checkout
- build_source
workflows:
version: 2.1
main:
jobs:
- build:
filters:
branches:
ignore: develop
【问题讨论】:
标签: continuous-integration circleci circleci-2.0 circleci-workflows