Integrating Azure DevOps Pipelines
Run your Gatling Enterprise simulations from Azure DevOps Pipelines.
We do not currently provide an official Azure Pipelines extension. This page documents how to use our CI script to run tests on Gatling Enterprise with Azure DevOps
Requirements
You will need:
- A git repository: we will be using GitHub in our example
- A working simulation on Gatling Enterprise Cloud: you will need its ID later on, which you can copy with Copy Simulation ID to clipboard in the Simulations page
- An API token which needs the Start permission.
On Azure DevOps, your will need:
- An Azure DevOps project
- An agent pool:
- You can learn how to create one by following the official Azure Devops documentation
- You will need the agent pool’s name later on, in our example we will use
AzurePipelinesAgentsPool
Preparing the repository
First, download the CI script, unzip it and put the content at the root of the repository. Make sure it is named start_simulation.sh
.
Create a file called azure-pipelines.yml
at the root of the repository with the following content:
trigger: none
pool: AzurePipelinesPool # Name of the agent pool configured in Azure DevOps
steps:
- task: Bash@3
displayName: Install JQ
inputs:
targetType: 'inline'
# Curl and JQ are required by the CI script
# In this example, we use Ubuntu agents which come with curl but not jq
script: 'sudo apt-get update && sudo apt-get -y install jq'
- task: Bash@3
displayName: Start simulation
inputs:
filePath: 'start_simulation.sh'
arguments: >
$(gatlingEnterpriseUrl)
$(apiToken)
$(simulationId)
Creating a pipeline
On Azure DevOps, click on Pipelines in the left menu, then on Create Pipeline or New Pipeline.
From here, you will follow a 4 steps process: Connect -> Select -> Configure -> Review.
-
On the Connect step, select the type of the repository you want to use. We will be using GitHub.
-
On the Select step, select the repository your created earlier.
If you never connected Azure DevOps to your GitHub account, you’ll be prompted by GitHub to authorize the Azure DevOps application to access your repositories on your behalf.
After your account is linked, you will be able to browse your repositories. When using an organization repository, click on All repositories on the top right.
-
On the Configure step, as we already made a
azure-pipelines.yml
file, the step will be skipped and you will be asked to review its content directly. -
On the Review step, create three variables by clicking New variable on the top right, then:
gatlingEnterpriseUrl
: usehttps://cloud.gatling.io
apiToken
: make sure Keep this value secret is enabledsimulationId
: use the ID of the simulation you want to run
Here is what it looks like:
Click on Save, and then on Run to start the job. You will be redirected to the Job summary page.
After the job has been queued, if you see permissions errors, click on the red Permission needed link on the bottom left:
After the job is created and queued, you can see the output of a Gatling Enterprise run by clicking on Job, then on the Start simulation task: