SaaS runners on Linux (FREE SAAS)

SaaS runners on Linux are autoscaled ephemeral Google Cloud Platform virtual machines.

Autoscaling means reduced queue times to spin up CI/CD jobs, and isolated VMs for each job, thus maximizing security. These shared runners are available on

GitLab offers Ultimate tier capabilities and included CI/CD minutes per group per month for our Open Source, Education, and Startups programs. For private projects, GitLab offers various plans, starting with a Free tier.

All your CI/CD jobs run on n1-standard-1 instances with 3.75GB of RAM, Google COS and the latest Docker Engine installed. Instances provide 1 vCPU and 25GB of HDD disk space. The default region of the VMs is US East1. Each instance is used only for one job. This ensures that any sensitive data left on the system can't be accessed by other people's CI/CD jobs.

NOTE: The final disk space your jobs can use will be less than 25GB. Some disk space allocated to the instance will be occupied by the operating system, the Docker image, and a copy of your cloned repository.

The fleet of runners are dedicated for GitLab projects as well as community forks of them. They use a slightly larger machine type (n1-standard-2) and have a bigger SSD disk size. They don't run untagged jobs and unlike the general fleet of shared runners, the instances are re-used up to 40 times.

Jobs handled by shared runners on ( time out after 3 hours, regardless of the timeout configured in a project. Check issue #4010 and #4070 for the reference.

Jobs handled by shared runners on Windows and macOS on time out after 1 hour while this service is in the Beta stage.

Below are the runners' settings.

Setting Default
Executor docker+machine -
Default Docker image ruby:2.5 -
privileged (run Docker in Docker) true false

These runners share a distributed cache through use of a Google Cloud Storage (GCS) bucket. Cache contents not updated within the last 14 days are automatically removed through use of an object lifecycle management policy.

Pre-clone script

With SaaS runners on Linux, you can run commands in a CI job before the runner attempts to run git init and git fetch to download a GitLab repository. The pre_clone_script can be used for:

  • Seeding the build directory with repository data
  • Sending a request to a server
  • Downloading assets from a CDN
  • Any other commands that must run before the git init

To use this feature, define a CI/CD variable called CI_PRE_CLONE_SCRIPT that contains a bash script.

NOTE: The CI_PRE_CLONE_SCRIPT variable does not work on Windows runners.

Pre-clone script example

This example was used in the gitlab-org/gitlab project until November 2021. The project no longer uses this optimization because the pack-objects cache lets Gitaly serve the full CI/CD fetch traffic. See Git fetch caching.

The CI_PRE_CLONE_SCRIPT was defined as a project CI/CD variable:

  echo "Downloading archived master..."
  wget -O /tmp/gitlab.tar.gz

  if [ ! -f /tmp/gitlab.tar.gz ]; then
      echo "Repository cache not available, cloning a new directory..."

  rm -rf $CI_PROJECT_DIR
  echo "Extracting tarball into $CI_PROJECT_DIR..."
  mkdir -p $CI_PROJECT_DIR
  tar xzf /tmp/gitlab.tar.gz
  rm -f /tmp/gitlab.tar.gz
  chmod a+w $CI_PROJECT_DIR

The first step of the script downloads gitlab-master.tar.gz from Google Cloud Storage. There was a GitLab CI/CD job named cache-repo that was responsible for keeping that archive up-to-date. Every two hours on a scheduled pipeline, it did the following:

  1. Create a fresh clone of the gitlab-org/gitlab repository on
  2. Save the data as a .tar.gz.
  3. Upload it into the Google Cloud Storage bucket.

When a job ran with this configuration, the output looked similar to:

Downloading archived master...
Extracting tarball into /builds/gitlab-org/gitlab...
Fetching changes...
Reinitialized existing Git repository in /builds/gitlab-org/gitlab/.git/

The Reinitialized existing Git repository message shows that the pre-clone step worked. The runner runs git init, which overwrites the Git configuration with the appropriate settings to fetch from the GitLab repository.

CI_REPO_CACHE_CREDENTIALS must contain the Google Cloud service account JSON for uploading to the gitlab-ci-git-repo-cache bucket.

Note that this bucket should be located in the same continent as the runner, or you can incur network egress charges.


The full contents of our config.toml are:

NOTE: Settings that are not public are shown as X.

Google Cloud Platform

concurrent = X
check_interval = 1
metrics_server = "X"
sentry_dsn = "X"

  name = "docker-auto-scale"
  request_concurrency = X
  url = ""
  pre_clone_script = "eval \"$CI_PRE_CLONE_SCRIPT\""
  executor = "docker+machine"
  environment = [
  limit = X
    image = "ruby:2.5"
    privileged = true
    volumes = [
      "/dummy-sys-class-dmi-id:/sys/class/dmi/id:ro" # Make kaniko builds work on GCP.
    IdleCount = 50
    IdleTime = 3600
    MaxBuilds = 1 # For security reasons we delete the VM after job has finished so it's not reused.
    MachineName = "srm-%s"
    MachineDriver = "google"
    MachineOptions = [
      "engine-opt=mtu=1460", # Set MTU for container interface, for more information check
      "engine-opt=ipv6", # This will create IPv6 interfaces in the containers.
      "google-operation-backoff-initial-interval=2" # Custom flag from forked docker-machine, for more information check
      Periods = ["* * * * * sat,sun *"]
      Timezone = "UTC"
      IdleCount = 70
      IdleTime = 3600
      Periods = ["* 30-59 3 * * * *", "* 0-30 4 * * * *"]
      Timezone = "UTC"
      IdleCount = 700
      IdleTime = 3600
    Type = "gcs"
    Shared = true
      CredentialsFile = "/path/to/file"
      BucketName = "bucket-name"