CircleCI Ideas

Persist to workspace runs even when there is no subsequent job

A workflow consists of a number of jobs. A common setup is to have a build job followed by a release job, where the build job always runs but the release job only runs on a tag. In order to work, the workspace has to be passed from the build job to the release job. As such, the build job has to end with `persist_to_workspace`.

But this means that `persist_to_workspace` is being called on the build jobs where it is utterly pointless. This slows down the build and wastes your disk space.

This proposal is for CircleCI to change `persist_to_workspace` so that it is a no-op if there is no subsequent job in the workflow.

 

jobs:
  build:
    executor: jdk8
    steps:
      - run: echo "build"
      - persist_to_workspace:
          root: .
          paths:
            - .
  release:
    executor: jdk8
    steps:
      - attach_workspace:
          at: .
      - run: echo "release"
workflows:
  ci_build:
    jobs:
      - build:
          filters:
            branches:
              only: /.*/
            tags:
              only: /^v.*/
      - release:
          requires:
            - build
          filters:
            branches:
              ignore: /.*/
            tags:
              only: /^v.*/

 

As a separate request, it should be a lot easier to pass the whole diskspace from one job to another. Currently it requires 4 lines in the first job and 3 lines in the second job. Can we not have sensible defaults for the root and path?

  • Avatar32.5fb70cce7410889e661286fd7f1897de Guest
  • Feb 22 2019
  • New
  • Attach files