我试图在 CircleCI 中实现一些在过去使用 Jenkins 等看起来相对简单但在这里证明有点困难的东西。
在高层次上,我想查看 circleCI 中的某个分支,然后触发一个管道,该管道将采用少量参数并基本上针对特定环境运行我们的 Selenium 测试。
我发现以下文档看起来很有希望 - https://circleci.com/docs/triggers-overview/#run-a-pipeline-from-the-circleci-web-app
然而,它在细节上很轻。
这是我尝试的解决方案:
on_demand_test_run_on_env:
when:
equal: [ true, << pipeline.parameters.on_demand_test_run >> ]
jobs:
- checkout_branch
- feature_tests:
name: Parallel Tests
parallelism: 10
feature_paths: features/parallel_tests
tags: << pipeline.parameters.on_demand_cucumber_tags >>
context: nightly_run
requires:
- checkout_branch
- feature_tests:
name: Serial Tests
parallelism: 10
feature_paths: features/serial_tests
tags: << pipeline.parameters.on_demand_cucumber_tags >>
context: nightly_run
requires:
- checkout_branch
我有几个问题:
在我的脑海里,这很简单:
feature_tests:
environment:
test_environment: << parameters.on_demand_test_environment >>
但是,我担心这不适用于评估参数的方式
令人惊讶的是,这确实有效!
对于问题 1,我确实需要提供默认参数类型/值以获得有效的 circleci 配置
对于问题2,反正我的需求根本就没有问题