CircleCI Ideas

Reusable Executors

As I was creating my first Orb, I think it is useful to reuse executors when defining a job. For example my Orb have one Elixir docker image and a Postgres docker image. But if the project uses FakeS3 for testing, it will need to add another docker image.

The current solution is to define a new executor that have all the docker images necessary. In the CircleCI docs there is an example of override executors (https://circleci.com/docs/2.0/reusing-config/#overriding-keys-when-invoking-an-executor) but the functionality I want is to allow to use the orb executor plus some others.

  • Avatar32.5fb70cce7410889e661286fd7f1897de Guest
  • Feb 20 2019
  • New
  • Attach files
  • Admin
    Nathan Dintenfass commented
    20 Feb 23:57

    You can also pass an executor as a parameter -- can you show a sketch of what you'd want this to look like in config?

  • Avatar40.8f183f721a2c86cd98fddbbe6dc46ec9
    Guest commented
    21 Feb 00:10

    Maybe something along this lines:

    orbs:
    elixir: coletiv/elixir@0.0.8
    executors:
    fakes3:
    docker:
    - image: circleci/fakes3:0.2.4
    jobs:
    build:
    executor:
    - elixir/default
    - fakes3
    steps:
    - elixir/test

    Not sure if this is the best structure, where the final objective is to have the fakes3 image available with Elixir and Postgres images.

    executors:
    default:
    docker:
    - image: circleci/elixir:1.6.5
    environment:
    MIX_ENV: test
    - image: circleci/postgres:10.4-alpine-postgis-ram
    - image: circleci/fakes3:0.2.4