diff --git a/deployment/scripts/codeship_aws_codedeploy_deploy b/deployment/scripts/codeship_aws_codedeploy_deploy index 1f9a29b..6cd3a9d 100755 --- a/deployment/scripts/codeship_aws_codedeploy_deploy +++ b/deployment/scripts/codeship_aws_codedeploy_deploy @@ -3,11 +3,14 @@ set -e set -o pipefail +# This script also uses an environment variable called CODEDEPLOY_CLI_INPUT_JSON which when supplied, it +# will be passed into the --cli-input-json argument for 'aws deploy create-deployment' APPLICATION_FOLDER=${1:?'You need to provide the directory with your code as the second parameter'} APPLICATION_NAME=${2:?'You need to provide the CodeDeploy application name'} DEPLOYMENT_GROUP_NAME=${3:?'You need to provide the Deployment Group name'} S3_BUCKET=${4:?'You need to provide the S3 Bucket to upload the artefact to'} DEPLOYMENT_CONFIG_NAME=$5 +CODEDEPLOY_CLI_INPUT_JSON=${6:? 'You need to provide the JSON file for custom overrides'} source utils S3_BUCKET_SUBFOLDER_PATH=$(s3_bucket_subfolder_path $S3_BUCKET) @@ -38,6 +41,10 @@ if [ ! -z "$DEPLOYMENT_CONFIG_NAME" ]; then deployment+=("--deployment-config-name" "$DEPLOYMENT_CONFIG_NAME") fi +if [ ! -z "$CODEDEPLOY_CLI_INPUT_JSON" ]; then + deployment+=("--cli-input-json" "$CODEDEPLOY_CLI_INPUT_JSON") +fi + echo "Deployment Command: ${deployment[@]}" deployment_id=$(aws deploy create-deployment "${deployment[@]}" | jq -r .deploymentId) diff --git a/deployment/scripts/custom_config.json b/deployment/scripts/custom_config.json new file mode 100644 index 0000000..ac18d37 --- /dev/null +++ b/deployment/scripts/custom_config.json @@ -0,0 +1,10 @@ +{ +"autoRollbackConfiguration": { + "enabled": true, + "events": [ + "DEPLOYMENT_FAILURE" + ] + }, + "updateOutdatedInstancesOnly": true, + "fileExistsBehavior": "OVERWRITE" +} \ No newline at end of file