Google

The Google driver is in the Beta phase.
Linux instance support only currently

The goal of this document is to give you enough technical specifics to configure and run google instances. When properly configured, it will automatically provision and terminate Google Compute Engine instances based on your Drone server’s build volume.

Prerequisites

Create Google Credentials file

If your vm runner is running in a GCP instance then create application_default_credentials.json by executing next command in the GCP instance:

gcloud auth application-default login

And credentials will be saved in /home/$(whoami)/.config/gcloud/application_default_credentials.json.

Otherwise, create service account, generate credentials file and save it somewhere in the machine where plan to run the vm runner.

Recommended Images

to find images to use on google compute engine, use the following command:

gcloud compute images list

A valid image will look like projects/{PROJECT}/global/images/{IMAGE} eg projects/ubuntu-os-pro-cloud/global/images/ubuntu-pro-1804-bionic-v20220131.

Example Pool File

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
version: "1"
instances:
  - name: ubuntu-gcp
    default: true
    type: google
    pool: 1
    limit:
    platform:
      os: linux
      arch: amd64
    spec:
      account:
        project_id: xxxxxxxxxxx
        json_path: path/to/credentials.json
      image: projects/ubuntu-os-pro-cloud/global/images/ubuntu-pro-1804-bionic-v20220131
      machine_type: e2-small
      zone:
        - europe-west1-b

Running the VM Runner without a poolfile

You can run the vm runner in Google Compute Engine without a pool file, and it will setup a pool of 2 instance running an Ubuntu 20.04 image.

docker run --detach \
  --env=DRONE_RPC_PROTO=https \
  --env=DRONE_RPC_HOST=drone.company.com \
  --env=DRONE_RPC_SECRET=super-duper-secret \
  --env=DRONE_RUNNER_CAPACITY=2 \
  --env=DRONE_RUNNER_NAME=my-first-runner \
  --env=GOOGLE_PROJECT_ID=asdasdasd \
  --volume=/home/user/.config/gcloud/:/root/.config/gcloud/ \
  --publish=3000:3000 \
  --restart=always \
  --name=runner \
  drone/drone-runner-aws