Skip to content

Commit

Permalink
sc: use sc api to retrieve SC download url
Browse files Browse the repository at this point in the history
  • Loading branch information
waggledans committed Aug 23, 2024
1 parent d916ab1 commit 2c89bd4
Show file tree
Hide file tree
Showing 5 changed files with 152 additions and 194 deletions.
227 changes: 78 additions & 149 deletions src/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,25 +3,7 @@ import os from 'os';

import {version} from '../package.json';

export const DEFAULT_SAUCE_CONNECT_VERSION = '4.9.1';
export const SAUCE_CONNECT_BASE = 'https://saucelabs.com/downloads';
export const SAUCE_CONNECT_VERSIONS_ENDPOINT =
'https://saucelabs.com/versions.json';
export const SAUCE_CONNECT_PLATFORM_DATA = {
darwin: {
url: `${SAUCE_CONNECT_BASE}/sc-%s-osx.zip`,
use: 'bin/sc',
},
linux: {
url: `${SAUCE_CONNECT_BASE}/sc-%s-linux.tar.gz`,
use: 'bin/sc',
},
win32: {
url: `${SAUCE_CONNECT_BASE}/sc-%s-win32.zip`,
use: 'bin/sc',
},
};

export const DEFAULT_SAUCE_CONNECT_VERSION = '5.1.3';
export const SAUCE_VERSION_NOTE = `node-saucelabs v${version}\nSauce Connect v${DEFAULT_SAUCE_CONNECT_VERSION}`;

