1. saucelabs/saucectl-run@3.2.0

saucelabs/saucectl-run@3.2.0

Partner
Sections
saucectl is a command line interface that orchestrates the relationship between your tests in your framework, and the rich parallelization, test history filtering, and analytics of Sauce Labs. Usage requires a Sauce Labs account.
Created: March 3, 2021Version Published: January 17, 2025Releases: 7
Org Usage:
< 25

Orb Quick Start Guide

Use CircleCI version 2.1 at the top of your .circleci/config.yml file.

1 version: 2.1

Add the orbs stanza below your version, invoking the orb:

1 2 orbs: saucectl-run: saucelabs/saucectl-run@3.2.0

Use saucectl-run elements in your existing workflows and jobs.

Opt-in to use of uncertified orbs on your organization’s Security settings page.

Usage Examples

run_on_sauce

This example illustrates how to execute your tests in Sauce Labs through saucectl. Note: A Sauce Labs account is required. You must set Username and Access Key credentials either through the env variables SAUCE_USERNAME and SAUCE_ACCESS_KEY or using orb parameters in order to execute the command.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 version: '2.1' orbs: saucectl: saucelabs/saucectl-run@3.0.0 jobs: run_saucectl: docker: - image: cimg/node:lts steps: - checkout - saucectl/saucectl-run workflows: test_on_sauce: jobs: - run_saucectl

Commands

saucectl-run

This command fetches saucectl binary and then execute "saucectl run". Note: A Sauce Labs account is required. You must set Username and Access Key credentials either through the env variables SAUCE_USERNAME and SAUCE_ACCESS_KEY or using orb parameters in order to execute the command.

Show command Source
PARAMETER
DESCRIPTION
REQUIRED
DEFAULT
TYPE
async
Launches tests without awaiting outcomes; operates in a fire-and-forget manner.
No
false
boolean
ccy
Sets the concurrency to be used for the run.
No
''
string
config-file
Configuration file to use with saucectl.
No
.sauce/config.yml
string
env
Environment variables to pass to saucectl.
No
''
string
region
Specifies the Sauce Labs data center through which tests will run. Valid values are us-west-1 or eu-central-1.
No
''
string
retries
Sets the number of retries to do for the run.
No
''
string
sauce-access-key
Sauce Labs account's access key.
No
''
string
sauce-username
Sauce Labs account's username.
No
''
string
saucectl-version
Version of saucectl to use. Example: v0.25.1.
No
latest
string
sauceignore
Path to .sauceignore file.
No
''
string
select-suite
Suite to be tested.
No
''
string
show-console-log
Show console log when suite succeed.
No
false
boolean
test-env-silent
Skips the test environment announcement.
No
false
boolean
timeout
Test timeout in seconds.
No
''
string
tunnel-name
Sets the sauce-connect tunnel ID to be used for the run.
No
''
string
tunnel-owner
Sets the sauce-connect tunnel parent to be used for the run.
No
''
string
tunnel-timeout
How long to wait for the specified tunnel to be ready. Supports duration values like '10s', '30m' etc.
No
''
string
working-directory
Change directory before running saucectl.
No
''
string

Orb Source

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 # This code is licensed from CircleCI to the user under the MIT license. # See here for details: https://circleci.com/developer/orbs/licensing version: 2.1 description: | saucectl is a command line interface that orchestrates the relationship between your tests in your framework, and the rich parallelization, test history filtering, and analytics of Sauce Labs. Usage requires a Sauce Labs account. display: home_url: https://docs.saucelabs.com/testrunner-toolkit/ source_url: https://github.com/saucelabs/saucectl-run-orb/ commands: saucectl-run: description: | This command fetches saucectl binary and then execute "saucectl run". Note: A Sauce Labs account is required. You must set Username and Access Key credentials either through the env variables SAUCE_USERNAME and SAUCE_ACCESS_KEY or using orb parameters in order to execute the command. parameters: async: default: false description: Launches tests without awaiting outcomes; operates in a fire-and-forget manner. type: boolean ccy: default: "" description: Sets the concurrency to be used for the run. type: string config-file: default: .sauce/config.yml description: Configuration file to use with saucectl. type: string env: default: "" description: Environment variables to pass to saucectl. type: string region: default: "" description: Specifies the Sauce Labs data center through which tests will run. Valid values are us-west-1 or eu-central-1. type: string retries: default: "" description: Sets the number of retries to do for the run. type: string sauce-access-key: default: "" description: Sauce Labs account's access key. type: string sauce-username: default: "" description: Sauce Labs account's username. type: string saucectl-version: default: latest description: 'Version of saucectl to use. Example: v0.25.1.' type: string sauceignore: default: "" description: Path to .sauceignore file. type: string select-suite: default: "" description: Suite to be tested. type: string show-console-log: default: false description: Show console log when suite succeed. type: boolean test-env-silent: default: false description: Skips the test environment announcement. type: boolean timeout: default: "" description: Test timeout in seconds. type: string tunnel-name: default: "" description: Sets the sauce-connect tunnel ID to be used for the run. type: string tunnel-owner: default: "" description: Sets the sauce-connect tunnel parent to be used for the run. type: string tunnel-timeout: default: "" description: How long to wait for the specified tunnel to be ready. Supports duration values like '10s', '30m' etc. type: string working-directory: default: "" description: Change directory before running saucectl. type: string steps: - run: command: "#!/usr/bin/env bash\n\ndeclare -A platforms=([Darwin]=mac [Linux]=linux [Windows]=win)\ndeclare -A archs=([i386]=32-bit [x86_64]=64-bit)\ndeclare -A exts=([mac]=tar.gz [linux]=tar.gz [win]=zip)\ndeclare ARGS\n\nSAUCECTL_VERSION=\nSAUCECTL_BIN_PATH=\n\ninstall() {\n src_platform=${1}\n src_arch=${2}\n version=${3}\n\n platform=${platforms[$src_platform]}\n arch=${archs[$src_arch]}\n\n # Check value\n if [ -z \"${platform}\" ] || [ -z \"${arch}\" ]; then\n echo \"Unexpected platform (${src_platform} / ${platform}) or arch (${src_arch} / ${arch})\"\n exit 1\n fi\n\n # Fetch and install\n ext=${exts[$platform]}\n download_url=\"https://github.com/saucelabs/saucectl/releases/download/v${version}/saucectl_${version}_${platform}_${arch}.${ext}\"\n\n tmpname=$(mktemp -d)\n curl -L -s \"${download_url}\" | tar -xz -C \"${tmpname}\" saucectl || (\n echo \"Failed to download / install saucectl\"\n exit 1\n )\n\n SAUCECTL_BIN_PATH=${tmpname}/saucectl\n}\n\n# Check version existence / Resolve latest\nresolve_version() {\n if [ \"${PARAM_SAUCECTL_VERSION}\" = \"latest\" ] || [ -z \"${PARAM_SAUCECTL_VERSION}\" ];then\n SAUCECTL_VERSION=$(curl -s https://api.github.com/repos/saucelabs/saucectl/releases/latest | jq -r '.name')\n SAUCECTL_VERSION=${SAUCECTL_VERSION/v/}\n else\n if [[ \"${version}\" =~ ^v?([0-9]+)\\.([0-9]+)\\.([0-9]+)\\$ ]]; then\n echo \"version: ${version} has an unexpected format\"\n exit 1\n fi\n version=${version/v/}\n\n check_url=\"https://github.com/saucelabs/saucectl/releases/tag/v${version}\"\n if ! curl -I -f \"${check_url}\" > /dev/null 2>&1;then\n echo \"Version v${version} is not available\"\n exit 1\n fi\n SAUCECTL_VERSION=${version}\n fi\n}\n\nparse_args() {\n if [ -n \"${PARAM_CONFIG_FILE}\" ];then\n ARGS+=(\"-c\" \"${PARAM_CONFIG_FILE}\")\n fi\n\n if [ -n \"${PARAM_REGION}\" ];then\n ARGS+=(\"--region\" \"${PARAM_REGION}\")\n fi\n\n if [ -n \"${PARAM_SUITE}\" ];then\n ARGS+=(\"--select-suite\" \"${PARAM_SUITE}\")\n fi\n\n if [ -n \"${PARAM_WORKING_DIRECTORY}\" ];then\n echo \"Changing directory to ${PARAM_WORKING_DIRECTORY}\"\n cd \"${PARAM_WORKING_DIRECTORY}\" || exit 1\n fi\n\n \n if [ -n \"${PARAM_SAUCEIGNORE}\" ];then\n ARGS+=(\"--sauceignore\" \"${PARAM_SAUCEIGNORE}\")\n fi\n\n if [ -n \"${PARAM_ENV}\" ];then\n while read -r LINE;do\n if [ -n \"${LINE}\" ];then\n ARGS+=(\"-e\" \"${LINE}\")\n fi\n done \\<<< \"${PARAM_ENV}\"\n fi\n\n if [ -n \"${PARAM_TIMEOUT}\" ];then\n ARGS+=(\"--timeout\" \"${PARAM_TIMEOUT}\")\n fi\n\n if [ -n \"${PARAM_TUNNEL_NAME}\" ];then\n ARGS+=(\"--tunnel-name\" \"${PARAM_TUNNEL_NAME}\")\n fi\n\n if [ -n \"${PARAM_TUNNEL_OWNER}\" ];then\n ARGS+=(\"--tunnel-owner\" \"${PARAM_TUNNEL_OWNER}\")\n fi\n\n if [ -n \"${PARAM_TUNNEL_TIMEOUT}\" ];then\n ARGS+=(\"--tunnel-timeout\" \"${PARAM_TUNNEL_TIMEOUT}\")\n fi\n\n if [ -n \"${PARAM_CCY}\" ];then\n ARGS+=(\"--ccy\" \"${PARAM_CCY}\")\n fi\n\n if [ -n \"${PARAM_RETRIES}\" ];then\n ARGS+=(\"--retries\" \"${PARAM_RETRIES}\")\n fi\n\n # For backward compatibility, we can't remove the field directly,\n # as it could break the customer's pipeline if it has already been set.\n if [ -n \"${PARAM_TEST_ENV_SILENT}\" ];then\n echo \"WARNING: 'test-env-silent' is deprecated. Please remove it from your configuration.\"\n fi\n\n # Boolean types set in CircleCI's config are parsed as 0/1 when converted to environment variables.\n if [ \"${PARAM_SHOW_CONSOLE_LOG}\" == \"1\" ]; then\n ARGS+=(\"--show-console-log\")\n fi\n\n if [ \"${PARAM_ASYNC}\" == \"1\" ];then\n ARGS+=(\"--async\")\n fi\n}\n\nrun() {\n # Set environment variables if credentials are given through params\n if [ -n \"${PARAM_SAUCE_USERNAME}\" ];then\n export SAUCE_USERNAME=${PARAM_SAUCE_USERNAME}\n fi\n if [ -n \"${PARAM_SAUCE_ACCESS_KEY}\" ];then\n export SAUCE_ACCESS_KEY=${PARAM_SAUCE_ACCESS_KEY}\n fi\n\n echo Running \"${SAUCECTL_BIN_PATH}\" run \"${ARGS[@]}\"\n ${SAUCECTL_BIN_PATH} run \"${ARGS[@]}\"\n}\n\n\n# Will not run if sourced for bats.\n# View src/tests for more information.\nTEST_ENV=\"bats-core\"\nif [ \"${0#*\"$TEST_ENV\"}\" == \"$0\" ]; then\n resolve_version\n install \"$(uname -s)\" \"$(uname -m)\" \"${SAUCECTL_VERSION}\"\n echo \"saucectl installed at: ${SAUCECTL_BIN_PATH}\"\n parse_args\n run\n echo \"saucectl test completed\"\nfi\n" environment: PARAM_ASYNC: <<parameters.async>> PARAM_CCY: <<parameters.ccy>> PARAM_CONFIG_FILE: <<parameters.config-file>> PARAM_ENV: <<parameters.env>> PARAM_REGION: <<parameters.region>> PARAM_RETRIES: <<parameters.retries>> PARAM_SAUCE_ACCESS_KEY: <<parameters.sauce-access-key>> PARAM_SAUCE_USERNAME: <<parameters.sauce-username>> PARAM_SAUCECTL_VERSION: <<parameters.saucectl-version>> PARAM_SAUCEIGNORE: <<parameters.sauceignore>> PARAM_SHOW_CONSOLE_LOG: <<parameters.show-console-log>> PARAM_SUITE: <<parameters.select-suite>> PARAM_TEST_ENV_SILENT: <<parameters.test-env-silent>> PARAM_TIMEOUT: <<parameters.timeout>> PARAM_TUNNEL_NAME: <<parameters.tunnel-name>> PARAM_TUNNEL_OWNER: <<parameters.tunnel-owner>> PARAM_TUNNEL_TIMEOUT: <<parameters.tunnel-timeout>> PARAM_WORKING_DIRECTORY: <<parameters.working-directory>> name: run saucectl examples: run_on_sauce: description: | This example illustrates how to execute your tests in Sauce Labs through saucectl. Note: A Sauce Labs account is required. You must set Username and Access Key credentials either through the env variables SAUCE_USERNAME and SAUCE_ACCESS_KEY or using orb parameters in order to execute the command. usage: version: "2.1" orbs: saucectl: saucelabs/saucectl-run@3.0.0 jobs: run_saucectl: docker: - image: cimg/node:lts steps: - checkout - saucectl/saucectl-run workflows: test_on_sauce: jobs: - run_saucectl
Developer Updates
Get tips to optimize your builds
Or join our research panel and give feedback
By submitting this form, you are agreeing to ourTerms of UseandPrivacy Policy.