我使用以下按预期工作的配置,它在每个 PR 上运行命令或合并到 master,现在我想做一些集成测试,我只想在合并到 master 时运行,所有 PR 应该保持不变(并像以前一样运行以下配置)。这里的细微差别是,对于集成测试,我需要其他 docker 映像和不同的运行命令来执行(只有在合并到主服务器时才应该执行),是否可以使用 CircleCI 来完成?
# Golang CircleCI 2.0 configuration file
version: 2
jobs:
build:
docker:
# specify the version
- image: circleci/golang:1.11
working_directory: /go/src/sbr
steps:
- checkout
- run: go version
- run: go env
- run: go get -v -t -d ./...
- run: go test -v ./...
我尝试在现有图像下添加另一个 docker 图像,但出现错误
更新:
version: 2
jobs:
build:
docker:
- image: circleci/golang:1.11
working_directory: /go/src/sbr
steps:
- checkout
- run: go version
- run: go env
- run: go get -v -t -d ./...
- run: go test -v ./...
test-integration:
docker:
- image: other-image
workflows:
version: 2
builds:
jobs:
- build
integration-test:
jobs:
- test-integration:
requires:
- build
filters:
branches:
only: master
这里的问题是我在添加到第二个工作流程时出错require
requires:
- build
我希望在测试之前test-integration它也能build按照要求运行作业。我做错了什么?
错误是:
requires job \"build\" but \"build\" is not part of this workflow.
# At least one job in the workflow must have no dependencies.
# The following jobs are unreachable: integration
#
# -------
# Don't rerun this job. Rerunning will have no effect.
false
郎朗坤
相关分类