Skip to content

A Google Cloud Storage distributed cache plugin for Nx.

License

Notifications You must be signed in to change notification settings

MansaGroup/nx-gcs-remote-cache

Repository files navigation

Banner

nx-gcs-remote-cache

License GitHub Issues GitHub Stars

This package implements a Google Cloud Storage-backed distributed cache for Nrwl Nx monorepos.

The distributed cache allows one or more developpers, including CI/CD pipelines to share the same task cache, allowing one to not run a task already ran by someone else when the code did not changed.

Nx provides Nx Cloud, a SaaS allowing you and your team to have a distributed cache and task runner to avoid the hassle of having your computer to burn when building your entire monorepo.

This plugin only provides a distributed cache implementation, not a task runner alternative.

Usage

Even if this plugin is installed in your workspace, the GCS cache is opt-in by default. If the NX_REMOTE_CACHE_BUCKET environment variable required is not found, this plugin will fallback to the default behavior you already know.

To add this plugin to your workspace, please install the package from npm using your favorite package manager:

# Install the package
npm install --save-dev @mansagroup/nx-gcs-remote-cache

Then, change your task runner for the one provided by the plugin in your nx.json file:

{
  "tasksRunnerOptions": {
    "default": {
      "runner": "@mansagroup/nx-gcs-remote-cache"
    }
  }
}

Finally, set your NX_REMOTE_CACHE_BUCKET environment variable to the name of your Google Cloud Storage bucket to use as cache container.

This plugin consider that you've already configured your Google Cloud CLI, especially the application default credentials using gcloud auth application-default login if you work locally. The procedure for an automated environment such as a CI/CD can differ.

License

This project is MIT licensed.

Contributors

Thanks goes to these wonderful people (emoji key):


Jérémy Levilain

💻 🤔

This project follows the all-contributors specification. Contributions of any kind welcome!