Information for: DEVELOPERS   PARTNERS

CD Environments

Tutorial Goal

Implement continuous integration for a Drupal application on Acquia Cloud.

Lesson Goal

Configure your build file to create a new CD environment (CDE) for each GitHub pull request and to destroy that CDE upon merge.

In this lesson, we will modify a build file so that Acquia CD pipelines will programmatically create a new CD environment for each pull request. This environment can then be visited by team members using a web browser to manually test for quality and stability. Once this feature branch is merged, Acquia CD pipelines will destroy the CD environment.

In order to complete this lesson you will need:


GitHub is not a requirement for Acquia Cloud CD.

In this lesson we will:

  1. Modify your build file
    • Create a new local feature branch
    • Add a new build step
    • Add new pr-merged and pr-closed steps
  2. Submit a Pull Request on GitHub
  3. Visit the new CD environment
  4. Merge the pull request

2. Modify your build file

Create a new local feature branch

Use git to create a new feature branch.

git checkout -b pipelines-ode-deploy

Add a new build step

Next, we will modify your acquia-pipelines.yaml file such that a new CDE will be created when a new Pull Request is opened. To accomplish this, we use the Pipelines Deploy tool.

Add the following build step to your build definition file:

- deploy:
      - pipelines-deploy


Nest this step under See the acquia-pipelines.yaml example.

Add new pr-merged and pr-closed steps

These steps will destroy the CD environment after a pull request is merged or closed:

    - deploy:
          - pipelines-deploy

# When a GitHub pull request is closed, this deletes the coresponding ODE.
    - deploy:
          - pipelines-deploy

Commit the changes and push the feature branch to github remote:

git add acquia-pipelines.yaml
git commit -m 'Adding ODE deployment step to acquia-pipelines.yaml.'
git push github pipelines-ode-deploy

3. Submit a Pull Request on GitHub

Use the GitHub UI to create a new Pull Request:

GitHub UI page that shows process of creating a new Pull Request

A pipelines build is triggered.  Wait for the build to finish and use GitHub to review proposed code changes.

Once the build completes successfully, a green checkbox appears next to the commit ID. This indicates that all steps were successful, including the step that created the CD environment.

4. Visit the new CD environment

Use the Acquia Cloud UI to find and visit that environment.

Feel free to interact with the application to manually inspect the environment as a user.

5. Merge the pull request

At this point, you can confidently merge the pull request.

Click the merge button in the GitHub UI. This destroys the CD environment and triggers a pipelines build for the “master” branch, which the feature branch was merged into.

The pipelines-master-build will update on the Acquia Cloud.

You may deploy the pipelines-master-build to a development environment and visit it!

Congratulations, you’ve successfully implemented a basic continuous integration process with Acquia Cloud!