Open in Grafana Cloud
Complete this learning path directly in your Grafana Cloud stack with an interactive learning experience.
Automate k6 in CI/CD pipelines
Welcome to the Grafana learning path that shows you how to automate k6 performance tests in your CI/CD pipelines. Running k6 manually gives you performance data when you think to ask for it. Automating k6 in your pipeline gives you performance data on every deploy, with the ability to block releases that don’t meet your standards.
This path guides you from a manually run k6 script to a CI/CD performance gate. You’ll verify that thresholds produce the right exit codes, parameterize your script for multiple environments, add k6 to GitHub Actions or GitLab CI, and stream results to Grafana Cloud k6. By the end, performance testing is part of the daily workflow, not a laptop-only habit.
Here’s what to expect
When you complete this path, you’ll be able to:
- Explain what a CI/CD performance gate is and why exit codes matter
- Verify that k6 thresholds pass and fail with the correct exit codes
- Parameterize a script with
__ENVso one script runs across environments - Add k6 to GitHub Actions or GitLab CI
- Treat threshold breaches as pipeline failures that block merges or deploys
- Stream automated test results to Grafana Cloud k6
Before you begin
Before you automate k6 in your CI/CD pipeline, ensure that you have:
- A Grafana Cloud account. To create an account, refer to Grafana Cloud.
- k6 installed on your machine. To install k6, refer to k6 installation.
- A k6 test script with thresholds. If you don’t have one yet, complete Run your first k6 performance test and Establish a performance baseline with k6 first.
- A code editor such as Visual Studio Code or Cursor.
- Access to a terminal or command line interface.
- Access to a CI/CD platform such as GitHub Actions or GitLab CI.
- Basic familiarity with your CI/CD platform’s YAML configuration.
Troubleshooting
If you get stuck, we’ve got your back! Where appropriate, troubleshooting information is just a click away.
More to explore
We understand you might want to explore other capabilities not strictly on this path. We’ll provide you opportunities where it makes sense.