Skip to content

Latest commit

 

History

History

api

How does Peril work?

There are some key files where the magic happens:

This is a reasonably tested project, there's a lot in places where the code isn't going to change much now so they're slowly getting covered.

Peril's main API is split into two components with three parts:

  • The API

    The two main responsibilities of the API are to take webhooks from GitHub and convert those into Dangerfile runs, and to provide a GraphQL API for the dashboard. It is an express app, it doesn't try to be too fancy because the domain is reasonably complex WRT security.

    • Deploy: yarn deploy:staging:api
    • Logs: yarn logs:staging
  • The Runner

    The runner is an AWS lambda, it has two parts. An AWS Layer which is the Peril "runtime". Then a function per-org which sets up environment for the shared runtime layer.

    Layer

    The shared Peril infrastructure that grabs the Dangerfile and evaluates it. It's effectively a subset of the Peril server, and it's opening module is source/runner/index.ts.

    To understand how it is created, see: source/scripts/generate-runner-deps.ts. It will generate a subset of Peril's dependencies for the layer because there is a 250MB size limit for the layer and Perils is 450MB (!!).

    Function

    A really basic set of files which are the CWD for the function. Enough to transpile JS/TS correctly and to handle evaluation for

    Then you can test evaluation:

Links

Staging Infra + Links