Skip to main content

saucectl with GitLab

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

Configure GitLab Credentials

The first step of the integration is to ensure you've added your SAUCE_USERNAME and SAUCE_ACCESS_KEY as a secret in your GitLab instance.

The easiest way to add credentials to GitLab is with the UI:

  1. Log in to GitLab.

  2. Go to your repository.

  3. In the left column, select Settings, then CI/CD.

    GitLab Secrets
  4. Look for Variables and click on Expand.

    GitLab Variables
  5. Click on Add Variable to create a new secret.

  6. Enter the following information:


    • Value: 'your-sauce-username'

    • Type: 'Variable'

    • Environment Scope: All

  7. Repeat the process for your Sauce Labs Access Key.

Credentials are now set!


Add GitLab-CI Configuration

  1. In the root of your project directory, create the .gitlab-ci.yml file. Below are some job snippets of how to configure saucectl with GitLab-CI:
  1. Commit the updated .gitlab-ci.yml to your git repository.
  2. Navigate back to the GitLab-CI dashboard to see your build pass.
GitLab Output