Information for: DEVELOPERS   PARTNERS

Example pipelines build definition files

Use the example files on this page to help you develop your own custom build definition files for the Cloud Platform pipelines feature.

Validating and testing your files

To determine if your build definition file uses valid YAML syntax, you can use an online validator, such as one of the following:

Before you run the composer install command in a YAML file, to reduce memory consumption in the container, Acquia recommends committing the composer.lock file to your code repository.

For more information, see Pipelines build fails because of memory limitations on pipelines container article at the Acquia Knowledge Base.

Examples

The following example YAML files are available:

An example of build definition file syntax suitable for use with Node.js is available at Creating a pipelines artifact for a Node.js application.

General example

Here is an example of a complete build definition file:

# For more acquia-pipelines.yml pipelines examples, see
# https://docs.acquia.com/cloud-platform/develop/pipelines/yaml/examples/

# Must have a value of at least 1.0.0
# Version: 1.1.0
#   Enables users to use a custom PHP version other than the default version.
#   For default and supported PHP versions, see
#   https://docs.acquia.com/cloud-platform/develop/pipelines/yaml/#php7
#   Note: As PHP is available by default, user need not mention 'php' as
#   a service unless a custom PHP version is required.
# Version: 1.2.0
#   Adds support for the 'cde-databases' key in your YAML file.
# Version: 1.3.0
#   Adds memcached support.
# For more info and supported versions, see
# https://docs.acquia.com/cloud-platform/develop/pipelines/yaml/#version-key
version: 1.3.0

# For more info on services supported, see
# https://docs.acquia.com/cloud-platform/develop/pipelines/yaml/#services-key

services:

  # mysql is supported from version: 1.0.0
  - mysql

  # custom php version is supported from version: 1.1.0
  - php:
      version: 7.3

  # memcached is supported from version: 1.3.0
  - memcached

events:
  build:
    steps:
      - setup:
          type: script
          script:
            - composer validate --no-check-all --ansi
            - composer install
            - mysql -u root -proot -e "CREATE DATABASE drupal"
      - test:
          type: script
          script:
            - ./vendor/bin/phpunit

Copying files to an on-demand environment

The scripts available in the copy-files-pipeline example in the pipelines-examples Github repository provide examples of copying files from any source environment to an on-demand environment in a pipelines job.

For additional examples, see Managing your environments with pipelines.

If you don’t want to use a pipelines job to copy files, the article Serving files from production on development environments includes other suggestions, such as the Stage File Proxy module.

Creating an empty MySQL database

The following build definition file example creates an empty MySQL database:

# For more acquia-pipelines.yml pipelines examples, see
# https://docs.acquia.com/cloud-platform/develop/pipelines/yaml/examples/
version: 1.0.0
services:
  - mysql

events:
  build:
    steps:
      - setup:
          type: script
          script:
            - mysql -u root -proot -e "CREATE DATABASE drupal"

More examples

Other example scripts for pipelines jobs are available in the pipelines-examples Github repository.