These examples can apply to virtually any Jenkins deployment, provided that you already have some existing automated tests, have access to the Jenkins instance, and are either the maintainer or an admin of the target repository.
What You'll Need
- A Sauce Labs account (Log in or sign up for a free trial license)
- Your Sauce Labs Username and Access Key
- Jenkins Server
- The following permissions in Jenkins:
- Ability to create and manage credentials
- Ability to create and manage new pipelines
Configure Jenkins Credentials
The first step of the integration is to ensure you've added your
SAUCE_ACCESS_KEY as a secret file/text in your Jenkins server.
The easiest way to add credentials to Jenkins is with the UI:
Log in to Jenkins.
Under Manage Jenkins, click Manage Credentials.
Next to (global), click Add credentials.
For Kind, select Secret Text.
Enter the following information:
- Scope: Global
- Description: Sauce Labs Username
Repeat the above steps for your Sauce Labs Access Key.note
For further information on how to store your Sauce Labs credentials in Jenkins, see Handling credentials.
Configure the Jenkins Pipeline
Jenkinsfile at the root of your project directory so that Jenkins can detect changes and run
saucectl accordingly. In the examples below, the
environment variables are the GitHub secrets configured in Jenkins:
Run the Pipeline Tests
Now you can commit these files and Jenkins will detect the new pipeline and launch
saucectl to run your tests.
For example, if you're using the Blue Ocean plugin, your output may look something like this: