Integrating Other CI/CD Systems
Run your Gatling Enterprise simulations from any CI/CD product.
We provide dedicated support for a number of CI tools: GitHub Actions, Gitlab CI, Jenkins, Teamcity, Bamboo. However, we also document here how to run your simulations on Gatling Enterprise from any other CI products, using either one of the supported build tools or our CI shell script. Note that we also provide dedicated instructions to use our CI shell script with Azure DevOps Pipelines.
This will not create a new Gatling Enterprise simulation, you have to create it using the Gatling Enterprise Dashboard before, or do it using the options provided by our build tools plugins:
Pre-requisites
You must first create an API token. It will be used to authenticate with Gatling Enterprise. Most CI tools should offer a way to store this token securely, and expose it to build scripts as an environment variable.
In the following examples, we assume the API Token is available in an environment variable named GATLING_ENTERPRISE_API_TOKEN
, which our tools will detect automatically.
We also assume that you have already configured a simulation on Gatling Enterprise. You can copy the simulation ID from the simulations list view. In the following examples, we will show the simulation ID as 00000000-0000-0000-0000-000000000000
.
Using a build tool plugin
You can build you Simulation, and then run the updated Simulation on Gatling Enterprise, using the enterpriseStart
command with any of our supported build tools.
With the waitForRunEnd=true
option, it will display live metrics until the end of the run, and exit with an error code if the run fails on Gatling Enterprise (e.g. if the run crashes or if the assertions fail).
Configure your CI build to run the command corresponding to the build tool you use:
gradle gatlingEnterpriseStart \
-Dgatling.enterprise.simulationId=00000000-0000-0000-0000-000000000000 \
-Dgatling.enterprise.waitForRunEnd=true
gradle gatlingEnterpriseStart \
-Dgatling.enterprise.simulationId=00000000-0000-0000-0000-000000000000 \
-Dgatling.enterprise.waitForRunEnd=true
mvn gatling:enterpriseStart \
-Dgatling.enterprise.simulationId=00000000-0000-0000-0000-000000000000 \
-Dgatling.enterprise.waitForRunEnd=true
sbt Gatling/enterpriseStart \
-Dgatling.enterprise.simulationId=00000000-0000-0000-0000-000000000000 \
-Dgatling.enterprise.waitForRunEnd=true
Using a shell script
This script launches an existing simulation on Gatling Enterprise and displays live metrics.
It can be downloaded here.
Shell script requirements
This script runs with:
- the
bash
shell - the
curl
HTTP client, see here for more information - the
jq
JSON processor, see here for more information
These tools must be installed on the machine or container where your CI system will execute the script.
Shell script usage
Configure your CI build to call the script with 3 parameters like this:
./start_simulation.sh \
'http://my-gatling-instance.my-domain.tld' \
"$GATLING_ENTERPRISE_API_TOKEN" \
'00000000-0000-0000-0000-000000000000'
- Gatling Enterprise URL: address of your Gatling Enterprise server, for example:
http://my-gatling-instance.my-domain.tld
. - API token: the API token will allow the script to authenticate to Gatling Enterprise. The API token needs the All role.
- Simulation ID: the ID of the simulation you want to start. You can get this ID on the Simulations table, with the icon.