Share service volumes in composition steps
How to share data in compositions
Using this repository, we’ll help you get up to speed with basic functionality such as building Docker images and using the shared volumes.
This project uses Node Js to build an application which will eventually become a distributable Docker image.
To share volumes of service in composition step for other yml steps you can use the variable ${{CF_VOLUME_NAME}}
. 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.
TIP
Read more about caching build dependencies our blog.
Looking around
In the root of this repository you’ll find a file named codefresh.yml
, this is our build descriptor that describes the different steps that comprise our process. Let’s quickly review the contents of this file:
codefresh.yml
Example
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.