cypress-io / cypress-docker-images

Docker images with Cypress dependencies and browsers

Home Page:https://on.cypress.io/continuous-integration

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Images probably missing the 'unzip' command

CamilleDrapier opened this issue · comments

As far as I understand, when installing Cypress, the post-install script will download and unzip the binaries necessary for running Cypress.

When using a "linux" image/computer, the post-install first tries to run the unzip command, and if that fails, tries to unzip the file with a unzip npm dependency.

When enabling the logs for this part of the post install, I always get this kind of log on my CI STDOUT:

2024-02-05T05:36:24.457Z cypress:cli:unzip unzipping from /tmp/cypress-273.zip
2024-02-05T05:36:24.458Z cypress:cli:unzip into /root/.cache/Cypress/13.6.2
2024-02-05T05:36:24.459Z cypress:cli:unzip zipFile entries count 21852
2024-02-05T05:36:24.459Z cypress:cli:unzip unzipping via `unzip`
2024-02-05T05:36:24.462Z cypress:cli:unzip unzip tool error: spawn unzip ENOENT
2024-02-05T05:36:24.462Z cypress:cli:unzip unzipping with node.js (slow)
2024-02-05T05:36:24.462Z cypress:cli:unzip calling Node extract tool /tmp/cypress-273.zip { dir: '/root/.cache/Cypress/13.6.2', onEntry: [Function: tick] }
2024-02-05T05:36:24.462Z cypress:cli:unzip unzip tool close with code -2
2024-02-05T05:36:24.463Z cypress:cli:unzip `unzip` failed { code: -2 }
2024-02-05T05:36:37.368Z cypress:cli:unzip node unzip finished
2024-02-05T05:36:37.370Z cypress:cli:unzip unzip completed { yauzlMs: 1, unzipMs: 12910 }

While it is not directly obvious what is wrong in this log, when running one of the recent images locally, I can confirm that the command is missing:

$ docker run -it cypress/browsers:node-20.11.0-chrome-121.0.6167.85-1-ff-120.0-edge-121.0.2277.83-1
root@651bd6990daf:/# unzip
bash: unzip: command not found

If I add the following to my CI script, then I do not have those errors anymore:

    - apt-get update
    - apt install unzip

The output of the log now becomes:

2024-02-05T05:57:09.555Z cypress:cli:unzip unzipping from /tmp/cypress-754.zip
2024-02-05T05:57:09.555Z cypress:cli:unzip into /root/.cache/Cypress/13.6.2
2024-02-05T05:57:09.557Z cypress:cli:unzip zipFile entries count 21852
2024-02-05T05:57:09.557Z cypress:cli:unzip unzipping via `unzip`
2024-02-05T05:57:14.576Z cypress:cli:unzip unzip tool close with code 0
2024-02-05T05:57:14.576Z cypress:cli:unzip unzip completed { yauzlMs: 2, unzipMs: 5019 }

Having this missing is not catastrophic as there is a fallback that will try to unzip with a npm dependency; but this fallback unzip can sometimes fail, and when this happens, it can lead to the command being stuck forever, or until the CI runner times out. (This issue is not directly related, but has been tracked here: cypress-io/cypress#28850)

Could the unzip be added to the Dockerfile of the recent/future images, please? Or am I misunderstanding how the cypress/browsers images are supposed to work/be-used?

@CamilleDrapier Yes, this seems reasonable. We'd be open to a PR to add this.

Thanks for reviewing and accepting the changes; I believe we can close this now 👍