1 #!/usr/bin/env nix-shell
2 #!nix-shell -i bash -p common-updater-scripts curl jq
3 # API documentation: https://docs.saucelabs.com/dev/api/connect/
8 echo -e "${BASH_SOURCE[0]}:${BASH_LINENO[0]}" ERROR
: "$@" >&2
11 # shellcheck disable=2154
12 trap 's=$?; die "$BASH_COMMAND"; exit $s' ERR
14 # Versions may not be updated simultaneously across all platforms, so need to figure out the latest
15 # version that includes both platforms. For example, currently the latest on Linux is 4.9.2 while
17 response
=$
(curl
-fsSL 'https://api.us-west-1.saucelabs.com/rest/v1/public/tunnels/info/versions?all=true')
18 all_versions
=$
(jq
--exit-status --raw-output \
19 '.all_downloads | to_entries[] | select(.value | has("linux") and has("osx")) | .key' \
21 latest_version
=$
(sort --version-sort <<< "$all_versions" |
tail -n 1)
22 for platform
in x86_64-linux x86_64-darwin
; do
23 update-source-version sauce-connect
"$latest_version" \
24 --ignore-same-version \
25 --source-key="passthru.sources.$platform"