diff --git a/.github/workflows/test-workflow.yml b/.github/workflows/test-workflow.yml index 0c092ba2..f5dafd4d 100644 --- a/.github/workflows/test-workflow.yml +++ b/.github/workflows/test-workflow.yml @@ -62,3 +62,29 @@ jobs: cluster: github-actions-deploy-task-def-integ-test wait-for-service-stability: true enable-ecs-managed-tags: true + + - name: Deploy Amazon ECS task definition with ECS Service VolumeConfiguration + uses: aws-actions/amazon-ecs-deploy-task-definition@0bad458c6aa901707e510cd05b797b05da075633 + with: + task-definition: task-definition-volume-configuration.json + service: github-actions-deploy-task-def-integ-test + cluster: github-actions-deploy-task-def-integ-test + wait-for-service-stability: true + enable-ecs-managed-tags: true + service-managed-ebs-volume-name: "ebs1" + service-managed-ebs-volume: '{"filesystemType":"xfs","roleArn":"arn:aws:iam::${{secrets.AWS_ACCOUNT_ID}}:role/GitHubActionsVolumeConfigurationsEBSRole","encrypted":false,"sizeInGiB":30}' + + - name: Deploy Amazon ECS task definition with one-off task and VolumeConfiguration + uses: aws-actions/amazon-ecs-deploy-task-definition@0bad458c6aa901707e510cd05b797b05da075633 + with: + task-definition: task-definition-volume-configuration.json + cluster: github-actions-deploy-task-def-integ-test + run-task: true + enable-ecs-managed-tags: true + run-task-subnets: subnet-e5604fce, subnet-fe9355b4, subnet-c49431bc, subnet-392f9b64 + run-task-security-groups: sg-067ebcde49c0f3ad8 + run-task-assign-public-IP: ENABLED + run-task-managed-ebs-volume-name: "ebs1" + run-task-managed-ebs-volume: '{"filesystemType":"xfs","roleArn":"arn:aws:iam::${{secrets.AWS_ACCOUNT_ID}}:role/GitHubActionsVolumeConfigurationsEBSRole","encrypted":false,"sizeInGiB":30}' + run-task-started-by: "GitHub-Actions-EBS-Test" + wait-for-task-stopped: true diff --git a/task-definition-run-task-volume-configuration.json b/task-definition-run-task-volume-configuration.json new file mode 100644 index 00000000..4c93ff87 --- /dev/null +++ b/task-definition-run-task-volume-configuration.json @@ -0,0 +1,38 @@ +{ + "containerDefinitions": [ + { + "memory": 32, + "essential": true, + "entryPoint": ["ping"], + "name": "alpine_ping", + "readonlyRootFilesystem": true, + "image": "alpine:3.4", + "command": [ + "-c", + "4", + "example.com" + ], + "cpu": 16, + "mountPoints": [ + { + "sourceVolume": "ebs1", + "containerPath": "/var/lib", + "readOnly": false + } + ] + } + ], + "memory": "512", + "volumes": [ + { + "name": "ebs1", + "configuredAtLaunch": true + } + ], + "family": "github-actions-deploy-task-def-integ-tests-run-task-volume-config", + "requiresCompatibilities": [ + "FARGATE" + ], + "networkMode": "awsvpc", + "cpu": "256" +} \ No newline at end of file diff --git a/task-definition-volume-configuration.json b/task-definition-volume-configuration.json new file mode 100644 index 00000000..f5343bb2 --- /dev/null +++ b/task-definition-volume-configuration.json @@ -0,0 +1,45 @@ +{ + "containerDefinitions": [ + { + "entryPoint": [ + "sh", + "-c" + ], + "portMappings": [ + { + "hostPort": 80, + "protocol": "tcp", + "containerPort": 80 + } + ], + "command": [ + "/bin/sh -c \"echo '
Your application is now running on a container in Amazon ECS.