我通过循环CI将我的Node.Js应用程序部署到AWS。
我想先运行测试,然后再将图像推送到回购程序。但是,当前运行测试的任务与AWS任务同时运行。下面是我的./circleci/config.yml文件。
如何更改此行为,以便只有在测试成功时才能推送映像?
version: 2.1
orbs:
aws-ecr: circleci/aws-ecr@6.10.0
jobs:
test:
docker:
- image: cypress/base:12.18.0
steps:
- checkout
- run: npm ci
- run: npm run cy:verify
# save npm dependencies and Cypress binary for future runs
- save_cache:
key: cache-{{ checksum "package.json" }}
paths:
- ~/.npm
- ~/.cache
- run: npm run test:ci
workflows:
version: 2.1
test:
jobs:
- test
- aws-ecr/build-and-push-image:
create-repo: true
no-output-timeout: 10m
repo: 'stage-instance'谢谢!
发布于 2020-07-15 13:28:49
在工作流中添加一个需要的步骤,以便根据条件进行筛选。
version: 2.1
orbs:
aws-ecr: circleci/aws-ecr@6.10.0
jobs:
test:
docker:
- image: cypress/base:12.18.0
steps:
- checkout
- run: npm ci
- run: npm run cy:verify
# save npm dependencies and Cypress binary for future runs
- save_cache:
key: cache-{{ checksum "package.json" }}
paths:
- ~/.npm
- ~/.cache
- run: npm run test:ci
workflows:
version: 2.1
test:
jobs:
- test
- aws-ecr/build-and-push-image:
create-repo: true
no-output-timeout: 10m
repo: 'stage-instance'
requires:
- testhttps://stackoverflow.com/questions/62900717
复制相似问题