Loving CircleCI 2.0 so far, but we’re noticing some extra build time when we want to complete tests at an early step and not continue performing steps (an early success).
Scenario: We have a monorepo and we build 10+ dockerfiles in parallel. However, if the directory with the dockerfile isn’t different than the one in master (i.e.
git diff origin/master path/to/service is empty) we don’t have to test and can complete the test early. See the following
version: 2 defaultBuild: &defaultBuild working_directory: ~/monorepo docker: - image: circleci/node:7.10.0 machine: services: - docker jobs: project1: <<: *defaultBuild steps: - checkout - run: cd libs/scripts ./check-for-difference project1 - setup_remote_docker: reusable: true - run: cd libs/scripts ./test project1 - run: cd libs/scripts ./build project1 project2: <<: *defaultBuild steps: - checkout - run: cd libs/scripts ./check-for-difference project2 - setup_remote_docker: reusable: true - run: cd libs/scripts ./test project2 - run: cd libs/scripts ./build project2
We don’t want to unnecessarily run the three steps after the check-for-difference step. I think we could do this with build dependencies, but we might have to checkout multiple times (maybe not that bad of a cost?). Is there a way to “exit early with success”?