From e7a19b25f50e8be383db79da139b9eeed2277060 Mon Sep 17 00:00:00 2001 From: Sherlyn Date: Wed, 31 Jul 2024 10:55:12 -0400 Subject: [PATCH] chore: Add new integration tests for newly added one off task (#594) * update tasks only feature * new integration tests * new integration tests with env variables defined * updated inputs * updated cluster inputs * updated region * Update test-workflow.yml * updated subnet values * updated values to link to my subnets, repo, cluster, and my service * update security group * modified workflow to add public IP and task definition with proper inputs * new task def file and yaml file changes * updated task def run task file with different container information * updated task def run task file with new cpu * new changes for integ tests with deploy task def credentials * updating task definition * updating env variables to inputs * updated region * updated env to both workflow files * removing env block * removing old commit and using commit from offical deploy repo * new echo integ test run no. * update original task definition * remove public IP input * keep only basic run task inputs * original inputs and different security group * final changes * made changes from comments * Delete .idea/.gitignore * Delete .idea/vcs.xml * Delete .idea/amazon-ecs-deploy-task-definition.iml * Delete .idea/inspectionProfiles/Project_Default.xml * Delete .idea/misc.xml * Delete .idea/modules.xml * clearer description name of each test --- .github/workflows/test-workflow.yml | 26 ++++++++++++++++++++++++-- task-definition-run-task.json | 25 +++++++++++++++++++++++++ test-workflow.yml | 26 ++++++++++++++++++++++++-- 3 files changed, 73 insertions(+), 4 deletions(-) create mode 100644 task-definition-run-task.json diff --git a/.github/workflows/test-workflow.yml b/.github/workflows/test-workflow.yml index 1acb08de4..f7fd261da 100644 --- a/.github/workflows/test-workflow.yml +++ b/.github/workflows/test-workflow.yml @@ -24,11 +24,33 @@ jobs: aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} aws-region: us-west-2 + + - name: Deploy Amazon ECS task definition with one-off task and wait for task stopped set to false + uses: aws-actions/amazon-ecs-deploy-task-definition@abe77ebded86b685c231c58bd5936280c6fcc011 + with: + task-definition: task-definition-run-task.json + cluster: github-actions-deploy-task-def-integ-test + run-task: true + run-task-subnets: subnet-e5604fce, subnet-fe9355b4, subnet-c49431bc, subnet-392f9b64 + run-task-security-groups: sg-067ebcde49c0f3ad8 + run-task-launch-type: FARGATE + wait-for-task-stopped: false + + - name: Deploy Amazon ECS task definition with one-off task and wait for task stopped set to true + uses: aws-actions/amazon-ecs-deploy-task-definition@abe77ebded86b685c231c58bd5936280c6fcc011 + with: + task-definition: task-definition-run-task.json + cluster: github-actions-deploy-task-def-integ-test + run-task: true + run-task-subnets: subnet-e5604fce, subnet-fe9355b4, subnet-c49431bc, subnet-392f9b64 + run-task-security-groups: sg-067ebcde49c0f3ad8 + run-task-launch-type: FARGATE + wait-for-task-stopped: true - - name: Deploy Amazon ECS task definition + - name: Deploy Amazon ECS task definition with ECS Service uses: aws-actions/amazon-ecs-deploy-task-definition@abe77ebded86b685c231c58bd5936280c6fcc011 with: task-definition: task-definition.json service: github-actions-deploy-task-def-integ-test cluster: github-actions-deploy-task-def-integ-test - wait-for-service-stability: true + wait-for-service-stability: true \ No newline at end of file diff --git a/task-definition-run-task.json b/task-definition-run-task.json new file mode 100644 index 000000000..79589ffaa --- /dev/null +++ b/task-definition-run-task.json @@ -0,0 +1,25 @@ +{ + "containerDefinitions": [ + { + "memory": 32, + "essential": true, + "entryPoint": ["ping"], + "name": "alpine_ping", + "readonlyRootFilesystem": true, + "image": "alpine:3.4", + "command": [ + "-c", + "4", + "example.com" + ], + "cpu": 16 + } + ], + "memory": "512", + "family": "github-actions-deploy-task-def-integ-tests", + "requiresCompatibilities": [ + "FARGATE" + ], + "networkMode": "awsvpc", + "cpu": "256" +} diff --git a/test-workflow.yml b/test-workflow.yml index 288591211..8f42d01db 100644 --- a/test-workflow.yml +++ b/test-workflow.yml @@ -25,10 +25,32 @@ jobs: aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} aws-region: us-west-2 - - name: Deploy Amazon ECS task definition + - name: Deploy Amazon ECS task definition with one-off task and wait for task stopped set to false + uses: aws-actions/amazon-ecs-deploy-task-definition@v1 + with: + task-definition: task-definition-run-task.json + cluster: github-actions-deploy-task-def-integ-test + run-task: true + run-task-subnets: subnet-e5604fce, subnet-fe9355b4, subnet-c49431bc, subnet-392f9b64 + run-task-security-groups: sg-067ebcde49c0f3ad8 + run-task-launch-type: FARGATE + wait-for-task-stopped: false + + - name: Deploy Amazon ECS task definition with one-off task and wait for task stopped set to true + uses: aws-actions/amazon-ecs-deploy-task-definition@v1 + with: + task-definition: task-definition-run-task.json + cluster: github-actions-deploy-task-def-integ-test + run-task: true + run-task-subnets: subnet-e5604fce, subnet-fe9355b4, subnet-c49431bc, subnet-392f9b64 + run-task-security-groups: sg-067ebcde49c0f3ad8 + run-task-launch-type: FARGATE + wait-for-task-stopped: true + + - name: Deploy Amazon ECS task definition with ECS Service uses: aws-actions/amazon-ecs-deploy-task-definition@v1 with: task-definition: task-definition.json service: github-actions-deploy-task-def-integ-test cluster: github-actions-deploy-task-def-integ-test - wait-for-service-stability: true + wait-for-service-stability: true \ No newline at end of file