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
8 changes: 8 additions & 0 deletions pkg/app/pipedv1/plugin/ecs/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# AWS ECS plugin

## Overview

ECS plugin supports the Deployment for AWS ECS.

> [!CAUTION]
> Currently, this is alpha status.
24 changes: 24 additions & 0 deletions pkg/app/pipedv1/plugin/ecs/config/application.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
// Copyright 2026 The PipeCD Authors.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

package config

// ECSApplicationSpec defines the application specification for ECS plugin.
type ECSApplicationSpec struct {
Input ECSDeploymentInput `json:"input"`
}

// ECSDeploymentInput defines the input for ECS deployment.
type ECSDeploymentInput struct {
}
40 changes: 40 additions & 0 deletions pkg/app/pipedv1/plugin/ecs/config/deploy_target.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
// Copyright 2026 The PipeCD Authors.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

package config

// ECSDeployTargetConfig represents the deployment target configuration for ECS plugin.
type ECSDeployTargetConfig struct {
// Region is the AWS region where the ECS cluster is located
// (e.g., "us-west-2").
Region string `json:"region"`

// Profile is the AWS profile to use from the credentials file
// If empty, uses the default profile or "default" if AWS_PROFILE env var is not set
Profile string `json:"profile,omitempty"`

// CredentialsFile is the path to the AWS shared credentials file
// (e.g., "~/.aws/credentials")
// If empty, uses the default location
CredentialsFile string `json:"credentialsFile,omitempty"`

// RoleARN is the IAM role ARN to assume when accessing AWS resources
// (e.g., "arn:aws:iam::123456789:role/ecs-deployment-role").
// Required when assuming a role across accounts
RoleARN string `json:"roleARN,omitempty"`

// TokenFile is the path to the OIDC token file for web identity federation.
// Required when RoleARN is set for OIDC-based authentication
TokenFile string `json:"tokenFile,omitempty"`
}
19 changes: 19 additions & 0 deletions pkg/app/pipedv1/plugin/ecs/config/plugin.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
// Copyright 2026 The PipeCD Authors.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

package config

// ECSPluginConfig holds the configuration for the ECS deployment plugin.
type ECSPluginConfig struct {
}
101 changes: 101 additions & 0 deletions pkg/app/pipedv1/plugin/ecs/deployment/pipeline.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
// Copyright 2026 The PipeCD Authors.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

package deployment

import (
sdk "github.com/pipe-cd/piped-plugin-sdk-go"
)

const (
// StageECSSync represents the ECS sync stage.
StageECSSync = "ECS_SYNC"

// StageECSPrimaryRollout represents the ECS primary rollout stage.
StageECSPrimaryRollout = "ECS_PRIMARY_ROLLOUT"

// StageECSCanaryRollout represents the ECS canary rollout stage.
StageECSCanaryRollout = "ECS_CANARY_ROLLOUT"

// StageECSCanaryClean represents the ECS canary clean stage.
StageECSCanaryClean = "ECS_CANARY_CLEAN"

// StageECSTrafficRouting represents the ECS traffic routing stage.
StageECSTrafficRouting = "ECS_TRAFFIC_ROUTING"

// StageECSRollback represents the ECS rollback stage.
StageECSRollback = "ECS_ROLLBACK"
)

var allStages = []string{
StageECSSync,
StageECSPrimaryRollout,
StageECSCanaryRollout,
StageECSCanaryClean,
StageECSTrafficRouting,
StageECSRollback,
}

const (
StageECSSyncDescription = "Sync ECS service with given task definition"
StageECSPrimaryRolloutDescription = "Roll out new task set as primary"
StageECSCanaryRolloutDescription = "Roll out new task set as canary"
StageECSCanaryCleanDescription = "Clean up canary task set"
StageECSTrafficRoutingDescription = "Route traffic between primary and canary task sets"
StageECSRollbackDescription = "Rollback to previous task set"
)

