From 66fa7c57517ed0d6245e87c2510cf690612f072e Mon Sep 17 00:00:00 2001 From: Alan Agius <17563226+alan-agius4@users.noreply.github.com> Date: Fri, 31 Jul 2026 19:29:42 +0000 Subject: [PATCH] ci: upgrade to Sauce Connect 5 to fix SC4 deprecation Starting July 31, 2026, Sauce Labs servers will no longer support Sauce Connect 4 traffic. This commit migrates the CI workflow to use saucelabs/sauce-connect-action@v3 (Sauce Connect 5) and refactors the Protractor Sauce Labs capabilities configuration. --- .github/workflows/ci.yml | 23 ++-- scripts/saucelabs/start-tunnel.sh | 40 ------ scripts/saucelabs/stop-tunnel.sh | 27 ---- scripts/saucelabs/wait-for-tunnel.sh | 28 ----- tests/e2e/assets/protractor-saucelabs.conf.js | 115 ++++++++++-------- 5 files changed, 73 insertions(+), 160 deletions(-) delete mode 100755 scripts/saucelabs/start-tunnel.sh delete mode 100755 scripts/saucelabs/stop-tunnel.sh delete mode 100755 scripts/saucelabs/wait-for-tunnel.sh diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 36989f0a514e..df2496715699 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -217,25 +217,18 @@ jobs: uses: angular/dev-infra/github-actions/bazel/configure-remote@24ba9709ca4bf6548bba6a9abfe2799e90645a60 # main with: google_credential: ${{ secrets.RBE_TRUSTED_BUILDS_USER }} + - name: Start Sauce Connect + uses: saucelabs/sauce-connect-action@cb88b508c6f9ff4d84490093733315dbd55de022 # v3 + with: + username: ${{ vars.SAUCE_USERNAME }} + accessKey: ${{ secrets.SAUCE_ACCESS_KEY }} + region: us-west-1 + tunnelName: ${{ env.SAUCE_TUNNEL_IDENTIFIER }} - name: Run E2E Browser tests env: SAUCE_USERNAME: ${{ vars.SAUCE_USERNAME }} SAUCE_ACCESS_KEY: ${{ secrets.SAUCE_ACCESS_KEY }} - SAUCE_LOG_FILE: /tmp/angular/sauce-connect.log - SAUCE_READY_FILE: /tmp/angular/sauce-connect-ready-file.lock - SAUCE_PID_FILE: /tmp/angular/sauce-connect-pid-file.lock - SAUCE_TUNNEL_IDENTIFIER: 'angular-${{ github.run_number }}' - SAUCE_READY_FILE_TIMEOUT: 120 - run: | - ./scripts/saucelabs/start-tunnel.sh & - ./scripts/saucelabs/wait-for-tunnel.sh - pnpm bazel test --config=saucelabs //tests:e2e.saucelabs - ./scripts/saucelabs/stop-tunnel.sh - - uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 - if: ${{ failure() }} - with: - name: sauce-connect-log - path: ${{ env.SAUCE_CONNECT_DIR_IN_HOST }}/sauce-connect.log + run: pnpm bazel test --config=saucelabs //tests:e2e.saucelabs publish-snapshots: needs: build diff --git a/scripts/saucelabs/start-tunnel.sh b/scripts/saucelabs/start-tunnel.sh deleted file mode 100755 index badf130e6eea..000000000000 --- a/scripts/saucelabs/start-tunnel.sh +++ /dev/null @@ -1,40 +0,0 @@ -#!/usr/bin/env bash - -set -x -u -e -o pipefail - -readonly currentDir=$(cd $(dirname $0); pwd) -readonly connectVersion="sc-4.9.2-linux" -readonly connectHash="2f8a3f87e1da4dc9a41bc45ec7c3a2ecdba4c72d72b7d0193f04ad66c5809104" - -echo "Downloading Sauce Connect" - -curl https://saucelabs.com/downloads/${connectVersion}.tar.gz -o ${currentDir}/${connectVersion}.tar.gz -echo "${connectHash} ${currentDir}/${connectVersion}.tar.gz" | shasum -a 256 -c -tar -xzf ${currentDir}/${connectVersion}.tar.gz -C ${currentDir} - -# Command arguments that will be passed to sauce-connect. By default we disable SSL bumping for -# all requests. This is because SSL bumping is not needed for our test setup and in order -# to perform the SSL bumping, Saucelabs intercepts all HTTP requests in the tunnel VM and modifies -# them. This can cause flakiness as it makes all requests dependent on the SSL bumping middleware. -# See: https://wiki.saucelabs.com/display/DOCS/Troubleshooting+Sauce+Connect#TroubleshootingSauceConnect-DisablingSSLBumping -sauceArgs="--no-ssl-bump-domains all" - -if [[ ! -z "${SAUCE_LOG_FILE:-}" ]]; then - mkdir -p $(dirname ${SAUCE_LOG_FILE}) - sauceArgs="${sauceArgs} --logfile ${SAUCE_LOG_FILE}" -fi - -if [[ ! -z "${SAUCE_READY_FILE:-}" ]]; then - mkdir -p $(dirname ${SAUCE_READY_FILE}) - sauceArgs="${sauceArgs} --readyfile ${SAUCE_READY_FILE}" -fi - -if [[ ! -z "${SAUCE_PID_FILE:-}" ]]; then - mkdir -p $(dirname ${SAUCE_PID_FILE}) - sauceArgs="${sauceArgs} --pidfile ${SAUCE_PID_FILE}" -fi - - -echo "Starting Sauce Connect. Passed arguments: ${sauceArgs}" - -${currentDir}/${connectVersion}/bin/sc -u ${SAUCE_USERNAME} -k ${SAUCE_ACCESS_KEY} ${sauceArgs} diff --git a/scripts/saucelabs/stop-tunnel.sh b/scripts/saucelabs/stop-tunnel.sh deleted file mode 100755 index 4ea8d13c7e12..000000000000 --- a/scripts/saucelabs/stop-tunnel.sh +++ /dev/null @@ -1,27 +0,0 @@ -#!/usr/bin/env bash - -# Disable printing of any executed command because this would cause a lot -# of spam due to the loop. -set +x -u -e -o pipefail - -if [[ ! -f ${SAUCE_PID_FILE} ]]; then - echo "Could not find Saucelabs tunnel PID file. Cannot stop tunnel.." - exit 1 -fi - -echo "Shutting down Sauce Connect tunnel" - -# The process id for the sauce-connect instance is stored inside of the pidfile. -tunnelProcessId=$(cat ${SAUCE_PID_FILE}) - -# Kill the process by using the PID that has been read from the pidfile. Note that -# we cannot use killall because CI base container images don't have it installed. -kill ${tunnelProcessId} - -while (ps -p ${tunnelProcessId} &> /dev/null); do - printf "." - sleep .5 -done - -echo "" -echo "Sauce Connect tunnel has been shut down" diff --git a/scripts/saucelabs/wait-for-tunnel.sh b/scripts/saucelabs/wait-for-tunnel.sh deleted file mode 100755 index feda9a85b694..000000000000 --- a/scripts/saucelabs/wait-for-tunnel.sh +++ /dev/null @@ -1,28 +0,0 @@ -#!/usr/bin/env bash - -# Disable printing of any executed command because this would cause a lot -# of spam due to the loop. -set +x -u -e -o pipefail - -# Waits for Saucelabs Connect to be ready before executing any tests. -counter=0 - -while [[ ! -f ${SAUCE_READY_FILE} ]]; do - counter=$((counter + 1)) - - # Counter needs to be multiplied by two because the while loop only sleeps a half second. - # This has been made in favor of better progress logging (printing dots every half second) - if [ $counter -gt $[${SAUCE_READY_FILE_TIMEOUT} * 2] ]; then - echo "Timed out after ${SAUCE_READY_FILE_TIMEOUT} seconds waiting for tunnel ready file." - echo "Printing logfile output:" - echo "" - cat ${SAUCE_LOG_FILE} - exit 5 - fi - - printf "." - sleep 0.5 -done - -echo "" -echo "Connected to Saucelabs" diff --git a/tests/e2e/assets/protractor-saucelabs.conf.js b/tests/e2e/assets/protractor-saucelabs.conf.js index fb9ab42798a8..799d0901d4fb 100644 --- a/tests/e2e/assets/protractor-saucelabs.conf.js +++ b/tests/e2e/assets/protractor-saucelabs.conf.js @@ -7,67 +7,82 @@ const { SpecReporter, StacktraceOption } = require('jasmine-spec-reporter'); const tunnelIdentifier = process.env['SAUCE_TUNNEL_IDENTIFIER']; +const capabilities = [ + { + browserName: 'chrome', + version: '132', + platform: 'Windows 11', + }, + { + browserName: 'chrome', + version: '131', + platform: 'Windows 11', + }, + { + browserName: 'firefox', + version: '134', + platform: 'Windows 11', + }, + { + browserName: 'firefox', + version: '128', // Latest Firefox ESR version as of Jan 2025 + platform: 'Windows 11', + }, + { + browserName: 'safari', + platform: 'macOS 13', + version: '17', + }, + { + browserName: 'safari', + platform: 'macOS 12', + version: '16', + }, + { + browserName: 'MicrosoftEdge', + platform: 'Windows 11', + version: '132', + }, + { + browserName: 'MicrosoftEdge', + platform: 'Windows 11', + version: '131', + }, +]; + /** * @type { import("protractor").Config } */ exports.config = { sauceUser: process.env['SAUCE_USERNAME'], sauceKey: process.env['SAUCE_ACCESS_KEY'], + sauceRegion: 'us', allScriptsTimeout: 11000, specs: ['./src/**/*.e2e-spec.ts'], // NOTE: https://saucelabs.com/products/platform-configurator can be used to determine configuration values - multiCapabilities: [ - { - browserName: 'chrome', - version: '132', - platform: 'Windows 11', - tunnelIdentifier, - }, - { - browserName: 'chrome', - version: '131', - platform: 'Windows 11', - tunnelIdentifier, - }, - { - browserName: 'firefox', - version: '134', - platform: 'Windows 11', - tunnelIdentifier, - }, - { - browserName: 'firefox', - version: '128', // Latest Firefox ESR version as of Jan 2025 - platform: 'Windows 11', - tunnelIdentifier, - }, - { - browserName: 'safari', - platform: 'macOS 13', - version: '17', - tunnelIdentifier, - }, - { - browserName: 'safari', - platform: 'macOS 12', - version: '16', - tunnelIdentifier, - }, - { - browserName: 'MicrosoftEdge', - platform: 'Windows 11', - version: '132', - tunnelIdentifier, - }, - { - browserName: 'MicrosoftEdge', - platform: 'Windows 11', - version: '131', - tunnelIdentifier, - }, - ], + multiCapabilities: capabilities.map((caps) => { + const w3cCaps = { + ...caps, + browserVersion: caps.version, + platformName: caps.platform, + }; + + if (tunnelIdentifier) { + return { + ...w3cCaps, + tunnelIdentifier, + tunnelName: tunnelIdentifier, + 'sauce:options': { + tunnelIdentifier, + tunnelName: tunnelIdentifier, + }, + }; + } + + return w3cCaps; + }), // Only allow one session at a time to prevent over saturation of Saucelabs sessions. maxSessions: 1,