Header

Build Pipelines

With Build Pipelines you can set up a build, which will consist of commands that you can define to run on our servers before starting a deployment. These commands may fetch dependencies, build assets, run tests on your code, or anything else you can think of. Any generated files will be uploaded with your deployment.

Getting started

To create a new build pipeline, click the Build Pipeline link on the left hand side of the page in any project, then the New Command button on the right hand side.

Pre-configured build commands

You'll be able to choose from a pre-configured build sequence that uses one of the common build tools:

Pre-selected build commands

If you have any additional commands to run alongside one of the pre-configured sequences, simply add or modify anything as appropriate. This can include any variables which have been defined within server config files.

Custom build commands

Or, if you have a custom set of commands to run, just choose the Custom option and input your commands manually.

New Build Command

Add a description for your build command, then enter any commands that you wish to run below. If you're running multiple commands, just place each command on a new line.

Build command - stop deployment

Enable the option Stop deployment if the command failed? if you want to halt the process if an exit code other than 0 is returned, then click Create Build Command to finish.

Complex build commands

If you wish to give your build pipeline a bit more complexity, you can freely do so. As build pipelines are run on top of Ubuntu 20.04, you can use the flexibility of bash scripting to create some more complex commands.

You can also make use of the available DeployHQ variables to set up easy movement and referencing between deployments, allowing you to create more complex actions, such as:

if [[ "%environment%" =~ ^(integration|testing|staging)$ ]]; then
    npm ci 
fi

This is only a basic example of conditional scripting, but you can also add loops, more complex conditional expressions, etc.

This can be used for example, for CI, for testing, conditional builds, for logging purposes, etc.

Build Configuration

Once you've created your build command sequence, it's recommended that you run through the Build Configuration section, which provides a number of useful features to help with your build process.

Running a build command

By default, the build command will run during all deployments for your project, but if you wish to override this for a specific deployment, click the Show Advanced Options button below the selected revisions on the deployment page, then enable or disable the Run build commands? option as appropriate.

Running a build

Fetching remote dependencies

Some builds may require you to fetch dependencies from an authenticated endpoint, in particular a remote repository. If you need to do so, you'll be able to add your DeployHQ project's public key to the authorized_keys file on the repository server, or the deployment/access keys list for the repository if it's hosted with one of the major hosting providers such as Codebase or Github.

For further information about adding the key to a repository hosted with one of the main providers, please take a look at this guide on our manual.

Further information

Out of the box, DeployHQ build runs on Ubuntu 20.04 servers and supports the following languages and tools:

  • PHP and Composer
  • NodeJS with npm, Yarn and gulp
  • ASP.NET Core 2.0, 2.1, 2.2 and 3.0 CLI
  • Ruby & Bundler
  • Java & Gradle
  • Python
  • Go

When running a build, a new, sandboxed container will be spawned in our build servers. You won't have root access, but you can run anything you like that's available from one of the supported tools.

If there is anything missing that you'd like us to add, please get in contact.

Tree

Proudly powered by Katapult. Running on 100% renewable energy.