mirror of
https://github.com/floci-io/floci.git
synced 2026-11-23 14:10:49 -05:00
* feat(codebuild,codedeploy): real build execution and Lambda deployment engine CodeBuild Phase 2: runs buildspec phases inside real Docker containers. Source injected via docker cp (copyArchiveToContainerCmd); artifacts extracted via docker cp (copyArchiveFromContainerCmd). No bind mounts — works transparently in Docker-in-Docker. CloudWatch log streaming, S3 artifact upload, StopBuild, RetryBuild, ListBuilds, ListBuildsForProject. CodeDeploy Phase 2: real Lambda deployments with traffic shifting via alias RoutingConfig, lifecycle hook invocation against live Lambda functions, PutLifecycleEventHookExecutionStatus callback, and auto-rollback on hook failure. CreateDeployment, GetDeployment, deployment state polling, ListDeployments, BatchGetDeployments, ListDeploymentTargets, BatchGetDeploymentTargets. * docs: updating docs with new services details
6.2 KiB
6.2 KiB
CodeDeploy
Floci implements the CodeDeploy API — stored-state management for applications, deployment groups, and configs, plus real Lambda deployment execution with traffic shifting and lifecycle hooks.
Protocol: JSON 1.1 — POST / with X-Amz-Target: CodeDeploy_20141006.<Action>
ARN formats:
arn:aws:codedeploy:<region>:<account>:application:<name>arn:aws:codedeploy:<region>:<account>:deploymentgroup:<app>/<group>arn:aws:codedeploy:<region>:<account>:deploymentconfig:<name>arn:aws:codedeploy:<region>:<account>:deployment:<id>
Supported Operations (30 total)
Applications
| Operation | Notes |
|---|---|
CreateApplication |
Supports computePlatform: Server, Lambda, ECS |
GetApplication |
Returns application metadata |
UpdateApplication |
Renames an application |
DeleteApplication |
Removes application and all its deployment groups |
ListApplications |
Returns all application names |
BatchGetApplications |
Returns info for multiple applications |
Deployment Groups
| Operation | Notes |
|---|---|
CreateDeploymentGroup |
Stores group config; deployment config defaults to CodeDeployDefault.OneAtATime |
GetDeploymentGroup |
Returns group metadata |
UpdateDeploymentGroup |
Partial update; supports rename via newDeploymentGroupName |
DeleteDeploymentGroup |
Returns hooksNotCleanedUp: [] |
ListDeploymentGroups |
Returns all group names for an application |
BatchGetDeploymentGroups |
Returns info for multiple groups |
Deployment Configs
| Operation | Notes |
|---|---|
CreateDeploymentConfig |
Creates a custom config; names starting with CodeDeployDefault. are rejected |
GetDeploymentConfig |
Returns config including built-ins |
DeleteDeploymentConfig |
Custom configs only; built-ins cannot be deleted |
ListDeploymentConfigs |
Returns all configs including all 17 pre-seeded built-ins |
Deployment Execution
| Operation | Notes |
|---|---|
CreateDeployment |
Starts a real Lambda deployment: shifts alias RoutingConfig weights for canary/linear strategies; invokes lifecycle hooks |
GetDeployment |
Returns current deployment state; poll status until Succeeded, Failed, or Stopped |
StopDeployment |
Signals an in-progress deployment to stop; transitions to Stopped |
ContinueDeployment |
Accepted (no-op for fully automated deployments) |
ListDeployments |
Returns deployment IDs filtered by application, group, or status |
BatchGetDeployments |
Returns info for multiple deployments |
ListDeploymentTargets |
Returns target IDs for a deployment |
BatchGetDeploymentTargets |
Returns target details including lifecycle event status |
PutLifecycleEventHookExecutionStatus |
Called by lifecycle hook Lambda to report Succeeded or Failed; failure triggers auto-rollback |
Tagging
| Operation | Notes |
|---|---|
TagResource |
Tags any resource by ARN |
UntagResource |
Removes specific tag keys |
ListTagsForResource |
Returns tags for a resource ARN |
On-Premises (no-op)
| Operation | Notes |
|---|---|
AddTagsToOnPremisesInstances |
Accepted, no-op |
RemoveTagsFromOnPremisesInstances |
Accepted, no-op |
Pre-seeded Built-in Deployment Configs
The following 17 configurations are always available (matching real AWS):
Server:
CodeDeployDefault.OneAtATimeCodeDeployDefault.HalfAtATimeCodeDeployDefault.AllAtOnce
Lambda:
CodeDeployDefault.LambdaAllAtOnceCodeDeployDefault.LambdaCanary10Percent5MinutesCodeDeployDefault.LambdaCanary10Percent10MinutesCodeDeployDefault.LambdaCanary10Percent15MinutesCodeDeployDefault.LambdaCanary10Percent30MinutesCodeDeployDefault.LambdaLinear10PercentEvery1MinuteCodeDeployDefault.LambdaLinear10PercentEvery2MinutesCodeDeployDefault.LambdaLinear10PercentEvery3MinutesCodeDeployDefault.LambdaLinear10PercentEvery10Minutes
ECS:
CodeDeployDefault.ECSAllAtOnceCodeDeployDefault.ECSCanary10Percent5MinutesCodeDeployDefault.ECSCanary10Percent15MinutesCodeDeployDefault.ECSLinear10PercentEvery1MinutesCodeDeployDefault.ECSLinear10PercentEvery3Minutes
Lambda Deployment Model
For computePlatform: Lambda, CreateDeployment performs real traffic shifting:
- Reads the deployment group's
deploymentStyleanddeploymentConfigNameto determine the traffic shift strategy - For canary and linear strategies: updates the Lambda alias
RoutingConfigto route a percentage to the new function version, waits the configured interval, then shifts to 100% - For all-at-once: shifts directly to 100% of the new version
- Invokes
BeforeAllowTrafficlifecycle hook Lambda (if configured) and waits forPutLifecycleEventHookExecutionStatuscallback - Invokes
AfterAllowTrafficlifecycle hook Lambda (if configured) and waits for the callback - If any lifecycle hook reports
Failed, auto-rolls back the alias to the previous version and marks the deploymentFailed
Configuration
floci:
services:
codedeploy:
enabled: true # default
CLI Examples
# Create an application
aws --endpoint-url http://localhost:4566 deploy create-application \
--application-name my-app \
--compute-platform Lambda
# Create a deployment group for Lambda
aws --endpoint-url http://localhost:4566 deploy create-deployment-group \
--application-name my-app \
--deployment-group-name my-group \
--deployment-config-name CodeDeployDefault.LambdaCanary10Percent5Minutes \
--service-role-arn arn:aws:iam::000000000000:role/codedeploy-role \
--deployment-style deploymentType=BLUE_GREEN,deploymentOption=WITH_TRAFFIC_CONTROL
# Start a deployment
aws --endpoint-url http://localhost:4566 deploy create-deployment \
--application-name my-app \
--deployment-group-name my-group \
--revision revisionType=AppSpecContent,appSpecContent={content='{"version":0.0,"Resources":[{"myFunction":{"Type":"AWS::Lambda::Function","Properties":{"Name":"my-function","Alias":"live","CurrentVersion":"1","TargetVersion":"2"}}}]}'}
# Poll deployment status
aws --endpoint-url http://localhost:4566 deploy get-deployment --deployment-id <id>
# List built-in deployment configs
aws --endpoint-url http://localhost:4566 deploy list-deployment-configs