Hi All,
Is there a quick and easy way to have docker executor with one or more sidecar loaded up conditionally? For example:
- Main container is nginx:latest
- Sidecar container redis:7 ONLY IF a specific parameters it is passed as parameters inside the executor.
Many thanks.
Example:
docker:
- image: << parameters.image_name >>
auth:
username: $DOCKER_LOGIN
password: $DOCKER_PASSWORD
- image: << parameters.mysql_image_name >>
name: mysql
environment:
MYSQL_ROOT_PASSWORD: root
MYSQL_ROOT_HOST: ‘%’
- when:
condition:
equal: [true, << parameters.install_redis >>]
steps:
docker:
- image: << parameters.redis_image_name >>
name: redis
I could be wrong, but I don’t think it’s possible.
You could make two different executors and do a conditional, but you’d probably have to define two versions of the job itself, and use the conditional at that level?
That said, I am guessing having the accessory container there in all cases isn’t likely to be harmful, and if it’s not in use, guessing it won’t affect resource consumption much?