GDrive - BredaUniversityGames/JenkinsLib GitHub Wiki
Uploads your build as a zip archive to Google Drive using a service account.
stages {
perforce.sync()
ue5.build()
gdrive.deploy()
discord.alert()
}- A Google Cloud service account with Drive API access
- Service account JSON key file stored as a Jenkins credential
- A Shared Drive (not a regular folder) with the service account added as a member
| Parameter | Default | Description |
|---|---|---|
GDRIVE_CREDENTIALS_ID |
(empty) | GDrive service account file (dropdown — Secret file credentials) |
GDRIVE_FOLDER_ID |
(empty) | Google Drive parent folder ID |
- Go to Google Cloud Console and sign in with your BUas Google Workspace account (Shared Drives require a Workspace account — personal Gmail accounts will not work)
- Click the project dropdown at the top of the page (next to "Google Cloud") and click New Project
- Enter a project name (e.g.,
MyGame-Jenkins), leave Organization and Location as "No organization", and click Create (no billing account is required) - Make sure your new project is selected in the project dropdown
- Go to APIs & Services > Library (or search "Drive API" in the top search bar)
- Find Google Drive API and click Enable
- Go to IAM & Admin > Service Accounts
- Click Create Service Account
- Enter a name (e.g.,
jenkins-uploader) — the email will be generated automatically - Click Done (no roles or permissions needed)
- Click on the newly created service account to open it
- Go to the Keys tab, click Add Key > Create new key
- Select JSON and click Create — the key file will download automatically
Service accounts do not have personal storage quota, so uploads must go to a Shared Drive (not a regular "My Drive" folder).
- In Google Drive, click Shared drives in the left sidebar
- Click New shared drive and give it a name (e.g.,
Jenkins Builds) - Click Manage members, add the service account email (e.g.,
[email protected]) with Contributor access - Create a folder inside the Shared Drive for your builds — use this folder's ID as
GDRIVE_FOLDER_ID
- Navigate to your team's folder in Jenkins
- Credentials > Add Credentials
-
Kind:
Secret file - File: upload the service account JSON key
-
ID: e.g.,
gdrive-myproject
The folder ID is the last part of the Google Drive folder URL:
https://drive.google.com/drive/folders/1AbCdEfGhIjKlMnOpQrStUvWxYz
^^^^^^^^^^^^^^^^^^^^^^^^^^^
This is the folder ID- Zips the platform-specific build output
- Authenticates with Google using the service account credentials (JWT + OAuth2)
- Uploads the zip to Google Drive using the resumable upload API (4 MB chunks)