Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cherry-pick #4033 #4084 #4097 #4102 #4104 #4114 #4117 #4119 #4122 #4123 #4128

4 changes: 4 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,10 @@ gen/test-tls:
-subj "/CN=localhost" \
-config pkg/rpc/testdata/tls.config

.PHONY: gen/contributions
gen/contributions:
./hack/gen-contributions.sh

.PHONY: release
release: release/init release/docs

Expand Down
37 changes: 20 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,31 +79,34 @@ We'd love you to join us! Please see the [Contributor Guide](https://pipecd.dev/
<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/ffjlabo"><img src="https://avatars.githubusercontent.com/u/40124947?v=4" title="ffjlabo" 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/sivchari"><img src="https://avatars.githubusercontent.com/u/55221074?v=4" title="sivchari" 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>
<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/TonkyH"><img src="https://avatars.githubusercontent.com/u/50762864?v=4" title="TonkyH" 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>
<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/sivchari"><img src="https://avatars.githubusercontent.com/u/55221074?v=4" title="sivchari" width="80" height="80"></a>
<a href="https://github.com/khanhtc3010"><img src="https://avatars.githubusercontent.com/u/9603918?v=4" title="khanhtc3010" width="80" height="80"></a>
<a href="https://github.com/na-ga"><img src="https://avatars.githubusercontent.com/u/537006?v=4" title="na-ga" 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/gotyoooo"><img src="https://avatars.githubusercontent.com/u/6133219?v=4" title="Lennie" width="80" height="80"></a>
<a href="https://github.com/tennashi"><img src="https://avatars.githubusercontent.com/u/10219626?v=4" title="tennashi" width="80" height="80"></a>
<a href="https://github.com/na-ga"><img src="https://avatars.githubusercontent.com/u/537006?v=4" title="na-ga" width="80" height="80"></a>
<a href="https://github.com/gotyoooo"><img src="https://avatars.githubusercontent.com/u/6133219?v=4" title="gotyoooo" width="80" height="80"></a>
<a href="https://github.com/ShotaKitazawa"><img src="https://avatars.githubusercontent.com/u/19530785?v=4" title="ShotaKitazawa" width="80" height="80"></a>
<a href="https://github.com/tennashi"><img src="https://avatars.githubusercontent.com/u/10219626?v=4" title="tennashi" width="80" height="80"></a>
<a href="https://github.com/Abirdcfly"><img src="https://avatars.githubusercontent.com/u/5100555?v=4" title="Abirdcfly" 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/mugioka"><img src="https://avatars.githubusercontent.com/u/62197019?v=4" title="mugioka" width="80" height="80"></a>
<a href="https://github.com/misukuro"><img src="https://avatars.githubusercontent.com/u/1040546?v=4" title="misukuro" width="80" height="80"></a>
<a href="https://github.com/eltociear"><img src="https://avatars.githubusercontent.com/u/22633385?v=4" title="eltociear" width="80" height="80"></a>
<a href="https://github.com/kentakozuka"><img src="https://avatars.githubusercontent.com/u/16733673?v=4" title="kentakozuka" width="80" height="80"></a>
<a href="https://github.com/RikiyaFujii"><img src="https://avatars.githubusercontent.com/u/23261497?v=4" title="RikiyaFujii" 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/hongchaodeng"><img src="https://avatars.githubusercontent.com/u/920884?v=4" title="hongchaodeng" width="80" height="80"></a>
<a href="https://github.com/hori-ryota"><img src="https://avatars.githubusercontent.com/u/2936501?v=4" title="hori-ryota" width="80" height="80"></a>
<a href="https://github.com/eltociear"><img src="https://avatars.githubusercontent.com/u/22633385?v=4" title="eltociear" width="80" height="80"></a>
<a href="https://github.com/sano307"><img src="https://avatars.githubusercontent.com/u/12808316?v=4" title="sano307" width="80" height="80"></a>
<a href="https://github.com/misukuro"><img src="https://avatars.githubusercontent.com/u/1040546?v=4" title="misukuro" width="80" height="80"></a>
<a href="https://github.com/masaaania"><img src="https://avatars.githubusercontent.com/u/2755429?v=4" title="masaaania" width="80" height="80"></a>
<a href="https://github.com/KeisukeYamashita"><img src="https://avatars.githubusercontent.com/u/23056537?v=4" title="KeisukeYamashita" width="80" height="80"></a>
<a href="https://github.com/kentakozuka"><img src="https://avatars.githubusercontent.com/u/16733673?v=4" title="kentakozuka" width="80" height="80"></a>
<a href="https://github.com/Lennie"><img src="https://avatars.githubusercontent.com/u/330102?v=4" title="Lennie" width="80" height="80"></a>
<a href="https://github.com/sano307"><img src="https://avatars.githubusercontent.com/u/12808316?v=4" title="sano307" width="80" height="80"></a>
<a href="https://github.com/RikiyaFujii"><img src="https://avatars.githubusercontent.com/u/23261497?v=4" title="RikiyaFujii" width="80" height="80"></a>
<a href="https://github.com/SakataAtsuki"><img src="https://avatars.githubusercontent.com/u/58636635?v=4" title="SakataAtsuki" width="80" height="80"></a>
<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/Linutux"><img src="https://avatars.githubusercontent.com/u/435352?v=4" title="Linutux" width="80" height="80"></a>
<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/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/hori-ryota"><img src="https://avatars.githubusercontent.com/u/2936501?v=4" title="hori-ryota" width="80" height="80"></a>
<a href="https://github.com/KeisukeYamashita"><img src="https://avatars.githubusercontent.com/u/23056537?v=4" title="KeisukeYamashita" width="80" height="80"></a>
<a href="https://github.com/amaany3"><img src="https://avatars.githubusercontent.com/u/25783732?v=4" title="amaany3" 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/funera1"><img src="https://avatars.githubusercontent.com/u/60760935?v=4" title="funera1" 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>
2 changes: 2 additions & 0 deletions docs/content/en/docs-dev/examples/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,8 @@ https://github.com/pipe-cd/examples
| [bluegreen](https://github.com/pipe-cd/examples/tree/master/ecs/bluegreen) | Deployment pipeline with blue-green strategy. |
| [secret-management](https://github.com/pipe-cd/examples/tree/master/ecs/secret-management) | Demonstrate how to manage sensitive data by using [Secret Management](../user-guide/managing-application/secret-management/) feature. |
| [wait-approval](https://github.com/pipe-cd/examples/tree/master/ecs/wait-approval) | Deployment pipeline that contains a manual approval stage. |
| [standalone-task](https://github.com/pipe-cd/examples/tree/master/ecs/standalone-task) | Deployment Standalone Task. (`Standalone task is only supported for Quick sync`) |


### Deployment chain

Expand Down
11 changes: 11 additions & 0 deletions docs/content/en/docs-dev/user-guide/command-line-tool.md
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,17 @@ pipectl application list \
--app-kind=KUBERNETES \
```

### Disable an application

Disable an application with given id:

``` console
pipectl application disable \
--address={CONTROL_PLANE_API_ADDRESS} \
--api-key={API_KEY} \
--app-id={APPLICATION_ID}
```

### Deleting an application

Delete an application with given id:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,70 @@ description: >
Specific guide to configuring deployment for Amazon ECS application.
---

Deploying an Amazon ECS application requires `TaskDefinition` and `Service` configuration files placing inside the application directory. Those files contain all configuration for [ECS TaskDefinition](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/task_definitions.html) object and [ECS Service](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/ecs_services.html) object, and will be used by Piped agent while deploy your application/service to ECS cluster.
There are two main ways to deploy an Amazon ECS application.
- Your application is a one-time or periodic batch job.
- it's a standalone task.
- you need to prepare `TaskDefinition`
- Your application is deployed to run continuously or behind a load balancer.
- you need to prepare `TaskDefinition` and `Service`

To deploy an Amazon ECS application, the `TaskDefinition` configuration file must be located in the application directory. This file contains all configuration for [ECS TaskDefinition](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/task_definitions.html) object and will be used by Piped agent while deploying your application/service to the ECS cluster.

To deploy your application to run continuously or to place it behind a load balancer, You need to create [ECS Service](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/ecs_services.html). The `Service` configuration file also must be located in the application directory. This file contains all configurations for [ECS Service](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/ecs_services.html) object.

If you're not familiar with ECS, you can get examples for those files from [here](../../../../examples/#ecs-applications).

## Quick sync

By default, when the [pipeline](../../../configuration-reference/#ecs-application) was not specified, PipeCD triggers a quick sync deployment for the merged pull request.
Quick sync for an ECS deployment will roll out the new version and switch all traffic to it immediately.
> In case of standalone task, only Quick sync is supported.

Here is an example for Quick sync.

{{< tabpane >}}
{{< tab lang="yaml" header="application" >}}
apiVersion: pipecd.dev/v1beta1
kind: ECSApp
spec:
name: simple
labels:
env: example
team: xyz
input:
# Path to Service configuration file in Yaml/JSON format.
serviceDefinitionFile: servicedef.yaml
# Path to TaskDefinition configuration file in Yaml/JSON format.
# Default is `taskdef.json`
taskDefinitionFile: taskdef.yaml
targetGroups:
primary:
targetGroupArn: arn:aws:elasticloadbalancing:ap-northeast-1:XXXX:targetgroup/ecs-lb/YYYY
containerName: web
containerPort: 80
{{< /tab >}}
{{< tab lang="yaml" header="standalone task" >}}
apiVersion: pipecd.dev/v1beta1
kind: ECSApp
spec:
name: standalonetask-fargate
labels:
env: example
team: xyz
input:
# Path to TaskDefinition configuration file in Yaml/JSON format.
# Default is `taskdef.json`
taskDefinitionFile: taskdef.yaml
clusterArn: arn:aws:ecs:ap-northeast-1:XXXX:cluster/test-cluster
awsvpcConfiguration:
assignPublicIp: ENABLED
subnets:
- subnet-YYYY
- subnet-YYYY
securityGroups:
- sg-YYYY
{{< /tab >}}
{{< /tabpane >}}

## Sync with the specified pipeline

Expand Down Expand Up @@ -46,7 +102,6 @@ kind: ECSApp
spec:
input:
# Path to Service configuration file in Yaml/JSON format.
# Default is `service.json`
serviceDefinitionFile: servicedef.yaml
# Path to TaskDefinition configuration file in Yaml/JSON format.
# Default is `taskdef.json`
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
apiVersion: pipecd.dev/v1beta1
kind: ECSApp
spec:
name: standalonetask-ec2-awsvpc
labels:
env: example
team: xyz
input:
taskDefinitionFile: taskdef.yaml
clusterArn: arn:aws:ecs:ap-northeast-1:XXXX:cluster/test-cluster
launchType: EC2
awsvpcConfiguration:
subnets:
- subnet-YYYY
- subnet-YYYY
description: |
This app demonstrates how to deploy an ECS application with [Quick Sync](https://pipecd.dev/docs/concepts/#sync-strategy) strategy.\
No pipeline is specified then in each deployment PipeCD will roll out the new version and switch all traffic to it immediately.\
References: [adding a new app](https://pipecd.dev/docs/user-guide/managing-application/adding-an-application/), [app configuration](https://pipecd.dev/docs/user-guide/configuration-reference/)
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
family: nginx-test-fam-ec2
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:
- EC2
requiresCompatibilities:
- EC2
networkMode: awsvpc
memory: 512
cpu: 256
pidMode: ""
volumes: []
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
apiVersion: pipecd.dev/v1beta1
kind: ECSApp
spec:
name: standalonetask-ec2-bridge-1
labels:
env: example
team: xyz
input:
taskDefinitionFile: taskdef.yaml
launchType: EC2
clusterArn: arn:aws:ecs:ap-northeast-1:XXXX:cluster/test-cluster
description: |
This app demonstrates how to deploy an ECS application with [Quick Sync](https://pipecd.dev/docs/concepts/#sync-strategy) strategy.\
No pipeline is specified then in each deployment PipeCD will roll out the new version and switch all traffic to it immediately.\
References: [adding a new app](https://pipecd.dev/docs/user-guide/managing-application/adding-an-application/), [app configuration](https://pipecd.dev/docs/user-guide/configuration-reference/)
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
family: nginx-test-fam-ec2-bridge
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:
- EC2
requiresCompatibilities:
- EC2
networkMode: bridge
memory: 512
cpu: 256
pidMode: ""
volumes: []
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
apiVersion: pipecd.dev/v1beta1
kind: ECSApp
spec:
name: standalonetask-fargate
labels:
env: example
team: xyz
input:
taskDefinitionFile: taskdef.yaml
clusterArn: arn:aws:ecs:ap-northeast-1:XXXX:cluster/test-cluster
awsvpcConfiguration:
assignPublicIp: ENABLED
subnets:
- subnet-YYYY
- subnet-YYYY
securityGroups:
- sg-YYYY
description: |
This app demonstrates how to deploy an ECS application with [Quick Sync](https://pipecd.dev/docs/concepts/#sync-strategy) strategy.\
No pipeline is specified then in each deployment PipeCD will roll out the new version and switch all traffic to it immediately.\
References: [adding a new app](https://pipecd.dev/docs/user-guide/managing-application/adding-an-application/), [app configuration](https://pipecd.dev/docs/user-guide/configuration-reference/)
20 changes: 20 additions & 0 deletions examples/ecs/standalone-task/launch-type/fargate/taskdef.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
family: nginx-test-fam-1
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: []
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ require (
github.com/envoyproxy/protoc-gen-validate v0.6.6
github.com/fsouza/fake-gcs-server v1.21.0
github.com/go-sql-driver/mysql v1.6.0
github.com/goccy/go-yaml v1.9.3
github.com/goccy/go-yaml v1.9.8
github.com/golang-jwt/jwt v3.2.1+incompatible
github.com/golang/mock v1.5.0
github.com/golang/protobuf v1.5.2
Expand Down
5 changes: 3 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -270,8 +270,8 @@ github.com/go-sql-driver/mysql v1.6.0/go.mod h1:DCzpHaOWr8IXmIStZouvnhqoel9Qv2LB
github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY=
github.com/go-test/deep v1.0.3 h1:ZrJSEWsXzPOxaZnFteGEfooLba+ju3FYIbOrS+rQd68=
github.com/go-test/deep v1.0.3/go.mod h1:wGDj63lr65AM2AQyKZd/NYHGb0R+1RLqB8NKt3aSFNA=
github.com/goccy/go-yaml v1.9.3 h1:9A7DkTBb7cZs5wqcqAhgR+2Ms8O7HTjT0SqOXO10HqM=
github.com/goccy/go-yaml v1.9.3/go.mod h1:U/jl18uSupI5rdI2jmuCswEA2htH9eXfferR3KfscvA=
github.com/goccy/go-yaml v1.9.8 h1:5gMyLUeU1/6zl+WFfR1hN7D2kf+1/eRGa7DFtToiBvQ=
github.com/goccy/go-yaml v1.9.8/go.mod h1:JubOolP3gh0HpiBc4BLRD4YmjEjHAmIIB2aaXKkTfoE=
github.com/godbus/dbus/v5 v5.0.4/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA=
github.com/godbus/dbus/v5 v5.0.6/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA=
github.com/gofrs/uuid v3.2.0+incompatible h1:y12jRkkFxsd7GpqdSZ+/KCs/fJbqpEXSGd4+jfEaewE=
Expand Down Expand Up @@ -877,6 +877,7 @@ golang.org/x/sys v0.0.0-20211025201205-69cdffdb9359/go.mod h1:oPkhp1MJrh7nUepCBc
golang.org/x/sys v0.0.0-20211116061358-0a5406a5449c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220209214540-3681064d5158/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220406163625-3f8b81556e12/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220412211240-33da011f77ad h1:ntjMns5wyP/fN65tdBD4g8J5w8n015+iIIs9rtjXkY0=
golang.org/x/sys v0.0.0-20220412211240-33da011f77ad/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
Expand Down
31 changes: 31 additions & 0 deletions hack/gen-contributions.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#!/usr/bin/env bash

# Copyright 2022 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.

echo "Updating the contributors list on README.md ..."

LINE_NUM=$(($(grep -Fn "### Thanks to the contributors of PipeCD" README.md | cut -f1 -d ':')+1))
head -n $LINE_NUM README.md >> README.md.tmp

while read -r line
do
cat <<EOT >> README.md.tmp
$line
EOT
done < <(gh api -XGET /repos/pipe-cd/pipecd/contributors -F per_page=100 | jq -r '.[] | "<a href=\"\(.html_url)\"><img src=\"\(.avatar_url)\" title=\"\(.login)\" width=\"80\" height=\"80\"></a>"')

mv README.md.tmp README.md

echo "Successfully update the contributions list on README.md"
1 change: 1 addition & 0 deletions pkg/app/pipectl/cmd/application/application.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ func NewCommand() *cobra.Command {
newGetCommand(c),
newListCommand(c),
newDeleteCommand(c),
newDisableCommand(c),
)

c.clientOptions.RegisterPersistentFlags(cmd)
Expand Down