Git Product home page Git Product logo

zoolander-ci's Introduction

Zoolander CI

derek

Zoolander is a minimal CI environment for the illumos operating system. It provides a single VM which manages CI for a single GitHub project, namely itself.

Zoolander's job is to provide the little green checkmarks next to commits which pass their tests, and to add a little red X next to any commit which fails its tests:

checks

Feel free to browse through this repo's prior commits to see this in action. Per normal GitHub conventions, clicking on either the checkmark or an X next to a commit will provide you with a "Details" link that will show you the console output for that commit's CI run.

Features

  • Updates commit status when builds start, pass, or fail
  • Self-deploying. Simply make deploy (with proper AWS credentials)
  • Dogfood capable! (Zoolander CI is tested via a Zoolander CI instance!)
  • Runs CI jobs as an unprivileged user (aptly named derek)
  • Define build pipelines with plain old GNU Make instead of some proprietary format (See Zoolander.mk).
  • Plaintext browser ui! Who needs Javascript when you have Ctrl-R?
 #######                                                              #####  ### 
      #   ####   ####  #        ##   #    # #####  ###### #####      #     #  #  
     #   #    # #    # #       #  #  ##   # #    # #      #    #     #        #  
    #    #    # #    # #      #    # # #  # #    # #####  #    #     #        #  
   #     #    # #    # #      ###### #  # # #    # #      #####      #        #  
  #      #    # #    # #      #    # #   ## #    # #      #   #      #     #  #  
 #######  ####   ####  ###### #    # #    # #####  ###### #    #      #####  ### 

+------------------------------------------------------------------------------+
|            Refresh your browser to see the latest build output               |
+------------------------------------------------------------------------------+

From https://github.com/robertdfrench/zoolander-ci
   a83e22a..c0140fc  thin-line-banner -> origin/thin-line-banner
OmniOS 5.11	omnios-r151030-632fca26eb	May 2019
/opt/ooce/bin/cargo test

running 11 tests
test http_document::tests::new_has_content_type ... ok
test http_document::tests::headers_is_a_sorted_iterator ... ok
test http_document::tests::return_text_plain ... ok
test http_document::tests::sorted_headers ... ok
test integration::can_read_empty_log ... ok
test integration::can_read_log ... ok
test pathify::tests::normal ... ok
test pathify::tests::short ... ok
test push_event::tests::accept_a_push_event ... ok
test push_event::tests::real_push_event ... ok
test integration::spawns_make ... ok

test result: ok. 11 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out

Limitations

Due to a handful of hadrcoded paths, Zoolander CI can currently only test itself. See Milestone 2 for more information about what work remains to make Zoolander easy for others to use.

Zoolander also has some woeful security problems. Webhooks are not delivered over TLS, and the application itself runs as root (although the CI jobs are executed as an unprivileged user). See #14, #12, and #26 for more information about potential solutions to these problems.

Getting Started

This repository is capable of bootstrapping and deploying itself, assuming you have valid AWS credentials and sufficient privileges to create and manage EC2 instance, images, and security groups. You will also need a github account.

Each Makefile in this repo is self-documenting. Just run make help in any directory to describe the available tasks.

Configuring Webhooks

Once you have deployed a zoolander instance, you will need to give it your API token, and point your webhooks to it. To deploy your token (or rotate your token in the event that it needs to change) just run make rotate. You will be prompted to paste in your GitHub API token, and Make will then install it on your zoolander instance.

Finally, to configure the webhook for your repository, go to Settings > Webhooks > Add webhook. The payload URL will look like http://X.X.X.X/zoolander/webhook where X.X.X.X is your Zoolander instance ip. Set the content-type to json, and then click "Add Webhook".

zoolander-ci's People

Contributors

robertdfrench avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar

zoolander-ci's Issues

Documentation for configuring a repo

  • Create a token with the right privileges
  • Deploy your Zoolander instance
  • Rotate the token on your Zoolander instance
  • Add the web hook to your repo

This could replace #10 since folks will need a GitHub access token anyhow, and it will be easier for folks in a pickle to re-read documentation that to figure out why terraform didn't configure some repo the way they thought it would.

Check for password in web hooks

GitHub's web hooks can provide a (hashed) password. Zoolander should check for this as a means of verifying the authenticity of the webhook.

Separate volume for logs?

To keep the logs from evaporating every time the EC2 instance is restarted, should they live in a separate volume which is attached to an instance on each boot?

Consider self-signed TLS cert

Could do this instead of #12 but would need to make sure documentation (#23) reflects that TLS is self-signed, specifically so that GitHub does not validate the certificate when sending web hooks.

Support optional DNS

DNS can help solve two problems:

  • #12 (Let's Encrypt)
  • #23 (Configure a repo to point to CI)

But we don't want to require someone just messing around with the project to have to use DNS, because that requires at least a time investment if not also a little cash. So if it will be supported, it should be optional.

Use floating IP

This will keep the ip and the EC2-provided DNS from changing in the event that the instance needs to be terminated. This should help make #28 and #25 easier to deal with.

Iterate keys in a sorted fashion

The bug in 97d8039 was introduced by the switch to proper HTTP status code in 9eda277. Mitigating this by changing the expected value of the Status field to match the full HTTP status code name will not suffice, because the document is not constructed the same way every time -- like many languages, rust's hash maps do not iterate in the same order between restarts unless forced. So we need to sort the keys and make sure the response documents are rendered the same way every time.

Confusing EIP output

Outputs:

ip = {
  "dns" = "zoolander-ci.robertdfrench.com"
  "id" = "eipalloc-039b7c92ec580ee1b"
  "ip" = "52.6.63.33"
}
zoolander = 52.4.19.86

So which is the right IP address?

Route GET to log reader

Currently, the greet handler is responding to everything.

This ought to block #7 since it will make it easier to distinguish requests.

CI Supervisor

  • A forked process that supervises an individual job
  • Has credentials to report back to the github API (with the URL for log reading)
  • should begin by just echoing "hello world" to the logs and then completing, before we start on #6

Remove 'make shell'

Now that dns is working, we don't really need to deduce the destination each time, do we?

/tmp fills up

This should be handled by doing jobs in zones, because we can just remove the zones afterwards. But in the current practice, /tmp/whatever persists after jobs are completed, so it fills up and then no new jobs can run successfully.

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.