sourcetoad / aws-codedeploy-action

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

add optional codedeploy_config_name #75

Closed bennettp123 closed 1 year ago

bennettp123 commented 1 year ago

By default, CodeDeploy uses the deployment config attached to the deployment group, and if that's not set, it uses CodeDeployDefault.OneAtATime.

However, there may be some cases where you need to temporarily override the deployment config—for example, during the initial deployment of an application, it's probably best to use CodeDeployDefault.AllAtOnce. This PR allows the deployment config to be overridden

Split from #73

iBotPeaches commented 1 year ago

Okay I lied - just linter remaining, then good to go.

bennettp123 commented 1 year ago

Okay I lied - just linter remaining, then good to go.

Haha no worries!

For the linter, I'm thinking of updating it to use shell parameter expansion ("$@") to pass the extra args—it should keep the linter happy, but more importantly, it won't allow globbing or word splitting of $INPUT_CODEDEPLOY_CONFIG_NAME.

eg

function deployRevision() {    
    aws deploy create-deployment "$@" \
        --application-name "$INPUT_CODEDEPLOY_NAME" \
        --deployment-group-name "$INPUT_CODEDEPLOY_GROUP" \
        --description "$GITHUB_REF - $GITHUB_SHA" \
        --s3-location bucket="$INPUT_S3_BUCKET",bundleType=zip,eTag="$ZIP_ETAG",key="$INPUT_S3_FOLDER"/"$ZIP_FILENAME" | jq -r '.deploymentId'
}

# ...

if [ -n "$INPUT_CODEDEPLOY_CONFIG_NAME" ]; then
    deployRevision --deployment-config-name "$INPUT_CODEDEPLOY_CONFIG_NAME"
else
    deployRevision
fi