Show AWS Deployment Success Code in logs
Problem to solve
Users deploying to AWS have a hard time understand that the deployment was successful. They often have to go to the AWS console or go through logs to look for a success/fail code.
Intended users
Further details
deployment-successful
--deployment-id <value>
[--cli-input-json <value>]
[--generate-cli-skeleton <value>]
Example
To pause script operations until a deployment is flagged as successful.
The following wait deployment-successful example pauses until the specified deployment completes successfully.
aws deploy wait deployment-successful --deployment-id d-A1B2C3111
This command produces no output, but pauses operation until the condition is met. It generates an error if the condition is not met after 120 checks that are 15 seconds apart.
Example:
To get information about a deployment
The following get-deployment example displays information about a deployment that is associated with the user's AWS account.
aws deploy get-deployment --deployment-id d-A1B2C3123
Output:
{
"deploymentInfo": {
"applicationName": "WordPress_App",
"status": "Succeeded",
"deploymentOverview": {
"Failed": 0,
"InProgress": 0,
"Skipped": 0,
"Succeeded": 1,
"Pending": 0
},
"deploymentConfigName": "CodeDeployDefault.OneAtATime",
"creator": "user",
"description": "My WordPress app deployment",
"revision": {
"revisionType": "S3",
"s3Location": {
"bundleType": "zip",
"eTag": "\"dd56cfdEXAMPLE8e768f9d77fEXAMPLE\"",
"bucket": "CodeDeployDemoBucket",
"key": "WordPressApp.zip"
}
},
"deploymentId": "d-A1B2C3123",
"deploymentGroupName": "WordPress_DG",
"createTime": 1409764576.589,
"completeTime": 1409764596.101,
"ignoreApplicationStopFailures": false
}
}
Proposal
Create a docker image to be placed under https://gitlab.com/gitlab-org/cloud-deploy/-/tree/master/aws
Deployment monitoring was already put in place for deployment to EC2: https://gitlab.com/gitlab-org/cloud-deploy/-/blob/master/aws/src/bin/gl-ec2#L31 (polling every 10 seconds).
But nothing similar was setup when deploying to ECS.
- We should create a stand-alone docker image that uses the script for monitoring in EC2 and place in https://gitlab.com/gitlab-org/cloud-deploy/-/tree/master/aws.
- Update the ECS image to call the monitoring docker image so that the success codes are visible in the ECS logs
- Update the EC2 docker image and template to call via
include
the monitoring docker image instead of having the script inside the EC2 template
Old proposal
(aws deploy create-deployment "
{args[@]}")
deployment_id=(echo "
deployment_response" | jq -r '.deploymentId')
echo "$deployment_response" echo "Deploying to your EC2 instance now..."
monitor_deployment
if [ "deployment_status" == "
deployment_success" ]; then
echo "Your deployment to your EC2 instance has now completed successfully."
else
echo "Your deployment to your EC2 instance has failed:"
echo "$deployment_description"
exit 1
fi
return 0 }
monitor_deployment() { sleep 10 get_deployment_status
if [ "deployment_status" != "
deployment_failed" ] && [ "deployment_status" != "
deployment_success" ]; then
monitor_deployment
fi
}
get_deployment_status() {
deployment_description=(aws deploy get-deployment --deployment-id "
deployment_id")
deployment_status=(echo "
deployment_description" | jq -r '.deploymentInfo.status')
}
</details>
This docker image should be included in:
* https://gitlab.com/gitlab-org/gitlab/-/blob/master/lib/gitlab/ci/templates/Deploy-ECS.gitlab-ci.yml
* https://gitlab.com/gitlab-org/gitlab/-/blob/master/lib/gitlab/ci/templates/AWS/CF-Provision-and-Deploy-EC2.gitlab-ci.yml
Documentation should be added for the new docker image
### Permissions and Security
<!-- What permissions are required to perform the described actions? Are they consistent with the existing permissions as documented for users, groups, and projects as appropriate? Is the proposed behavior consistent between the UI, API, and other access methods (e.g. email replies)?-->
### Documentation
<!-- See the Feature Change Documentation Workflow https://docs.gitlab.com/ee/development/documentation/feature-change-workflow.html
* Add all known Documentation Requirements in this section. See https://docs.gitlab.com/ee/development/documentation/feature-change-workflow.html#documentation-requirements
* If this feature requires changing permissions, update the permissions document. See https://docs.gitlab.com/ee/user/permissions.html -->
### Availability & Testing
<!-- This section needs to be retained and filled in during the workflow planning breakdown phase of this feature proposal, if not earlier.
What risks does this change pose to our availability? How might it affect the quality of the product? What additional test coverage or changes to tests will be needed? Will it require cross-browser testing?
Please list the test areas (unit, integration and end-to-end) that needs to be added or updated to ensure that this feature will work as intended. Please use the list below as guidance.
* Unit test changes
* Integration test changes
* End-to-end test change
See the test engineering planning process and reach out to your counterpart Software Engineer in Test for assistance: https://about.gitlab.com/handbook/engineering/quality/test-engineering/#test-planning -->
### What does success look like, and how can we measure that?
<!-- Define both the success metrics and acceptance criteria. Note that success metrics indicate the desired business outcomes, while acceptance criteria indicate when the solution is working correctly. If there is no way to measure success, link to an issue that will implement a way to measure this. -->
### What is the type of buyer?
<!-- What is the buyer persona for this feature? See https://about.gitlab.com/handbook/marketing/product-marketing/roles-personas/buyer-persona/
In which enterprise tier should this feature go? See https://about.gitlab.com/handbook/product/pricing/#four-tiers -->
### Is this a cross-stage feature?
<!-- Communicate if this change will affect multiple Stage Groups or product areas. We recommend always start with the assumption that a feature request will have an impact into another Group. Loop in the most relevant PM and Product Designer from that Group to provide strategic support to help align the Group's broader plan and vision, as well as to avoid UX and technical debt. https://about.gitlab.com/handbook/product/#cross-stage-features -->
### Links / references
* https://docs.aws.amazon.com/cli/latest/reference/deploy/get-deployment.html
* https://docs.aws.amazon.com/cli/latest/reference/deploy/wait/deployment-successful.html
* https://docs.aws.amazon.com/cli/latest/reference/greengrass/get-deployment-status.html
<!-- triage-serverless v3 PLEASE DO NOT REMOVE THIS SECTION -->
*This page may contain information related to upcoming products, features and functionality.
It is important to note that the information presented is for informational purposes only, so please do not rely on the information for purchasing or planning purposes.
Just like with all projects, the items mentioned on the page are subject to change or delay, and the development, release, and timing of any products, features, or functionality remain at the sole discretion of GitLab Inc.*
<!-- triage-serverless v3 PLEASE DO NOT REMOVE THIS SECTION -->