{"id":26359107,"url":"https://github.com/assemblyai/drone-deploy-ecs","last_synced_at":"2025-03-16T15:58:43.902Z","repository":{"id":36983847,"uuid":"367434502","full_name":"AssemblyAI/drone-deploy-ecs","owner":"AssemblyAI","description":"A Drone plugin to deploy to ECS","archived":false,"fork":false,"pushed_at":"2023-10-21T11:24:19.000Z","size":121,"stargazers_count":3,"open_issues_count":7,"forks_count":6,"subscribers_count":5,"default_branch":"main","last_synced_at":"2024-06-20T00:33:53.029Z","etag":null,"topics":["aws","cicd","drone","ecs","fargate"],"latest_commit_sha":null,"homepage":"https://gallery.ecr.aws/assemblyai/drone-deploy-ecs","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/AssemblyAI.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-05-14T17:25:16.000Z","updated_at":"2022-06-17T09:25:04.000Z","dependencies_parsed_at":"2024-06-20T00:14:32.730Z","dependency_job_id":"c15db958-5400-4c47-89c7-0f6c066ac2dc","html_url":"https://github.com/AssemblyAI/drone-deploy-ecs","commit_stats":{"total_commits":71,"total_committers":4,"mean_commits":17.75,"dds":"0.45070422535211263","last_synced_commit":"3a60c190257522f03ea91aa5eb0e84928b620689"},"previous_names":[],"tags_count":33,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AssemblyAI%2Fdrone-deploy-ecs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AssemblyAI%2Fdrone-deploy-ecs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AssemblyAI%2Fdrone-deploy-ecs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AssemblyAI%2Fdrone-deploy-ecs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/AssemblyAI","download_url":"https://codeload.github.com/AssemblyAI/drone-deploy-ecs/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243893859,"owners_count":20364916,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["aws","cicd","drone","ecs","fargate"],"created_at":"2025-03-16T15:58:43.824Z","updated_at":"2025-03-16T15:58:43.897Z","avatar_url":"https://github.com/AssemblyAI.png","language":"Go","readme":"# drone-deploy-ecs\n\n## Overview\n\n`drone-deploy-ecs` is an opinionated Drone plugin for updating a single container within an ECS Task.\n\nThis plugin has support for two deployment modes: rolling and blue / green.\n\nDuring a rolling deployment, the plugin retrieves the active Task Definition for a specified ECS Service, creates a new revision of the Task Definition with an updated image for a specified container, updates the Service to use the new Task Definition, and waits for the deployment to complete.\n\nA blue / green deployment is similar to a rolling deployment. The key difference is that once the number of running green tasks matches the number of desired green tasks, the blue service is scaled down. It's important to note that this plugin _only_ uses desired vs running to determine deployment health. It will not check the health of a target in a target group, for example\n\n[ECR Link](https://gallery.ecr.aws/assemblyai/drone-deploy-ecs)\n\n## Important Notes\n\nThis plugin cannot update multiple containers within the same Task Definition simultaneously. It will only update the image for a single container within a Task Defintion\n\nThe ECS Service must use the `ECS` deployment controller.\n\n\n## Requirements\n\nThe ECS Service being deployed to must use the `ECS` deployment controller.\n\n### IAM\n\n- `iam:PassRole` on any Task Role (container) or Task Execution Role (ECS Agent) defined in any Task Definition that this tool will modify\n  - You might consider using tag-based access control if there are a lot of roles Drone must be able to pass\n- `ecs:DescribeTaskDefinition` on any task definitions this tool will modify\n- `ecs:DescribeServices` on any services this tool will modify\n- `ecs:UpdateService` on any services this tool will modify\n- `ecs:ListTasks` on `*`\n- `ecs:DescribeTasks` on `*`\n- `ecs:RegisterTaskDefinition` on `*`\n- `application-autoscaling:DescribeScalableTargets` on `*`\n- `application-autoscaling:RegisterScalableTarget` on `*` if you plan on using a blue/green deployment\n\n## Example usage\n\n### Rolling Deployment\n\n```yaml\n---\nkind: pipeline\nname: deploy\n\nsteps:\n- name: deploy\n  image: public.ecr.aws/assemblyai/drone-deploy-ecs\n  settings:\n    mode: rolling\n    aws_region: us-east-2\n    # The name of the ECS service\n    service: webapp\n    # The name of the ECS cluster that the service is in\n    cluster: dev-ecs-cluster\n    # The name of the container to update\n    container: nginx\n    # The image to deploy\n    image: myorg/nginx-${DRONE_COMMIT_SHA}\n    max_deploy_checks: 10\n```\n\nYou can deploy to multiple services in the same step by declaring a comma-separated list of `settings.service`. This is beneficial if you have multiple services using the same task definition.\n\nFor example:\n\n```yml\nsteps:\n- name: deploy\n  image: public.ecr.aws/assemblyai/drone-deploy-ecs\n  settings:\n    mode: rolling\n    aws_region: us-east-2\n    service: webapp,webapp-spot\n    cluster: dev-ecs-cluster\n    container: nginx\n    image: myorg/nginx-${DRONE_COMMIT_SHA}\n    max_deploy_checks: 10\n```\n\n#### Disabling rollbacks\n\nYou can disable rollbacks by setting the `disable_rollbacks` to any string. Simply omit it to enable rollbacks. You may want to disable rollbacks if you have the ECS Circuit Breaker enabled for your service.\n\n\n### Blue / Green Cluster deploy\n\nThis is very similar to the rolling deploy except it takes additional info to deploy to the inactive environment.\nCurrently, how it pulls the live environment is somewhat hardcoded in the logic and by checking to see if the inactive\nenvironment has no tasks running. \n\n```yaml\n---\nkind: pipeline\nname: deploy\n\nsteps:\n- name: deploy\n  image: public.ecr.aws/assemblyai/drone-deploy-ecs\n  settings:\n    mode: blue-green-cluster\n    aws_region: us-east-2\n    # the name of the secret tag that will store the live color\n    secret_service: secret\n    # The name of the ECS service\n    blue_service: webapp-blue\n    green_service: webapp-green\n    # The name of the ECS cluster that the service is in\n    cluster: dev-ecs-cluster\n    # The name of the container to update\n    container: nginx\n    # The images to deploy\n    blue_image: myorg/nginx-blue-${DRONE_COMMIT_SHA}\n    green_image: myorg/nginx-green-${DRONE_COMMIT_SHA}\n    max_deploy_checks: 10\n```\n\n### Blue / Green\n\nBlue / Green deployments will work with services that use Application Autoscaling and those that do not.\n\nOne service must have a desired count of 0, the other must have a desired count \u003e 0.\n\nIt does not matter which service is set for `blue_service` or `green_service`. The plugin will use the service with a desired count of 0 as the green service. This is simply a way to define which two services the plugin should modify. \n\nOnce the number of running containers equals the number of desired containers for the green service, the plugin will begin scaling down the blue service by  `scale_down_percent`. \n\nBlue / Green deployments do not support disabling rollbacks.\n\n```yml\n---\nkind: pipeline\nname: deploy\n\nsteps:\n- name: deploy\n  image: public.ecr.aws/assemblyai/drone-deploy-ecs\n  settings:\n    mode: blue-green\n    aws_region: us-east-2\n    # The name of the green ECS service\n    green_service: webapp-green\n    # The name of the blue ECS service\n    blue_service: webapp-blue\n    # The name of the ECS cluster that the service is in\n    cluster: dev-ecs-cluster\n    # The name of the container to update\n    container: nginx\n    # The image to deploy\n    image: myorg/nginx-${DRONE_COMMIT_SHA}\n    # How many times to check rollout status before failing\n    max_deploy_checks: 10\n    # Percent of instances to scale down blue service by\n    scale_down_percent: 50\n    # Seconds to wait between scale down events\n    scale_down_interval: 600\n    # Number of seconds between scaling up green service and scaling down blue\n    # This is useful if your application takes some time to become healthy\n    scale_down_wait_period: 10\n    # Number of times running count must equal desired count in order to mark green deployment as a success\n    checks_to_pass: 2\n```\n\n\n## TODO\n\n- Code cleanup\n- Better `settings` documentation\n- Tests\n- Better, more consistent logging\n- Update `pkg/deploy` functions to use `deploy.DeployConfig`","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fassemblyai%2Fdrone-deploy-ecs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fassemblyai%2Fdrone-deploy-ecs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fassemblyai%2Fdrone-deploy-ecs/lists"}