如何在 Circle CI orb 中为一个作业创建多个执行器?

How can I create several executors for a job in Circle CI orb?

注意:我试图解决的实际问题是 运行 testcontainers in Circle CI。

为了使其可重复使用,我决定扩展我组织中的现有 orb。

问题是,如何为一个作业创建多个执行器?我能够自己创建执行程序。

执行者ubuntu.yml:

description: >
  The executor to run testcontainers without extra setup in Circle CI builds.
parameters:
  # https://circleci.com/docs/2.0/configuration-reference/#resource_class
  resource-class:
    type: enum
    default: medium
    enum: [medium, large, xlarge, 2xlarge]

  tag:
    type: string
    default: ubuntu-2004:202010-01

resource_class: <<parameters.resource-class>>

machine:
  image: <<parameters.tag>>

其中一份工作本身:

parameters:
  executor:
    type: executor
    default: openjdk
  resource-class:
    type: enum
    default: medium
    enum: [small, medium, medium+, large, xlarge]

executor: << parameters.executor >>
resource_class: << parameters.resource-class >>

environment:
  # Customize the JVM maximum heap limit
  MAVEN_OPTS: -Xmx3200m

steps:
  # Instead of checking out code, just grab it the way it is
  - attach_workspace:
      at: .

  # Guessing this is still necessary (we only attach the project folder)
  - configure-maven-settings
  - cloudwheel/fetch-and-update-maven-cache

  - run:
      name: "Deploy to Nexus without running tests"
      command: mvn clean deploy -DskipTests

我找不到添加多个执行程序的好示例,我假设我需要为每个作业添加 ubuntu 和 openjdk。我说得对吗?

我继续查看其他 orbs 和文档,但找不到与我的相似的案例。

正如 Circle CI 文档中所述,执行程序可以这样定义:

executors:
  my-executor:
    machine: true
  my-openjdk:
    docker:
      - image: openjdk:11

旁注,可以有许多任何类型的执行器,例如 dockermachine (Linux)、macoswin

见,