Skip to content

bench-playwright image: set K6_BROWSER_EXECUTABLE_PATH or symlink chromium #949

@RafaelPaulovic

Description

@RafaelPaulovic

Problem

The grafana-bench-playwright image bundles chromium via the Playwright base image (mcr.microsoft.com/playwright), but k6's browser module can't auto-detect it because the binary lives at a non-standard, version-dependent path like /ms-playwright/chromium-1208/chrome-linux/chrome.

This forces every consumer to hardcode the path via K6_BROWSER_EXECUTABLE_PATH, and the path changes with each Playwright version bump (e.g., chromium-1193 in v0.6.11 → chromium-1208 in v1.0.7).

Similarly, K6_BROWSER_ARGS needs to include no-sandbox,disable-dev-shm-usage,disable-gpu for Chrome to run in containers — the official k6 Docker image sets these by default but the playwright image doesn't since it uses a different base.

Suggestion

Set these in the Dockerfile so consumers get a working setup out of the box:

# Symlink chromium to a stable path so k6 can auto-detect it
RUN ln -s /ms-playwright/chromium-*/chrome-linux/chrome /usr/local/bin/chromium

# Or alternatively, set the env vars directly
ENV K6_BROWSER_EXECUTABLE_PATH=/ms-playwright/chromium-*/chrome-linux/chrome
ENV K6_BROWSER_ARGS=headless=new,no-sandbox,disable-dev-shm-usage,disable-gpu

A symlink with a glob at build time would be the most resilient since it resolves the version-dependent path once during docker build.

Context

We hit this in deployment_tools while setting up k6 browser tests for RRC graceful degradation (grafana/deployment_tools#538742, grafana/deployment_tools#542615). Currently we maintain the chromium path as a variable in the Jsonnet config that must be updated alongside the bench version.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions