Skip to content

Commit

Permalink
Merge branch 'master' into update-readme
Browse files Browse the repository at this point in the history
  • Loading branch information
ffjlabo authored Dec 7, 2023
2 parents 3e73d0c + 5cdf2b8 commit deb9617
Show file tree
Hide file tree
Showing 24 changed files with 162 additions and 42 deletions.
7 changes: 4 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -99,15 +99,16 @@ You can find a list of publicly recognized users of the PipeCD in the [ADOPTERS.
<a href="https://github.com/funera1"><img src="https://avatars.githubusercontent.com/u/60760935?v=4" title="funera1" width="80" height="80"></a>
<a href="https://github.com/sanposhiho"><img src="https://avatars.githubusercontent.com/u/44139130?v=4" title="sanposhiho" width="80" height="80"></a>
<a href="https://github.com/Szarny"><img src="https://avatars.githubusercontent.com/u/26561120?v=4" title="Szarny" width="80" height="80"></a>
<a href="https://github.com/ffjlabo"><img src="https://avatars.githubusercontent.com/u/40124947?v=4" title="ffjlabo" width="80" height="80"></a>
<a href="https://github.com/sivchari"><img src="https://avatars.githubusercontent.com/u/55221074?v=4" title="sivchari" width="80" height="80"></a>
<a href="https://github.com/kevin-namba"><img src="https://avatars.githubusercontent.com/u/68955641?v=4" title="kevin-namba" width="80" height="80"></a>
<a href="https://github.com/ffjlabo"><img src="https://avatars.githubusercontent.com/u/40124947?v=4" title="ffjlabo" width="80" height="80"></a>
<a href="https://github.com/kurochan"><img src="https://avatars.githubusercontent.com/u/591247?v=4" title="kurochan" width="80" height="80"></a>
<a href="https://github.com/TaKO8Ki"><img src="https://avatars.githubusercontent.com/u/41065217?v=4" title="TaKO8Ki" width="80" height="80"></a>
<a href="https://github.com/chaspy"><img src="https://avatars.githubusercontent.com/u/10370988?v=4" title="chaspy" width="80" height="80"></a>
<a href="https://github.com/gkuga"><img src="https://avatars.githubusercontent.com/u/33643470?v=4" title="gkuga" width="80" height="80"></a>
<a href="https://github.com/hungran"><img src="https://avatars.githubusercontent.com/u/26101787?v=4" title="hungran" width="80" height="80"></a>
<a href="https://github.com/karamaru-alpha"><img src="https://avatars.githubusercontent.com/u/38310693?v=4" title="karamaru-alpha" width="80" height="80"></a>
<a href="https://github.com/t-kikuc"><img src="https://avatars.githubusercontent.com/u/97105818?v=4" title="t-kikuc" width="80" height="80"></a>
<a href="https://github.com/TonkyH"><img src="https://avatars.githubusercontent.com/u/50762864?v=4" title="TonkyH" width="80" height="80"></a>
<a href="https://github.com/golemiso"><img src="https://avatars.githubusercontent.com/u/3282656?v=4" title="golemiso" width="80" height="80"></a>
<a href="https://github.com/tnqv"><img src="https://avatars.githubusercontent.com/u/23372024?v=4" title="tnqv" width="80" height="80"></a>
Expand All @@ -117,6 +118,7 @@ You can find a list of publicly recognized users of the PipeCD in the [ADOPTERS.
<a href="https://github.com/arabian9ts"><img src="https://avatars.githubusercontent.com/u/24448137?v=4" title="arabian9ts" width="80" height="80"></a>
<a href="https://github.com/anhpnv"><img src="https://avatars.githubusercontent.com/u/40441000?v=4" title="anhpnv" width="80" height="80"></a>
<a href="https://github.com/seipan"><img src="https://avatars.githubusercontent.com/u/88176012?v=4" title="seipan" width="80" height="80"></a>
<a href="https://github.com/nnnkkk7"><img src="https://avatars.githubusercontent.com/u/68233204?v=4" title="nnnkkk7" width="80" height="80"></a>
<a href="https://github.com/p0tr3c"><img src="https://avatars.githubusercontent.com/u/12850042?v=4" title="p0tr3c" width="80" height="80"></a>
<a href="https://github.com/TakumaKurosawa"><img src="https://avatars.githubusercontent.com/u/39955827?v=4" title="TakumaKurosawa" width="80" height="80"></a>
<a href="https://github.com/seitarof"><img src="https://avatars.githubusercontent.com/u/51070449?v=4" title="seitarof" width="80" height="80"></a>
Expand Down Expand Up @@ -144,16 +146,15 @@ You can find a list of publicly recognized users of the PipeCD in the [ADOPTERS.
<a href="https://github.com/butterv"><img src="https://avatars.githubusercontent.com/u/15773082?v=4" title="butterv" width="80" height="80"></a>
<a href="https://github.com/mura-s"><img src="https://avatars.githubusercontent.com/u/4702673?v=4" title="mura-s" width="80" height="80"></a>
<a href="https://github.com/Warashi"><img src="https://avatars.githubusercontent.com/u/3600530?v=4" title="Warashi" width="80" height="80"></a>
<a href="https://github.com/moko-poi"><img src="https://avatars.githubusercontent.com/u/55864094?v=4" title="moko-poi" width="80" height="80"></a>
<a href="https://github.com/Linutux"><img src="https://avatars.githubusercontent.com/u/435352?v=4" title="Linutux" width="80" height="80"></a>
<a href="https://github.com/hosht"><img src="https://avatars.githubusercontent.com/u/3858627?v=4" title="hosht" width="80" height="80"></a>
<a href="https://github.com/ww24"><img src="https://avatars.githubusercontent.com/u/695166?v=4" title="ww24" width="80" height="80"></a>
<a href="https://github.com/tnir"><img src="https://avatars.githubusercontent.com/u/10229505?v=4" title="tnir" width="80" height="80"></a>
<a href="https://github.com/t-kikuc"><img src="https://avatars.githubusercontent.com/u/97105818?v=4" title="t-kikuc" width="80" height="80"></a>
<a href="https://github.com/yoiki"><img src="https://avatars.githubusercontent.com/u/39365493?v=4" title="yoiki" width="80" height="80"></a>
<a href="https://github.com/JohnTitor"><img src="https://avatars.githubusercontent.com/u/25030997?v=4" title="JohnTitor" width="80" height="80"></a>
<a href="https://github.com/testwill"><img src="https://avatars.githubusercontent.com/u/8717479?v=4" title="testwill" width="80" height="80"></a>
<a href="https://github.com/mugioka"><img src="https://avatars.githubusercontent.com/u/62197019?v=4" title="mugioka" width="80" height="80"></a>
<a href="https://github.com/nnnkkk7"><img src="https://avatars.githubusercontent.com/u/68233204?v=4" title="nnnkkk7" width="80" height="80"></a>
<a href="https://github.com/naonao2323"><img src="https://avatars.githubusercontent.com/u/74669884?v=4" title="naonao2323" width="80" height="80"></a>
<a href="https://github.com/tokku5552"><img src="https://avatars.githubusercontent.com/u/69064290?v=4" title="tokku5552" width="80" height="80"></a>
<a href="https://github.com/minhquang4334"><img src="https://avatars.githubusercontent.com/u/22545967?v=4" title="minhquang4334" width="80" height="80"></a>
Expand Down
2 changes: 1 addition & 1 deletion RELEASE
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
tag: v0.45.3
tag: v0.45.4

releaseNoteGenerator:
showCommitter: false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -477,6 +477,7 @@ Note: The available values are identical to those found in the aws-sdk-go-v2 Typ

| Field | Type | Description | Required |
|-|-|-|-|
| recreate | bool | Whether to delete old tasksets before creating new ones or not. Default to false. | No |

## AnalysisMetrics

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ spec:
- name: prod-slack
events:
- DEPLOYMENT_TRIGGERED
- DEPLOYMENT_COMPLETED
- DEPLOYMENT_SUCCEEDED
labels:
env: prod
team: pipecd
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ spec:
- name: prod-slack
events:
- DEPLOYMENT_TRIGGERED
- DEPLOYMENT_COMPLETED
- DEPLOYMENT_SUCCEEDED
labels:
env: prod
team: pipecd
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ spec:
- name: prod-slack
events:
- DEPLOYMENT_TRIGGERED
- DEPLOYMENT_COMPLETED
- DEPLOYMENT_SUCCEEDED
labels:
env: prod
team: pipecd
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ spec:
- name: prod-slack
events:
- DEPLOYMENT_TRIGGERED
- DEPLOYMENT_COMPLETED
- DEPLOYMENT_SUCCEEDED
labels:
env: prod
team: pipecd
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ spec:
- name: prod-slack
events:
- DEPLOYMENT_TRIGGERED
- DEPLOYMENT_COMPLETED
- DEPLOYMENT_SUCCEEDED
labels:
env: prod
team: pipecd
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ spec:
- name: prod-slack
events:
- DEPLOYMENT_TRIGGERED
- DEPLOYMENT_COMPLETED
- DEPLOYMENT_SUCCEEDED
labels:
env: prod
team: pipecd
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ spec:
- name: prod-slack
events:
- DEPLOYMENT_TRIGGERED
- DEPLOYMENT_COMPLETED
- DEPLOYMENT_SUCCEEDED
labels:
env: prod
team: pipecd
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ One of `yamlField` or `regex` is required.
|-|-|-|-|
| file | string | The relative path from the repository root to the file to be updated. | Yes |
| yamlField | string | The yaml path to the field to be updated. It requires to start with `$` which represents the root element. e.g. `$.foo.bar[0].baz`. | No |
| regex | string | The regex string that specify what should be replaced. The only first capturing group enclosed by `()` will be replaced with the new value. e.g. `host.xz/foo/bar:(v[0-9]+.[0-9]+.[0-9]+)` | No |
| regex | string | The regex string that specify what should be replaced. The only first capturing group enclosed by `()` will be replaced with the new value. e.g. `host.xz/foo/bar:(v[0-9].[0-9].[0-9])` | No |

## CommitMatcher

Expand Down Expand Up @@ -477,6 +477,7 @@ Note: The available values are identical to those found in the aws-sdk-go-v2 Typ

| Field | Type | Description | Required |
|-|-|-|-|
| recreate | bool | Whether to delete old tasksets before creating new ones or not. Default to false. | No |

## AnalysisMetrics

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,10 @@ spec:
app: simple
environments:
FOO: bar
# ephemeralStorage is optional value. If you define a ephemeral storage to lambda, you can
# use this field. The value must be in between 512 to 10240 MB.
ephemeralStorage:
size: 512
# vpcConfig is optional value. If you define a vpc configuration to lambda, you can
# use this field.
vpcConfig:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ This field is deprecated, please use [PlatformProvider](#platformprovider) inste
| Field | Type | Description | Required |
|-|-|-|-|
| name | string | The name of the platform provider. | Yes |
| type | string | The platform provider type. Must be one of the following values:<br>`KUBERNETES`, `TERRAFORM`, `CLOUDRUN`, `LAMBDA`. | Yes |
| type | string | The platform provider type. Must be one of the following values:<br>`KUBERNETES`, `TERRAFORM`, `ECS`, `CLOUDRUN`, `LAMBDA`. | Yes |
| config | [PlatformProviderConfig](#platformproviderconfig) | Specific configuration for the specified type of platform provider. | No |

## PlatformProviderConfig
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ spec:
- name: prod-slack
events:
- DEPLOYMENT_TRIGGERED
- DEPLOYMENT_COMPLETED
- DEPLOYMENT_SUCCEEDED
labels:
env: prod
team: pipecd
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ provider "pipecd" {
```

### Manage Piped agent
Add `pipecd_piped` resource to manage a Piped aegnt.
Add `pipecd_piped` resource to manage a Piped agent.

```hcl
resource "pipecd_piped" "mypiped" {
Expand Down
31 changes: 31 additions & 0 deletions examples/ecs/servicediscovery/canary/app.pipecd.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
apiVersion: pipecd.dev/v1beta1
kind: ECSApp
spec:
name: servicediscovery-canary
labels:
env: example
team: xyz
input:
serviceDefinitionFile: servicedef.yaml
taskDefinitionFile: taskdef.yaml
# When you use ECS Service Discovery for interservice networking, you must specify 'SERVICE_DISCOVERY' for 'accessType'.
accessType: SERVICE_DISCOVERY
# 'targetGroups' is not used in Service Discovery type.
pipeline:
stages:
# Rollout CANARY variant's workload.
# scale represents the percentage of workload will be rolled out,
# in this case 30% of the current PRIMARY variant's workload is set.
# Note: Rolled out variant DOES serve traffic at this time unlike the ELB type.
- name: ECS_CANARY_ROLLOUT
with:
scale: 100
# Hold the deployment process for 150 seconds.
- name: WAIT
with:
duration: 150s
# Update the workload of PRIMARY variant to the new version.
# NOTE: The new PRIMARY variant will serve 100% of the traffic at this time.
- name: ECS_PRIMARY_ROLLOUT
# Destroy all workloads of CANARY variant.
- name: ECS_CANARY_CLEAN
26 changes: 26 additions & 0 deletions examples/ecs/servicediscovery/canary/servicedef.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
cluster: arn:aws:ecs:ap-northeast-1:XXXX:cluster/test-cluster
serviceName: nginx-canary-service
desiredCount: 2
deploymentConfiguration:
maximumPercent: 200
minimumHealthyPercent: 0
schedulingStrategy: REPLICA
# CAUTION: To enable PipeCD controls the deployment
# DeploymentController of type EXTERNAL is required.
deploymentController:
type: EXTERNAL
enableECSManagedTags: true
propagateTags: SERVICE
launchType: FARGATE
networkConfiguration:
awsvpcConfiguration:
assignPublicIp: ENABLED
securityGroups:
- sg-YYYY
subnets:
- subnet-YYYY
- subnet-YYYY
# Service Discovery Config.
serviceRegistries:
# You need to specify the service id of the service discovery namespace.
- registryArn: arn:aws:servicediscovery:ap-northeast-1:XXXX:service/srv-XXXXX
20 changes: 20 additions & 0 deletions examples/ecs/servicediscovery/canary/taskdef.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
family: nginx-service-fam
executionRoleArn: arn:aws:iam::XXXX:role/ecsTaskExecutionRole
containerDefinitions:
- command: null
cpu: 100
image: XXXX.dkr.ecr.ap-northeast-1.amazonaws.com/nginx:1
memory: 100
mountPoints: []
name: web
portMappings:
- containerPort: 80
compatibilities:
- FARGATE
requiresCompatibilities:
- FARGATE
networkMode: awsvpc
memory: 512
cpu: 256
pidMode: ""
volumes: []
64 changes: 46 additions & 18 deletions pkg/app/piped/executor/ecs/deploy.go
Original file line number Diff line number Diff line change
Expand Up @@ -126,16 +126,27 @@ func (e *deployExecutor) ensurePrimaryRollout(ctx context.Context) model.StageSt
return model.StageStatus_STAGE_FAILURE
}

primary, _, ok := loadTargetGroups(&e.Input, e.appCfg, e.deploySource)
if !ok {
return model.StageStatus_STAGE_FAILURE
}
if primary == nil {
e.LogPersister.Error("Primary target group is required to enable rolling out PRIMARY variant")
return model.StageStatus_STAGE_FAILURE
}
switch e.appCfg.Input.AccessType {
case config.AccessTypeELB:
primary, _, ok := loadTargetGroups(&e.Input, e.appCfg, e.deploySource)
if !ok {
return model.StageStatus_STAGE_FAILURE
}
if primary == nil {
e.LogPersister.Error("Primary target group is required to enable rolling out PRIMARY variant")
return model.StageStatus_STAGE_FAILURE
}

if !rollout(ctx, &e.Input, e.platformProviderName, e.platformProviderCfg, taskDefinition, servicedefinition, primary) {
if !rollout(ctx, &e.Input, e.platformProviderName, e.platformProviderCfg, taskDefinition, servicedefinition, primary) {
return model.StageStatus_STAGE_FAILURE
}
case config.AccessTypeServiceDiscovery:
// Target groups are not used.
if !rollout(ctx, &e.Input, e.platformProviderName, e.platformProviderCfg, taskDefinition, servicedefinition, nil) {
return model.StageStatus_STAGE_FAILURE
}
default:
e.LogPersister.Errorf("Unsupported access type %s in stage %s for ECS application", e.appCfg.Input.AccessType, e.Stage.Name)
return model.StageStatus_STAGE_FAILURE
}

Expand All @@ -152,23 +163,40 @@ func (e *deployExecutor) ensureCanaryRollout(ctx context.Context) model.StageSta
return model.StageStatus_STAGE_FAILURE
}

_, canary, ok := loadTargetGroups(&e.Input, e.appCfg, e.deploySource)
if !ok {
return model.StageStatus_STAGE_FAILURE
}
if canary == nil {
e.LogPersister.Error("Canary target group is required to enable rolling out CANARY variant")
return model.StageStatus_STAGE_FAILURE
}
switch e.appCfg.Input.AccessType {
case config.AccessTypeELB:
_, canary, ok := loadTargetGroups(&e.Input, e.appCfg, e.deploySource)
if !ok {
return model.StageStatus_STAGE_FAILURE
}
if canary == nil {
e.LogPersister.Error("Canary target group is required to enable rolling out CANARY variant")
return model.StageStatus_STAGE_FAILURE
}

if !rollout(ctx, &e.Input, e.platformProviderName, e.platformProviderCfg, taskDefinition, servicedefinition, canary) {
if !rollout(ctx, &e.Input, e.platformProviderName, e.platformProviderCfg, taskDefinition, servicedefinition, canary) {
return model.StageStatus_STAGE_FAILURE
}
case config.AccessTypeServiceDiscovery:
// Target groups are not used.
if !rollout(ctx, &e.Input, e.platformProviderName, e.platformProviderCfg, taskDefinition, servicedefinition, nil) {
return model.StageStatus_STAGE_FAILURE
}
default:
e.LogPersister.Errorf("Unsupported access type %s in stage %s for ECS application", e.appCfg.Input.AccessType, e.Stage.Name)
return model.StageStatus_STAGE_FAILURE
}

return model.StageStatus_STAGE_SUCCESS
}

func (e *deployExecutor) ensureTrafficRouting(ctx context.Context) model.StageStatus {
// Traffic Routing is not supported for other kinds than ELB.
if !e.appCfg.Input.IsAccessedViaELB() {
e.LogPersister.Errorf("Unsupported access type %s in stage %s for ECS application", e.appCfg.Input.AccessType, e.Stage.Name)
return model.StageStatus_STAGE_FAILURE
}

primary, canary, ok := loadTargetGroups(&e.Input, e.appCfg, e.deploySource)
if !ok {
return model.StageStatus_STAGE_FAILURE
Expand Down
2 changes: 2 additions & 0 deletions pkg/app/piped/executor/ecs/ecs.go
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,8 @@ func createPrimaryTaskSet(ctx context.Context, client provider.Client, service t
}

// Remove old taskSets if existed.
// HACK: All old task sets including canary are deleted here.
// However, we need to discuss whether we should delete the canary here or in later stage(CanaryClean).
for _, prevTaskSet := range prevTaskSets {
if err = client.DeleteTaskSet(ctx, *prevTaskSet); err != nil {
return err
Expand Down
4 changes: 2 additions & 2 deletions pkg/app/piped/executor/ecs/rollback.go
Original file line number Diff line number Diff line change
Expand Up @@ -111,8 +111,8 @@ func rollback(ctx context.Context, in *executor.Input, platformProviderName stri
return false
}

// Rollback ECS service configuration to previous state.
service, err := client.UpdateService(ctx, serviceDefinition)
// Rollback ECS service configuration to previous state including commit-hash of the tag.
service, err := applyServiceDefinition(ctx, client, serviceDefinition)
if err != nil {
in.LogPersister.Errorf("Unable to rollback ECS service %s configuration to previous stage: %v", *serviceDefinition.ServiceName, err)
return false
Expand Down
12 changes: 9 additions & 3 deletions pkg/app/piped/platformprovider/lambda/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,9 @@ func (c *client) CreateFunction(ctx context.Context, fm FunctionManifest) error
input.Architectures = architectures
}
if fm.Spec.EphemeralStorage != nil {
input.EphemeralStorage.Size = aws.Int32(fm.Spec.EphemeralStorage.Size)
input.EphemeralStorage = &types.EphemeralStorage{
Size: aws.Int32(fm.Spec.EphemeralStorage.Size),
}
}
if fm.Spec.VPCConfig != nil {
input.VpcConfig = &types.VpcConfig{
Expand Down Expand Up @@ -183,7 +185,9 @@ func (c *client) CreateFunctionFromSource(ctx context.Context, fm FunctionManife
},
}
if fm.Spec.EphemeralStorage != nil {
input.EphemeralStorage.Size = aws.Int32(fm.Spec.EphemeralStorage.Size)
input.EphemeralStorage = &types.EphemeralStorage{
Size: aws.Int32(fm.Spec.EphemeralStorage.Size),
}
}
_, err = c.client.CreateFunction(ctx, input)
if err != nil {
Expand Down Expand Up @@ -284,7 +288,9 @@ func (c *client) updateFunctionConfiguration(ctx context.Context, fm FunctionMan
configInput.Handler = aws.String(fm.Spec.Handler)
}
if fm.Spec.EphemeralStorage != nil {
configInput.EphemeralStorage.Size = aws.Int32(fm.Spec.EphemeralStorage.Size)
configInput.EphemeralStorage = &types.EphemeralStorage{
Size: aws.Int32(fm.Spec.EphemeralStorage.Size),
}
}
if fm.Spec.VPCConfig != nil {
configInput.VpcConfig = &types.VpcConfig{
Expand Down
Loading

0 comments on commit deb9617

Please sign in to comment.