lambuild
Lambda => CodeBuild = lambuild
lambuild
empowers AWS CodeBuild whose source provider is GITHUB
.
Instead of AWS CodeBuild's GitHub webhook events support,
lambuild
triggers build with GitHub Webhook, Amazon API Gateway, and AWS Lambda to provide the following powerful features.
Link
Feature
Multiple buildspec files
GitHub Actions supports multiple workflow files in .github/workflows
directory.
Like GitHub Actions, lambuild
supports multiple buildspec files.
Conditional builds
e.g.
version: 0.2
lambuild:
if: 'event.Headers.Event == "pull_request"'
build-status-context: "foo ({{.event.Headers.Event}})"
phases:
build:
commands:
- "echo foo"
Custom Environment Variables with GitHub Webhook Event and associated Pull Request
e.g.
version: 0.2
lambuild:
env:
variables:
LAMBUILD_WEBHOOK_BODY: "event.Body"
LAMBUILD_WEBHOOK_EVENT: "event.Headers.Event"
LAMBUILD_WEBHOOK_DELIVERY: "event.Headers.Delivery"
LAMBUILD_HEAD_COMMIT_MSG: "getCommitMessage()"
phases:
build:
commands:
- 'echo $LAMBUILD_HEAD_COMMIT_MSG'
Override Build Configuration like image
in buildspec
e.g.
version: 0.2
lambuild:
build-status-context: "foo ({{.event.Headers.Event}})"
image: aws/codebuild/standard:5.0
compute-type: BUILD_GENERAL1_SMALL
phases:
build:
commands:
- "echo foo"
Run multiple builds based on the same buildspec without Batch Build
e.g.
version: 0.2
lambuild:
env:
variables:
NAME: "item.name"
items:
- image: aws/codebuild/standard:5.0
param:
name: foo
- param:
name: bar
phases:
build:
commands:
- "echo NAME: $NAME"
Maybe you prefer this feature rather than Batch Build, because
- It takes time to run Batch Build
- Batch Build is a little inconvenient
Run Batch Build's each build conditionally
e.g.
version: 0.2
batch:
build-list:
- identifier: foo
buildspec: foo/buildspec.yaml
if: 'any(getPRFileNames(), {# startsWith "foo/"})'
- identifier: renovate
buildspec: buildspec/renovate.yaml
if: 'any(getPRFileNames(), {# == "renovate.json"})'
Architecture
User = (push, pull_request) => GitHub = (webhook) => API Gateway => Lambda => CodeBuild
This image is created with diagrams.net
How does it work?
- Lambda Functions is called via GitHub Webhook
- Request is filtered with hook configuration
- Configuration file is downloaded from the source repository
- buildspec is generated
- Build or Batch Build is run
Supported GitHub Events
LICENSE
MIT