Rust Applications MySQL Database
A workflow can be made up of multiple pipelines A pipeline can be made up of multiple stages A stage can perform multiple executions
Webhook Handler
- Handle webhooks from GitHub
- POST /hooks/github
- Parse webhook payload
- Read project information from database
- Call the orchestrator to queue a new workflow
Project Manager
- GET /project?id=123
- POST /project
- PUT /project?id=123
- DELETE /project?id=123
Projects Table
Field | Type | Description |
---|---|---|
id | uuid | Project ID |
Owner | string | |
Project | string | |
url | string | GitHub URL |
webhook_secret | string | GitHub Webhook Secret used to verify x-hub-signature-256 header |
Owner Table
Field | Type | Description |
---|---|---|
id | uuid | Owner ID |
name | string | Owner Name |
Orchestrator
- Queue new workflows (function called by webhook handler)
- Use the project information to provision new build agent
- Use Consul for service discovery
- Use Kubernetes for container (build agent) orchestration
The build agent is an image that contains the following capabilities:
- Checkout the source code from GitHub
- Parse the .factory directory
- All *.hcl files are parsed and converted into a single configuration
- Determine which pipelines are to be executed (checking out the filter stuff)
- Execute pipelines according to stages
- Execute the stages
Read of the repo of the owner
- User installs the GitHub app (manually)
- User creates a new project
- If they are not an existing owner, create a new owner
- This will authenticate them with GitHub
- Sets up the webhook automatically
- If they are not an existing owner, create a new owner
Pre-requisites: The project must exist
- Once a webhook event is recieved from GitHub, the webhook handler will queue a new workflow
- The orchestrator will be reading from the queue and provision a new pod to run the workflow
- The pod will have an installation of the factory_agent cli tool
- The agent will read the project information from the database (including auth mechanism)
- The agent will authenticate with GitHub
- The agent will read the .factory directory from the repository (prior to checking out everything else)
- Syntax check the .hcl files
- Conditionally check whether which pipelines are to be executed
- Execute pipelines according to stages
- Checkout code