feat(codebuild,codedeploy): Implementing real build in docker phase2 (#649)

* 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
This commit is contained in:
Hector Ventura authored and GitHub committed 2026-04-29 22:11:55 -05:00
1 parent 2ff85a450e
commit 2832bc7714
22 files changed
+2570 -38

No files matched your search

+67 -12
View File
@@ -1,6 +1,6 @@
# CodeDeploy
Floci implements the CodeDeploy management API (Phase 1) — stored-state CRUD for applications, deployment groups, and deployment configurations. Built-in deployment configurations are pre-seeded and always available. Deployment execution (Phase 2) is not yet implemented.
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>`
@@ -8,8 +8,12 @@ Floci implements the CodeDeploy management API (Phase 1) — stored-state CRUD f
- `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 (Phase 1 — 21 total)
## Supported Operations (30 total)
### Applications
| Operation | Notes |
|---|---|
@@ -19,19 +23,53 @@ Floci implements the CodeDeploy management API (Phase 1) — stored-state CRUD f
| `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 |
@@ -62,6 +100,17 @@ The following 17 configurations are always available (matching real AWS):
- `CodeDeployDefault.ECSLinear10PercentEvery1Minutes`
- `CodeDeployDefault.ECSLinear10PercentEvery3Minutes`
## Lambda Deployment Model
For `computePlatform: Lambda`, `CreateDeployment` performs real traffic shifting:
1. Reads the deployment group's `deploymentStyle` and `deploymentConfigName` to determine the traffic shift strategy
2. For **canary** and **linear** strategies: updates the Lambda alias `RoutingConfig` to route a percentage to the new function version, waits the configured interval, then shifts to 100%
3. For **all-at-once**: shifts directly to 100% of the new version
4. Invokes `BeforeAllowTraffic` lifecycle hook Lambda (if configured) and waits for `PutLifecycleEventHookExecutionStatus` callback
5. Invokes `AfterAllowTraffic` lifecycle hook Lambda (if configured) and waits for the callback
6. If any lifecycle hook reports `Failed`, auto-rolls back the alias to the previous version and marks the deployment `Failed`
## Configuration
```yaml
@@ -79,17 +128,23 @@ aws --endpoint-url http://localhost:4566 deploy create-application \
--application-name my-app \
--compute-platform Lambda
# List built-in deployment configs
aws --endpoint-url http://localhost:4566 deploy list-deployment-configs
# Create a deployment group
# 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.LambdaAllAtOnce \
--service-role-arn arn:aws:iam::000000000000:role/codedeploy-role
--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
```
## Phase 2 (not yet implemented)
`CreateDeployment`, `GetDeployment`, `StopDeployment`, `ContinueDeployment` with real Lambda traffic-shifting (updating alias `RoutingConfig` weights). Phase 2 focuses on the `computePlatform: Lambda` path since Lambda is already fully real in Floci.