These examples can apply to virtually any GitLab deployment, provided that you already have some existing automated tests, 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
- GitLab Account and Instance
- The following permissions in GitLab:
- Ability to manage GitLab repository containing the project
Configure GitLab Credentials
The first step of the integration is to ensure you've added your
SAUCE_ACCESS_KEY as a secret in your GitLab instance.
The easiest way to add credentials to GitLab is with the UI:
Log in to GitLab.
Go to your repository.
In the left column, select Settings, then CI/CD.
Look for Variables and click on Expand.
Click on Add Variable to create a new secret.
Enter the following information:
Environment Scope: All
Repeat the process for your Sauce Labs Access Key.
Credentials are now set!
Add GitLab-CI Configuration
- In the root of your project directory, create the
.gitlab-ci.ymlfile. Below are some job snippets of how to configure
- Commit the updated
.gitlab-ci.ymlto your git repository.
- Navigate back to the GitLab-CI dashboard to see your build pass.