Skip to content

Azure DevOps

Azure DevOps and the controller can be used together to build highly automated self-service pipelines for build and release processes. Specifically, customers can integrate with Azure Pipelines to automate deployments of containerized applications to their fleet of Kubernetes clusters.


CI/CD Helper Repo

Tip

Access the CICD Helper Git Repo here

We develop and maintain a public Git repository with functioning illustrative examples of integrations with common CI platforms. Users are welcome to leverage, extend and contribute examples.


CI/CD using Azure Pipelines

Azure Pipelines


Example Pipeline

# Starter pipeline

# Start with a minimal pipeline that you can customize to build and deploy your code.
# Add steps that build, run tests, deploy, and more:
# https://aka.ms/yaml

trigger:
- master

variables:
  workload_yaml: demo-az-pipeline.yaml
  workload: demo-az-pipeline
  container: az-httpbin

pool:
  vmImage: 'ubuntu-latest'

steps:
- task: Docker@2
  inputs:
    containerRegistry: 'rafay-registry'
    repository: 'test_prod_org_private/kutumba.manne/az-httpbin'
    command: 'buildAndPush'
    Dockerfile: '**/Dockerfile'
  displayName: 'Build and push image'

- script: |
    export RCTL_API_KEY=$(RCTL_API_KEY)
    export RCTL_API_SECRET=$(RCTL_API_SECRET)
    wget -O ${HOME}/rctl-linux-amd64.tar.bz2 https://s3-us-west-2.amazonaws.com/rafay-prod-cli/publish/rctl-linux-amd64.tar.bz2
    tar -C ${HOME} -xf ${HOME}/rctl-linux-amd64.tar.bz2
    chmod 0755 ${HOME}/rctl
    mkdir -p ${HOME}/.rafay/cli
    ${HOME}/rctl create workload $(workload_yaml)
    ${HOME}/rctl workload set-image $(workload) $(container) $(RAFAY_REGISTRY_ENDPOINT)/$(RAFAY_ORGANIZATION_LABEL)/$(container):$(Build.BuildId)
    ${HOME}/rctl publish workload $(workload)
    workload_status="Not Ready"
    workload_status_iterations=1
    while [ "$workload_status" != "Ready" ];
    do
      workload_status=`${HOME}/rctl status workload $(workload) -o json|jq .result[].status|tr -d '"'`
      echo $workload_status
      sleep 30
      if [ $workload_status_iterations -ge 30 ];
      then
        break
      fi
      if [ "$workload_status" = "Failed" ];
      then
        echo "Workload Deployment Failed"
        break
      fi
      workload_status_iterations=$((workload_status_iterations+1))
    done
  displayName: 'create and publish workload'

- script: |
    echo "Run your tests here"
  displayName: 'Test'

- script: |
    export RCTL_API_KEY=$(RCTL_API_KEY)
    export RCTL_API_SECRET=$(RCTL_API_SECRET)
    ${HOME}/rctl delete workload $(workload)
  displayName: 'Cleanup'