summaryrefslogtreecommitdiff
path: root/lib/gitlab/ci/templates/Jobs/Load-Performance-Testing.gitlab-ci.yml
blob: 12105e0e95d0b97b6649c723b006bb0545330968 (plain)
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
load_performance:
  stage: performance
  image: docker:20.10.12
  allow_failure: true
  variables:
    DOCKER_TLS_CERTDIR: ""
    K6_IMAGE: grafana/k6
    K6_VERSION: 0.41.0
    K6_TEST_FILE: raw.githubusercontent.com/grafana/k6/master/samples/http_get.js
    K6_OPTIONS: ''
    K6_DOCKER_OPTIONS: ''
  services:
    - name: 'docker:20.10.12-dind'
      command: ['--tls=false', '--host=tcp://0.0.0.0:2375']
  script:
    - |
      if ! docker info &>/dev/null; then
        if [ -z "$DOCKER_HOST" ] && [ -n "$KUBERNETES_PORT" ]; then
          export DOCKER_HOST='tcp://localhost:2375'
        fi
      fi
    - 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
  artifacts:
    reports:
      load_performance: load-performance.json
  rules:
    - if: '($CI_KUBERNETES_ACTIVE == null || $CI_KUBERNETES_ACTIVE == "") && ($KUBECONFIG == null || $KUBECONFIG == "")'
      when: never
    - if: '$LOAD_PERFORMANCE_DISABLED'
      when: never
    - if: '$CI_COMMIT_TAG || $CI_COMMIT_BRANCH'