Skip to content

failfast-ci/failfast-api

Repository files navigation

Failfast-ci API server

Trigger gitlab build from github events

Installation

GitHub Configuration

To configure GitHub to use failfast-ci, add an application through "Developer Settings", "GitHub Apps".

  1. Create "New GitHub App"

  2. Give the app a name.

  3. Add a homepage url. I use the url for our fork of failfast-ci.

  4. Set the "Webhook URL" to http[s]://<your api server hostname>/api/v1/github_event.

  5. Add permissions:

    • Repository Administration: Read
    • Commit statuses: Read and Write
    • Deployments: Read and Write
    • Issues: Read and Write
    • Pull Requests: Read and Write
    • Repository Contents: Read and Write
    • Organization Members: Read
  6. Subscribe to events:

    • Label
    • Repository
    • Deployment
    • Pull Request
    • Commit comment
    • Delete
    • Push
    • Public
    • Status
    • Deployment status
    • Pull request review
    • Pull request review comment
    • Create
    • Release
  7. "Where can this GitHub App be installed?"

    Unless you want to make this app and its connected services available to the entirety of GitHub, set this to "Only on this account".

  8. Click "Create GitHub app"

  9. Click "Generate Private Key". This will download a PEM file. Make a note of its filename and download location.

  10. Make a note of the GitHub Application ID found under the "About" header labeled "ID".

Note: If you're going to install failfast-api via helm, you'll need to double base64 encode the PEM file downloaded above, eg.:

base64 -w0 <filename.pem> | base64 -w0 > /tmp/pemb64.b64

GitLab Configuration

To configure GitLab to use failfast-ci, add a robot user, a group, and make the robot a maintainer of the group.

  1. From the "Users" section of the Admin Area create a "New User".

  2. Give it a "Name", "User Name", and "Email".

    Note: with many email systems you can use an existing email address with the "+" notation for adding additional "sub-email" addresses, eg. gitlab_admin+robot1@domain.dom.

  3. Uncheck "Can Create Group".

  4. "Create User"

  5. Click on the "Impersonation Tokens" heading.

  6. Add a name for the application that will use this token, eg. failfast-ci. This name is an arbitrary string.

  7. Check both "api" and "read_user".

  8. Click "Create impersonation token".

  9. Save the Token shown for configuration.

Features

Contribute

Code-style

The project is using flake8, pylint, yapf and mypy. To automatically format and lint run the commands:

make prepare

or only lint:

make check

Modify the CI jobs

The .gitlab-ci.yml is generated from the .gitlab-ci.jsonnet

To add or modify the jobs edit the .gitlab-ci.jsonnet or the files in the .gitlab-ci directory and generate the yaml file it requires https://github.com/failfast-ci/ffctl

pip install ffctl
make gen-ci

Architecture

architecture diagram