Skip to content

Commit 2219302

Browse files
mydeaclaude
andcommitted
fix(ci): Set HOME=/root via GITHUB_ENV and fix E2E temp path
GHA strips -e flags from container options, so HOME can't be overridden that way. Instead, add a 'Fix HOME for root user' step that writes HOME=/root to GITHUB_ENV at the start of every container job. Firefox requires HOME to be owned by the current user (root), and GHA sets HOME=/github/home (owned by runner). Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 2770a2f commit 2219302

4 files changed

Lines changed: 27 additions & 7 deletions

File tree

.github/docker/playwright.Dockerfile

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,3 +29,9 @@ RUN sudo mkdir -p /opt/pw-browsers && \
2929
# Mark GitHub Actions workspace as safe for git (system-wide config so it
3030
# works regardless of HOME, which GHA overrides to /github/home).
3131
RUN sudo git config --system --add safe.directory '*'
32+
33+
# Ensure /root exists and is owned by root. When running as --user root,
34+
# Firefox requires HOME to be owned by the current user. GHA sets
35+
# HOME=/github/home (owned by runner), but we can't override it.
36+
# The workflow sets HOME=/root via a step, and this ensures /root is ready.
37+
RUN mkdir -p /root

.github/workflows/build.yml

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -500,7 +500,7 @@ jobs:
500500
credentials:
501501
username: ${{ github.actor }}
502502
password: ${{ secrets.GITHUB_TOKEN }}
503-
options: --ipc=host --user root -e HOME=/root
503+
options: --ipc=host --user root
504504
timeout-minutes: 25
505505
strategy:
506506
fail-fast: false
@@ -550,6 +550,8 @@ jobs:
550550
project: 'chromium'
551551

552552
steps:
553+
- name: Fix HOME for root user
554+
run: echo "HOME=/root" >> $GITHUB_ENV
553555
- name: Check out current commit (${{ needs.job_get_metadata.outputs.commit_label }})
554556
uses: actions/checkout@v6
555557
with:
@@ -604,7 +606,7 @@ jobs:
604606
credentials:
605607
username: ${{ github.actor }}
606608
password: ${{ secrets.GITHUB_TOKEN }}
607-
options: --ipc=host --user root -e HOME=/root
609+
options: --ipc=host --user root
608610
timeout-minutes: 15
609611
strategy:
610612
fail-fast: false
@@ -619,6 +621,8 @@ jobs:
619621
- loader_tracing_replay
620622

621623
steps:
624+
- name: Fix HOME for root user
625+
run: echo "HOME=/root" >> $GITHUB_ENV
622626
- name: Check out current commit (${{ needs.job_get_metadata.outputs.commit_label }})
623627
uses: actions/checkout@v6
624628
with:
@@ -824,13 +828,15 @@ jobs:
824828
credentials:
825829
username: ${{ github.actor }}
826830
password: ${{ secrets.GITHUB_TOKEN }}
827-
options: --ipc=host --user root -e HOME=/root
831+
options: --ipc=host --user root
828832
timeout-minutes: 15
829833
strategy:
830834
fail-fast: false
831835
matrix:
832836
node: [18, 20, 22, 24]
833837
steps:
838+
- name: Fix HOME for root user
839+
run: echo "HOME=/root" >> $GITHUB_ENV
834840
- name: Check out current commit (${{ needs.job_get_metadata.outputs.commit_label }})
835841
uses: actions/checkout@v6
836842
with:
@@ -928,7 +934,7 @@ jobs:
928934
credentials:
929935
username: ${{ github.actor }}
930936
password: ${{ secrets.GITHUB_TOKEN }}
931-
options: --ipc=host --user root -e HOME=/root
937+
options: --ipc=host --user root
932938
timeout-minutes: 15
933939
env:
934940
# We just use a dummy DSN here, only send to the tunnel anyhow
@@ -943,6 +949,8 @@ jobs:
943949
fail-fast: false
944950
matrix: ${{ fromJson(needs.job_e2e_prepare.outputs.matrix) }}
945951
steps:
952+
- name: Fix HOME for root user
953+
run: echo "HOME=/root" >> $GITHUB_ENV
946954
- name: Check out current commit (${{ needs.job_get_metadata.outputs.commit_label }})
947955
uses: actions/checkout@v6
948956
with:
@@ -1053,7 +1061,7 @@ jobs:
10531061
credentials:
10541062
username: ${{ github.actor }}
10551063
password: ${{ secrets.GITHUB_TOKEN }}
1056-
options: --ipc=host --user root -e HOME=/root
1064+
options: --ipc=host --user root
10571065
timeout-minutes: 15
10581066
env:
10591067
E2E_TEST_AUTH_TOKEN: ${{ secrets.E2E_TEST_AUTH_TOKEN }}
@@ -1069,6 +1077,8 @@ jobs:
10691077
matrix: ${{ fromJson(needs.job_e2e_prepare.outputs.matrix-optional) }}
10701078

10711079
steps:
1080+
- name: Fix HOME for root user
1081+
run: echo "HOME=/root" >> $GITHUB_ENV
10721082
- name: Check out current commit (${{ needs.job_get_metadata.outputs.commit_label }})
10731083
uses: actions/checkout@v6
10741084
with:

.github/workflows/canary.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ jobs:
7777
credentials:
7878
username: ${{ github.actor }}
7979
password: ${{ secrets.GITHUB_TOKEN }}
80-
options: --ipc=host --user root -e HOME=/root
80+
options: --ipc=host --user root
8181
timeout-minutes: 20
8282
env:
8383
# We just use a dummy DSN here, only send to the tunnel anyhow
@@ -145,6 +145,8 @@ jobs:
145145
label: 'nestjs-microservices (latest)'
146146

147147
steps:
148+
- name: Fix HOME for root user
149+
run: echo "HOME=/root" >> $GITHUB_ENV
148150
- name: Check out current commit
149151
uses: actions/checkout@v6
150152
with:

.github/workflows/flaky-test-detector.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,12 +45,14 @@ jobs:
4545
credentials:
4646
username: ${{ github.actor }}
4747
password: ${{ secrets.GITHUB_TOKEN }}
48-
options: --ipc=host --user root -e HOME=/root
48+
options: --ipc=host --user root
4949
timeout-minutes: 60
5050
name: 'Check tests for flakiness'
5151
# Also skip if PR is from master -> develop
5252
if: ${{ github.base_ref != 'master' && github.ref != 'refs/heads/master' }}
5353
steps:
54+
- name: Fix HOME for root user
55+
run: echo "HOME=/root" >> $GITHUB_ENV
5456
- name: Check out current branch
5557
uses: actions/checkout@v6
5658
- name: Set up Node

0 commit comments

Comments
 (0)