Git Product home page Git Product logo

ci-gate's Introduction

Build Status

Gates access to the CI system for Github pull requests. Authorized users get immediate CI service. Pull Requests from 3rd party users only enter CI once the CI label is added to their Pull Request by a member of the project.

Suppress CI on a particular Pull Request by applying the 'noCI' label. To resume CI service on the Pull Request:

  1. Remove the 'noCI' label
  2. Add new commit, close/re-open, or add the 'CI' label

Setup

If you'd like to use ci-gate for your github project:

Github Project Config

  1. Create the following labels in your github project:
  • CI - Pull Requests from 3rd party users only enter CI once this label is attached
  • automerge - Pull requests with this label attached will be automatically merged once status checks pass
  1. Go to the webhooks section of your project settings and create a new webhook as follows:
    1. Payload URL = https://ci-gate.herokuapp.com/github
    2. Content Type = application/json
    3. Secret = contents of the GITHUB_WEBHOOK_SECRET environment variable
    4. Which events ... = "Send me everything" for simplicity
  2. Check ci-gate server log file to ensure a github "ping" event was received, indicating the webhook was successfully created

Buildkite Configuration

Ensure the following is added to /etc/buildkite-agent/hooks/environment for each build agent:

if [[ $BUILDKITE_BRANCH =~ pull/* ]]; then
  export BUILDKITE_REFSPEC="+$BUILDKITE_BRANCH:refs/remotes/origin/$BUILDKITE_BRANCH"
  echo $BUILDKITE_REFSPEC
fi

This workaround is necessary to enable the buildkite API to successfully create a new pipeline from a pull request branch (pull/123/head).

affected_files meta data for Pull Requests

From within a job use buildkite-agent meta-data get affected_files to obtain a colon-delimited list of files that were added/removed/modified by this Pull Request.

Heroku Config

Heroku Template

You can click the following button to use a template to deploy to Heroku:

Deploy

Manual Setup

The following config variables should be set in Heroku. See the code comments in index.js for details on each:

  • BUILDKITE_TOKEN
  • BUILDKITE_ORG_SLUG
  • BUILDKITE_PIPELINE_PUBLIC_LOG_WHITELIST
  • GITHUB_TOKEN
  • GITHUB_WEBHOOK_SECRET
  • PUBLIC_URL_ROOT

Optional:

  • To increase verbosity of logs add SILK_DEBUG=silk-*
  • Set TZ to your desired timezone (America/Los_Angeles)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.