Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions apps/docs/components/icons.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5512,6 +5512,33 @@ export function CloudWatchIcon(props: SVGProps<SVGSVGElement>) {
)
}

export function CodePipelineIcon(props: SVGProps<SVGSVGElement>) {
return (
<svg
{...props}
viewBox='5 5 70.002 70.002'
version='1.1'
xmlns='http://www.w3.org/2000/svg'
xmlnsXlink='http://www.w3.org/1999/xlink'
>
<g
id='Icon-Architecture/64/Arch_AWS-CodePipeline_64'
stroke='none'
strokeWidth='1'
fill='none'
fillRule='evenodd'
transform='translate(40, 40) scale(1.25) translate(-40, -40)'
>
<path
d='M30,31 L35,31 L35,29 L30,29 L30,31 Z M36.667,61.166 L34.817,60.407 L42.409,41.885 L44.259,42.644 L36.667,61.166 Z M45.571,55.78 L51.068,50.958 L45.575,46.197 L46.886,44.685 L53.245,50.198 C53.463,50.387 53.589,50.662 53.590006,50.951 C53.591,51.24 53.467,51.515 53.249,51.706 L46.89,57.284 L45.571,55.78 Z M25.508976,51.048 C25.507,50.759 25.63,50.484 25.847,50.293 L32.184,44.691 L33.508,46.19 L28.029,51.033 L33.478,55.73 L32.171,57.245 L25.855,51.799 C25.637,51.611 25.511,51.337 25.508976,51.048 L25.508976,51.048 Z M62.535,35 L18.465,35 C16.555,35 15,33.446 15,31.536 L15,31 L27,31 L27,29 L15,29 L15,18.464 C15,16.554 16.555,15 18.465,15 L62.535,15 C64.445,15 66,16.554 66,18.464 L66,29 L38,29 L38,31 L66,31 L66,31.536 C66,33.446 64.445,35 62.535,35 L62.535,35 Z M22,66 L58,66 L58,37 L22,37 L22,66 Z M62.535,13 L18.465,13 C15.451,13 13,15.451 13,18.464 L13,31.536 C13,34.549 15.451,37 18.465,37 L20,37 L20,67 C20,67.552 20.447,68 21,68 L59,68 C59.553,68 60,67.552 60,67 L60,37 L62.535,37 C65.549,37 68,34.549 68,31.536 L68,18.464 C68,15.451 65.549,13 62.535,13 L62.535,13 Z'
id='AWS-CodePipeline_Icon_64_Squid'
fill='currentColor'
/>
</g>
</svg>
)
}

