Pipelines Configuration - NCIOCPL/cgov-digital-platform GitHub Wiki

Important Note

Acquia Cloud vs Acquia Cloud Site Factory (ACSF)

Acquia Cloud is a collection of environments that make up a single (usually) website or web api. This contains the dev, qa, stage, and production environments. Our subscription is the Enterprise offering, so you may see Acquia Cloud Enterprise or ACE in documentation.

Acquia Cloud Site Factory is a different offering that allows for the management of large numbers of websites using the same codebase. ACSF is separate from Acquia Cloud environments and has a different deployment workflow from Acquia Cloud.

*The same codebase can be used between ACE and ACSF, and as such we will use ACE for building and testing our code, via Pipelines, and ACSF for large scale testing and production sites hosting.

Concepts

Pipelines

The Acquia Cloud Pipelines feature is a tool for developing, testing, and deploying websites or other applications to Acquia Cloud.

Documentation surrounding Pipelines can be found at https://docs.acquia.com/acquia-cloud/develop/pipelines/.

Acquia Cloud CD

Acquia Cloud CD is a service which provides the ability to provision new dev/test environments on demand through either the UI or via scripts, and remove them when no longer needed. These on-demand environments are referred to as ODEs.

We have 10 CD environments.

NOTE: It is unclear what it actually means to spin up a CD environment. In our Pipelines configuration, which was based on the PoC, we have a pipelines-deploy step on pr-merged and pr-closed (actually, pre-closed). This does not create a brand new ODE visible to the front-end.

The instructions at Deploying the build artifact indicate that once an environment is tied to a piplines-build-xxx branch then it will automatically deploy. It does not mention the need for pipeline-deploy in the piplines configuration.

Cloud Cloud Hooks

Acquia Cloud Hooks are scripts that run when various events occur within the Acquia Cloud environment. You can configure environment specific scripts, or common scripts that run no matter what the environment is.

The triggering events are:

  • post-code-deploy - The post-code-deploy hook is run whenever you use the Workflow page to deploy new code to an environment, either via drag-drop or by selecting an existing branch or tag from the Code drop-down list.
  • post-code-update - The post-code-update hook runs upon a PR approval, or other change, to a branch that is deployed to an environment.
  • post-db-copy - The post-db-copy hook is run whenever you use the Workflow page to copy a database from one environment to another.
  • post-files-copy - The post-files-copy hook is run whenever you use the Workflow page to copy the user-uploaded files directory from one environment to another.

NOTE: Cloud hooks are only for Acquia Cloud environments, NOT Acquia Cloud Site Factory. See Site Factory Hooks below.

For more information see Cloud Hooks Readme.

Acquia Cloud Site Factory Hooks

TBD

Pipeline Configuration

Hooks

Hook Type Location Description
slack.sh post-code-deploy
post-code-update
common Sends slack notification upon successful deployment
site-install.sh post-code-deploy
post-code-update
dev Does a fresh site install - needs work
post-code-deploy.sh post-code-deploy common Inert post-code-deploy script -- usually does a db update which does not work for a fresh site.
post-code-update.sh post-code-update common Inert post-code-deploy script -- usually does a db update, which does not work for a fresh site.

Important Files

Project Code

\<PROJECT_ROOT\>

  • blt - The BLT configuration folder. This matters because some of the pipelines commands use BLT to perform tasks.
    • blt.yml - The main BLT configuration file.
    • blt.dev.yml - The configuration overrides for the dev environment
  • hooks - The folder that contains the Acquia Cloud Hooks. These fire off upon various activities that occur in the cloud. (e.g. Post Code Deployments). FYI, from the docs, it appears that this folder must be named hooks and at the root of the project.
    • common - These hooks fire on every environment
      • post-code-deploy - The hooks that fire when code has been deployed to the server. (Through a pipelines-deploy command, a drag-and-drop through the UI, or code switch in the UI)
        • post-code-deploy.sh
    • \<ENV\> - Each Acquia Cloud environment can specify their own hooks. You make a folder name for the environment. (I THINK)
    • dev - These hooks fire on the dev environment. *
  • factory-hooks - ACSF hooks. This does not exist at this moment.
  • acquia-pipelines.yml - The pipelines configuration file.

Application User Home Directory

Pipeline Specific

Cloud Hooks

  • common
    • post-code-deploy
      • post-code-deploy.sh -
      • slack.sh - Posts a message to slack noting a deployment has occurred. See server's ~/slack_settings.
    • post-code-update
      • post-code-update.sh - Script run upon git updates
      • slack.sh - Posts a message to slack noting a deployment has occurred. See server's ~/slack_settings.
  • dev

Notes for now

  • To set the version of node you must modify:
    • The <root>/docker/web/Dockerfile to install the correct version -- This is for developers.
    • The `/scripts/pipelines/setup_env -- This is for setting up the pipeline
⚠️ **GitHub.com Fallback** ⚠️