I’m using YAML’s merge feature to reduce duplication in a given config file. For instance:
version: 2.1
docker-auth: &docker-auth
auth:
username: $DOCKERHUB_USERNAME
password: $DOCKERHUB_PASSWORD
workflows:
version: 2
workflow:
jobs:
- job1:
context: dockerhub
- job2:
context: dockerhub
jobs:
job1:
docker:
- image: circleci/whatever
<<: *docker-auth
steps:
- checkout
job2:
docker:
- image: circleci/whatever
<<: *docker-auth
steps:
- checkout