I’m not deeply familiar with Gitlab CI, but couldn’t you start the New Relic container as part of the services key in the .gitlab-ci.yml? See their documentation for examples.
You should be able to specify all arguments and environment variables you need there, and then target the container in k6 with the StatsD environment variables. Though I’m unsure how Gitlab CI names the services or if you’ll have to reference it by IP, some testing is needed there.
hey, so I am not familiar with GitLab but if you can run the New Relic integration remotely and doesn’t need to be on your localhost. Have you tried that? I think it should work
This should in theory work by just pointing the output to a remote host running the New Relic StatsD integration.
Based at least on this guide and in the script section you would just have to append the script to be like K6_STATSD_ADDR=<AWS Public IP or hostname>:8125 k6 run ./loadtests/performance-test.js as that will override the localhost which is set by default.
I have just tried this by spinning up the integration on an AWS t2.micro to act as a relay between my k6 client on my laptop to output the metrics to New Relic StatsD running on the AWS instance, relaying those metrics into my New Relic account.
Here’s what I did:
Spin up an EC2 t2.micro, configure it. I used Amazon Linux 2.
Set a security policy that you can SSH into it to install the integration (port 22), allow incoming/outgoing traffic on port 8125 (StatsD)
Install Docker
sudo amazon-linux-extras install docker
sudo service docker start
sudo usermod -a -G docker ec2-user
sudo chkconfig docker on
@imiric@gspncr Thanks all for your inputs, appreciated that much. With some helps from devops team, I managed to make it work on Gitlab CI. So probably I post it here and anyone who may stuck like me could find a way out.
All right, so in my k6 project, I created a Dockerfile, something like this:
FROM peternguyentr/node-java-chrome:latest
ADD . / k6-test/
WORKDIR k6-test/
RUN CI=true
RUN npm install
Hi, team. Hope everyone is doing well. I am trying to integrate NewRelic-K6 with Gitlab and managed to install the docker container but when executing the script I am getting “K6 not found” error. Kindly help me with this. Attached the piepline and .gitlab-ci.yml file images for reference