Builds & testing

Buddy uses delivery pipelines to build, test and deploy websites and applications. The pipelines consist of actions that can be easily arranged, covering the entire process of web development: fetching dependencies, compiling code, compressing CSS, running Gulp/Grunt, bundling modules with Webpack — basically any task that your workflow requires.

Overview

When a pipeline is triggered, Buddy launches an isolated Docker container in which it runs build commands in the context of the repository. The artifacts (files created by build action) are saved in the pipeline filesystem and remain available for other actions, including deployments.

Buddy spans over 20 predefined environments for the most popular programming languages, frameworks, and task runners. The environments and their configuration are officially approved by their authors and communities connected with a given language or tool. Buddy actions

Configuration

Build actions use build commands executed in a predefined environment. The commands can be run as SH or BASH scripts. If any command ends with an error, Buddy will stop the execution and mark it as failed. Build actions require two things to be configured:

  1. Commands to run in the container [Run tab]
  2. Environment required to run the commands [Environment tab]

For example, if you want to test your PHP application, all you need to do is select the PHP action, enter the command to run, and choose the PHP version.

Build commands

Build commands are defined in the Run tab. They are run on every execution and should be used for:

  • fetching dependencies
  • building and testing your application Default build commands

You can use Environment Variables to parameterize your builds.

Do not enter commands which prepare the environment (e.g. apt-get install) For this purpose, use the Environment tab (see below).

Environment

The Environment tab lets you specify the version of the framework or tool that you need. All actions use official Docker images from the Docker Hub as the template. You can also use custom images from the selected registry. Environment tab

Environment customization

If the selected image is missing components required by the build (eg. PHP extensions or Apache modules), you can install them in the lower part of the Environment tab. Environment customization console

The commands from the Environment tab are run only once during the first execution. They are cached in the container and don't need to be downloaded again (unless the pipeline cache is cleared).

  • During the execution of customization commands, repository files are not available. This means you should not use it to download dependencies already defined in the repository
  • Environment variables and SSH keys are also not available during the execution of the commands
  • If you want to use multi-line commands, make sure to end lines with a backslash \

Filesystem mount path and working dir

By default, the filesystem is mounted to a container in the /buddy/$repo-slug-name path. This is the same path where build commands are executed. You can change both the mount path and the working dir by in the Cache tab: Configuring thee filesystem

Docker Container as a Build Environment

Besides predefined environments, you can use your own Docker image or any image hosted on the Docker Hub, Amazon ECR, Google GCR, or a private registry. To use your own image, select the Custom Build action: Environment settings

The image will be run with a mounted filesystem and CMDs defined in the 'Build commands' field. If you want to run the image with CMDs defined in the Docker image, use the Run Docker Image action.

You can also use a Docker image built in a previous action in the pipeline without pulling it from the registry.

See also