Skip to content

Commit 598d2cf

Browse files
authored
Feature: Handle CodeDeploy file exists behaviour (#95)
* feature: handle codedeploy file exists behaviour * fix: amend readme formatting * fix: remediate yaml format change * chore: actioned review comments for @iBotPeaches
1 parent c339442 commit 598d2cf

File tree

3 files changed

+24
-18
lines changed

3 files changed

+24
-18
lines changed

README.md

+19-18
Original file line numberDiff line numberDiff line change
@@ -62,23 +62,24 @@ permissions:
6262
6363
Following inputs can be used as `step.with` keys
6464

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

8384
### outputs
8485

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

164165
* These permissions are a rough example of allowing the user to list/get/register a revision for all resources
165-
* A specific permission statement exists to lock creating the deployment to a specific resource
166+
* A specific permission statement exists to lock creating the deployment to a specific resource

action.yaml

+4
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,10 @@ inputs:
4747
description: 'Whether to register the deployment (vs automatic deploy).'
4848
required: false
4949
default: 'false'
50+
codedeploy_file_exists_behavior:
51+
description: 'What to do if the file already exists in the deployment location. Possible options are DISSALOW|OVERWRITE|RETAIN'
52+
required: false
53+
default: 'DISALLOW'
5054
max_polling_iterations:
5155
description: 'Max amount of iterations (15s increments) to wait for a deployment'
5256
required: false

deploy.sh

+1
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ function deployRevision() {
2020
--application-name "$INPUT_CODEDEPLOY_NAME" \
2121
--deployment-group-name "$INPUT_CODEDEPLOY_GROUP" \
2222
--description "$GITHUB_REF - $GITHUB_SHA" \
23+
--file-exists-behavior "$INPUT_CODEDEPLOY_FILE_EXISTS_BEHAVIOR" \
2324
--s3-location bucket="$INPUT_S3_BUCKET",bundleType="$BUNDLE_TYPE",eTag="$ZIP_ETAG",key="$INPUT_S3_FOLDER"/"$ZIP_FILENAME" | jq -r '.deploymentId'
2425
}
2526

0 commit comments

Comments
 (0)