cypress-io / cypress-docker-images

Docker images with Cypress dependencies and browsers
https://on.cypress.io/continuous-integration
MIT License
1.01k stars 376 forks source link

fix: remove obsolete environment variable npm_config_unsafe_perm #1078

Closed MikeMcC399 closed 1 month ago

MikeMcC399 commented 1 month ago

Issue

https://github.com/cypress-io/cypress-docker-images/blob/b32255e644878bdbdf88e209f827c2ae47e24095/factory/factory.Dockerfile#L14-L15 sets an environment variable:

npm_config_unsafe_perm: true

This environment variable is obsolete.

Background

The lowest supported Node.js version is Node.js 18.0.0 which bundles npm 8.6.0. (See Node.js Release schedule.)

The npm CHANGELOG 7.0.0 > All Lifecycle Scripts says:

The user, group, uid, gid, and unsafe-perms configurations are no longer relevant. When npm is run as root, scripts are always run with the effective uid and gid of the working directory owner.

The environment variable npm_config_unsafe_perm is no longer needed or used, since the current lowest supported version of npm (8.6.0) is higher than the version where its used was removed (7.0.0). Even considering Node.js 16.0.0 the lowest npm version is 7.10.0, which is already higher than the version where unsafe_perm was removed.

Change

Remove the environment variable npm_config_unsafe_perm from the factory/factory.Dockerfile file.

Bump FACTORY_VERSION.

Verification

cd factory
docker compose build factory
docker compose build
cd test-project
set -a && . ../.env && set +a
docker compose run test-factory-all-included
docker compose run test-factory-cypress-included-electron-non-root-user
cypress-app-bot commented 1 month ago
MikeMcC399 commented 1 month ago
  1) Aliasing
       .as() - alias a route for later use:

      Timed out retrying after 4000ms
      + expected - actual

      -502
      +200