0.0.22 • Published 4 years ago

@pclabs/gru v0.0.22

Weekly downloads
33
License
ISC
Repository
-
Last release
4 years ago

Gru

Gru manages code deployment state in monorepos

Gru uses tags to track which version of your code is built and in which environments it is deployed.

The goal is to have your git repo be the single source of truth for the history and state of your code's builds and deployments!

With Gru think: "BUILD - CACHE - DEPLOY!"

Usage

  1. install
  npm install --save-dev @pclabs/gru
  1. Add gru script to package.json
  ...
  "scripts": {
    ...
    gru: "gru"
  }

Gru's strict assumptions

  • That the code you are ultimately going to deploy can be reduced to a single stateless zip file
    • Examples: docker image, static bundle, cloud function build

These assumptions mean that in order to use Gru, you have to answer a few questions for us via delegates

  • How do you turn a commit into a build? (wepback, build, docker init, etc.)
  • How can we cache these builds? (aws s4, google cloud bucket, etc.)
    • Once an app is cached the repo will be tagged with the given build prefix
  • How do you deploy a build to a defined ENVIRONMENT?

Gru will manage Github tags to keep track of

  • Which commits have been built (via the buildTag)
  • Which commits have been deployed to which environments (via the envTag)
  • Which commits have been previously released (via the envTag)

This way the state of your system is always up to date with your commit history.

Configuration

You will need to export a config file from .gruconfig.js that defines how to deploy each of your apps.

  {
    apps: {
      [APPNAME]: {
        name: [APPNAME]
        buildTagPrefix: // the prefix associated with builds.
        envTagPrefix: // the prefix associated with environments,
        envReqTagPrefix: // the prefix associated with environment requests,
        releaseTagPrefix: // the prefix associated with releases requests,
        releaseReqTagPrefix: // the prefix associated with releases requests,

        buildTagPrefix: 
        envTagPrefix: 

        // DELEGATES
        build: async function(buildKey) {
          // this function should build the code and return the local path to where it was built
        },
        cache: async function(buildKey, zipFile) {
          // expected to handle hosting the zipFile somewhere and returning the destination path
        },
      },
    },
    customParser: (custom) => {
      // A function that is called with the cli option --custom
      // This is useful when using CI/CD tools (such as Github Actions) for turning events into easily defined CLI commands. For example:
      //    gru --custom=env_app_prod_key
      // the parser then receives env_app_prod_key and and may convert it into
      //    { app: 'app', cache: 'true', deployTo: 'prod' }
      // which would be equivalent to calling 
      //    gru --app=app cache=true deployTo=prod
      // returns { app, cache, deployTo }
    }
  }

Upcoming Features

  • Deployment Management
  • Usage of OS .temp directory
  • Query remote tags for existing builds, in addition to local repository
0.0.22

4 years ago

0.0.21

4 years ago

0.0.20

4 years ago

0.0.19

4 years ago

0.0.18

4 years ago

0.0.17

4 years ago

0.0.16

4 years ago

0.0.13

4 years ago

0.0.14

4 years ago

0.0.15

4 years ago

0.0.10

4 years ago

0.0.11

4 years ago

0.0.12

4 years ago

0.0.9

4 years ago

0.0.8

4 years ago

0.0.7

4 years ago

0.0.6

4 years ago

0.0.5

4 years ago

0.0.4

4 years ago

0.0.3

4 years ago

0.0.2

4 years ago

0.0.3-alpha.0

4 years ago

0.0.2-alpha.0

4 years ago

0.0.1-alpha.0

4 years ago