pnpm / pnpm/action-setup

EACCES: permission denied when running in a container w/ non-default user

Open
#98 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
1.3k
Forks
217
Avg merge
8h 42m
Merged PRs (30d)
1

Description

Cypress docs recommend that if you want to run in a container, you use

container:
   image: cypress/browsers:latest
   options: --user 1001

in your job.

However, this results in a permissions error w/ the pnpm/action-setup github action:

Run pnpm/action-setup@v2
  with:
    version: 8
    dest: ~/setup-pnpm
    run_install: null
    package_json_file: package.json
/usr/local/bin/docker exec  6686201126ed5c34125a267c0082d372fd0e529f00478b06bffe9160dc7665b9 sh -c "cat /etc/*release | grep ^ID"
Error: EACCES: permission denied, open '/__w/_temp/_runner_file_commands/save_state_c75dc5bb-ff9a-48d3-a0fe-ce5c45a0281e'
    at Object.openSync (node:fs:590:3)
    at Object.writeFileSync (node:fs:2202:35)
    at Object.appendFileSync (node:fs:2264:6)
    at Object.issueFileCommand (/__w/_actions/pnpm/action-setup/v2/dist/index.js:1:13826)
    at saveState (/__w/_actions/pnpm/action-setup/v2/dist/index.js:1:11983)
    at main (/__w/_actions/pnpm/action-setup/v2/dist/index.js:1:426)
    at Object.9450 (/__w/_actions/pnpm/action-setup/v2/dist/index.js:1:540)
    at __nccwpck_require__ (/__w/_actions/pnpm/action-setup/v2/dist/index.js:10:34263)
    at /__w/_actions/pnpm/action-setup/v2/dist/index.js:10:34448
    at Object.<anonymous> (/__w/_actions/pnpm/action-setup/v2/dist/index.js:10:34492) {
  errno: -13,
  syscall: 'open',
  code: 'EACCES',
  path: '/__w/_temp/_runner_file_commands/save_state_c75dc5bb-ff9a-48d3-a0fe-ce5c45a0281e'
}
Error: Error: EACCES: permission denied, open '/__w/_temp/_runner_file_commands/save_state_c75dc5bb-ff9a-48d3-a0fe-ce5c45a0281e'

Removing options: --user 1001 solves this, but goes against Cypress's advice regarding permissions.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the reported workflow with the Cypress container and options: --user 1001, then inspect dist/index.js around the saveState call and the /__w/_temp/_runner_file_commands path. Done means pnpm/action-setup@v2 completes successfully for the non-default container user without the reported EACCES error.

Written by the indexing model from the issue text.

Assessment

Tech stack
docker, github-actions, nodejs, typescript
Domain
ci-cd
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.