GitHub Action: deploy-ecspresso
Deploy on ECS with Escpresso
Introduction
This is template repository to create composite GitHub Actions. Feel free to use it as reference and starting point.
Usage
name: Pull Request
on:
push:
branches: [ 'main' ]
jobs:
context:
runs-on: ubuntu-latest
steps:
- name: Example action
uses: cloudposse/example-github-action-deploy-ecspresso@main
id: example
with:
image: 1111111111111.dkr.ecr.us-east-2.amazonaws.com/cloudposse/example-app-on-ecs
image-tag: latest
region: us-east-2
operation: deploy
cluster: acme-plat-ue2-sandbox
application: acme-plat-ue2-sandbox-example-app-on-ecs
taskdef-path: taskdef.json
outputs:
result: ${{ steps.example.outputs.webapp-url }}
S3 Mirroring
S3 Mirroring is a pattern of uploading the deployed task definition to an S3 Bucket. This is so that the task definition can be updated with the latest image tag, and the terraform does not reset it back to a previous tag set in the infrastructure repository.
Partial Task Definition
A "Partial Task Definition" is an authoring pattern where the application repository maintains only the parts of the ECS task definition that the app team owns or changes frequently (for example, container image/tag, environment variables, command/args, CPU/memory for a container). The more static, infrastructure-owned parts (for example, IAM roles, volumes, EFS mounts, log configuration, task-level networking) are provided by a template maintained in the infrastructure repository.
During deployment, this action merges the infrastructure-provided template (optionally fetched from S3) with the local partial task definition from the application repo to produce a complete task-definition.json
, which is then deployed by ecspresso
.