CircleCI: Cannot find a definition for executor named ubuntu?

三世轮回 提交于 2021-01-29 10:20:12

问题


I am trying to extend the orb that is already in use. We have used Docker before but now want to use a machine executor and maybe a windows executor in the future. I go through the documentation, but it is not clear if it is possible to have executors of different types and call them on the same jobs.

Is it possible to have executors of different types in the same orb in CircleCI?

I tried creating the executor 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>>

Another executor, openjdk.yml:

description: >
  The default executor for our OpenJDK + Maven-based builds.

parameters:
  # https://circleci.com/docs/2.0/configuration-reference/#resource_class
  resource-class:
    type: enum
    default: medium
    enum: [small, medium, medium+, large, xlarge]

  tag:
    type: string
    default: 11.0-jdk-stretch

resource_class: <<parameters.resource-class>>

docker:
  - image: circleci/openjdk:<<parameters.tag>>

The beginning of my job is:

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

How can I reference my ubuntu executor so that it can be visible by other orbs?


回答1:


There 3 types of executors invocation in Circle CI:

  • Call CircleCI predefined images such as ruby, openjdk.
  • Invoke executors from the same config file/orb such as my-openjdk, my-executor.

For example,

executors:
  my-executor:
    machine: true
  my-openjdk:
    docker:
      - image: openjdk:11
  • Invoke executors from the existing orbs such as <orb-name>/<executor-name>.

In my case, it was the 3rd option, my-orb/ubuntu.



来源:https://stackoverflow.com/questions/65392836/circleci-cannot-find-a-definition-for-executor-named-ubuntu

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!