nx-remotecache-google
v1.1.0
Published
Remote caching for @nrwl/nx using Google Cloud Storage
Downloads
376
Maintainers
Readme
nx-remotecache-google
A task runner for @nrwl/nx that uses an Google Cloud Storage as a remote cache. This enables all team members and CI servers to share a single cache. The concept and benefits of computation caching are explained in the NX documentation.
This package was built with nx-remotecache-custom 🙌
Compatibility
| Nx | nx-remotecache-google |
| ----------------- |---------------------|
| >= 19.0.0 < 20
| = 1.1.0
|
| >= 17.0.0 < 18
| = 1.0.0
|
Setup
npm install --save-dev nx-remotecache-google
| Parameter | Description | Environment Variable / .env | nx.json
|
|-------------|--------------------------------------|---------------------------------------|----------------|
| Project ID | Id of your project on GCP | NXCACHE_GOOGLE_STORAGE_PROJECT_ID
| project_id
|
| Client Name | Client email of your service account | NXCACHE_GOOGLE_STORAGE_CLIENT_EMAIL
| client_email
|
| Private Key | Private key of your service account | NXCACHE_GOOGLE_STORAGE_PRIVATE_KEY
| private_key
|
| Bucket Name | Bucket name where to store cache | NXCACHE_GOOGLE_STORAGE_BUCKET
| bucket
|
{
"tasksRunnerOptions": {
"default": {
"runner": "nx-remotecache-google",
"options": {
// All of the gcp specific options can also be inserted via environment variables! ⬆️
"private_key": "-----BEGIN PRIVATE KEY-----\n.........\n-----END PRIVATE KEY-----",
"project_id": "your-project-id",
"client_email": "[email protected]",
"bucket": "gs://your-storage-bucket",
"cacheableOperations": ["build", "test", "lint", "e2e"]
}
}
}
}
Run it 🚀
Running tasks should now show the storage or retrieval from the remote cache:
chunk (runtime: main) main.js (main) 827 KiB [entry] [rendered]
webpack compiled successfully (xxxxx)
------------------------------------------------------------------------------
Stored output to remote cache: GCP Storage
File: 1679426766935461636258771.tar.gz
------------------------------------------------------------------------------
Advanced Configuration
| Option | Environment Variable / .env | Description |
| ------------ | --------------------------- | ----------------------------------------------------------------------------------------------------- |
| name
| NXCACHE_NAME
| Set to provide task runner name for logging. Overrides name provided in implementation. |
| verbose
| | Set to receive full stack traces whenever errors occur. Best used for debugging. Default: false
|
| silent
| | Set to mute success and info logs. Default: false
|
| read
| NXCACHE_READ
| Set to enable / disable reading from the remote cache. Default: true
|
| write
| NXCACHE_WRITE
| Set to enable / disable writing to the remote cache. Default: true
|
| dotenv
| | Set to false
to disable reading .env
into process.env
. Default: true
|
| dotenvPath
| | Set to read .env
files from a different folder. |
"tasksRunnerOptions": {
"default": {
"options": {
"name": "My Storage",
"verbose": true,
"silent": true
}
}
}
All Custom Runners
| Runner | Storage | |------------------------------------------------------------------------------|----------------------| | nx-remotecache-azure | Azure Blob Storage | | nx-remotecache-minio | MinIO Storage | | nx-remotecache-google | Google Cloud Storage |