我有一个CircleCi配置文件,当有提交时该配置文件可以成功运行,但是我需要通过外壳(CircleAPI命令)启动该文件。
这是我在本地用于运行手动作业的命令(无需提交到存储库):
curl -u ${CIRCLE_TOKEN}: \
--form config=@config.yml \
-d build_parameters[CIRCLE_JOB]=deploy_dev_2 \
https://circleci.com/api/v1.1/project/bitbucket/<project_name>/<repo>/tree/<branch>
这是我的文件
version: 2.1
orbs:
jira: circleci/jira@volatile
jobs:
build:
docker:
- image: circleci/node:carbon
steps:
- checkout
- setup_remote_docker:
version: 18.06.0-ce
- run: echo "do stuff here"
deploy_dev:
docker:
- image: circleci/node:carbon
environment:
steps:
- checkout
- setup_remote_docker:
version: 18.06.0-ce
- run: echo "do other stuff here"
deploy_dev_2:
docker:
- image: circleci/node:carbon
environment:
steps:
- checkout
- setup_remote_docker:
version: 18.06.0-ce
- run: echo "do other stuff here 2"
deploy_prod:
docker:
- image: circleci/node:carbon
steps:
- checkout
- setup_remote_docker:
version: 18.06.0-ce
- run: echo "do awesome stuff here"
workflows:
deploy:
jobs:
- build
- deploy_dev:
name: Dev Deploy
requires:
- build
filters:
branches:
only:
- master-dev
post-steps:
- jira/notify:
environment_type: development
job_type: deployment
- deploy_dev_2:
name: Dev Extra Deploy
requires:
- build
filters:
branches:
only:
- extra-servers-test
post-steps:
- jira/notify:
environment_type: development
job_type: deployment
- hold:
name: Approve Prod Deploy
requires:
- Dev Deploy
type: approval
- deploy_prod:
name: Prod Deploy
requires:
- Approve Prod Deploy
post-steps:
- jira/notify:
environment_type: production
job_type: deployment
错误日志:
Your config file has errors and may not run correctly:
workflows: 12 schema violations found
workflows: minimum size: [2], found: [1]
workflows: deploy: jobs: 11 schema violations found
workflows: deploy: jobs: 1: 0 subschemas matched instead of one
workflows: deploy: jobs: 1: expected type: String, found: Mapping
workflows: deploy: jobs: 1: deploy_dev: 2 schema violations found
workflows: deploy: jobs: 1: deploy_dev: extraneous key [name] is not permitted
workflows: deploy: jobs: 1: deploy_dev: extraneous key [post-steps] is not permitted
workflows: deploy: jobs: 2: 0 subschemas matched instead of one
workflows: deploy: jobs: 2: expected type: String, found: Mapping
workflows: deploy: jobs: 2: deploy_dev_2: 2 schema violations found
workflows: deploy: jobs: 2: deploy_dev_2: extraneous key [name] is not permitted
workflows: deploy: jobs: 2: deploy_dev_2: extraneous key [post-steps] is not permitted
workflows: deploy: jobs: 3: 0 subschemas matched instead of one
workflows: deploy: jobs: 3: expected type: String, found: Mapping
workflows: deploy: jobs: 3: hold: extraneous key [name] is not permitted
workflows: deploy: jobs: 4: 0 subschemas matched instead of one
workflows: deploy: jobs: 4: expected type: String, found: Mapping
workflows: deploy: jobs: 4: deploy_prod: 2 schema violations found
workflows: deploy: jobs: 4: deploy_prod: extraneous key [name] is not permitted
workflows: deploy: jobs: 4: deploy_prod: extraneous key [post-steps] is not permitted
在过去的几周中,我尝试过多次编辑此文件,但是由于该版本在提交存储库后可以正常工作,因此不得不恢复到该版本。
我不知道配置文件版本(2.1)与API版本(1.1)之间是否存在冲突,或者这些都可以通过语法解决,而又不会失去功能(手动作业批准等),如果可以通过API命令运行它,那就太好了。