const protocols = [
Expand Down Expand Up @@ -156,218 +138,165 @@ export const SAUCE_CONNECT_CLI_PARAMS = [
description: 'Specify the Sauce Connect version you want to use.',
default: DEFAULT_SAUCE_CONNECT_VERSION,
},
{
/**
* Sauce Connect parameter
*/
alias: 'a',
name: 'auth',
description:
'Perform basic authentication when an URL on <host:port> asks for a username and password.',
},
{
name: 'cainfo',
description:
'CA certificate bundle to use for verifying REST connections. (default "/usr/local/etc/openssl/cert.pem")',
},
{
name: 'capath',
description:
'Directory of CA certs to use for verifying REST connections. (default "/etc/ssl/certs")',
deprecated: true,
},
{
alias: 'c',
name: 'config-file',
description: 'Path to YAML config file.',
},
{
alias: 'D',
name: 'direct-domains',
alias: 'i',
name: 'tunnel-name',
description:
'Comma-separated list of domains. Requests whose host matches one of these will be relayed directly through the internet, instead of through the tunnel.',
'Tunnel name used for this tunnel or the tunnels in the same HA pool.',
},
{
name: 'dns',
alias: 'M',
name: 'metadata',
description:
'Use specified name server(s). Example: --dns 8.8.8.8,8.8.4.4:53',
'Custom metadata key-value pairs. This flag is, primarily, used by Sauce Labs to assign custom properties to the tunnel for reporting purposes.',
},
{
name: 'doctor',
alias: 's',
name: 'shared',
description:
'Perform checks to detect possible misconfiguration or problems.',
type: 'boolean',
deprecated: true,
"Share the tunnel within the same org unit. Only the 'all' option is currently supported. See here: https://docs.saucelabs.com/basics/acct-team-mgmt/sauce-connect-proxy-tunnels/.",
},
{
alias: 'F',
name: 'fast-fail-regexps',
alias: 't',
name: 'tunnel-pool',
type: 'boolean',
description:
'Comma-separated list of regular expressions. Requests matching one of these will get dropped instantly and will not go through the tunnel.',
},
{
alias: 'z',
name: 'log-stats',
description: 'Log statistics about HTTP traffic every <seconds>.',
type: 'number',
deprecated: true,
},
{
alias: 'l',
name: 'logfile',
description: 'Specify custom logfile.',
'Denotes a tunnel as part of a high availability tunnel pool. See here: https://docs.saucelabs.com/secure-connections/sauce-connect/setup-configuration/high-availability/.',
},
{
name: 'max-logsize',
alias: 'F',
name: 'deny-domains',
description:
'Rotate logfile after reaching <bytes> size. Disabled by default.',
type: 'number',
"Deny requests to the matching domains. Prefix domains with '-' to exclude requests from being denied. Special keyword 'all' matches all domains.",
},
{
alias: 'M',
name: 'max-missed-acks',
alias: 'D',
name: 'direct-domains',
description:
'The max number of keepalive acks that can be missed before triggering reconnect.',
type: 'number',
deprecated: true,
},
{
name: 'metrics-address',
description: 'host:port server used to expose client-side metrics.',
deprecated: true,
},
{
name: 'status-address',
description: 'host:port server used to expose client status.',
"Forward matching requests to their origin server over the public internet. Requests that don't match \"direct domains\" will be forwarded to customer-side over the Sauce Connect Proxy connection. You can specify --direct-domains or --tunnel-domains, but not both. Prefix domains with '-' to exclude requests from being forwarded directly.",
},
{
name: 'no-autodetect',
description: 'Disable the autodetection of proxy settings.',
type: 'boolean',
alias: 'B',
name: 'tls-passthrough-domains',
description:
"Pass matching requests to their origin server without SSL/TLS re-encryption. Requests that don't match will be re-encrypted. You can specify --tls-passthrough-domains or --tls-resign-domains, but not both. Prefix domains with '-' to exclude requests from being passed through.",
},
{
alias: 'N',
name: 'no-proxy-caching',
alias: 'b',
name: 'tls-resign-domains',
description:
'Disable caching in Sauce Connect. All requests will be sent through the tunnel.',
type: 'boolean',
deprecated: true,
"Resign SSL/TLS certificates for matching requests. You can specify --tls-resign-domains or --tls-passthrough-domains, but not both. Prefix domains with '-' to exclude requests from being resigned.",
},
{
name: 'no-remove-colliding-tunnels',
alias: 'T',
name: 'tunnel-domains',
description:
"Don't remove identified tunnels with the same name, or any other default tunnels if this is a default tunnel. Jobs will be distributed between these tunnels, enabling load balancing and high availability. By default, colliding tunnels will be removed when Sauce Connect is starting up.",
type: 'boolean',
deprecated: true,
"Forward matching requests over the Sauce Connect Proxy connection. Requests not matching \"tunnel domains\" will be forwarded to their origin server over the public internet. You can specify --tunnel-domains or --direct-domains, but not both. Prefix domains with '-' to exclude requests from being forwarded over the SC Proxy connection. Special keyword 'all' matches all domains.",
},
{
alias: 'B',
name: 'no-ssl-bump-domains',
alias: 'a',
name: 'auth',
description:
'Comma-separated list of domains. Requests whose host matches one of these will not be SSL re-encrypted.',
'Site or upstream proxy basic authentication credentials. The host and port can be set to "*" to match all hosts and ports respectively. The flag can be specified multiple times to add multiple credentials. Note that all the hosts are automatically resigned as if they were passed to --tls-resign-domains flag.',
},
{
name: 'pac',
description:
'Proxy autoconfiguration. Can be an http(s) or local file:// (absolute path only) URI.',
'Proxy Auto-Configuration file to use for upstream proxy selection.',
},
{
alias: 'd',
name: 'pidfile',
description: 'File that will be created with the pid of the process.',
alias: 'x',
name: 'proxy',
description:
'Upstream proxy for test sessions. It is used for requests received from the Sauce Connect Server only. The supported protocols are: http, https, socks5. No protocol specified will be interpreted as an HTTP proxy. The basic authentication username and password can be specified in the host string, e.g. user:pass@host:port. Alternatively, you can specify the credentials using the -a, --auth flag.',
},
{
alias: 'T',
name: 'proxy-tunnel',
description: 'Use the proxy configured with -p for the tunnel connection.',
type: 'boolean',
name: 'proxy-localhost',
description:
'Setting this to allow enables sending requests to localhost through the upstream proxy. Setting this to direct sends requests to localhost directly without using the upstream proxy. By default, requests to localhost are denied.',
},
{
alias: 'w',
name: 'proxy-userpwd',
name: 'proxy-sauce',
description:
'Username and password required to access the proxy configured with -p.',
'Establish a tunnel through an upstream proxy. Proxy for requests to Sauce Labs REST API and Sauce Connect servers only. See the -x, --proxy flag for more details on the format.',
},
{
alias: 'f',
name: 'readyfile',
description: 'File that will be touched to signal when tunnel is ready.',
name: 'dns-round-robin',
description:
'If more than one DNS server is specified with the --dns-server flag, passing this flag will enable round-robin selection.',
},
{
alias: 'X',
name: 'scproxy-port',
description: 'Port on which scproxy will be listening.',
alias: 'n',
name: 'dns-server',
description:
'DNS server(s) to use instead of system default. There are two execution policies, when more then one server is specified. Fallback: the first server in a list is used as primary, the rest are used as fallbacks. Round robin: the servers are used in a round-robin fashion. The port is optional, if not specified the default port is 53.',
},
{
name: 'scproxy-read-limit',
name: 'dns-timeout',
description:
'Rate limit reads in scproxy to X bytes per second. This option can be used to adjust local network transfer rate in order not to overload the tunnel connection.',
deprecated: true,
'Timeout for dialing DNS servers. Only used if DNS servers are specified.',
},
{
name: 'scproxy-write-limit',
name: 'cacert-file',
description:
'Rate limit writes in scproxy to X bytes per second. This option can be used to adjust local network transfer rate in order not to overload the tunnel connection.',
deprecated: true,
'Add your own CA certificates to verify against. The system root certificates will be used in addition to any certificates in this list. Use this flag multiple times to specify multiple CA certificate files.',
},
{
alias: 'P',
name: 'se-port',
name: 'http-dial-timeout',
description:
"Port on which Sauce Connect's Selenium relay will listen for requests. Selenium commands reaching Connect on this port will be relayed to Sauce Labs securely and reliably through Connect's tunnel (default 4445)",
type: 'number',
default: 4445,
'The maximum amount of time a dial will wait for a connect to complete. With or without a timeout, the operating system may impose its own earlier timeout. For instance, TCP timeouts are often around 3 minutes.',
},
{
alias: 's',
name: 'shared-tunnel',
name: 'http-idle-conn-timeout',
description:
'Let sub-accounts of the tunnel owner use the tunnel if requested.',
type: 'boolean',
'The maximum amount of time an idle (keep-alive) connection will remain idle before closing itself. Zero means no limit.',
},
{
name: 'tunnel-cainfo',
name: 'http-response-header-timeout',
description:
'CA certificate bundle to use for verifying tunnel connections. (default "/usr/local/etc/openssl/cert.pem")',
"The amount of time to wait for a server's response headers after fully writing the request (including its body, if any).This time does not include the time to read the response body. Zero means no limit.",
},
{
name: 'tunnel-capath',
name: 'http-tls-handshake-timeout',
description:
'Directory of CA certs to use for verifying tunnel connections. (default "/etc/ssl/certs")',
deprecated: true,
'The maximum amount of time waiting to wait for a TLS handshake. Zero means no limit.',
},
{
name: 'tunnel-cert',
name: 'http-tls-keylog-file',
description:
'Specify certificate to use for the tunnel connection, either public or private. Default: private. (default "private")',
'File to log TLS master secrets in NSS key log format. By default, the value is taken from the SSLKEYLOGFILE environment variable. It can be used to allow external programs such as Wireshark to decrypt TLS connections.',
},
{
alias: 't',
name: 'tunnel-domains',
name: 'api-address',
description:
"Inverse of '--direct-domains'. Only requests for domains in this list will be sent through the tunnel. Overrides '--direct-domains'.",
'The server address to listen on. If the host is empty, the server will listen on all available interfaces.',
},
{
name: 'tunnel-identifier',
name: 'api-basic-auth',
description: 'Basic authentication credentials to protect the server.',
},
{
name: 'api-idle-timeout',
description:
'Tunnel name used for this tunnel or the tunnels in the same HA pool.',
deprecated: true,
'The maximum amount of time to wait for the next request before closing connection.',
},
{
alias: 'i',
name: 'tunnel-name',
name: 'log-file',
description:
'Tunnel name used for this tunnel or the tunnels in the same HA pool.',
'Path to the log file, if empty, logs to stdout. The file is reopened on SIGHUP to allow log rotation using external tools.',
},
{
name: 'tunnel-pool',
description: 'The tunnel is a part of a high availability tunnel pool.',
name: 'log-http',
description: 'HTTP request and response logging mode.',
},
{
alias: 'v',
name: 'verbose',
type: 'boolean',
description: 'Enable verbose logging. Can be used up to two times.',
name: 'log-level',
description: 'Log level.',
},
];
export const SC_BOOLEAN_CLI_PARAMS = SAUCE_CONNECT_CLI_PARAMS.filter(
Expand Down
Loading

0 comments on commit 2c89bd4

Please sign in to comment.