Run xk6 browser in Buildkite pipeline throws panic error

Hi xk6 team,

Good day,

Anyone who tried running xk6 browser using buildkite pipeline or do we have an example of it? i tried to run using buildkite but seeing an error as below, although running with local using docker works fine and looks good. thanks. Below are the screenshots for panic error:


Sometimes, when running the build, it just throws nothing… and needs to cancel the build since it runs already long enough. Below is a screenshot of a canceled build after 15mins of running and still nothing happens.

Note: Same setup (buildkite config) in running my k6 API scripts and no errors so far. Error happens when running xk6 browser.

1 Like

Hi @markxk6,

Can you send us:

  1. The version of xk6-browser you are running;
  2. The dockerfile/docker-compose file you are using to create the image;
  3. The test file itself;
  4. The BuiltKite configuration file (if there is one).

I’ve not used BuildKite before, but I’m hoping I can still be of help.

Cheers,
Ankur

1 Like

Hi @ankur

Sorry for the late reply,

Here’s the sample dockerfile used for the image:

FROM golang:1.17-alpine as builder
WORKDIR "$GOPATH"/src/go.k6.io/k6

RUN apk --no-cache add git &&\
    go install -trimpath go.k6.io/xk6/cmd/xk6@latest &&\
    xk6 build --output xk6-browser --with github.com/grafana/xk6-browser &&\
    cp xk6-browser "$GOPATH"/bin/k6

FROM alpine:3.16

# Installs latest Chromium package.
RUN apk upgrade --no-cache --available \
    && apk add --no-cache \
      ca-certificates  \
      chromium \
      ttf-freefont \
      font-noto-emoji \
    && apk add --no-cache \
      --repository=https://dl-cdn.alpinelinux.org/alpine/edge/testing \
      font-wqy-zenhei

COPY local.conf /etc/fonts/local.conf

RUN adduser -D -u 12345 -g 12345 k6

# Add Chrome as a user
RUN mkdir -p /usr/src/app \
    # && adduser -D chrome \
    && chown -R 12345:12345 /usr/src/app

RUN apk add curl

RUN apk add chromium

COPY --from=builder /go/bin/k6 /usr/bin/k6

USER 12345

ENV CHROME_BIN=/usr/bin/chromium-browser \
    CHROME_PATH=/usr/lib/chromium/

CMD ["bash"]

Docker compose file:

version: '2.2'
services:
  xk6:
    image: test/sre-k6:1.0.0
    container_name: k6
    command: k6 run --out statsd -e configs=${IUX_ENV} -e username=${USERNAME} -e password=${PASSWORD} /k6/xk6/${FILENAME}.js
    volumes:
      - '${PWD}:/k6'
    environment:
      - K6_STATSD_NAMESPACE=${K6_TEST_ID}
    depends_on:
      statsd:
        condition: service_healthy
    network_mode: host

Buildkite script:

#!/bin/bash

set -euo pipefail

IUX_ENV=$(buildkite-agent meta-data get iux_env)
FILENAME=$(buildkite-agent meta-data get script)
K6_TEST_ID="k6.${typeHere}."

PIPELINE="
  env:
    FILENAME: $filename
    IUX_ENV: '$env_here'
    K6_TEST_ID: $K6_testID
    
  steps:
    - label: 'Performance Test'
      plugins:
        - seek-oss/aws-sm#v2.3.1:
            env:
              USERNAME: 'xxusernamexx'
              PASSWORD: 'xxpasswordxx'         
        - docker-compose#v3.9.0:
            run: xk6
            config:
              - ./docker-compose-xk6.yml
      agents:
        queue: xxagentxx
"
echo "$PIPELINE" | buildkite-agent pipeline upload

@ankur

That is the same setup for our API k6 scripts which runs smoothly in Buildkite. The setup is working as well when we run those scripts in our local (xk6-browser). The issue happens when we build a test for xk6-browser (UI) using Buildkite.

Thanks a lot

When i re-run the scripts, it throws this error SIGILL: illegal instruction

and another error is [signal SIGSEGV: segmentation violation code=0x1 addr=0x8 pc=0x8]