#!/bin/bash -eo pipefail
ID=$(aws deploy create-deployment \
--application-name APP_NAME \
--deployment-group-name DG_NAME \
--deployment-config-name CodeDeployDefault.OneAtATime \
--s3-location bucket=S3_BUCKET,bundleType=zip,key=codedeploy/deployment.zip \
--output text \
--query '[deploymentId]')
STATUS=$(aws deploy get-deployment \
--deployment-id $ID \
--output text \
--query '[deploymentInfo.status]')
while [[ $STATUS == "Created" || $STATUS == "InProgress" || $STATUS == "Pending" || $STATUS == "Queued" || $STATUS == "Ready" ]]; do
echo "Status: $STATUS..."
STATUS=$(aws deploy get-deployment \
--deployment-id $ID \
--output text \
--query '[deploymentInfo.status]')
sleep 5
done
if [[ $STATUS == "Succeeded" ]]; then
EXITCODE=0
echo "Deployment finished."
else
EXITCODE=1
echo "Deployment failed!"
fi
aws deploy get-deployment --deployment-id $ID
exit $EXITCODE
Status: InProgress...
Status: InProgress...
Status: InProgress...
Status: InProgress...
Status: InProgress...
Status: InProgress...
Status: InProgress...
Status: InProgress...
Status: InProgress...
Status: InProgress...
Status: InProgress...
Status: InProgress...
Status: InProgress...
Status: InProgress...
Status: InProgress...
Status: InProgress...
Status: InProgress...
Status: InProgress...
Deployment finished.
WARNING: terminal is not fully functional
�{ress RETURN)
"deploymentInfo": {
"applicationName": "APP_NAME",
"deploymentGroupName": "DG_NAME",
"deploymentConfigName": "CodeDeployDefault.OneAtATime",
"deploymentId": "DeploymentID",
"revision": {
"revisionType": "S3",
"s3Location": {
"bucket": "S3_BUCKET",
"key": "codedeploy/deployment.zip",
"bundleType": "zip"
}
},
"status": "Succeeded",
"createTime": "2020-05-12T06:27:54.543000+00:00",
"completeTime": "2020-05-12T06:29:38.413000+00:00",
"deploymentOverview": {
"Pending": 0,
"InProgress": 0,
"Succeeded": 1,
"Failed": 0,
"Skipped": 0,
:�
Too long with no output (exceeded 10m0s): context deadline exceeded
version: 2.1
orbs:
aws-cli: circleci/aws-cli@1
aws-code-deploy: circleci/aws-code-deploy@1
executors:
alpine:
docker:
- image: alpine:latest
jobs:
checkout_code:
executor: alpine
steps:
- checkout
- persist_to_workspace:
root: ~/project
paths:
- .
deploy_to_staging:
executor: aws-cli/default
steps:
- attach_workspace:
at: ~/project
- aws-cli/setup:
aws-access-key-id: STAGING_AWS_ACCESS_KEY_ID
aws-secret-access-key: STAGING_AWS_SECRET_ACCESS_KEY
aws-region: STAGING_AWS_DEFAULT_REGION
- aws-code-deploy/push-bundle:
application-name: APP_NAME
bundle-bucket: S3_BUCKET
bundle-key: codedeploy/deployment
- aws-code-deploy/deploy-bundle:
application-name: APP_NAME
deployment-group: DG_NAME
bundle-bucket: S3_BUCKET
bundle-key: codedeploy/deployment
workflows:
version: 2
build_test_deploy:
jobs:
- checkout_code
- deploy_to_staging:
requires:
- checkout_code
filters:
branches:
only: master
No client-side pager is used while deploying.
Environment variable AWS_PAGER set to empty string in ORB.
...
executor: aws-cli/default
steps:
- run:
name: Setup Environment Variables
# https://docs.aws.amazon.com/cli/latest/userguide/cli-usage-pagination.html#cli-usage-pagination-clientside
command: |
echo "export AWS_PAGER=" >> $BASH_ENV
- attach_workspace:
at: ~/project
- aws-cli/setup:
...