feat: Fargate

This commit is contained in:
Zakaria
2026-10-02 09:53:45 -04:00
parent 7f08f5b668
commit 2d8ff50a99
27 changed files with 574 additions and 35 deletions
+1
View File
@@ -6,6 +6,7 @@ export interface CodeBuildEnvironmentVariableOverride {
export interface StartCodeBuildInput {
environmentVariablesOverride?: CodeBuildEnvironmentVariableOverride[]
buildspecOverride?: string
}
export interface CodeBuildPhase {
+45 -2
View File
@@ -19,14 +19,57 @@ export function awsCodeBuildSchema(): ServiceSchema {
{name: 'name', label: 'Project name', type: 'text', required: true, group: 'Required'},
{name: 'serviceRole', label: 'Service role ARN', type: 'text', required: true, group: 'Required'},
{
name: 'environmentImage', label: 'Environment image', type: 'text', required: false, group: 'Environment',
name: 'sourceType', label: 'Source type', type: 'select', required: true, group: 'Source', defaultValue: 'NO_SOURCE',
options: [{label: 'No source', value: 'NO_SOURCE'}, {label: 'Amazon S3', value: 'S3'}],
description: 'S3 source is supported locally. GitHub and Gitea sources are not executed by the local runner.',
},
{
name: 'sourceBucket', label: 'Source S3 bucket', type: 'text', required: false, requiredWhen: {field: 'sourceType', equals: 'S3'}, group: 'Source',
validation: {pattern: '^[a-z0-9](?:[a-z0-9.-]{1,61}[a-z0-9])?$', message: 'Use a valid 3-63 character S3 bucket name.'},
},
{
name: 'sourceKey', label: 'Source object key', type: 'text', required: false, requiredWhen: {field: 'sourceType', equals: 'S3'}, group: 'Source',
description: 'The ZIP source object key in the source bucket.',
},
{
name: 'buildspec', label: 'Buildspec', type: 'textarea', required: false, group: 'Source', span: true,
defaultValueWhen: {field: 'sourceType', values: {NO_SOURCE: 'version: 0.2\nphases:\n pre_build:\n commands:\n - AWS_ACCOUNT_ID=$(aws sts get-caller-identity --query Account --output text)\n - REPOSITORY_URI=$AWS_ACCOUNT_ID.dkr.ecr.$AWS_DEFAULT_REGION.amazonaws.com/$ECR_REPOSITORY\n - aws ecr get-login-password | docker login --username AWS --password-stdin $AWS_ACCOUNT_ID.dkr.ecr.$AWS_DEFAULT_REGION.amazonaws.com\n build:\n commands:\n - IMAGE_TAG=${CODEBUILD_RESOLVED_SOURCE_VERSION:0:7}\n - docker build -t $REPOSITORY_URI:$IMAGE_TAG .\n - docker push $REPOSITORY_URI:$IMAGE_TAG\n post_build:\n commands:\n - printf \'[{"name":"IMAGE1_NAME","imageUri":"%s"}]\' "$REPOSITORY_URI:$IMAGE_TAG" > imageDetail.json\nartifacts:\n files:\n - imageDetail.json\n - taskdef.json\n - appspec.yaml', S3: ''}},
description: 'For no source, this is a Docker-to-ECR buildspec. For S3, leave blank to use buildspec.yml from the source, or provide an override.',
},
{
name: 'artifactsType', label: 'Artifact type', type: 'select', required: true, group: 'Artifacts', defaultValue: 'NO_ARTIFACTS',
options: [{label: 'No artifacts', value: 'NO_ARTIFACTS'}, {label: 'Amazon S3', value: 'S3'}],
},
{
name: 'artifactsBucket', label: 'Artifact S3 bucket', type: 'text', required: false, requiredWhen: {field: 'artifactsType', equals: 'S3'}, group: 'Artifacts',
validation: {pattern: '^[a-z0-9](?:[a-z0-9.-]{1,61}[a-z0-9])?$', message: 'Use a valid 3-63 character S3 bucket name.'},
},
{
name: 'artifactsPrefix', label: 'Artifact prefix', type: 'text', required: false, group: 'Artifacts',
description: 'Optional S3 key prefix for build artifacts.',
},
{
name: 'environmentImage', label: 'Runtime image', type: 'select', required: true, group: 'Environment',
defaultValue: 'aws/codebuild/standard:7.0',
description: 'AWS CodeBuild managed image identifier.',
options: [
{label: 'CodeBuild Standard 7.0', value: 'aws/codebuild/standard:7.0'},
{label: 'Node.js 20 (Debian)', value: 'node:20-bookworm'},
],
description: 'Choose the container runtime for your build commands.',
},
{
name: 'computeType', label: 'Compute type', type: 'select', required: true, group: 'Environment', defaultValue: 'BUILD_GENERAL1_SMALL',
options: [{label: 'General 1 small', value: 'BUILD_GENERAL1_SMALL'}],
},
{
name: 'ecrRepository', label: 'ECR repository', type: 'text', required: true, group: 'Docker and ECR',
description: 'An existing ECR repository. The project exports it as ECR_REPOSITORY for the Docker buildspec.',
},
{
name: 'dockerPrivilegedMode', label: 'Docker daemon', type: 'select', required: true, group: 'Docker and ECR', defaultValue: 'enabled',
options: [{label: 'Enabled (required for Docker builds)', value: 'enabled'}],
description: 'CodeBuild runs Docker-in-Docker in privileged mode. This console flow targets ECS EC2 only.',
},
],
actions: ['list', 'create', 'delete', 'inspect'],
capabilities: {
@@ -17,6 +17,8 @@ export interface PipelineActionState {
revisionUrl?: string
codeBuildProject?: string
codeDeployDeploymentId?: string
codeDeployApplication?: string
codeDeployDeploymentGroup?: string
}
export interface PipelineStageState {
@@ -18,8 +18,11 @@ export function awsCodePipelineSchema(): ServiceSchema {
{name: 'sourceBucket', label: 'Source S3 bucket', type: 'text', required: true, group: 'Source'},
{name: 'sourceKey', label: 'Source object key', type: 'text', required: true, group: 'Source'},
{name: 'codeBuildProject', label: 'CodeBuild project', type: 'text', required: true, group: 'Build'},
{name: 'deployBucket', label: 'Deploy S3 bucket', type: 'text', required: true, group: 'Deploy'},
{name: 'deployKey', label: 'Deploy object key', type: 'text', required: true, group: 'Deploy'},
{name: 'codeDeployApplication', label: 'CodeDeploy application', type: 'text', required: true, group: 'ECS deploy'},
{name: 'codeDeployDeploymentGroup', label: 'CodeDeploy deployment group', type: 'text', required: true, group: 'ECS deploy'},
{name: 'taskDefinitionPath', label: 'Task definition path', type: 'text', required: true, group: 'ECS deploy', defaultValue: 'taskdef.json'},
{name: 'appSpecPath', label: 'AppSpec path', type: 'text', required: true, group: 'ECS deploy', defaultValue: 'appspec.yaml'},
{name: 'imageContainerName', label: 'Task definition image placeholder', type: 'text', required: true, group: 'ECS deploy', defaultValue: 'IMAGE1_NAME', description: 'The placeholder in taskdef.json, for example <IMAGE1_NAME>. CodeBuild supplies the ECR image from BuildOutput. The CodeDeploy deployment group must target an ECS EC2 service.'},
],
actions: ['list', 'create', 'delete', 'inspect'],
capabilities: {resourceActions: [
+63
View File
@@ -0,0 +1,63 @@
import type {FieldSchema, ServiceSchema, TableColumnSchema} from './types'
const columns: TableColumnSchema[] = [
{name: 'name', label: 'Service'},
{name: 'status', label: 'Status', format: 'badge'},
{name: 'launchType', label: 'Launch type', path: 'metadata.launchType', format: 'badge'},
{name: 'cluster', label: 'Cluster', path: 'metadata.cluster', format: 'code'},
{name: 'taskDefinition', label: 'Task definition', path: 'metadata.taskDefinition', format: 'code'},
{name: 'runningCount', label: 'Running', path: 'metadata.runningCount'},
{name: 'desiredCount', label: 'Desired', path: 'metadata.desiredCount'},
]
const filters: FieldSchema[] = [{name: 'search', label: 'Search', type: 'text', required: false}]
export function awsEcsSchema(): ServiceSchema {
return {
cloud: 'aws', service: 'ecs', displayName: 'Amazon ECS',
fields: [
{name: 'cluster', label: 'Cluster', type: 'text', required: true, group: 'Required'},
{name: 'serviceName', label: 'Service name', type: 'text', required: true, group: 'Required'},
{name: 'taskDefinition', label: 'Task definition', type: 'text', required: true, group: 'Required'},
{name: 'launchType', label: 'Launch type', type: 'select', required: true, defaultValue: 'FARGATE', group: 'Required', options: [{label: 'Fargate', value: 'FARGATE'}, {label: 'EC2', value: 'EC2'}]},
{name: 'desiredCount', label: 'Desired tasks', type: 'text', required: false, defaultValue: '1', group: 'Required'},
{name: 'subnets', label: 'Subnet IDs', type: 'text', required: false, requiredWhen: {field: 'launchType', equals: 'FARGATE'}, group: 'awsvpc networking', span: true, description: 'Required for Fargate. Comma-separated subnets are used for awsvpc task ENIs.'},
{name: 'securityGroups', label: 'Security group IDs', type: 'text', required: false, group: 'awsvpc networking', span: true, description: 'Optional comma-separated groups for awsvpc tasks.'},
{name: 'assignPublicIp', label: 'Assign public IP', type: 'select', required: false, defaultValue: 'DISABLED', group: 'awsvpc networking', options: [{label: 'Disabled', value: 'DISABLED'}, {label: 'Enabled', value: 'ENABLED'}]},
{name: 'targetGroupArn', label: 'ALB target group ARN', type: 'text', required: false, group: 'Load balancing', span: true, description: 'Fargate awsvpc services must use an IP target group. The target health and attached ALB endpoint are shown after creation.'},
{name: 'containerName', label: 'Container name', type: 'text', required: false, group: 'Load balancing'},
{name: 'containerPort', label: 'Container port', type: 'text', required: false, group: 'Load balancing'},
],
actions: ['list', 'create', 'delete', 'inspect'],
capabilities: {resourceActions: [
{name: 'list', label: 'List ECS services', enabled: true, status: 'available', runtimeRequired: true},
{name: 'inspect', label: 'Inspect service health', enabled: true, status: 'available', runtimeRequired: true},
{name: 'create', label: 'Create EC2 or Fargate service', enabled: true, status: 'available', runtimeRequired: true},
{name: 'delete', label: 'Force delete service', enabled: true, status: 'available', runtimeRequired: true},
]},
filters, columns,
}
}
export function awsFargateSchema(): ServiceSchema {
const ecs = awsEcsSchema()
return {
...ecs,
service: 'fargate',
displayName: 'AWS Fargate',
fields: ecs.fields
.filter((field) => field.name !== 'launchType')
.map((field) => field.name === 'subnets' ? {
...field,
required: true,
requiredWhen: undefined,
description: 'Required for Fargate awsvpc task ENIs. Comma-separated subnets are used for awsvpc networking.',
} : field),
capabilities: {
resourceActions: ecs.capabilities?.resourceActions?.map((action) => action.name === 'create' ? {
...action,
label: 'Create Fargate service',
} : action),
},
}
}
@@ -79,6 +79,18 @@ export const SERVICE_CATALOG = {
group: 'Compute',
order: 40,
},
ecs: {
displayName: 'ECS',
iconKey: 'containers',
group: 'Compute',
order: 50,
},
fargate: {
displayName: 'Fargate',
iconKey: 'containers',
group: 'Compute',
order: 51,
},
codebuild: {
displayName: 'CodeBuild',
iconKey: 'codebuild',
+1
View File
@@ -84,6 +84,7 @@ export interface FieldSchema {
label: string
type: FieldType
required: boolean
requiredWhen?: {field: string; equals: string}
description?: string
group?: string
span?: boolean