Files
floci/docs/services/codepipeline.md
T
Sam Fakhreddine bcf1045536 feat(codepipeline): execute ThirdParty GitHub version 1 source actions (#4615)
* feat(codepipeline): execute ThirdParty GitHub version 1 source actions

Downloads the configured branch archive from codeload.github.com and republishes it with the repo at the artifact root, keeping unix modes and symlinks; zip entries decode as STORED or DEFLATED only, avoiding the ZSTD/XZ dispatch path that breaks the native build.

* fix(codepipeline): bound GitHub source archive size and reject escaping entries

Cap download, uncompressed bytes and entry count; reject escaping paths and symlinks; end the Inflater.

* refactor(codepipeline): use explicit types and imports in the GitHub source, fix its symlink comment

Rename the test class to the *ServiceTest convention and correct the invalid-ref error message, which claimed the branch cannot contain slashes.

* fix(codepipeline): report the GitHub commit as the source revision and harden the GitHub source

Only the ThirdParty version 1 GitHub action takes the codeload path, so a custom action named GitHub still reaches its worker. The revision is the commit SHA from the archive comment, recorded in sourceRevisions as well. Branch segments are percent-encoded, entry checksums are verified, and the archive caps drop to 128 MiB to keep the heap bounded.

* test(codepipeline): wait on state with Awaitility and order imports in the GitHub source test

* refactor(codepipeline): make GitHub source limits final behind overridable accessors

Archive size, entry and base URL settings move from mutable fields to protected accessors that tests override. Also reject archive entries with a leading slash instead of treating it as the top-level separator.
2026-10-01 13:00:50 -04:00

5.0 KiB

CodePipeline

Floci implements the AWS CodePipeline JSON 1.1 API and a local pipeline execution engine.

Protocol: POST / with Content-Type: application/x-amz-json-1.1 and X-Amz-Target: CodePipeline_20150709.<Action>.

Supported Operations (44 total)

The complete CodePipeline 2015-07-09 API surface is routed:

  • Pipeline lifecycle, state, execution history, start, stop, retry, and rollback
  • Stage transitions, manual approvals, action and rule execution history
  • Custom action types and AWS/third-party worker job polling
  • Webhook registration and tag lifecycle

Pipeline definitions, executions, custom action types, jobs, webhooks, tags, and transition state use Floci's configured storage backend.

Execution

Stages execute in declaration order. Actions with the same runOrder execute in parallel. SUPERSEDED, QUEUED, and PARALLEL execution modes are recognized, with QUEUED and PARALLEL restricted to V2 pipelines. A QUEUED or PARALLEL pipeline holds at most 50 active executions, as on AWS; StartPipelineExecution beyond that returns ConcurrentPipelineExecutionsLimitExceededException.

S3 source actions poll for source changes by default, matching AWS when PollForSourceChanges is omitted or set to true. Floci establishes a baseline for the configured object and starts one new execution when its version ID or ETag changes, recording PollForSourceChanges as the execution trigger. Set PollForSourceChanges to false to disable this polling path.

RetryStageExecution resumes the same pipeline execution at a failed stage. FAILED_ACTIONS reruns failed or not-yet-started actions while preserving successful actions; ALL_ACTIONS reruns the complete stage. Runtime artifacts from failed executions are retained for the retry until a newer execution fails the same stage, and a successful retry continues with the stages that follow rather than restarting from the source. A retried execution counts toward the QUEUED/PARALLEL active-execution limit, and a second retry of the same execution while it is still running, including while sibling actions of a failed action finish, returns ConflictException.

S3 source actions resolve sourceRevisions from the object actually consumed by the execution. Unversioned objects report their ETag as the revision ID; versioned objects report the version ID. StartPipelineExecution.sourceRevisions is treated as an override, including supported S3 object-key and version-ID overrides, rather than being copied directly into execution history. Resolved revisions appear in ListPipelineExecutions summaries, as on AWS. RollbackStage reruns with the object key and version ID the target execution consumed, so rolling back redeploys that version rather than the latest upload.

The following providers execute against local Floci services:

Category Provider Behavior
Source S3 Reads the configured object and publishes the output artifact
Source GitHub (ThirdParty, v1) Downloads the configured branch archive from github.com and publishes it with the repo contents at the artifact root
Build/Test CodeBuild Starts and monitors the configured local CodeBuild project
Deploy S3 Writes the input artifact to the configured bucket and key
Deploy CodeDeploy Starts and monitors a local CodeDeploy deployment
Invoke Lambda Invokes the configured local Lambda function
Invoke CodePipeline Starts a nested local pipeline execution
Approval Manual Waits for PutApprovalResult
Custom/third-party Any registered action Uses poll, acknowledge, success, and failure job APIs

AWS-managed providers without a corresponding Floci execution adapter fail the action with an AWS-shaped action error. Floci does not call real AWS accounts or third-party SaaS providers.

Approvals

PutApprovalResult completes waiting Manual approval actions with AWS-shaped validation and error responses. Floci validates the stage and action names, enforces result.status as Approved or Rejected, limits result.summary to 512 characters, returns InvalidApprovalTokenException for unknown tokens, and returns ApprovalAlreadyCompletedException if the same approval token is reused after completion.

Configuration

Variable Default Description
FLOCI_SERVICES_CODEPIPELINE_ENABLED true Enables the CodePipeline API
FLOCI_STORAGE_SERVICES_CODEPIPELINE_MODE global mode Overrides CodePipeline storage mode
FLOCI_STORAGE_SERVICES_CODEPIPELINE_FLUSH_INTERVAL_MS 5000 Hybrid storage flush interval
FLOCI_SERVICES_CODEPIPELINE_SOURCE_POLL_INTERVAL_MS 500 How often (ms) S3 sources are polled for a new object revision

Example

aws --endpoint-url http://localhost:4566 codepipeline create-pipeline \
  --pipeline file://pipeline.json

aws --endpoint-url http://localhost:4566 codepipeline start-pipeline-execution \
  --name local-release

aws --endpoint-url http://localhost:4566 codepipeline list-pipeline-executions \
  --pipeline-name local-release