func buildQuickSyncPipeline(autoRollback bool) []sdk.QuickSyncStage {
out := []sdk.QuickSyncStage{
{
Name: StageECSSync,
Description: StageECSSyncDescription,
Rollback: false,
},
}

if autoRollback {
out = append(out, sdk.QuickSyncStage{
Name: StageECSRollback,
Description: StageECSRollbackDescription,
Rollback: true,
})
}

return out
}

func buildPipelineStages(input *sdk.BuildPipelineSyncStagesInput) []sdk.PipelineStage {
stages := input.Request.Stages

out := make([]sdk.PipelineStage, 0, len(stages)+1)

for _, s := range stages {
out = append(out, sdk.PipelineStage{
Name: s.Name,
Index: s.Index,
Rollback: false,
})
}

if input.Request.Rollback {
out = append(out, sdk.PipelineStage{
Name: StageECSRollback,
Index: len(stages) + 1,
Rollback: true,
})
}

return out
}
102 changes: 102 additions & 0 deletions pkg/app/pipedv1/plugin/ecs/deployment/plugin.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
// Copyright 2026 The PipeCD Authors.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

package deployment

import (
"context"
"errors"

ecsconfig "github.com/pipe-cd/pipecd/pkg/app/pipedv1/plugin/ecs/config"
sdk "github.com/pipe-cd/piped-plugin-sdk-go"
)

var _ sdk.DeploymentPlugin[ecsconfig.ECSPluginConfig, ecsconfig.ECSDeployTargetConfig, ecsconfig.ECSApplicationSpec] = (*ECSPlugin)(nil)

var ErrUnsupportedStage = errors.New("unsupported stage")

type ECSPlugin struct {
}

// FetchDefinedStages returns the list of stages that the plugin can execute.
func (p *ECSPlugin) FetchDefinedStages() []string {
return allStages
}

// BuildQuickSyncStages builds the stages that will be executed during the quick sync process.
func (p *ECSPlugin) BuildQuickSyncStages(
ctx context.Context,
cfg *ecsconfig.ECSPluginConfig,
input *sdk.BuildQuickSyncStagesInput,
) (*sdk.BuildQuickSyncStagesResponse, error) {
return &sdk.BuildQuickSyncStagesResponse{
Stages: buildQuickSyncPipeline(input.Request.Rollback),
}, nil
}

// BuildPipelineSyncStages builds the stages that will be executed by the plugin.
func (p *ECSPlugin) BuildPipelineSyncStages(
_ context.Context,
_ *ecsconfig.ECSPluginConfig,
input *sdk.BuildPipelineSyncStagesInput,
) (*sdk.BuildPipelineSyncStagesResponse, error) {
return &sdk.BuildPipelineSyncStagesResponse{
Stages: buildPipelineStages(input),
}, nil
}

// ExecuteStage executes the given stage.
func (p *ECSPlugin) ExecuteStage(
ctx context.Context,
cfg *ecsconfig.ECSPluginConfig,
deployTargets []*sdk.DeployTarget[ecsconfig.ECSDeployTargetConfig],
input *sdk.ExecuteStageInput[ecsconfig.ECSApplicationSpec],
) (*sdk.ExecuteStageResponse, error) {
switch input.Request.StageName {
default:
return nil, ErrUnsupportedStage
}
}

// DetermineVersions determines the versions of the resources that will be deployed.
func (p *ECSPlugin) DetermineVersions(
ctx context.Context,
cfg *ecsconfig.ECSPluginConfig,
input *sdk.DetermineVersionsInput[ecsconfig.ECSApplicationSpec],
) (*sdk.DetermineVersionsResponse, error) {
return &sdk.DetermineVersionsResponse{
// TODO: Implement the logic to determine the versions of the resources that will be deployed.
// This is just a placeholder
Versions: []sdk.ArtifactVersion{
{
Version: "latest",
Name: "ecs-task",
URL: "",
},
},
}, nil
}

