Hello everyone, I’m trying to reuse an executor but in a specific job I need to use an additional docker image that I don’t need in other jobs that use the same executor, so how can I specify for that specific job to use this additional docker image?
I’m trying to avoid code duplication so I don’t want 2 executors with the same environment variables and the second executor with the additional image as is shown in the following .circleci/config.yml file:
executors:
ruby_with_db_executor:
docker:
- image: circleci/ruby:2.6.6-node-browsers
environment:
<some-params-here>
- image: postgres:11.6-alpine
ruby_with_db_and_redis_executor:
docker:
- image: circleci/ruby:2.6.6-node-browsers
environment:
<same-params-as-previous-executor-here>
- image: postgres:11.6-alpine
- image: redis
I’m trying to get rid of the second executor because if I change any parameters in one executor, I would need to do so in the second as well.
I have read the documentation proposed Overriding keys when invoking an executor but it seems the docker images from the executor are not present in the build when I do the following:
jobs:
my_job:
docker:
- image: circleci/ruby:2.6.6-node-browsers
- image: redis
executor: ruby_with_db_executor
steps:
- checkout
<other-steps>
I get an error that postgres image is not present (that should have come from the executor).