Cache
Cache in Buddy
Working speed is essential to any CI/CD tool. Buddy improves pipeline performance by caching resources that would otherwise have to be generated or downloaded on every run:
- Repository files, dependencies and artifacts (cached within the Pipeline Filesystem)
- Docker images in which build actions are run (no need to build the environment from scratch every time)
- Docker images used in the Run Docker Container action
- Docker layers built with the Docker Build action
You can also enable cache for services and databases attached to build actions or an extra cache per individual build action.
Pipeline filesystem cache
Each pipeline has its own filesystem. On the first pipeline run, the repository is cloned to the filesystem. Subsequent executions only fetch changes from the repository (git fetch
).
The pipeline filesystem is available for every action executed in the pipeline:
- Build actions are run in a Docker container to which the filesystem is mounted. By default, all build commands are executed in the context of the filesystem.
- Deployment actions are also run in the context of the filesystem, enabling you to deploy artifacts built in previous actions.
Cache in build actions
Repository, dependencies, and artifacts
Builds, tests and other commands defined in the build action are executed in the context of the filesystem containing the repository. This is the primary cache of the pipeline.
If you fetch dependencies to a different directory than the default build context, you can cache them by entering their paths in the Caching tab:
Cache tab in a Node action
Build environment cache
Build actions are run in Docker containers. The build environment is based on the Docker image pulled from a registry. On the first pipeline run, Buddy pulls and caches the image in the selected version. If you set the tag to 'Latest', it checks for a new version by running docker pull
on every subsequent execution. The procedure only downloads Docker layers missing in the previous execution.
This way you don't have to pull the full image every time, and you're always sure that you're using the most recent version. The same rule applies to other actions that pull Docker images from the registry.
Environment customization
Docker images can be customized with commands in the Packages & Tools tab of the build action. The commands are run on the first pipeline execution to create a new image. The image is used until a new one is pulled from the registry or until modified with new commands.
Databases and services
All build actions support microservices (MySQL, MongoDB, Redis, etc.). The services act like individual containers with separate caching systems.
Docker
All layers created in Docker-building actions are cached. During subsequent builds, Buddy adds only the layers that have not been built in the previous step. Cached images can be used by other actions in the pipeline, including builds and Docker Push/Docker Run actions.
Clearing cache
Sometimes you may want to clear the cache, for example, if you need to regenerate the artifacts. In such case, you can either clear the cache manually, or select an option which will do that automatically before every execution. The operation is performed per pipeline – it is not possible to clear caches of the entire workspace at once.
Checking consumed space
You can check the volume of consumed space for each project and pipeline by switching to the Plans, Usage & Billing tab in the workspace settings.
Or directly at: https://app.buddy.works/YOUR_WORKSPACE/payments
Cache usage in workspace settings
Manual purge
- Click the 'Clear cache' option from the pipeline's dropdown menu:
Clear cache in pipeline options
Check the corresponding option when running the pipeline manually.
Use
/[name] clear run
slash command when running the pipeline from Slack.Use the
--clear-cache
parameter when running the pipeline with a commit command.
Automatic purge
To automatically purge the cache on every pipeline run, check 'Clear cache before pipeline execution' in the pipeline's settings.
Last modified on June 20, 2022