// DetermineStrategy determines the strategy to deploy the resources.
func (p *ECSPlugin) DetermineStrategy(
ctx context.Context,
cfg *ecsconfig.ECSPluginConfig,
input *sdk.DetermineStrategyInput[ecsconfig.ECSApplicationSpec],
) (*sdk.DetermineStrategyResponse, error) {
// Use quick sync as the default strategy for ECS deployment.
return &sdk.DetermineStrategyResponse{
Strategy: sdk.SyncStrategyQuickSync,
Summary: "Use quick sync strategy for ECS deployment (work as ECS_SYNC stage)",
}, nil
}
59 changes: 59 additions & 0 deletions pkg/app/pipedv1/plugin/ecs/go.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
module github.com/pipe-cd/pipecd/pkg/app/pipedv1/plugin/ecs

go 1.25.0

require github.com/pipe-cd/piped-plugin-sdk-go v0.3.0

require (
cloud.google.com/go v0.112.1 // indirect
cloud.google.com/go/compute/metadata v0.3.0 // indirect
cloud.google.com/go/profiler v0.3.1 // indirect
github.com/beorn7/perks v1.0.1 // indirect
github.com/cespare/xxhash/v2 v2.2.0 // indirect
github.com/coreos/go-oidc/v3 v3.11.0 // indirect
github.com/creasty/defaults v1.6.0 // indirect
github.com/envoyproxy/protoc-gen-validate v1.0.4 // indirect
github.com/go-jose/go-jose/v4 v4.0.5 // indirect
github.com/go-logr/logr v1.4.2 // indirect
github.com/go-logr/stdr v1.2.2 // indirect
github.com/golang-jwt/jwt/v5 v5.2.2 // indirect
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
github.com/golang/protobuf v1.5.4 // indirect
github.com/google/pprof v0.0.0-20221103000818-d260c55eee4c // indirect
github.com/google/s2a-go v0.1.7 // indirect
github.com/googleapis/enterprise-certificate-proxy v0.3.2 // indirect
github.com/googleapis/gax-go/v2 v2.12.2 // indirect
github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0 // indirect
github.com/inconshreveable/mousetrap v1.1.0 // indirect
github.com/matttproud/golang_protobuf_extensions v1.0.2-0.20181231171920-c182affec369 // indirect
github.com/pipe-cd/pipecd v0.54.0-rc1.0.20250912082650-0b949bb7aac9 // indirect
github.com/prometheus/client_golang v1.12.1 // indirect
github.com/prometheus/client_model v0.5.0 // indirect
github.com/prometheus/common v0.32.1 // indirect
github.com/prometheus/procfs v0.7.3 // indirect
github.com/spf13/cobra v1.9.1 // indirect
github.com/spf13/pflag v1.0.6 // indirect
go.opencensus.io v0.24.0 // indirect
go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.49.0 // indirect
go.opentelemetry.io/otel v1.28.0 // indirect
go.opentelemetry.io/otel/metric v1.28.0 // indirect
go.opentelemetry.io/otel/trace v1.28.0 // indirect
go.uber.org/atomic v1.11.0 // indirect
go.uber.org/multierr v1.6.0 // indirect
go.uber.org/zap v1.19.1 // indirect
go.yaml.in/yaml/v2 v2.4.2 // indirect
golang.org/x/crypto v0.36.0 // indirect
golang.org/x/net v0.38.0 // indirect
golang.org/x/oauth2 v0.30.0 // indirect
golang.org/x/sync v0.16.0 // indirect
golang.org/x/sys v0.31.0 // indirect
golang.org/x/text v0.23.0 // indirect
golang.org/x/time v0.5.0 // indirect
google.golang.org/api v0.169.0 // indirect
google.golang.org/genproto v0.0.0-20240213162025-012b6fc9bca9 // indirect
google.golang.org/genproto/googleapis/api v0.0.0-20240701130421-f6361c86f094 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20240701130421-f6361c86f094 // indirect
google.golang.org/grpc v1.64.1 // indirect
google.golang.org/protobuf v1.34.2 // indirect
sigs.k8s.io/yaml v1.5.0 // indirect
)
Loading