amazon-ecs-deploy-task-definition icon indicating copy to clipboard operation
amazon-ecs-deploy-task-definition copied to clipboard

Support waiting for deployment ready state for Blue/Green deployments

Open JohnNeville opened this issue 4 years ago • 1 comments

I am working on a CI/CD pipeline and I want to gate the Blue/Green deploy process on the results of integration tests against the test listener.

What I would love is for the aws-actions/amazon-ecs-deploy-task-definition action to wait until the CodeDeploy is in a "Ready" state and the listener is available to test. Then I can run Github Action run cypress integration tests against the testing listener and use the aws cli to tell the listener to continue the deployment.

Right now I am replicating this feature the following bash step:

- name: Wait until deployment is "Ready"
    run: | 
        # Try every 15 seconds
        maxRetries=40
        retryInterval=15
        echo "Waiting for the deployment to be ready for testing"
        retry=0
        until [ ${retry} -ge ${maxRetries} ]
        do
            status=`aws deploy get-deployment --deployment-id ${{ steps.ecs-deployment.outputs.codedeploy-deployment-id }} --region us-east-1 | jq '.deploymentInfo.status'`
            echo "::debug::The deployment is currently in the status $status"
            retry=$[${retry}+1]
            echo "::debug::Retrying [${retry}/${maxRetries}] in ${retryInterval}(s) "
            sleep ${retryInterval}
        done

        if [ ${retry} -ge ${maxRetries} ]; then
            echo "::warning::Deployment Ready Check Timed Out after ${maxRetries} attempts"
        fi

While this solves the problem it is a lot of boilerplate code that would need to be replicated or converted into a shared action. It would help if it was a built in feature to the action.

It looks like one problem with adding this in is that the AWSJavaScriptSDK CodeDeploy waiter only supports the deploymentSuccessful state so this would either need to be implemented in the action itself or added to the SDK.

JohnNeville avatar Aug 05 '20 21:08 JohnNeville