Sharing code checkout step between jobs

#1

Every job in my workflow needs access to source code, and I have to repeat - checkout step every time. Is it possible to checkout out code once and then just share it among the jobs?

I tried to use workspaces

        steps:
            - checkout
            - persist_to_workspace:
                root: .

Which fails with The specified paths did not match any files in /root/project.

            - persist_to_workspace:
                root: $CIRCLE_WORKING_DIRECTORY

Fails with Error locating workspace root directory: stat /root/project/$CIRCLE_WORKING_DIRECTORY: no such file or directory

#2

You can’t use an env here, as the config parser can not interpolate it. What happens if you put the working directory path specifically?

#3

I tried different ways for root including * and absolute paths, which did not work, and then I found the solution here.

        - persist_to_workspace:
            root: .
            paths:
                - .
1 Like
closed #4

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.