ci: use bazel downloaded saucelabs connect binary (#56456)

The saucelabs connect tunnel utility is now downloaded via bazel as needed.
For the directly invoked case the utility is downloaded via the local shell script.
Previously it was part of the root `package.json` and downloaded whenever
a package install was executed. The utility archive was also not an actual
package which incidentally worked with npm but does not work with newer versions
of yarn.

PR Close #56456
This commit is contained in:
Charles Lyding
2024-06-14 12:42:47 -04:00
committed by Andrew Kushnir
parent 34e7d14d16
commit fb1d0a2881
4 changed files with 71 additions and 43 deletions
-1
View File
@@ -214,7 +214,6 @@
"patch-package": "^7.0.0",
"playwright-core": "^1.41.2",
"prettier": "^3.0.0",
"sauce-connect": "https://saucelabs.com/downloads/sc-4.9.1-linux.tar.gz",
"semver": "^7.3.5",
"tmp": "^0.2.3",
"ts-node": "^10.9.1",
+28 -7
View File
@@ -4,47 +4,68 @@ sh_binary(
name = "sauce_service_setup",
srcs = ["sauce-service.sh"],
args = ["setup"],
data = ["@npm//sauce-connect"],
data = ["//:sauce_connect"],
env = {
"SAUCE_CONNECT": "$(rootpath //:sauce_connect)",
},
)
sh_binary(
name = "sauce_service_start",
srcs = ["sauce-service.sh"],
args = ["start"],
data = ["@npm//sauce-connect"],
data = ["//:sauce_connect"],
env = {
"SAUCE_CONNECT": "$(rootpath //:sauce_connect)",
},
)
sh_binary(
name = "sauce_service_start_ready_wait",
srcs = ["sauce-service.sh"],
args = ["start-ready-wait"],
data = ["@npm//sauce-connect"],
data = ["//:sauce_connect"],
env = {
"SAUCE_CONNECT": "$(rootpath //:sauce_connect)",
},
)
sh_binary(
name = "sauce_service_ready_wait",
srcs = ["sauce-service.sh"],
args = ["ready-wait"],
data = ["@npm//sauce-connect"],
data = ["//:sauce_connect"],
env = {
"SAUCE_CONNECT": "$(rootpath //:sauce_connect)",
},
)
sh_binary(
name = "sauce_service_stop",
srcs = ["sauce-service.sh"],
args = ["stop"],
data = ["@npm//sauce-connect"],
data = ["//:sauce_connect"],
env = {
"SAUCE_CONNECT": "$(rootpath //:sauce_connect)",
},
)
sh_binary(
name = "sauce_service_tail",
srcs = ["sauce-service.sh"],
args = ["tail"],
data = ["@npm//sauce-connect"],
data = ["//:sauce_connect"],
env = {
"SAUCE_CONNECT": "$(rootpath //:sauce_connect)",
},
)
sh_binary(
name = "sauce_service_log",
srcs = ["sauce-service.sh"],
args = ["log"],
data = ["@npm//sauce-connect"],
data = ["//:sauce_connect"],
env = {
"SAUCE_CONNECT": "$(rootpath //:sauce_connect)",
},
)
+43 -31
View File
@@ -93,38 +93,50 @@ service-setup-command() {
@fail "SAUCE_TUNNEL_IDENTIFIER environment variable required"
fi
local unameOut="$(uname -s)"
case "${unameOut}" in
Linux*) local machine=linux ;;
Darwin*) local machine=darwin ;;
CYGWIN*) local machine=windows ;;
MINGW*) local machine=windows ;;
MSYS_NT*) local machine=windows ;;
*) local machine=linux
printf "\nUnrecongized uname '${unameOut}'; defaulting to use node for linux.\n" >&2
printf "Please file an issue to https://github.com/bazelbuild/rules_nodejs/issues if \n" >&2
printf "you would like to add your platform to the supported rules_nodejs node platforms.\n\n" >&2
;;
esac
if [[ -z "${SAUCE_CONNECT:-}" ]]; then
local unameOut="$(uname -s)"
case "${unameOut}" in
Linux*) local machine=linux ;;
Darwin*) local machine=darwin ;;
CYGWIN*) local machine=windows ;;
MINGW*) local machine=windows ;;
MSYS_NT*) local machine=windows ;;
*) local machine=linux
printf "\nUnrecongized uname '${unameOut}'; defaulting to use node for linux.\n" >&2
printf "Please file an issue to https://github.com/bazelbuild/rules_nodejs/issues if \n" >&2
printf "you would like to add your platform to the supported rules_nodejs node platforms.\n\n" >&2
;;
esac
case "${machine}" in
# Path to sauce connect executable
linux)
if [[ -z "${BUILD_WORKSPACE_DIRECTORY:-}" ]]; then
# Started manually
SAUCE_CONNECT="${SCRIPT_DIR}/../../node_modules/sauce-connect/bin/sc"
else
# Started via `bazel run`
SAUCE_CONNECT="${BUILD_WORKSPACE_DIRECTORY}/node_modules/sauce-connect/bin/sc"
fi
;;
*)
if [[ -z "${SAUCE_CONNECT:-}" ]]; then
@fail "SAUCE_CONNECT environment variable is required on non-linux environments"
exit 1
fi
;;
esac
case "${machine}" in
# Path to sauce connect executable
linux)
if [[ -z "${BUILD_WORKSPACE_DIRECTORY:-}" ]]; then
# Started manually
readonly connectVersion="sc-4.9.2-linux"
readonly connectHash="2f8a3f87e1da4dc9a41bc45ec7c3a2ecdba4c72d72b7d0193f04ad66c5809104"
echo "Downloading Sauce Connect"
curl https://saucelabs.com/downloads/${connectVersion}.tar.gz -o ${SCRIPT_DIR}/${connectVersion}.tar.gz
echo "${connectHash} ${SCRIPT_DIR}/${connectVersion}.tar.gz" | shasum -a 256 -c
tar -xzf ${SCRIPT_DIR}/${connectVersion}.tar.gz -C ${SCRIPT_DIR}
SAUCE_CONNECT="${SCRIPT_DIR}/${connectVersion}/bin/sc"
else
# Started via `bazel run`
SAUCE_CONNECT="${BUILD_WORKSPACE_DIRECTORY}/node_modules/sauce-connect/bin/sc"
fi
;;
*)
if [[ -z "${SAUCE_CONNECT:-}" ]]; then
@fail "SAUCE_CONNECT environment variable is required on non-linux environments"
exit 1
fi
;;
esac
fi
if [[ ! -f ${SAUCE_CONNECT} ]]; then
@fail "sc binary not found at ${SAUCE_CONNECT}"
-4
View File
@@ -14184,10 +14184,6 @@ sass@1.77.4:
immutable "^4.0.0"
source-map-js ">=0.6.2 <2.0.0"
"sauce-connect@https://saucelabs.com/downloads/sc-4.9.1-linux.tar.gz":
version "0.0.0"
resolved "https://saucelabs.com/downloads/sc-4.9.1-linux.tar.gz#9310bc860f7870a1f872b11c4dc6073a1ad34e5e"
saucelabs@7.5.0, saucelabs@^1.5.0, saucelabs@^4.6.3:
version "7.5.0"
resolved "https://registry.yarnpkg.com/saucelabs/-/saucelabs-7.5.0.tgz#75c88a95e1519a63b79978d146a764a2eecb4f0e"