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 task managers, and serving all modern backend, frontend, mobile, and container technologies – basically any task that your workflow requires.

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

Overview

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

Image loading...Build actions in Buddy

Configuration

Once you add a container action, you need to configure the commands to run, and the environment in which they will be executed. For example, if you want to test your PHP application, you need to select the PHP action, choose the version of PHP, and define the commands (e.g. vendor/bin/phpunit).

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

Image loading...Default build commands

Hint
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
Warning
Do not enter commands which prepare the environment in the Run tab (e.g. apt-get install). For this purpose, use the environment tab (see below).

Environment

The runtime 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.

Image loading...Environment tab

If the selected image is missing some components required by the build (e.g. PHP extensions or Apache modules), you can install them in the Packages & Tools section of the environment tab.

Image loading...Environment customization console

Hint
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).
Warning
  • When environment commands are run, 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

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 the mount path in the Cache tab:

Image loading...Filesystem configuration

Docker Container as build environment

Besides predefined environments, you can use your own Docker image as your build template. In this case, select the Custom action:

Image loading...Custom action on action list

The action comes with plain Ubuntu 20.04 as default, but you can change it to any image pulled from Docker Hub, Amazon ECR, Google GCR, Google Artifact Registry, or your own private registry. The required dependencies and tools can be installed in the Packages & Tools tab.

Tip
You can also use the Docker image built by a preceding action in the pipeline. To do it, select 'From action' as the image location.

Image loading...Environment settings in Custom action

Hint
The image will be run with a mounted filesystem and CMDs defined in the Run tab. If you want to run the image with CMDs defined in the Docker image, use the Run Docker Image action insted.

Last modified on Sep 23, 2024

Recommended