Skip to content

Commit

Permalink
chore: add integration test for VolumeConfiguration property (#722)
Browse files Browse the repository at this point in the history
* Add integration test for VolumeConfiguration property

* Update to include run-task-assign-public-IP
  • Loading branch information
amazreech authored Jan 30, 2025
1 parent c65f737 commit cc0b04b
Show file tree
Hide file tree
Showing 4 changed files with 135 additions and 0 deletions.
26 changes: 26 additions & 0 deletions .github/workflows/test-workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
38 changes: 38 additions & 0 deletions task-definition-run-task-volume-configuration.json
Original file line number Diff line number Diff line change
@@ -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"
}
45 changes: 45 additions & 0 deletions task-definition-volume-configuration.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
{
"containerDefinitions": [
{
"entryPoint": [
"sh",
"-c"
],
"portMappings": [
{
"hostPort": 80,
"protocol": "tcp",
"containerPort": 80
}
],
"command": [
"/bin/sh -c \"echo '<html> <head> <title>Amazon ECS Sample App</title> <style>body {margin-top: 40px; background-color: #333;} </style> </head><body> <div style=color:white;text-align:center> <h1>Amazon ECS Sample App</h1> <h2>Congratulations!</h2> <p>Your application is now running on a container in Amazon ECS.</p> </div></body></html>' > /usr/local/apache2/htdocs/index.html && httpd-foreground\""
],
"cpu": 256,
"memoryReservation": 512,
"image": "httpd:2.4",
"essential": true,
"name": "sample-app",
"mountPoints": [
{
"sourceVolume": "ebs1",
"containerPath": "/var/lib",
"readOnly": false
}
]
}
],
"memory": "512",
"volumes": [
{
"name": "ebs1",
"configuredAtLaunch": true
}
],
"family": "github-actions-deploy-task-def-integ-tests-volume-config",
"requiresCompatibilities": [
"FARGATE"
],
"networkMode": "awsvpc",
"cpu": "256"
}
26 changes: 26 additions & 0 deletions test-workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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@v2
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@v2
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

0 comments on commit cc0b04b

Please sign in to comment.