Azure DevOps Pipelines Example

Prerequisites

  • Access to an Azure DevOps account and project. Sign up for free here.
  • Git must be set up and configured in your Coalesce Org. Azure DevOps Pipelines are flexible and can be configured with all git providers that Coalesce supports.

Agent Setup

Azure DevOps has multiple configurations for agents that include self-hosted or Microsoft-hosted (requires an Azure subscription). Coalesce can use an existing agent pool if your organization already has pre-configured agents.

  • Details on setting up an Azure DevOps agent can be found in Microsoft's documentation.
  • Take note of the agent pool name when setting up the agent as you will need this when defining the pool in your pipeline definition (azure-pipelines.yml). In the examples below, we will use pool: default since that is how our agent pool is configured.

Upload Secure File

To follow best practices, Coalesce recommends that you upload your coa config file as a secure file within the Azure DevOps Pipeline.

  1. From within your Azure DevOps Project, select Pipelines and subsection Library from the left sidebar.
  2. Select + Secure File to upload your coa config. By default this file is in ~/.coa. Take note of the file name for the next section.
Uploading coa config fileUploading coa config file

Uploading coa config file

Create a Pipeline

  1. From within your Azure DevOps Project, select Pipelines and subsection Pipelines from the left sidebar.
Creating a PipelineCreating a Pipeline

Creating a Pipeline

  1. Select Create Pipeline and follow the wizard to connect your git repository to the Azure DevOps Pipeline.
  2. When prompted to Configure your pipeline, select Starter pipeline
  3. When prompted to Review your pipeline YAML, replace the azure-pipelines.yml contents with the following code.

📘

On the YAML Example Code

The below is an example for an hourly refresh on the main branch, although it could be modified for a daily deploy, a different branch, or other options.

pool: default

variables:
 - name: coalesceCliVersion
   value: "1.0.112"

schedules:
- cron: "0 * * * *"
  displayName: Hourly Refresh
  branches:
    include:
    - main

steps:

- task: [email protected]
  name: coaConfig
  displayName: 'Download coa config'
  inputs:
    secureFile: 'config'

- task: [email protected]
  inputs:
    script: |
      # Install Coalesce CLI tool, if not installed
      npm list -g | grep "@coalescesoftware/[email protected]$(coalesceCliVersion)" || npm install -g @coalescesoftware/[email protected]$(coalesceCliVersion);
      
      # Start refresh
      coa refresh  --config $(coaConfig.secureFilePath);
  1. Remember to click Save
  2. Now manually test your new pipeline by selecting Run to kick off your refresh.

What’s Next
Did this page help you?