From 81d497ce1fb7cbe80a3c704d594fc402bf6c7c3b Mon Sep 17 00:00:00 2001 From: George Kalpakas Date: Mon, 11 Dec 2017 16:27:29 +0200 Subject: [PATCH] build: pin ChromeDriver version (#20940) Since our version of Chromium is also pinned, a new ChromeDriver (that drops support for our Chromium version) can cause random (and unrelated to the corresponding changes) errors on CI. This commit pins the version of ChromeDriver and it should now be manually upgraded to a vrsion that is compatible with th currently used Chromium version. PR Close #20940 --- aio/package.json | 2 +- aio/tools/examples/run-example-e2e.js | 6 ++++-- aio/tools/examples/shared/package.json | 2 +- integration/dynamic-compiler/package.json | 2 +- integration/hello_world__closure/package.json | 2 +- integration/hello_world__systemjs_umd/package.json | 2 +- integration/i18n/package.json | 2 +- package.json | 3 ++- packages/platform-server/integrationtest/package.json | 2 +- scripts/ci/env.sh | 3 ++- scripts/ci/install.sh | 2 +- 11 files changed, 16 insertions(+), 12 deletions(-) diff --git a/aio/package.json b/aio/package.json index 3f395f3672..203e3d4099 100644 --- a/aio/package.json +++ b/aio/package.json @@ -56,7 +56,7 @@ "~~check-env": "node scripts/check-environment", "~~build": "ng build --target=production --environment=stable -sm", "post~~build": "yarn sw-manifest && yarn sw-copy", - "~~update-webdriver": "webdriver-manager update --standalone false --gecko false" + "~~update-webdriver": "webdriver-manager update --standalone false --gecko false $CHROMEDRIVER_VERSION_ARG" }, "engines": { "node": ">=8.9.1 <9.0.0", diff --git a/aio/tools/examples/run-example-e2e.js b/aio/tools/examples/run-example-e2e.js index 3783744184..3cacd7573c 100644 --- a/aio/tools/examples/run-example-e2e.js +++ b/aio/tools/examples/run-example-e2e.js @@ -200,8 +200,10 @@ function runProtractorAoT(appDir, outputFile) { // All protractor output is appended to the outputFile. // CLI version function runE2eTestsCLI(appDir, outputFile) { - // --preserve-symlinks is needed due the symlinked node_modules in each example - const e2eSpawn = spawnExt('yarn', ['e2e', '--preserve-symlinks'], { cwd: appDir }); + // `--preserve-symlinks` is needed due the symlinked `node_modules/` in each example. + // `--no-webdriver-update` is needed to preserve the ChromeDriver version already installed. + const args = ['e2e', '--preserve-symlinks', '--no-webdriver-update']; + const e2eSpawn = spawnExt('yarn', args, { cwd: appDir }); return e2eSpawn.promise.then( function () { fs.appendFileSync(outputFile, `Passed: ${appDir}\n\n`); diff --git a/aio/tools/examples/shared/package.json b/aio/tools/examples/shared/package.json index 3e17b7ac7d..6ed6c84ad3 100644 --- a/aio/tools/examples/shared/package.json +++ b/aio/tools/examples/shared/package.json @@ -6,7 +6,7 @@ "scripts": { "http-server": "http-server", "protractor": "protractor", - "webdriver:update": "webdriver-manager update --standalone false --gecko false", + "webdriver:update": "webdriver-manager update --standalone false --gecko false $CHROMEDRIVER_VERSION_ARG", "postinstall": "yarn webdriver:update" }, "keywords": [], diff --git a/integration/dynamic-compiler/package.json b/integration/dynamic-compiler/package.json index 59b2de6980..24c178f7e0 100644 --- a/integration/dynamic-compiler/package.json +++ b/integration/dynamic-compiler/package.json @@ -10,7 +10,7 @@ "ngc": "ngc -p tsconfig.json", "rollup": "rollup -f iife -c rollup.config.js -o dist/bundle.es2015.js", "rollup:lazy": "rollup -f cjs -c rollup.lazy.config.js -o dist/lazy.bundle.es2015.js", - "postinstall": "webdriver-manager update --gecko false", + "postinstall": "webdriver-manager update --gecko false --standalone false $CHROMEDRIVER_VERSION_ARG", "preprotractor": "tsc -p e2e", "protractor": "protractor e2e/protractor.config.js", "serve": "lite-server -c e2e/browser.config.json", diff --git a/integration/hello_world__closure/package.json b/integration/hello_world__closure/package.json index 22d868e828..6d34a2accb 100644 --- a/integration/hello_world__closure/package.json +++ b/integration/hello_world__closure/package.json @@ -22,7 +22,7 @@ "protractor": "file:../../node_modules/protractor" }, "scripts": { - "postinstall": "webdriver-manager update --gecko false", + "postinstall": "webdriver-manager update --gecko false --standalone false $CHROMEDRIVER_VERSION_ARG", "closure": "java -jar node_modules/google-closure-compiler/compiler.jar --flagfile closure.conf", "test": "ngc && yarn run closure && concurrently \"yarn run serve\" \"yarn run protractor\" --kill-others --success first", "serve": "lite-server -c e2e/browser.config.json", diff --git a/integration/hello_world__systemjs_umd/package.json b/integration/hello_world__systemjs_umd/package.json index e5343ee304..cf411ebe0a 100644 --- a/integration/hello_world__systemjs_umd/package.json +++ b/integration/hello_world__systemjs_umd/package.json @@ -4,7 +4,7 @@ "version": "0.0.0", "license": "MIT", "scripts": { - "postinstall": "webdriver-manager update --gecko false", + "postinstall": "webdriver-manager update --gecko false --standalone false $CHROMEDRIVER_VERSION_ARG", "test": "concurrently \"npm run serve\" \"npm run protractor\" --kill-others --success first", "serve": "lite-server -c bs-config.e2e.json", "preprotractor": "tsc -p e2e", diff --git a/integration/i18n/package.json b/integration/i18n/package.json index 24aa5395b1..616e5cb025 100644 --- a/integration/i18n/package.json +++ b/integration/i18n/package.json @@ -22,7 +22,7 @@ "protractor": "file:../../node_modules/protractor" }, "scripts": { - "postinstall": "webdriver-manager update --gecko false", + "postinstall": "webdriver-manager update --gecko false --standalone false $CHROMEDRIVER_VERSION_ARG", "closure": "java -jar node_modules/google-closure-compiler/compiler.jar --flagfile closure.conf", "test": "ngc && yarn run closure && concurrently \"yarn run serve\" \"yarn run protractor\" --kill-others --success first", "serve": "lite-server -c e2e/browser.config.json", diff --git a/package.json b/package.json index 616b4e97e6..bd43ffb770 100644 --- a/package.json +++ b/package.json @@ -18,7 +18,8 @@ "scripts": { "buildifier": "bazel build @com_github_bazelbuild_buildtools//buildifier && find . -type f \\( -name BUILD -or -name BUILD.bazel \\) ! -path \"*/node_modules/*\" | xargs $(bazel info bazel-bin)/external/com_github_bazelbuild_buildtools/buildifier/buildifier", "preinstall": "node -e \"if(process.env.npm_execpath.indexOf('yarn') === -1) throw new Error('Please use Yarn instead of NPM to install dependencies. See: https://yarnpkg.com/lang/en/docs/install/')\"", - "postinstall": "webdriver-manager update --gecko false", + "postinstall": "yarn update-webdriver", + "update-webdriver": "webdriver-manager update --gecko false $CHROMEDRIVER_VERSION_ARG", "check-env": "gulp check-env" }, "dependencies": { diff --git a/packages/platform-server/integrationtest/package.json b/packages/platform-server/integrationtest/package.json index 9471392bc0..81b1c8c698 100644 --- a/packages/platform-server/integrationtest/package.json +++ b/packages/platform-server/integrationtest/package.json @@ -33,7 +33,7 @@ "webpack": "^2.2.1" }, "scripts": { - "postinstall": "webdriver-manager update --gecko false", + "postinstall": "webdriver-manager update --gecko false --standalone false $CHROMEDRIVER_VERSION_ARG", "build": "./build.sh", "test": "npm run build && concurrently \"npm run serve\" \"npm run protractor\" --kill-others --success first", "serve": "node built/server-bundle.js", diff --git a/scripts/ci/env.sh b/scripts/ci/env.sh index 4c0a98b78e..b6c791ff40 100755 --- a/scripts/ci/env.sh +++ b/scripts/ci/env.sh @@ -17,7 +17,7 @@ function setEnvVar() { if [[ ${print} == "print" ]]; then echo ${name}=${value} fi - export ${name}=${value} + export ${name}="${value}" } # use BASH_SOURCE so that we get the right path when this script is called AND source-d @@ -37,6 +37,7 @@ fi setEnvVar NODE_VERSION 8.9.1 setEnvVar YARN_VERSION 1.0.2 setEnvVar CHROMIUM_VERSION 499098 # Chrome 62 linux stable, see https://www.chromium.org/developers/calendar +setEnvVar CHROMEDRIVER_VERSION_ARG "--versions.chrome 2.33" setEnvVar BAZEL_VERSION 0.8.1 setEnvVar SAUCE_CONNECT_VERSION 4.4.9 setEnvVar ANGULAR_CLI_VERSION 1.5.0-rc.2 diff --git a/scripts/ci/install.sh b/scripts/ci/install.sh index a850c06405..85e2273952 100755 --- a/scripts/ci/install.sh +++ b/scripts/ci/install.sh @@ -37,7 +37,7 @@ travisFoldEnd "install-yarn" # Install all npm dependencies according to yarn.lock travisFoldStart "yarn-install" - node tools/npm/check-node-modules --purge || yarn install --frozen-lockfile --non-interactive + (node tools/npm/check-node-modules --purge && yarn update-webdriver) || yarn install --frozen-lockfile --non-interactive travisFoldEnd "yarn-install"