# Azure DevOps

Azure DevOps provides excellent Docker integration with managed agents and Azure Container Instances, making it ideal for enterprise KushoAI testing workflows.

# Prerequisites

  1. Docker Support: Azure DevOps agents with Docker capability
  2. Azure Container Registry (optional): For caching Docker images
  3. Azure Key Vault (recommended): For secure credential management

# Docker Image

All execution uses the Kusho test runner Docker image:

public.ecr.aws/y5g4u6y7/kusho-test-runner:latest

# Setup Instructions

# 1. Configure Pipeline Variables

Navigate to your Azure DevOps project → Pipelines → Library → Variable groups:

# Create Variable Group: "Kusho-Config"

Variable Name Value Secret
KUSHO_API_KEY Your Kusho API key
KUSHO_BASE_URL https://be.kusho.ai
ENVIRONMENT_ID 2
TEST_SUITE_UUID uuid1,uuid2

# 2. Create Azure Pipeline

Create azure-pipelines.yml in your repository root:

# 3. Basic Pipeline Configuration

trigger:
  branches:
    include:
      - main
      - develop

pr:
  branches:
    include:
      - main

variables:
  - group: Kusho-Config

pool:
  vmImage: 'ubuntu-latest'

stages:
- stage: Test
  displayName: 'Run Kusho Tests'
  jobs:
  - job: KushoTests
    displayName: 'Execute API Tests'
    steps:
    - task: Docker@2
      displayName: 'Run Kusho Test Suite'
      inputs:
        command: 'run'
        arguments: |
          --rm \
          -e BASE_URL="$(KUSHO_BASE_URL)" \
          -e ENVIRONMENT_ID="$(ENVIRONMENT_ID)" \
          -e API_KEY="$(KUSHO_API_KEY)" \
          -e CI_COMMIT_SHA="$(Build.SourceVersion)" \
          -e CI_COMMIT_MESSAGE="$(Build.SourceVersionMessage)" \
          -e TEST_SUITE_UUID="$(TEST_SUITE_UUID)" \
          public.ecr.aws/y5g4u6y7/kusho-test-runner:latest

# Execution Methods

# 1. Execute by Test Suite UUID

- task: Docker@2
  displayName: 'Run Tests by UUID'
  inputs:
    command: 'run'
    arguments: |
      --rm \
      -e BASE_URL="$(KUSHO_BASE_URL)" \
      -e ENVIRONMENT_ID="$(ENVIRONMENT_ID)" \
      -e API_KEY="$(KUSHO_API_KEY)" \
      -e CI_COMMIT_SHA="$(Build.SourceVersion)" \
      -e CI_COMMIT_MESSAGE="$(Build.SourceVersionMessage)" \
      -e TEST_SUITE_UUID="$(TEST_SUITE_UUID)" \
      public.ecr.aws/y5g4u6y7/kusho-test-runner:latest

# 2. Execute by Group ID

- task: Docker@2
  displayName: 'Run Tests by Group'
  inputs:
    command: 'run'
    arguments: |
      --rm \
      -e BASE_URL="$(KUSHO_BASE_URL)" \
      -e ENVIRONMENT_ID="$(ENVIRONMENT_ID)" \
      -e API_KEY="$(KUSHO_API_KEY)" \
      -e CI_COMMIT_SHA="$(Build.SourceVersion)" \
      -e CI_COMMIT_MESSAGE="$(Build.SourceVersionMessage)" \
      -e GROUP_ID="$(GROUP_ID)" \
      public.ecr.aws/y5g4u6y7/kusho-test-runner:latest

# 3. Execute by Tags

- task: Docker@2
  displayName: 'Run Tests by Tags'
  inputs:
    command: 'run'
    arguments: |
      --rm \
      -e BASE_URL="$(KUSHO_BASE_URL)" \
      -e ENVIRONMENT_ID="$(ENVIRONMENT_ID)" \
      -e API_KEY="$(KUSHO_API_KEY)" \
      -e CI_COMMIT_SHA="$(Build.SourceVersion)" \
      -e CI_COMMIT_MESSAGE="$(Build.SourceVersionMessage)" \
      -e TAGS="$(TEST_TAGS)" \
      public.ecr.aws/y5g4u6y7/kusho-test-runner:latest

