1load_performance:
2  stage: performance
3  image: docker:19.03.11
4  allow_failure: true
5  variables:
6    DOCKER_TLS_CERTDIR: ""
7    K6_IMAGE: loadimpact/k6
8    K6_VERSION: 0.27.0
9    K6_TEST_FILE: github.com/loadimpact/k6/samples/http_get.js
10    K6_OPTIONS: ''
11    K6_DOCKER_OPTIONS: ''
12  services:
13    - docker:19.03.11-dind
14  script:
15    - |
16      if ! docker info &>/dev/null; then
17        if [ -z "$DOCKER_HOST" -a "$KUBERNETES_PORT" ]; then
18          export DOCKER_HOST='tcp://localhost:2375'
19        fi
20      fi
21    - docker run --rm -v "$(pwd)":/k6 -w /k6 $K6_DOCKER_OPTIONS $K6_IMAGE:$K6_VERSION run $K6_TEST_FILE --summary-export=load-performance.json $K6_OPTIONS
22  artifacts:
23    reports:
24      load_performance: load-performance.json
25  rules:
26    - if: '($CI_KUBERNETES_ACTIVE == null || $CI_KUBERNETES_ACTIVE == "") && ($KUBECONFIG == null || $KUBECONFIG == "")'
27      when: never
28    - if: '$LOAD_PERFORMANCE_DISABLED'
29      when: never
30    - if: '$CI_COMMIT_TAG || $CI_COMMIT_BRANCH'
31