Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Scaffold for buildkite CI. Fixes #4801 #4814

Merged
merged 27 commits into from
May 2, 2020
Merged

Conversation

bkase
Copy link
Member

@bkase bkase commented Apr 30, 2020

Initial scaffolding for BuildKite CI system

Summary

For now, builds are generated manually, but it is very easy to trigger them automatically on PRs.

There is no infrastructure for running build agents yet -- so to iterate on builds you can run an agent locally. I have included an agent.nix with instructions on how to run the agent on your own computer.

Currently, the agents do not shell out to docker containers so make sure you have installed the environment necessary to run your pipeline before running your agent.

It works

Included are two samples with separate "dirtyWhen" filters. When the branch includes changes from something in src/lib or a file containing transition in it the pipeline executes as follows:

Screen Shot 2020-04-29 at 8 10 50 PM

And if your branch does not include such changed files:

Screen Shot 2020-04-29 at 8 11 41 PM

Implementation

Pipelines are defined in Dhall. To support monorepo triaging, there is one top-level pipeline that dynamically pushes individual "Job"s to buildkite when a dirtyWhen trigger occurs.

BuildKite talks to .buildkite/pipeline.dhall which loads ./.buildkite/src/Monorepo.dhall. Jobs are defined in ./.buildkite/src/jobs/ and two sample jobs are provided as a reference.
Inline comments in the Dhall code can provide more background.

Note that detecting dirty files is handled through the scripts/generate_diff.sh script.

Epic: #4762

Copy link
Member

@nholland94 nholland94 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

some initial feedback on dhall code

-- Maps are lists of special "entry" records. This is made explicit here
let Entry = { Type = \(value: Type) -> { mapKey : Text, mapValue : value } } in
{ Entry = Entry, Type = \(value : Type) -> List (Entry.Type value) }

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Prelude provides this functionality in it's map related exports. See Prelude.Map.Type and Prelude.Map.Entry.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

wow how did I miss that

Pipeline.Config::{
spec = ./Spec.dhall,
steps = [
Command.Config::{ command = [ "echo \"hello\"" ], label = "Test Echo", key = "hello", target = <Large | Small>.Small }
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You should make an alias for this size union so that you don't have to always use this syntax.

-- Add any new jobs here
[
./jobs/Sample/Spec.dhall,
./jobs/Sample2/Spec.dhall
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we auto-gen this dhall file?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, but I'll add a TODO for that and we can do it later

@bkase bkase linked an issue Apr 30, 2020 that may be closed by this pull request
4 tasks
@bkase
Copy link
Member Author

bkase commented Apr 30, 2020

@yourbuddyconner ✅ ? @mrmr1993 ✅ ?

@bkase bkase added the ready-to-merge Adding this label will trigger mergify and trigger CI to run and merge the PR label Apr 30, 2020
@netlify
Copy link

netlify bot commented Apr 30, 2020

Preview:

Built with commit 9b6ce4c

https://deploy-preview-4814--o1website2.netlify.app

@bkase bkase merged commit 868412d into develop May 2, 2020
@bkase bkase deleted the feature/buildkite-ci-scaffold branch May 2, 2020 19:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ready-to-merge Adding this label will trigger mergify and trigger CI to run and merge the PR
Projects
None yet
Development

Successfully merging this pull request may close these issues.

BuildKite CI: Initial infrastructure for building pipelines
3 participants