Running K6 The moduleSpecifier couldn't be found on local disk

Hi

I am just going through the K6/GitLab integration, we are running self-hosted premium . I’ve ran K6 before, just not directly within GitLab. I’m looking at these docs and have a very basic setup

- performance
   - performance.js
.gitlab-ci.yml

This is my ci file

stages:
  - performance

include:
  template: Verify/Load-Performance-Testing.gitlab-ci.yml

workflow:
  rules:
    - if: '$CI_PIPELINE_SOURCE == "schedule"'
      when: always
    - when: never  

load_performance:
  stage: performance
  variables:
    K6_TEST_FILE: performance/performance.js

When it runs though I get the following:

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
...
 Init   [--------------------------------------] runner
time="2021-07-23T11:07:00Z" level=error msg="The moduleSpecifier \"./performance/performance.js\" couldn't be found on local disk. Make sure that you've specified the right path to the file. If you're running k6 using the Docker image make sure you have mounted the local directory (-v /local/path/:/inside/docker/path) containing your script and modules so that they're accessible by k6 from inside of the container, see https://k6.io/docs/using-k6/modules#using-local-modules-with-docker."
  • I’ve confirmed the performance folder and file are mounted.
  • I’ve ran a multitude of variants of the K6_TEST_FILE property
    • /k6/performance/performance.js
    • ./performance/performance.js
    • //k6/performance/performance.js
  • I’ve also ran the same docker run cmd in my machine
 docker run --rm -v "$(pwd)":/k6 -w /k6 loadimpact/k6:master run performance/performance.js

          /\      |‾‾| /‾‾/   /‾‾/
     /\  /  \     |  |/  /   /  /
    /  \/    \    |     (   /   ‾‾\
   /          \   |  |\  \ |  (‾)  |
  / __________ \  |__| \__\ \_____/ .io

  execution: local
     script: performance/performance.js
     output: -

  scenarios: (100.00%) 1 scenario, 500 max VUs, 6m0s max duration (incl. graceful stop):

seems to work fine. So I’m not sure what right way forward is for this, I see the gitlab example the k6 guys have doesn’t utilize the your builtin include stuff. Which I’m sure would work, however, it would be nice to use the builtin stuff

1 Like

Hey @jonny7, I’m stuck with the exact same problem. Just curious if you figured it out. Thanks!

Experiencing the same issue.

@jonny7 @mikeBk have you found any solution for this?