From 28124cfbbe136acceae6c7d124a503e030d412ec Mon Sep 17 00:00:00 2001 From: Cacie Prins Date: Fri, 25 Jul 2025 13:05:44 -0400 Subject: [PATCH 1/4] fix: use a direct bash script instead of an intermediary node script to install cypress --- factory/factory.Dockerfile | 3 +-- factory/installScripts/cypress/default.sh | 13 ---------- .../cypress/install-cypress-version.js | 24 ------------------- factory/installScripts/cypress/install.sh | 16 +++++++++++++ 4 files changed, 17 insertions(+), 39 deletions(-) delete mode 100755 factory/installScripts/cypress/default.sh delete mode 100755 factory/installScripts/cypress/install-cypress-version.js create mode 100755 factory/installScripts/cypress/install.sh diff --git a/factory/factory.Dockerfile b/factory/factory.Dockerfile index d9c4d08dac..d575f73059 100644 --- a/factory/factory.Dockerfile +++ b/factory/factory.Dockerfile @@ -131,8 +131,7 @@ ONBUILD ARG CYPRESS_VERSION # This is only set if the cypress version is passed in (thats what the + syntax stuff does.) ONBUILD ENV NODE_PATH=${CYPRESS_VERSION:+/usr/local/lib/node_modules} -ONBUILD RUN node /opt/installScripts/cypress/install-cypress-version.js ${CYPRESS_VERSION} - +ONBUILD RUN /opt/installScripts/cypress/install.sh ${CYPRESS_VERSION} # Global Cleanup ONBUILD RUN apt-get purge -y --auto-remove \ curl \ diff --git a/factory/installScripts/cypress/default.sh b/factory/installScripts/cypress/default.sh deleted file mode 100755 index 7735412de9..0000000000 --- a/factory/installScripts/cypress/default.sh +++ /dev/null @@ -1,13 +0,0 @@ -#! /bin/bash - -# TODO: should typescript be versioned? Should it have it's own ARG for the factory? -# Typescript is installed to allow testing of .ts spec files. -npm install -g "cypress@${1}" typescript - -# Loosen file priveleges for the cypress cache. The first time that cypress runs it will create a -# binary_state.json file if it hasn't already been created. This was causing issues with non-root -# users, they do not have access to write to this directory. Since this is a develompent docker container -# and to lower barriers as much as possible, we are loosening privs to allow the binary_state.json file -# to be created. Previously this file was created by root when cypress verify was called, but this would -# apply to amd processors since cypress verify was not called on arm processors. -chmod -R 777 /root/.cache diff --git a/factory/installScripts/cypress/install-cypress-version.js b/factory/installScripts/cypress/install-cypress-version.js deleted file mode 100755 index 1c327f82e7..0000000000 --- a/factory/installScripts/cypress/install-cypress-version.js +++ /dev/null @@ -1,24 +0,0 @@ -#!/usr/bin/node -const { spawn } = require('child_process') - -const cypressVersion = process.argv.slice(2)[0] - -if (!cypressVersion) { - console.log('No Cypress version provided, skipping Cypress install') - process.exit(0) -} - -console.log('Installing Cypress version ', cypressVersion) - -// Insert logic here if needed to run a different install script based on cypress version. -const install = spawn(`${__dirname}/default.sh`, [cypressVersion], { stdio: 'inherit' }) - -install.on('error', function (error) { - console.log('child process errored with ' + error.toString()) - process.exit(1) -}) - -install.on('exit', function (code) { - console.log('child process exited with code ' + code.toString()) - process.exit(code) -}) diff --git a/factory/installScripts/cypress/install.sh b/factory/installScripts/cypress/install.sh new file mode 100755 index 0000000000..2b1efbc9f9 --- /dev/null +++ b/factory/installScripts/cypress/install.sh @@ -0,0 +1,16 @@ +#! /bin/bash +# TODO: should typescript be versioned? Should it have it's own ARG for the factory? +# Typescript is installed to allow testing of .ts spec files. +if [[ -n "$1" ]]; then + npm install -g "cypress@$1" typescript + + # Loosen file priveleges for the cypress cache. The first time that cypress runs it will create a + # binary_state.json file if it hasn't already been created. This was causing issues with non-root + # users, they do not have access to write to this directory. Since this is a develompent docker container + # and to lower barriers as much as possible, we are loosening privs to allow the binary_state.json file + # to be created. Previously this file was created by root when cypress verify was called, but this would + # apply to amd processors since cypress verify was not called on arm processors. + chmod -R 777 /root/.cache +else + echo 'No Cypress version provided; skipping install.' +fi \ No newline at end of file From a34c65634581bf1bfdf187666458038045fa0d2d Mon Sep 17 00:00:00 2001 From: Cacie Prins Date: Fri, 25 Jul 2025 13:27:23 -0400 Subject: [PATCH 2/4] exit immediately if cy fails to install --- factory/installScripts/cypress/install.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/factory/installScripts/cypress/install.sh b/factory/installScripts/cypress/install.sh index 2b1efbc9f9..0b81b41d41 100755 --- a/factory/installScripts/cypress/install.sh +++ b/factory/installScripts/cypress/install.sh @@ -1,4 +1,5 @@ #! /bin/bash +set -e # TODO: should typescript be versioned? Should it have it's own ARG for the factory? # Typescript is installed to allow testing of .ts spec files. if [[ -n "$1" ]]; then From 225da86f5e3526d8344f9f1871773714d220933c Mon Sep 17 00:00:00 2001 From: Cacie Prins Date: Fri, 25 Jul 2025 13:35:40 -0400 Subject: [PATCH 3/4] changelog, version bump --- factory/.env | 2 +- factory/CHANGELOG.md | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/factory/.env b/factory/.env index 602e5a7ff2..aceb3db7d6 100644 --- a/factory/.env +++ b/factory/.env @@ -18,7 +18,7 @@ NODE_VERSION="${FACTORY_DEFAULT_NODE_VERSION}" # Update the FACTORY_VERSION to deploy cypress/factory if you make changes to # BASE_IMAGE, FACTORY_DEFAULT_NODE_VERSION, YARN_VERSION, factory.Dockerfile or installScripts -FACTORY_VERSION='5.11.5' +FACTORY_VERSION='5.11.6' # Chrome versions: https://www.ubuntuupdates.org/package/google_chrome/stable/main/base/google-chrome-stable # Linux/amd64 only diff --git a/factory/CHANGELOG.md b/factory/CHANGELOG.md index 005fc8fe4f..5131a9cb22 100644 --- a/factory/CHANGELOG.md +++ b/factory/CHANGELOG.md @@ -1,5 +1,9 @@ # Change log +## 5.11.6 + +- Failed installs of Cypress no longer get cached as a docker layer. Addressed in [#1390](https://github.com/cypress-io/cypress-docker-images/pull/1390) + ## 5.11.5 - When importing PGP keys for Node.js, allow individual key imports to fail. Log an error and continue to build. Resolves an issue when there is a network connectivity problem to the fallback keyserver keyserver.ubuntu.com. Addressed in [#1385](https://github.com/cypress-io/cypress-docker-images/issues/1385). From 7bb2765f27b5b858a53f26df6fe12ca906369d07 Mon Sep 17 00:00:00 2001 From: Cacie Prins Date: Fri, 25 Jul 2025 13:46:08 -0400 Subject: [PATCH 4/4] Update install.sh --- factory/installScripts/cypress/install.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/factory/installScripts/cypress/install.sh b/factory/installScripts/cypress/install.sh index 0b81b41d41..5062698ff2 100755 --- a/factory/installScripts/cypress/install.sh +++ b/factory/installScripts/cypress/install.sh @@ -14,4 +14,4 @@ if [[ -n "$1" ]]; then chmod -R 777 /root/.cache else echo 'No Cypress version provided; skipping install.' -fi \ No newline at end of file +fi