Skip to content

ci: remove sudo from playwright-e2e-tests container action#6143

Merged
eamonnmoloney merged 1 commit into
mainfrom
fix/playwright-action-sudo-removal
Jun 24, 2026
Merged

ci: remove sudo from playwright-e2e-tests container action#6143
eamonnmoloney merged 1 commit into
mainfrom
fix/playwright-action-sudo-removal

Conversation

@eamonnmoloney

Copy link
Copy Markdown
Contributor

Summary

  • Remove sudo from all commands in the playwright-e2e-tests action's Install system dependencies step — the playwright-runner container runs as root, but sudo is not installed
  • Disable build-essential-enabled in the common-tooling step — prevents the external action from running sudo apt install build-essential, which also fails in the container and is not needed for Playwright tests

Root Cause

The playwright-runner:latest container (ghcr.io/camunda/team-distribution/playwright-runner) is launched with --user root but does not include the sudo package. When the action runs sudo apt-get update, it fails with sudo: command not found.

Two code paths triggered this:

  1. Our Install system dependencies step (lines 74-94) — all sudo calls replaced with direct commands
  2. The external common-tooling action — when build-essential-enabled: "true", it runs sudo apt install build-essential internally. Changed to "false" since Playwright tests don't compile native npm modules

Testing

  • The test-local-template.yaml workflow is not affected — it runs on gcp-core-8-release self-hosted runners where sudo is available
  • The check-tools guard (lines 110-116) skips the common-tooling step entirely if helm and kubectl are pre-installed, but the current playwright-runner image does not include them

@eamonnmoloney eamonnmoloney requested a review from a team as a code owner May 13, 2026 05:29
@eamonnmoloney eamonnmoloney requested review from Copilot and jessesimpson36 and removed request for a team May 13, 2026 05:29

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates the .github/actions/playwright-e2e-tests composite action to run correctly inside the ghcr.io/camunda/team-distribution/playwright-runner:latest container, where the job runs as root but sudo is not installed.

Changes:

  • Remove sudo from the apt-get/rm/sed commands in the “Install system dependencies” step.
  • Disable build-essential-enabled in the common-tooling action invocation to avoid internal sudo apt install build-essential calls.

@hisImminence hisImminence force-pushed the fix/playwright-action-sudo-removal branch from 60e436c to 533b85a Compare May 21, 2026 16:53
@hisImminence hisImminence requested review from hisImminence and removed request for jessesimpson36 May 21, 2026 17:00

@hisImminence hisImminence left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

crev review

Specialists run: correctness, devils-advocate. Devil's-advocate hypotheses: 0 raised, 0 promoted.


# Install gettext for envsubst command used by render-e2e-env.sh
# Note: no sudo — containers run as root, and sudo may not be installed.
if command -v apt-get &> /dev/null; then

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 · Unconditional sudo removal breaks non-root bare-runner callers (via devils-advocate)

The bare apt-get calls (without sudo) will fail with 'permission denied' if this composite action is ever invoked outside a root container — for example, from a GitHub-hosted runner (ubuntu-latest runs as a non-root user) or a self-hosted runner that doesn't use the playwright-runner image. The current callers both specify options: --user root, so this is safe today. But the action itself carries no guard limiting it to root-only environments. A future caller that omits --user root would get a silent permission failure partway through the retry loop. Recommendation: either (a) add a root-check at the top of the step (if [ "$(id -u)" -eq 0 ]; then apt-get ...; else sudo apt-get ...; fi), or (b) document in the action's description field that it requires a root execution context.

            apt-get update && apt-get install -y gettext-base

echo "Switching to alternative Ubuntu mirror..."
sudo sed -i 's|http://archive.ubuntu.com|http://mirrors.edge.kernel.org|g' /etc/apt/sources.list 2>/dev/null || true
sudo sed -i 's|http://security.ubuntu.com|http://mirrors.edge.kernel.org|g' /etc/apt/sources.list 2>/dev/null || true
sed -i 's|http://archive.ubuntu.com|http://mirrors.edge.kernel.org|g' /etc/apt/sources.list 2>/dev/null || true

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 · Mirror-fallback sed targets /etc/apt/sources.list, which is empty on Debian bookworm (node:24-slim base) (via correctness)

The playwright-runner image is built FROM node:24-slim (Debian 12/bookworm). Debian 12 moved to DEB822 format: the active APT source is /etc/apt/sources.list.d/debian.sources, not /etc/apt/sources.list. The file /etc/apt/sources.list is present but empty, so the sed substitution on lines 94–95 silently no-ops (saved by || true) and the mirror switch never takes effect. The retry-on-mirror-failure logic is therefore non-functional on the primary container target. In practice impact is low because the envsubst early-exit guard means this block rarely runs, but the fallback is misleading and will silently fail if ever reached on a Debian 12 host. Recommendation: add a sed targeting /etc/apt/sources.list.d/debian.sources alongside the existing one, or replace both with a write that creates a fresh DEB822 sources entry pointing at the kernel.org mirror.

                sed -i 's|http://archive.ubuntu.com|http://mirrors.edge.kernel.org|g' /etc/apt/sources.list 2>/dev/null || true

@@ -119,7 +120,7 @@ runs:
uses: camunda/infra-global-github-actions/common-tooling@28e9ac0ffb3c71c7a1aaa989d5abdad0738c0436 # main
with:

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 · build-essential disabled on the fallback bare-runner path with node-enabled: true (via devils-advocate)

The check-tools guard means this common-tooling step only executes when helm and kubectl are absent — i.e., on a bare runner lacking the pre-built playwright-runner image. On that path, node-enabled: true is still set. All current package.json files under charts/*/test/e2e/ use only pure-JS deps (@playwright/test, dotenv, typescript-eslint), so disabling build-essential is safe today. However, if @camunda/e2e-test-suite (currently pulled as latest) ever introduces a native addon, the bare-runner path will fail with a cryptic node-gyp error. Recommendation: pin @camunda/e2e-test-suite to a non-latest version so any future native-dep introduction is a visible diff, or add a brief comment explaining why native compilation is not needed.

        build-essential-enabled: "false"

@CLAassistant

CLAassistant commented May 31, 2026

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

The playwright-runner container runs as root but does not have sudo
installed, causing 'sudo: command not found' failures in CI.

- Replace sudo with direct commands in apt-get/rm/sed calls
- Disable build-essential-enabled in common-tooling (prevents sudo
  apt install build-essential, which Playwright tests don't need)
@eamonnmoloney eamonnmoloney force-pushed the fix/playwright-action-sudo-removal branch from 533b85a to c82208f Compare June 23, 2026 08:38
@eamonnmoloney eamonnmoloney added this pull request to the merge queue Jun 23, 2026
@github-merge-queue github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Jun 23, 2026
@eamonnmoloney eamonnmoloney added this pull request to the merge queue Jun 23, 2026
@github-merge-queue github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Jun 23, 2026
@eamonnmoloney eamonnmoloney added this pull request to the merge queue Jun 24, 2026
Merged via the queue into main with commit 5d6923a Jun 24, 2026
269 checks passed
@eamonnmoloney eamonnmoloney deleted the fix/playwright-action-sudo-removal branch June 24, 2026 05:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants