@pipeline-builder/pipeline-events
v3.4.69
Published
AWS Lambda handler for Pipeline Builder that ingests CodePipeline state-change events from EventBridge and forwards normalized payloads to the reporting service.
Maintainers
Keywords
Readme
@pipeline-builder/pipeline-events
AWS Lambda handler for Pipeline Builder that ingests CodePipeline state-change events from EventBridge and forwards normalized payloads to the reporting service.
Internal workspace package. This is not imported by other packages — it is deployed as a Lambda by the CLI's
setup-eventscommand, which provisions the full EventBridge → SQS → Lambda stack (rule, queue, dead-letter queue, IAM, and this handler).
Responsibilities
- Receives CodePipeline (pipeline / stage / action) events delivered as an SQS batch sourced from EventBridge.
- Classifies each record into a normalized event type (
PIPELINE,STAGE,ACTION) and derives status, start/completion times, run duration, and — on failures — theerrorMessage(from the action'sexecution-result.external-execution-summary). - Resolves each pipeline's stable
PIPELINE_EVENT_IDtag (applied at CDK synth = the platformpipelineId) viacodepipeline:ListTagsForResource, cached per pipeline. The ARN and AWS account never leave AWS, so there is no masking/secret to manage. Untagged (unregistered) pipelines are skipped. - Posts the normalized batch (keyed by
pipelineId) to the reporting service viaPOST /api/reports/events.
CodeBuild Build State events are skipped: a build project can be shared across pipelines, so there is no clean 1:1 mapping to a pipeline id.
Key exports
| Export | Purpose |
|---|---|
| handler(event: SQSEvent) | The Lambda entry point. Parses + resolves the SQS batch and POSTs normalized events to the reporting service. |
Runtime
- Lambda Node.js runtime, using the runtime-provided
@aws-sdk/client-codepipeline. - Triggered by an SQS queue fed by an EventBridge rule matching the
aws.codepipelinesource; processes events in batches and POSTs them in a single request per invocation. - Requires
PLATFORM_BASE_URL(set bysetup-events). - IAM: the execution role must allow
codepipeline:ListTagsForResource. AnAccessDeniedis logged as an error and fails the batch, so a missing grant is visible rather than silent. - Authenticates with either
PLATFORM_TOKEN(a JWT set directly) orPLATFORM_SECRET_NAME(a Secrets Manager secret holdingaccessToken, created viapipeline-manager store-token); the resolved token is cached across invocations.
Development
pnpm build # projen build (compile + lint + test + package)
pnpm test # run the Jest test suiteLicense
Apache-2.0. See LICENSE.
