Skip to content

Commit

Permalink
Feature: Handle CodeDeploy file exists behaviour (#95)
Browse files Browse the repository at this point in the history
* feature: handle codedeploy file exists behaviour

* fix: amend readme formatting

* fix: remediate yaml format change

* chore: actioned review comments for @iBotPeaches
  • Loading branch information
ardens-jw authored Mar 7, 2024
1 parent c339442 commit 598d2cf
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 18 deletions.
37 changes: 19 additions & 18 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,23 +62,24 @@ permissions:
Following inputs can be used as `step.with` keys

| Name | Required | Type | Description |
|----------------------------|----------|---------|-----------------------------------------------------------------|
| `aws_access_key` | No | String | IAM Access Key. |
| `aws_secret_key` | No | String | IAM Secret Key. |
| `aws_region` | No | String | AWS Region (default: `us-east-1`). |
| `codedeploy_name` | Yes | String | CodeDeploy Project Name. |
| `codedeploy_group` | Yes | String | CodeDeploy Project Group. |
| `codedeploy_config_name` | No | String | If provided, override the default CodeDeploy Configuration name |
| `codedeploy_register_only` | No | Boolean | If true, revision is registered not deployed. |
| `s3_bucket` | Yes | String | S3 Bucket for archive to be uploaded. |
| `s3_folder` | Yes | String | S3 Folder for archive to be uploaded within bucket. |
| `excluded_files` | No | String | Space delimited list of patterns to exclude from archive |
| `directory` | No | String | Directory to archive. Defaults to root of project. |
| `custom_zip_flags` | No | String | Flags to pass to `zip` command. (ie `zip "$FLAGS" ...`) |
| `archive` | No | String | Zip to deploy. Defaults to empty (thus ignored) |
| `max_polling_iterations` | No | Number | Number of 15s iterations to poll max. (default: `60`) |
| `dry_run` | No | Boolean | If true, no connection to AWS is made. Just local zip creation. |
| Name | Required | Type | Description |
|-----------------------------------|----------|---------|-------------------------------------------------------------------|
| `aws_access_key` | No | String | IAM Access Key. |
| `aws_secret_key` | No | String | IAM Secret Key. |
| `aws_region` | No | String | AWS Region (default: `us-east-1`). |
| `codedeploy_name` | Yes | String | CodeDeploy Project Name. |
| `codedeploy_group` | Yes | String | CodeDeploy Project Group. |
| `codedeploy_config_name` | No | String | If provided, override the default CodeDeploy Configuration name |
| `codedeploy_register_only` | No | Boolean | If true, revision is registered not deployed. |
| `codedeploy_file_exists_behavior` | No | String | If provided, override the default CodeDeploy File Exists Behavior |
| `s3_bucket` | Yes | String | S3 Bucket for archive to be uploaded. |
| `s3_folder` | Yes | String | S3 Folder for archive to be uploaded within bucket. |
| `excluded_files` | No | String | Space delimited list of patterns to exclude from archive |
| `directory` | No | String | Directory to archive. Defaults to root of project. |
| `custom_zip_flags` | No | String | Flags to pass to `zip` command. (ie `zip "$FLAGS" ...`) |
| `archive` | No | String | Zip to deploy. Defaults to empty (thus ignored) |
| `max_polling_iterations` | No | Number | Number of 15s iterations to poll max. (default: `60`) |
| `dry_run` | No | Boolean | If true, no connection to AWS is made. Just local zip creation. |

### outputs

Expand Down Expand Up @@ -162,4 +163,4 @@ For deploying via CodeDeploy you will need another set of permissions.
```

* These permissions are a rough example of allowing the user to list/get/register a revision for all resources
* A specific permission statement exists to lock creating the deployment to a specific resource
* A specific permission statement exists to lock creating the deployment to a specific resource
4 changes: 4 additions & 0 deletions action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,10 @@ inputs:
description: 'Whether to register the deployment (vs automatic deploy).'
required: false
default: 'false'
codedeploy_file_exists_behavior:
description: 'What to do if the file already exists in the deployment location. Possible options are DISSALOW|OVERWRITE|RETAIN'
required: false
default: 'DISALLOW'
max_polling_iterations:
description: 'Max amount of iterations (15s increments) to wait for a deployment'
required: false
Expand Down
1 change: 1 addition & 0 deletions deploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ function deployRevision() {
--application-name "$INPUT_CODEDEPLOY_NAME" \
--deployment-group-name "$INPUT_CODEDEPLOY_GROUP" \
--description "$GITHUB_REF - $GITHUB_SHA" \
--file-exists-behavior "$INPUT_CODEDEPLOY_FILE_EXISTS_BEHAVIOR" \
--s3-location bucket="$INPUT_S3_BUCKET",bundleType="$BUNDLE_TYPE",eTag="$ZIP_ETAG",key="$INPUT_S3_FOLDER"/"$ZIP_FILENAME" | jq -r '.deploymentId'
}

Expand Down

0 comments on commit 598d2cf

Please sign in to comment.