export function TextractIcon(props: SVGProps<SVGSVGElement>) {
return (
<svg
Expand Down
2 changes: 2 additions & 0 deletions apps/docs/components/ui/icon-mapping.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ import {
CloudFormationIcon,
CloudflareIcon,
CloudWatchIcon,
CodePipelineIcon,
ConfluenceIcon,
CrowdStrikeIcon,
CursorIcon,
Expand Down Expand Up @@ -243,6 +244,7 @@ export const blockTypeToIconMap: Record<string, IconComponent> = {
cloudflare: CloudflareIcon,
cloudformation: CloudFormationIcon,
cloudwatch: CloudWatchIcon,
codepipeline: CodePipelineIcon,
confluence: ConfluenceIcon,
confluence_v2: ConfluenceIcon,
crowdstrike: CrowdStrikeIcon,
Expand Down
237 changes: 237 additions & 0 deletions apps/docs/content/docs/en/tools/codepipeline.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,237 @@
---
title: CodePipeline
description: Run, monitor, and approve AWS CodePipeline pipelines
---

import { BlockInfoCard } from "@/components/ui/block-info-card"

<BlockInfoCard
type="codepipeline"
color="linear-gradient(45deg, #2E27AD 0%, #527FFF 100%)"
/>

## Usage Instructions

Integrate AWS CodePipeline into workflows. Start, stop, and monitor pipeline executions, retry failed stages, and approve or reject manual approval actions. Requires AWS access key and secret access key.



## Tools

### `codepipeline_list_pipelines`

List all CodePipeline pipelines in an AWS account and region

#### Input

| Parameter | Type | Required | Description |
| --------- | ---- | -------- | ----------- |
| `awsRegion` | string | Yes | AWS region \(e.g., us-east-1\) |
| `awsAccessKeyId` | string | Yes | AWS access key ID |
| `awsSecretAccessKey` | string | Yes | AWS secret access key |
| `maxResults` | number | No | Maximum number of pipelines to return \(1-1000\) |
| `nextToken` | string | No | Pagination token from a previous call |

#### Output

| Parameter | Type | Description |
| --------- | ---- | ----------- |
| `pipelines` | array | List of pipelines with name, version, type, and timestamps |
| ↳ `name` | string | Pipeline name |
| ↳ `version` | number | Pipeline version number |
| ↳ `pipelineType` | string | Pipeline type \(V1 or V2\) |
| ↳ `executionMode` | string | Execution mode \(QUEUED, SUPERSEDED, PARALLEL\) |
| ↳ `created` | number | Epoch ms when the pipeline was created |
| ↳ `updated` | number | Epoch ms when the pipeline was last updated |
| `nextToken` | string | Pagination token for the next page of results |

### `codepipeline_get_pipeline_state`

Get the current state of a CodePipeline pipeline, including stage and action status and pending approval tokens

#### Input

| Parameter | Type | Required | Description |
| --------- | ---- | -------- | ----------- |
| `awsRegion` | string | Yes | AWS region \(e.g., us-east-1\) |
| `awsAccessKeyId` | string | Yes | AWS access key ID |
| `awsSecretAccessKey` | string | Yes | AWS secret access key |
| `pipelineName` | string | Yes | Name of the pipeline |

#### Output

| Parameter | Type | Description |
| --------- | ---- | ----------- |
| `pipelineName` | string | Pipeline name |
| `pipelineVersion` | number | Pipeline version number |
| `created` | number | Epoch ms when the pipeline was created |
| `updated` | number | Epoch ms when the pipeline was last updated |
| `stageStates` | array | Per-stage state including latest execution status and action details |
| ↳ `stageName` | string | Stage name |
| ↳ `status` | string | Latest stage execution status \(InProgress, Succeeded, Failed, Stopped, Cancelled\) |
| ↳ `pipelineExecutionId` | string | Pipeline execution ID currently in the stage |
| ↳ `inboundTransitionEnabled` | boolean | Whether the inbound transition into the stage is enabled |
| ↳ `actionStates` | array | Per-action state with status, summary, error details, and approval token \(for pending manual approvals\) |

### `codepipeline_get_pipeline_execution`

Get details of a CodePipeline execution, including status, trigger, source revisions, and resolved variables

#### Input

| Parameter | Type | Required | Description |
| --------- | ---- | -------- | ----------- |
| `awsRegion` | string | Yes | AWS region \(e.g., us-east-1\) |
| `awsAccessKeyId` | string | Yes | AWS access key ID |
| `awsSecretAccessKey` | string | Yes | AWS secret access key |
| `pipelineName` | string | Yes | Name of the pipeline |
| `pipelineExecutionId` | string | Yes | ID of the pipeline execution |

#### Output

| Parameter | Type | Description |
| --------- | ---- | ----------- |
| `pipelineExecutionId` | string | Pipeline execution ID |
| `pipelineName` | string | Pipeline name |
| `pipelineVersion` | number | Pipeline version number |
| `status` | string | Execution status \(Cancelled, InProgress, Stopped, Stopping, Succeeded, Superseded, Failed\) |
| `statusSummary` | string | Status summary for the execution |
| `executionMode` | string | Execution mode \(QUEUED, SUPERSEDED, PARALLEL\) |
| `executionType` | string | Execution type \(STANDARD or ROLLBACK\) |
| `triggerType` | string | What triggered the execution \(e.g., Webhook, StartPipelineExecution\) |
| `triggerDetail` | string | Detail about the trigger \(e.g., user ARN\) |
| `artifactRevisions` | array | Source artifact revisions for the execution |
| ↳ `name` | string | Artifact name |
| ↳ `revisionId` | string | Revision ID \(e.g., commit SHA\) |
| ↳ `revisionSummary` | string | Revision summary \(e.g., commit message\) |
| ↳ `revisionUrl` | string | URL of the revision |
| ↳ `created` | number | Epoch ms when the revision was created |
| `variables` | array | Resolved pipeline variables for the execution |
| ↳ `name` | string | Variable name |
| ↳ `resolvedValue` | string | Resolved variable value |

### `codepipeline_list_pipeline_executions`

List recent executions of a CodePipeline pipeline with status and source revisions

#### Input

| Parameter | Type | Required | Description |
| --------- | ---- | -------- | ----------- |
| `awsRegion` | string | Yes | AWS region \(e.g., us-east-1\) |
| `awsAccessKeyId` | string | Yes | AWS access key ID |
| `awsSecretAccessKey` | string | Yes | AWS secret access key |
| `pipelineName` | string | Yes | Name of the pipeline |
| `maxResults` | number | No | Maximum number of executions to return \(1-100, default 100\) |
| `nextToken` | string | No | Pagination token from a previous call |
| `succeededInStage` | string | No | Only return executions that succeeded in this stage |

#### Output

| Parameter | Type | Description |
| --------- | ---- | ----------- |
| `executions` | array | Pipeline execution summaries, most recent first |
| ↳ `pipelineExecutionId` | string | Pipeline execution ID |
| ↳ `status` | string | Execution status \(Cancelled, InProgress, Stopped, Stopping, Succeeded, Superseded, Failed\) |
| ↳ `statusSummary` | string | Status summary for the execution |
| ↳ `startTime` | number | Epoch ms when the execution started |
| ↳ `lastUpdateTime` | number | Epoch ms when the execution was last updated |
| ↳ `executionMode` | string | Execution mode \(QUEUED, SUPERSEDED, PARALLEL\) |
| ↳ `executionType` | string | Execution type \(STANDARD or ROLLBACK\) |
| ↳ `stopTriggerReason` | string | Reason the execution was stopped, if applicable |
| ↳ `triggerType` | string | What triggered the execution |
| ↳ `triggerDetail` | string | Detail about the trigger |
| ↳ `sourceRevisions` | array | Source revisions \(commit IDs, summaries, URLs\) for the execution |
| `nextToken` | string | Pagination token for the next page of results |

### `codepipeline_start_execution`

Start a CodePipeline pipeline execution, optionally overriding pipeline variables

#### Input

| Parameter | Type | Required | Description |
| --------- | ---- | -------- | ----------- |
| `awsRegion` | string | Yes | AWS region \(e.g., us-east-1\) |
| `awsAccessKeyId` | string | Yes | AWS access key ID |
| `awsSecretAccessKey` | string | Yes | AWS secret access key |
| `pipelineName` | string | Yes | Name of the pipeline to start |
| `clientRequestToken` | string | No | Idempotency token to identify a unique execution request |
| `variables` | json | No | Pipeline variable overrides as an array of \{ name, value \} objects |

#### Output

| Parameter | Type | Description |
| --------- | ---- | ----------- |
| `pipelineExecutionId` | string | ID of the pipeline execution that was started |

### `codepipeline_stop_execution`

Stop a CodePipeline pipeline execution, either finishing in-progress actions or abandoning them

#### Input

| Parameter | Type | Required | Description |
| --------- | ---- | -------- | ----------- |
| `awsRegion` | string | Yes | AWS region \(e.g., us-east-1\) |
| `awsAccessKeyId` | string | Yes | AWS access key ID |
| `awsSecretAccessKey` | string | Yes | AWS secret access key |
| `pipelineName` | string | Yes | Name of the pipeline |
| `pipelineExecutionId` | string | Yes | ID of the pipeline execution to stop |
| `abandon` | boolean | No | Abandon in-progress actions instead of letting them finish \(default false\) |
| `reason` | string | No | Reason for stopping the execution \(max 200 characters\) |

#### Output

| Parameter | Type | Description |
| --------- | ---- | ----------- |
| `pipelineExecutionId` | string | ID of the pipeline execution that was stopped |

### `codepipeline_retry_stage_execution`

Retry the failed actions (or all actions) of a failed CodePipeline stage

#### Input

| Parameter | Type | Required | Description |
| --------- | ---- | -------- | ----------- |
| `awsRegion` | string | Yes | AWS region \(e.g., us-east-1\) |
| `awsAccessKeyId` | string | Yes | AWS access key ID |
| `awsSecretAccessKey` | string | Yes | AWS secret access key |
| `pipelineName` | string | Yes | Name of the pipeline |
| `stageName` | string | Yes | Name of the failed stage to retry |
| `pipelineExecutionId` | string | Yes | ID of the pipeline execution in the failed stage |
| `retryMode` | string | Yes | Scope of the retry: FAILED_ACTIONS or ALL_ACTIONS |

#### Output

| Parameter | Type | Description |
| --------- | ---- | ----------- |
| `pipelineExecutionId` | string | ID of the pipeline execution with the retried stage |

### `codepipeline_put_approval_result`

Approve or reject a pending CodePipeline manual approval action. The approval token is available from Get Pipeline State on the pending approval action

#### Input

| Parameter | Type | Required | Description |
| --------- | ---- | -------- | ----------- |
| `awsRegion` | string | Yes | AWS region \(e.g., us-east-1\) |
| `awsAccessKeyId` | string | Yes | AWS access key ID |
| `awsSecretAccessKey` | string | Yes | AWS secret access key |
| `pipelineName` | string | Yes | Name of the pipeline |
| `stageName` | string | Yes | Name of the stage containing the approval action |
| `actionName` | string | Yes | Name of the manual approval action |
| `token` | string | Yes | Approval token from Get Pipeline State for the pending approval |
| `status` | string | Yes | Approval decision: Approved or Rejected |
| `summary` | string | Yes | Summary explaining the approval decision \(max 512 characters\) |

#### Output

| Parameter | Type | Description |
| --------- | ---- | ----------- |
| `approvedAt` | number | Epoch ms when the approval or rejection was submitted |
| `status` | string | The submitted approval decision \(Approved or Rejected\) |


1 change: 1 addition & 0 deletions apps/docs/content/docs/en/tools/meta.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
"cloudflare",
"cloudformation",
"cloudwatch",
"codepipeline",
"confluence",
"crowdstrike",
"cursor",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
import { CodePipelineClient, GetPipelineExecutionCommand } from '@aws-sdk/client-codepipeline'
import { createLogger } from '@sim/logger'
import { toError } from '@sim/utils/errors'
import { type NextRequest, NextResponse } from 'next/server'
import { awsCodepipelineGetPipelineExecutionContract } from '@/lib/api/contracts/tools/aws/codepipeline-get-pipeline-execution'
import { parseToolRequest } from '@/lib/api/server'
import { checkInternalAuth } from '@/lib/auth/hybrid'
import { withRouteHandler } from '@/lib/core/utils/with-route-handler'
import { awsErrorStatus } from '@/app/api/tools/codepipeline/utils'

const logger = createLogger('CodePipelineGetPipelineExecution')

export const POST = withRouteHandler(async (request: NextRequest) => {
try {
const auth = await checkInternalAuth(request)
if (!auth.success || !auth.userId) {
return NextResponse.json({ error: auth.error || 'Unauthorized' }, { status: 401 })
}

const parsed = await parseToolRequest(awsCodepipelineGetPipelineExecutionContract, request, {
errorFormat: 'details',
logger,
})
if (!parsed.success) return parsed.response
const validatedData = parsed.data.body

logger.info('Getting CodePipeline pipeline execution')

const client = new CodePipelineClient({
region: validatedData.region,
credentials: {
accessKeyId: validatedData.accessKeyId,
secretAccessKey: validatedData.secretAccessKey,
},
})

try {
const command = new GetPipelineExecutionCommand({
pipelineName: validatedData.pipelineName,
pipelineExecutionId: validatedData.pipelineExecutionId,
})

const response = await client.send(command)
const execution = response.pipelineExecution

if (!execution) {
throw new Error('Pipeline execution not found in response')
}

logger.info('Successfully got pipeline execution')

return NextResponse.json({
success: true,
output: {
pipelineExecutionId: execution.pipelineExecutionId ?? validatedData.pipelineExecutionId,
pipelineName: execution.pipelineName ?? validatedData.pipelineName,
pipelineVersion: execution.pipelineVersion,
status: execution.status ?? 'Unknown',
statusSummary: execution.statusSummary,
executionMode: execution.executionMode,
executionType: execution.executionType,
triggerType: execution.trigger?.triggerType,
triggerDetail: execution.trigger?.triggerDetail,
artifactRevisions: (execution.artifactRevisions ?? []).map((r) => ({
name: r.name ?? '',
revisionId: r.revisionId,
revisionSummary: r.revisionSummary,
revisionUrl: r.revisionUrl,
created: r.created?.getTime(),
})),
variables: (execution.variables ?? []).map((v) => ({
name: v.name ?? '',
resolvedValue: v.resolvedValue ?? '',
})),
},
})
} finally {
client.destroy()
}
} catch (error) {
logger.error('GetPipelineExecution failed', { error: toError(error).message })
return NextResponse.json(
{ error: `Failed to get CodePipeline pipeline execution: ${toError(error).message}` },
{ status: awsErrorStatus(error) }
)
}
})
Loading
Loading