# 4. Execute E2E Workflows

- task: Docker@2
  displayName: 'Run E2E Tests'
  inputs:
    command: 'run'
    arguments: |
      --rm \
      -e BASE_URL="$(KUSHO_BASE_URL)" \
      -e ENVIRONMENT_ID="$(ENVIRONMENT_ID)" \
      -e API_KEY="$(KUSHO_API_KEY)" \
      -e CI_COMMIT_SHA="$(Build.SourceVersion)" \
      -e CI_COMMIT_MESSAGE="$(Build.SourceVersionMessage)" \
      -e E2E_TEST_SUITE_UUID="$(E2E_TEST_SUITE_UUID)" \
      -e EXECUTION_PROFILE_UUID="$(EXECUTION_PROFILE_UUID)" \
      public.ecr.aws/y5g4u6y7/kusho-test-runner:latest

# Complete Pipeline Examples

# Multi-Stage Testing Pipeline

trigger:
  branches:
    include:
      - main
      - develop

variables:
  - group: Kusho-Config

pool:
  vmImage: 'ubuntu-latest'

stages:
- stage: SmokeTests
  displayName: 'Smoke Tests'
  jobs:
  - job: Smoke
    displayName: 'Run Smoke Tests'
    steps:
    - task: Docker@2
      displayName: 'Execute Smoke Tests'
      inputs:
        command: 'run'
        arguments: |
          --rm \
          -e BASE_URL="$(KUSHO_BASE_URL)" \
          -e ENVIRONMENT_ID="$(ENVIRONMENT_ID)" \
          -e API_KEY="$(KUSHO_API_KEY)" \
          -e CI_COMMIT_SHA="$(Build.SourceVersion)" \
          -e CI_COMMIT_MESSAGE="$(Build.SourceVersionMessage)" \
          -e TAGS="smoke" \
          public.ecr.aws/y5g4u6y7/kusho-test-runner:latest

- stage: IntegrationTests
  displayName: 'Integration Tests'
  dependsOn: SmokeTests
  condition: and(succeeded(), in(variables['Build.SourceBranch'], 'refs/heads/main', 'refs/heads/develop'))
  jobs:
  - job: Integration
    displayName: 'Run Integration Tests'
    steps:
    - task: Docker@2
      displayName: 'Execute Integration Tests'
      inputs:
        command: 'run'
        arguments: |
          --rm \
          -e BASE_URL="$(KUSHO_BASE_URL)" \
          -e ENVIRONMENT_ID="$(ENVIRONMENT_ID)" \
          -e API_KEY="$(KUSHO_API_KEY)" \
          -e CI_COMMIT_SHA="$(Build.SourceVersion)" \
          -e CI_COMMIT_MESSAGE="$(Build.SourceVersionMessage)" \
          -e TAGS="integration" \
          public.ecr.aws/y5g4u6y7/kusho-test-runner:latest

# Azure DevOps Features

# Built-in Environment Variables

Azure DevOps provides useful predefined variables:

  • $(Build.SourceVersion) - Git commit SHA
  • $(Build.SourceVersionMessage) - Git commit message
  • $(Build.SourceBranch) - Source branch
  • $(Build.RequestedFor) - User who triggered the build

# Best Practices

# Security

  • Use Azure Key Vault for sensitive data
  • Implement service connections with minimal permissions
  • Use managed identities where possible

# Performance

  • Use Azure Container Registry to cache images
  • Implement parallel job execution
  • Use conditions to skip unnecessary stages

# Troubleshooting

# Common Issues

  1. Docker Permission Issues

    - task: Docker@2
      inputs:
        command: 'run'
        addPipelineData: false
        arguments: '--rm --privileged ...'
  2. Variable Resolution Issues

    • Verify variable group linking
    • Check variable scope and security settings
    • Use $(Build.SourceVersionMessage) for commit messages
  3. Network Connectivity

    • Ensure agent can access ECR registry
    • Check firewall and network security group rules