sourcetoad / aws-codedeploy-action

AWS CodeDeploy via GitHub Actions
MIT License
35 stars 13 forks source link

Error with Blue Green deployment #91

Closed a-jackson closed 7 months ago

a-jackson commented 7 months ago

Our deployment group is blue/green with copy autoscaling group. When the deployment starts and the action begins polling aws deploy get-deployment, this does not return the deploymentOverview object until the new ASG and instances are ready.

The action seems to continue fine anyway and once the instances are ready and deployment starts then it works as normal.

The log below is the last poll before instances were running and the first after.

/deploy.sh: line 65: [: null: integer expression expected
Deployment in progress. Sleeping 15 seconds. (Try 18)
Instance Overview: Failed (null), In-Progress (null), Skipped (null), Pending (null), Succeeded (null)
Deployment Status: InProgress
Deployment in progress. Sleeping 15 seconds. (Try 19)
Instance Overview: Failed (0), In-Progress (1), Skipped (0), Pending (1), Succeeded (0)
Deployment Status: InProgress
iBotPeaches commented 7 months ago

Thanks for report. Personally never used Blue/Green so makes sense how we missed that coverage. From your description it sounds like while the deployment was registered - it does not respond on get-deployment until ready.

Might have to set up one of these to test or if you have sample JSON from list-deployment and get-deployment before/during a Blue/Green deploy.

a-jackson commented 7 months ago

list-deployments seems to work the same.

Output ```json { "deployments": [ "d-C60F1S8G3" ] } ```

get-deployment during the provisioning instances stage seems to just be missing the deploymentOverview object. This is the stage during which it logs the error.

Output ```json { "deploymentInfo": { "applicationName": "ts-cert-submitters-deploy-application", "deploymentGroupName": "ts-cert-submitters-api-deploy-group", "deploymentConfigName": "CodeDeployDefault.OneAtATime", "deploymentId": "d-C60F1S8G3", "previousRevision": { "revisionType": "S3", "s3Location": { "bucket": "ts-cert-submitters-deployment-s3", "key": "web/7387814085-4dda9c7d4e693a5492f81c3ac9370e45dc90c889.zip", "bundleType": "zip", "eTag": "e3451aa541c87f3a2c6e18915e5c5472-5" } }, "revision": { "revisionType": "S3", "s3Location": { "bucket": "ts-cert-submitters-deployment-s3", "key": "web/7397578829-62968eb8c2e8efd15511ca9ac12df2b7a9ceb3ae.zip", "bundleType": "zip", "eTag": "86e60881d1fc4236c6f1ba096cd35dee-5" } }, "status": "InProgress", "createTime": "2024-01-03T13:22:45.165000+00:00", "description": "refs/heads/master - 62968eb8c2e8efd15511ca9ac12df2b7a9ceb3ae", "creator": "user", "ignoreApplicationStopFailures": false, "updateOutdatedInstancesOnly": false, "deploymentStyle": { "deploymentType": "BLUE_GREEN", "deploymentOption": "WITH_TRAFFIC_CONTROL" }, "targetInstances": { "tagFilters": [], "autoScalingGroups": [ "CodeDeploy_ts-cert-submitters-api-deploy-group_d-C60F1S8G3" ] }, "instanceTerminationWaitTimeStarted": false, "blueGreenDeploymentConfiguration": { "terminateBlueInstancesOnDeploymentSuccess": { "action": "TERMINATE", "terminationWaitTimeInMinutes": 0 }, "deploymentReadyOption": { "actionOnTimeout": "CONTINUE_DEPLOYMENT", "waitTimeInMinutes": 0 }, "greenFleetProvisioningOption": { "action": "COPY_AUTO_SCALING_GROUP" } }, "loadBalancerInfo": { "targetGroupInfoList": [ { "name": "ts-cert-submitters-api-tg" } ] }, "fileExistsBehavior": "DISALLOW", "deploymentStatusMessages": [], "computePlatform": "Server" } } ```

Once the new instances are provisioned and it begins installing the deployment, the output is just the same as an in place deployment.

Output ```json { "deploymentInfo": { "applicationName": "ts-cert-submitters-deploy-application", "deploymentGroupName": "ts-cert-submitters-api-deploy-group", "deploymentConfigName": "CodeDeployDefault.OneAtATime", "deploymentId": "d-C60F1S8G3", "previousRevision": { "revisionType": "S3", "s3Location": { "bucket": "ts-cert-submitters-deployment-s3", "key": "web/7387814085-4dda9c7d4e693a5492f81c3ac9370e45dc90c889.zip", "bundleType": "zip", "eTag": "e3451aa541c87f3a2c6e18915e5c5472-5" } }, "revision": { "revisionType": "S3", "s3Location": { "bucket": "ts-cert-submitters-deployment-s3", "key": "web/7397578829-62968eb8c2e8efd15511ca9ac12df2b7a9ceb3ae.zip", "bundleType": "zip", "eTag": "86e60881d1fc4236c6f1ba096cd35dee-5" } }, "status": "InProgress", "createTime": "2024-01-03T13:22:45.165000+00:00", "deploymentOverview": { "Pending": 1, "InProgress": 1, "Succeeded": 0, "Failed": 0, "Skipped": 0, "Ready": 0 }, "description": "refs/heads/master - 62968eb8c2e8efd15511ca9ac12df2b7a9ceb3ae", "creator": "user", "ignoreApplicationStopFailures": false, "updateOutdatedInstancesOnly": false, "deploymentStyle": { "deploymentType": "BLUE_GREEN", "deploymentOption": "WITH_TRAFFIC_CONTROL" }, "targetInstances": { "tagFilters": [], "autoScalingGroups": [ "CodeDeploy_ts-cert-submitters-api-deploy-group_d-C60F1S8G3" ] }, "instanceTerminationWaitTimeStarted": false, "blueGreenDeploymentConfiguration": { "terminateBlueInstancesOnDeploymentSuccess": { "action": "TERMINATE", "terminationWaitTimeInMinutes": 0 }, "deploymentReadyOption": { "actionOnTimeout": "CONTINUE_DEPLOYMENT", "waitTimeInMinutes": 0 }, "greenFleetProvisioningOption": { "action": "COPY_AUTO_SCALING_GROUP" } }, "loadBalancerInfo": { "targetGroupInfoList": [ { "name": "ts-cert-submitters-api-tg" } ] }, "fileExistsBehavior": "DISALLOW", "deploymentStatusMessages": [], "computePlatform": "Server", "relatedDeployments": {} } } ```

The deployment still worked perfectly and the workflow completely successfully, the error doesn't seem to affect the actual progress so this is a pretty minor problem

iBotPeaches commented 7 months ago

Thank you for the research. We could fix the minor issues w/ this research I believe.