0

注意:我要解决的实际问题是在 Circle CI 中运行 testcontainers。

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

问题是,我怎样才能为一个工作创建多个执行者?我能够创建执行器本身。

执行者 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。我对吗?

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

4

1 回答 1

0

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

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

旁注,可以有许多任何类型的执行器,例如docker, machine(Linux), macos, win.

请参阅StackOverflow 问题如何从 CircleCI orbs 调用执行程序

于 2021-01-07T13:05:11.413 回答