Shared volumes of service from composition step for other yml steps

Using this repository we’ll help you get up to speed with basic functionality such as: building Docker images and use the shared volumes feature.

This project uses Node Js to build an application which will eventually become a distributable Docker image. If you want to share volumes of service in composition step for other yml steps you can use the variable ${{CF_VOLUME}}. It will refer to the volume that was generated for the specific flow. Can be used in conjunction with a composition to provide access to your cloned repository.

Caching build dependencies

More information about caching build dependencies you can find HERE

Looking around

In the root of this repository you’ll find a file named codefresh.yml, this is our build descriptor and it describes the different steps that comprise our process. Let’s quickly review the contents of this file:


  type: composition
    version: '2'
          - ${{CF_VOLUME}}:/codefresh/volume
        image: ${{build_step}}
        command: bash -c "echo hello > /codefresh/volume/myfile.txt"
        external: true
      image: ${{build_step}}
      command: echo hello

Just head over to the example repository in Github and follow the instructions there.

The way the volume is shared between builds is that upon build completion we create an image of the volume state to be used in the next builds. If you run 2 builds in parallel from the same pipeline and at the same time, each will use the same last volume image but it’ll run separately on both. The volume image you’ll get upon completion is the state of the build that finished last.