1. grafana/k6@1.1.3

grafana/k6@1.1.3

Partner
Sections
Run load tests and reliability tests using k6. This orb allows for running k6 tests locally on the runner and in the k6 Cloud.
Created: February 24, 2022Version Published: March 9, 2022Releases: 6
Org Usage:
< 25
Homepage:

Orb Quick Start Guide

Use CircleCI version 2.1 at the top of your .circleci/config.yml file.

1 version: 2.1

Add the orbs stanza below your version, invoking the orb:

1 2 orbs: k6: grafana/k6@1.1.3

Use k6 elements in your existing workflows and jobs.

Opt-in to use of uncertified orbs on your organization’s Security settings page.

Usage Examples

test_cloud

Executes a k6 test in the k6 Cloud. Ensure you set your K6_CLOUD_TOKEN on the CircleCI environment variables.

1 2 3 4 5 6 7 8 9 version: '2.1' orbs: grafana: grafana/k6@1.1.0 workflows: load_test: jobs: - grafana/k6: cloud: true script: tests/cloud-test.js

test_local

Executes a k6 load test or reliability test on the currently used runner.

1 2 3 4 5 6 7 8 version: '2.1' orbs: grafana: grafana/k6@1.1.0 workflows: load_test: jobs: - grafana/k6: script: tests/api-stressing.js

test_with_args

Executes a test with arguments supplied to the k6 CLI. Any argument with either a CLI flag or an environment variable can be used here. For a full list of options, see https://k6.io/docs/using-k6/options

1 2 3 4 5 6 7 8 9 version: '2.1' orbs: grafana: grafana/k6@1.1.0 workflows: load_test: jobs: - grafana/k6: arguments: '--env SOME_ENV_VAR=some-value --compatibility-mode=base' script: tests/some-test.js

Jobs

k6

Run a k6 test

Show job Source
PARAMETER
DESCRIPTION
REQUIRED
DEFAULT
TYPE
arguments
Any command-line arguments, or flags, that you would like to pass on to k6. For a full list of options, see https://k6.io/docs/using-k6/options.
No
''
string
cloud
Whether it runs the k6 test in the k6 Cloud. If true, set your K6_CLOUD_TOKEN on the CircleCI environment variables.
No
false
boolean
script
The path to your test script, relative to the current working directory
No
test.js
string
tag
Allows for overriding the tag used to pick a docker image for the k6 test job.
No
latest
string

Orb Source

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 # This code is licensed from CircleCI to the user under the MIT license. # See here for details: https://circleci.com/developer/orbs/licensing version: 2.1 description: | Run load tests and reliability tests using k6. This orb allows for running k6 tests locally on the runner and in the k6 Cloud. display: home_url: https://k6.io source_url: https://github.com/grafana/k6-circleci-orb jobs: k6: description: | Run a k6 test docker: - image: loadimpact/k6:<< parameters.tag >> parameters: arguments: default: "" description: | Any command-line arguments, or flags, that you would like to pass on to k6. For a full list of options, see https://k6.io/docs/using-k6/options. type: string cloud: default: false description: | Whether it runs the k6 test in the k6 Cloud. If true, set your K6_CLOUD_TOKEN on the CircleCI environment variables. type: boolean script: default: test.js description: | The path to your test script, relative to the current working directory type: string tag: default: latest description: Allows for overriding the tag used to pick a docker image for the k6 test job. type: string steps: - checkout - when: condition: << parameters.cloud >> steps: - run: command: | k6 cloud << parameters.script >> << parameters.arguments >> name: Execute cloud test - unless: condition: << parameters.cloud >> steps: - run: command: k6 run << parameters.script >> << parameters.arguments >> name: Local Execution - store_artifacts: path: /tmp/artifacts examples: test_cloud: description: | Executes a k6 test in the k6 Cloud. Ensure you set your K6_CLOUD_TOKEN on the CircleCI environment variables. usage: version: "2.1" orbs: grafana: grafana/k6@1.1.0 workflows: load_test: jobs: - grafana/k6: cloud: true script: tests/cloud-test.js test_local: description: | Executes a k6 load test or reliability test on the currently used runner. usage: version: "2.1" orbs: grafana: grafana/k6@1.1.0 workflows: load_test: jobs: - grafana/k6: script: tests/api-stressing.js test_with_args: description: | Executes a test with arguments supplied to the k6 CLI. Any argument with either a CLI flag or an environment variable can be used here. For a full list of options, see https://k6.io/docs/using-k6/options usage: version: "2.1" orbs: grafana: grafana/k6@1.1.0 workflows: load_test: jobs: - grafana/k6: arguments: --env SOME_ENV_VAR=some-value --compatibility-mode=base script: tests/some-test.js
Developer Updates
Get tips to optimize your builds
Or join our research panel and give feedback
By submitting this form, you are agreeing to ourTerms of UseandPrivacy Policy.