Missing dependency for common cypress/included usage
Summary
When using a recommended tool (start-server-and-test
node module, available here), an error is encountered in cypress/included
- the ps
command is unavailable, as it has not been installed. This is necessary to be installed so that a server's startup can be waited upon until it is ready. For example, in the official cypress/base:16.16.0
, ps
is installed: https://github.com/cypress-io/cypress-docker-images/blob/master/base/16.16.0/Dockerfile#L21, and since the official cypress/included
is an extension of cypress/browsers
and thus cypress/base
, it also has this command available.
Steps to reproduce
Try using the start-server-and-test
node module referenced in the cypress documentation here: https://docs.cypress.io/guides/continuous-integration/introduction#Solutions in a Jenkins pipeline with a kubernetes agent and the cypress container selected via container(). For example:
...
stage("test") {
steps {
container("cypress") {
sh 'npx start-server-and-test start :3000 "cypress run"'
}
}
}
...
This will attempt to run npm start
and then wait until port 3000 returns 200. Once it returns 200, cypress run
will be executed.
What is the current bug behavior?
An issue is encountered with cypress/included that is documented here: https://github.com/cypress-io/cypress-docker-images/issues/644.
What is the expected correct behavior?
When using the container as an agent in a pipeline, it should be possible to use start-server-and-test
.
Relevant logs and/or screenshots
Cypress Version: 12.3.0
node:events:491
throw er; // Unhandled 'error' event
^
Error: spawn ps ENOENT
at ChildProcess._handle.onexit (node:internal/child_process:283:19)
at onErrorNT (node:internal/child_process:476:16)
at process.processTicksAndRejections (node:internal/process/task_queues:82:21)
Emitted 'error' event on ChildProcess instance at:
at ChildProcess._handle.onexit (node:internal/child_process:289:12)
at onErrorNT (node:internal/child_process:476:16)
at process.processTicksAndRejections (node:internal/process/task_queues:82:21) {
errno: -2,
code: 'ENOENT',
syscall: 'spawn ps',
path: 'ps',
spawnargs: [ '-A', '-o', 'ppid,pid,stat,comm' ]
}
Node.js v18.13.0
Possible fixes
Install procps
in cypress/included
images.
Tasks
-
Bug has been identified and corrected within the container