---
title: "Example Pipelines build definition files"
date: "2024-02-14T06:18:38+00:00"
summary: "Explore example Pipelines build definition files for custom YAML development. Learn validation techniques, find general and specific examples, and access resources for creating robust Acquia Cloud Platform CI/CD workflows."
image:
type: "page"
url: "/acquia-cloud-platform/example-pipelines-build-definition-files"
id: "2157be54-a7db-4335-bad5-d0d5f161bc01"
---

Use the example files on this page to help you develop your own custom build definition files for Pipelines.

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:

*   [YAML Lint](http://www.yamllint.com)
*   [YAML Validator](http://codebeautify.org/yaml-validator) at Code Beautify

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 the Pipelines container](/acquia-cloud-platform/help/93036-pipelines-build-fails-because-memory-limitations-pipelines-container "Pipelines build fails because of memory limitations on pipelines container").

Examples
--------

The following example YAML files are available:

*   [General example](#pipelines-yaml-general-example)
*   [Copying files to an on-demand environment](#pipelines-yaml-copy-files)
*   [Creating an empty MySQL database](#pipelines-yaml-empty-db)
*   [More examples](#pipelines-examples-repo)

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](/acquia-cloud-platform/add-ons/node-js/start#nodejs-pipelines-example).

### General example

Here is an example of a complete build definition file:

    # For more acquia-pipelines.yaml pipelines examples, see
    # https://docs.acquia.com/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/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/pipelines/yaml/#version-key
    version: 1.3.0
    
    # For more info on services supported, see
    # https://docs.acquia.com/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: 8.0
    
      # 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](https://github.com/acquia/pipelines-examples/tree/copy-files-pipeline) example in the [pipelines-examples](https://github.com/acquia/pipelines-examples) GitHub repository provide examples of copying files from any source environment to an [on-demand environment](/acquia-cloud-platform/features/cd) in a Pipelines job.

For additional examples, see [Managing your environments with Pipelines](/acquia-cloud-platform/features/cd/env#cd-manage-environments).

If you don’t want to use a Pipelines job to copy files, the [Serving files from production on development environments](/acquia-cloud-platform/help/94236-serving-files-production-development-environments "Serving files from production on development environments") article includes other suggestions, such as the [Stage File Proxy](https://drupal.org/project/stage_file_proxy) module.

### Creating an empty MySQL database

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

    # For more acquia-pipelines.yaml pipelines examples, see
    # https://docs.acquia.com/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](https://github.com/acquia/pipelines-examples) GitHub repository.

More information
----------------

*   [Creating and managing your build definition file](/acquia-cloud-platform/features/pipelines/yaml)
*   [Creating a custom variable for job tracking](/acquia-cloud-platform/features/pipelines/yaml/variables)
*   [Encrypting keys and variables](/acquia-cloud-platform/features/pipelines/encrypt)
*   [Commands available in Pipelines](/acquia-cloud-platform/features/pipelines/commands)
*   [Copying a database into a Cloud Platform CD environment](/acquia-cloud-platform/features/pipelines/databases)
*   [Managing Cloud Platform CD environments](/acquia-cloud-platform/features/cd/env)