Skip to content

Commit c0d4a1a

Browse files
feat(storage): add support for GCS as storage driver (#60)
1 parent 650b625 commit c0d4a1a

File tree

9 files changed

+419
-14
lines changed

9 files changed

+419
-14
lines changed

.github/workflows/ci-cd.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ jobs:
4444
runs-on: ubuntu-latest
4545
strategy:
4646
matrix:
47-
storage-driver: [filesystem, memory, s3]
47+
storage-driver: [filesystem, memory, s3, gcs]
4848
db-driver: [postgres, mysql, sqlite]
4949
steps:
5050
- name: pnpm install

docs/content/1.getting-started/2.storage-drivers.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,5 @@ description: A list of storage drivers available for the GitHub Actions Cache Se
55

66
- [File System](/storage-drivers/filesystem)
77
- [S3 / MinIO](/storage-drivers/s3)
8+
- [GCS](/storage-drivers/gcs)
89
- [Memory](/storage-drivers/memory)
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
---
2+
title: Google Cloud Storage
3+
description: This storage driver stores the cache in a GCS bucket.
4+
---
5+
6+
Driver: `gcs`
7+
8+
This storage driver stores the cache in a GCS bucket.
9+
10+
## Configuration
11+
12+
### `docker-compose` GCS bucket
13+
14+
```yaml [docker-compose.yml]
15+
version: '3.9'
16+
17+
services:
18+
cache-server:
19+
image: ghcr.io/falcondev-oss/github-actions-cache-server:latest
20+
ports:
21+
- '3000:3000'
22+
environment:
23+
URL_ACCESS_TOKEN: random_token
24+
API_BASE_URL: http://localhost:3000
25+
26+
STORAGE_DRIVER: gcs
27+
STORAGE_GCS_BUCKET: gh-actions-cache
28+
# Optional, not required if running in GCP
29+
STORAGE_GCS_SERVICE_ACCOUNT_KEY: /gcp/config/application_default_credentials.json
30+
volumes:
31+
- cache-data:/app/.data
32+
33+
# Use host's application default credentials
34+
- $HOME/.config/gcloud:/gcp/config:ro
35+
36+
volumes:
37+
cache-data:
38+
```
39+
40+
### Environment Variables
41+
42+
Don't forget to set the `STORAGE_DRIVER` environment variable to `gcs` to use the GCS storage driver.
43+
44+
#### `STORAGE_GCS_BUCKET`
45+
46+
Example: `gh-actions-cache`
47+
48+
The name of the GCS bucket used for storage.
49+
50+
#### `STORAGE_GCS_SERVICE_ACCOUNT_KEY`
51+
52+
Example: `/config/auth/serviceaccount.json`
53+
54+
Path to the service account key used for authentication. If not set, [Application Default Credentials](https://cloud.google.com/docs/authentication/application-default-credentials) is used.
55+
56+
#### `STORAGE_GCS_ENDPOINT`
57+
58+
Example: `http://localhost:9000`
59+
60+
The API endpoint for GCS.

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
"extends": "gh:falcondev-it/configs/changelogithub"
2525
},
2626
"dependencies": {
27+
"@google-cloud/storage": "^7.12.1",
2728
"@types/better-sqlite3": "^7.6.11",
2829
"@types/pg": "^8.11.6",
2930
"better-sqlite3": "^11.1.2",

0 commit comments

Comments
 (0)