My mono-repo currently has a pretty verbose CircleCI configuration. One of the pain points is our repeated blocks of docker images, docker commands, and docker environments.
For example, all our jobs use the same
base_image but then different jobs will augment their environment with a database (or two), elastic search, browsers, etc.
It looks like parameters is the solution to my problem but I can’t seem to get it to parse correctly – as far as I can tell, I don’t really understand the conceptual model of parameters at compile time.
This is basically what I have working:
executors: base_executor: docker: - image: &base_image some_image rails_executor: docker: - image: *base_image - image: &mysql_image mysql_image command: &mysql_command - mysqld ... environment: &mysql_environment FOO: bar rspec_executor: docker: - image: *base_image - image: *mysql_image command: *mysql_command environment: *mysql_environment - image: &redis_image redis_image end_to_end_executor: docker: - image: *base_image - image: *mysql_image command: *mysql_command environment: *mysql_environment - image: *redis_image - image: firefox_image
It is pretty obvious that I want an additive approach to our docker images but executors replace the node value – unless it is the
I was then hoping to see if something with parameters would work:
executors: org_executor: parameters: use_db: type: boolean default: false use_inmemory_db: type: boolean default: false use_browser: type: boolean default: false docker: - image: some_image <<# use_db >> - image: mysql_image command: - mysqld ... environment: FOO: bar <</ use_db >> <<# use_inmemory_db >> - image: &redis_image redis_image <</ use_inmemory_db >> <<# use_browser >> - image: firefox_image <</ use_browser >>
Help would be appreciated.