From 55184430ab5b59743111a37134c48ebb96362a1d Mon Sep 17 00:00:00 2001 From: forkimenjeckayang Date: Thu, 20 Jun 2024 20:46:26 +0100 Subject: [PATCH] ECR to ECS --- .../workflows/create_ECR_deploy_to_ECS.yml | 84 +------------------ 1 file changed, 1 insertion(+), 83 deletions(-) diff --git a/.github/workflows/create_ECR_deploy_to_ECS.yml b/.github/workflows/create_ECR_deploy_to_ECS.yml index d71ce7b..eb09df5 100644 --- a/.github/workflows/create_ECR_deploy_to_ECS.yml +++ b/.github/workflows/create_ECR_deploy_to_ECS.yml @@ -83,86 +83,4 @@ jobs: with: task-definition: ${{ steps.task-def.outputs['task-definition'] }} service: ${{ env.ECS_SERVICE }} - cluster: ${{ env.ECS_CLUSTER }} - - - - # - name: Update ECS service with new image - # run: | - # IMAGE="${{ env.IMAGE }}" - - # # Fetch the current task definition - # CURRENT_TASK_DEF=$(aws ecs describe-task-definition --task-definition ${{ env.ECS_TASK_DEFINITION }} --query 'taskDefinition' --output json) - - # # Debug: Output current task definition to log - # echo "Current task definition: $CURRENT_TASK_DEF" - - # # Extract the task definition family - # FAMILY=$(echo $CURRENT_TASK_DEF | jq -r '.family') - - # # Get the container definitions and update the image - # UPDATED_CONTAINER_DEFINITIONS=$(echo $CURRENT_TASK_DEF | jq --arg IMAGE "$IMAGE" --arg NAME "${{ env.CONTAINER_NAME }}" '.containerDefinitions | map(if .name == $NAME then .image = $IMAGE else . end)') - - # # Debug: Output updated container definitions to log - # echo "Updated container definitions: $UPDATED_CONTAINER_DEFINITIONS" - - # # Create a temporary JSON file with updated container definitions - # echo "$UPDATED_CONTAINER_DEFINITIONS" > updated-containers.json - - # # Debug: Check if the file exists and output its contents - # ls -l updated-containers.json - # cat updated-containers.json - - # # Register the new task definition revision - # NEW_TASK_DEF_ARN=$(aws ecs register-task-definition \ - # --family $FAMILY \ - # --task-role-arn "$(echo $CURRENT_TASK_DEF | jq -r '.taskRoleArn')" \ - # --execution-role-arn "$(echo $CURRENT_TASK_DEF | jq -r '.executionRoleArn')" \ - # --network-mode "$(echo $CURRENT_TASK_DEF | jq -r '.networkMode')" \ - # --container-definitions file://updated-containers.json \ - # --volumes "$(echo $CURRENT_TASK_DEF | jq -c '.volumes')" \ - # --placement-constraints "$(echo $CURRENT_TASK_DEF | jq -c '.placementConstraints')" \ - # --requires-compatibilities "$(echo $CURRENT_TASK_DEF | jq -c '.requiresCompatibilities')" \ - # --cpu "$(echo $CURRENT_TASK_DEF | jq -r '.cpu')" \ - # --memory "$(echo $CURRENT_TASK_DEF | jq -r '.memory')" \ - # --tags "$(echo $CURRENT_TASK_DEF | jq -c '.tags')" \ - # --pid-mode "$(echo $CURRENT_TASK_DEF | jq -r '.pidMode')" \ - # --ipc-mode "$(echo $CURRENT_TASK_DEF | jq -r '.ipcMode')" \ - # --proxy-configuration "$(echo $CURRENT_TASK_DEF | jq -c '.proxyConfiguration')" \ - # --inference-accelerators "$(echo $CURRENT_TASK_DEF | jq -c '.inferenceAccelerators')" \ - # --ephemeral-storage "$(echo $CURRENT_TASK_DEF | jq -c '.ephemeralStorage')" \ - # --runtime-platform "$(echo $CURRENT_TASK_DEF | jq -c '.runtimePlatform')" \ - # --query 'taskDefinition.taskDefinitionArn' \ - # --output text) - - # # Update ECS service to use the new task definition revision - # aws ecs update-service --cluster ${{ env.ECS_CLUSTER }} --service ${{ env.ECS_SERVICE }} --task-definition $NEW_TASK_DEF_ARN - # aws ecs wait services-stable --cluster ${{ env.ECS_CLUSTER }} --services ${{ env.ECS_SERVICE }} - - # - name: Get current task definition - # id: get-task-def - # run: | - # aws ecs describe-task-definition --task-definition ${{ env.ECS_TASK_DEFINITION }} > current-task-def.json - - # - name: Update task definition with new image - # id: update-task-def - # run: | - # NEW_IMAGE="${{ env.IMAGE }}" - # CONTAINER_NAME="${{ env.CONTAINER_NAME }}" - # jq --arg IMAGE "$NEW_IMAGE" --arg NAME "$CONTAINER_NAME" \ - # '.taskDefinition.containerDefinitions |= map(if .name == $NAME then .image = $IMAGE else . end)' \ - # current-task-def.json > updated-task-def.json - - # - name: Register updated task definition - # id: register-task-def - # run: | - # aws ecs register-task-definition \ - # --cli-input-json file://updated-task-def.json \ - # --query 'taskDefinition.taskDefinitionArn' \ - # --output text > task-def-arn.txt - # echo "TASK_DEF_ARN=$(cat task-def-arn.txt)" >> $GITHUB_ENV - - # - name: Deploy updated task definition - # run: | - # aws ecs update-service --cluster ${{ env.ECS_CLUSTER }} --service ${{ env.ECS_SERVICE }} --task-definition ${{ env.TASK_DEF_ARN }} - # aws ecs wait services-stable --cluster ${{ env.ECS_CLUSTER }} --services ${{ env.ECS_SERVICE }} \ No newline at end of file + cluster: ${{ env.ECS_CLUSTER }} \ No newline at end of file