# DevOps process automation

Why not treat resilience/chaos testing the same way as functional or load testing, for example? We believe that these are not a "one time type of thing". Once you've made your system resilient to failures, you should test its ability to recover from unexpected states on a regular basis.

# Azure DevOps Pipelines

A pipeline defines the continuous integration and deployment process for your app. It's made up of one or more stages than can contain multiple tasks.

A task is the building block for defining automation in a pipeline. It is a packaged script or procedure that has been abstracted with a set of inputs.

Important notes

Learn more about Azure DevOps Pipelines here

# Chaos pipeline tasks

Chaos Platform provides the Chaos attack runner pipeline task. It lets you run scenarios and attacks from your pipeline.

# Run your first pipeline

# Create an attack

Follow the instructions from the attacks guide to create an attack or a scenario.

# Acquire a token

Running the attack runner task requires a Chaos Platform token. Please follow the instructions to acquire such a token.

# Create pipeline file

Running attacks and scenarios from your pipeline, requires two tasks:

  1. Python: Chaos Platform uses Python to run its attacks.

  2. Attack runner: Run the attack or scenario.

    # file: ./getting-started/experiment.yml
    
    pool:
      vmImage: 'ubuntu-latest'
    
    steps:
    - task: UsePythonVersion@0
      inputs:
        versionSpec: '3.7'
        addToPath: true
        architecture: 'x64'
    - task: ChaosAttackRunner@0
      inputs:
        token: $(TOKEN)
        attackId: $(ATTACK_OR_SCENARIO_ID)
        azureConnection: $(AZURE_SERVICE_CONNECTION)
    

    Parameters:

    Parameter Description Example
    token Token that authenticates you with the Proofdock Cloud ey...
    attackOrScenarioId Attack id or scenario id that is run 364cf76e-c985-4ccb-abed-ac42330e283e
    azureConnection Service connection name that is used to authenticate with Azure. Only needed when you run Azure attacks. my-azure-service-connection

    Save and push it to your repository.

# Create pipeline in Azure DevOps

Now you have to configure the pipeline in the Azure DevOps.

  1. Go to the Pipeline Service in DevOps and click New pipeline

    New pipeline

  2. Select the repository where your experiment and pipeline are stored (in this guide we select Azure Repos Git)

    New pipeline

  3. In the Configure step select Existing Azure Pipelines YAML file and point towards the location in your repo where the pipeline is stored. When you are ready, click Continue.

  4. Now, configure the TOKEN variable. Use the token that you generated in the Get started - Configure step or create new. Keep your secrets protected by checking Keep this value secret. When you are ready, save and run the experiment.

    New pipeline

  5. Congratulations! You have executed your first experiment using Azure Pipelines.

# What next?

We have just shown you how to integrate a simple attack into your DevOps process. With this knowledge you can now write your own attacks to test resilience and availability of your system.