Could you share the pipeline definition (.gitlab-ci.yml) and the execution logs? If you can send a bit more instructions to reproduce what you are doing, we’ll might be able to help. If the handler runs in a container/VM that has k6 installed, maybe it’s the binary missing from the PATH, as Matt mentioned. However, it’s probably best to try and reproduce your example to see what is going on, and more information will help.
Hmmm. I don’t want to make any assumptions about your use case, but have you tried just installing k6 as a standard binary? That might be an easier approach. You could still use the docker version in your GitLab pipeline.
Unless I’m really incorrect, k6 can’t be a dependency for a node project. k6 scripts run in the k6 binary, which is written in Go. So they can’t run in a node environment. I’d thought that your node pipeline was maybe calling k6 processes, but now I think it’s maybe trying to use k6 directly in node. If I’m off here, please let me know what incorrect assumptions I’ve made!
I’m not sure what that npm package is. It looks like it’s a “dummy package for autocomplete”.
I’d just model your pipeline off of this configuration:
- echo "executing local k6 in k6 container..."
- k6 run ./loadtests/performance-test.js
As you’ll see, the pipeline itself calls k6 run. I guess you could store your scripts in the repo of the pipeline, and put all the configuration for your tests in the scripts, or through environment variables.
I need to install “k6” as package.json only.
Also, how can I install k6 as a dev dependency of a Node.js project ??
I don’t think that would work at all. k6 is really a Go application, you need to have the k6 binary.
But, I still think that you can install k6 in your container with your node application.
Are you trying to do something like this?
And, can you post the full (sanitized) pipeline? My guess is that the VM that runs node could also run k6. The only thing you couldn’t do is run k6 scripts in Node, since they use different JS engines.