Integrate IPM with Azure DevOps Pipelines

This guide explains how to integrate IPM into your Azure DevOps pipelines. IPM can be installed dynamically within your pipeline jobs for tasks such as package management and status monitoring. Common use cases include downloading packages, publishing updates, and running status checks to enhance observability.

Installing IPM in Your Pipeline

Add the following step to your pipeline to install the latest version of IPM:

- bash: |
    curl -Lo ipm-cli.tar.gz "https://github.com/ipmhubio/ipm/releases/download/0.7.0/ipm-linux-x64-full.tar.gz"
    tar -xzf ipm-cli.tar.gz 
    sudo mv ./ipm /usr/local/bin/ipm
  displayName: 'Install IPM CLI'

Authentication Setup

To use IPM in your pipelines, you’ll need to authenticate using the --non-interactive parameter and a client secret. You can provide authentication through pipeline variables. For more details about non-interactive mode, see the parameter documentation.

Setting Up Client Secrets

  1. Create a client secret in the IPM portal following the client secrets creation guide

  2. Add the secret to your Azure DevOps pipeline:

    • Navigate to your project settings
    • Select PipelinesLibrary
    • Create a new variable group or select an existing one
    • Add a new variable named IPM_CLIENT_SECRETS
    • Mark the variable as secret by clicking the padlock icon

    create Azure DevOps secret

    Click the image to enlarge

  3. Link the variable group to your pipeline:

    variables:
    - group: your-variable-group-name
    

Example Pipeline Commands

Status Check

- bash: |
    cd $(System.DefaultWorkingDirectory)
    pwd
    ls -lah
    ipm status --non-interactive
  displayName: 'Run IPM Status'
  env:
    IPM_CLIENT_SECRETS: $(IPM_CLIENT_SECRETS)

Workspace Sync

- bash: |
    cd $(System.DefaultWorkingDirectory)
    pwd
    ls -lah
    ipm sync --non-interactive
  displayName: 'Run IPM Sync'
  env:
    IPM_CLIENT_SECRETS: $(IPM_CLIENT_SECRETS)

Complete Pipeline Example

Here’s a complete pipeline example that installs IPM and runs a status check:

trigger:
- main

pool:
  vmImage: 'ubuntu-latest'

variables:
- group: ipm-secrets

steps:
- bash: |
    curl -Lo ipm-cli.tar.gz "https://github.com/ipmhubio/ipm/releases/download/0.7.0/ipm-linux-x64-full.tar.gz"
    tar -xzf ipm-cli.tar.gz 
    sudo mv ./ipm /usr/local/bin/ipm
  displayName: 'Install IPM CLI'

- bash: |
    cd $(System.DefaultWorkingDirectory)
    ipm status --non-interactive
  displayName: 'Check IPM Status'
  env:
    IPM_CLIENT_SECRETS: $(IPM_CLIENT_SECRETS)