Skip to content

Commit aa60a5e

Browse files
authored
v5.0.0 (#7)
* add send_command input * add client-ssm * add SSMClient * add sendCommand * add send_command to tests * Update dist file * add deps * add inputs/outputs to readme * update action table * update README * update README * update README * update action.yml * update readme.ts * update send_command description * update README * add waitForCommand * update deps * update inputs * use snake_case for inputs * update inputs * update inputs * fix conditionals * refactor getEnvironments * refactor updateListenerRules * refactor updateListenerRules * update readme * update command status logging * filter empty envs * use vitest * add ansi-styles * delete jest.config.js * update tsconfig.json * remove dotenv * update setDescribeEventsInterval params * use esm import * rename main.blue_green.test.ts * import fs * refactor inputs.test.ts * add TestAlbStack * rename shared_alb.test.ts * update deps * update TestAlbStack * fix shared_alb test * update shared_alb test * update getCnamePrefix * update tsconfig * update tsconfig * Update dist file * set default DisableIMDSv1 to true in order to use launch template * Update dist file * use named exports * Update dist file * update deps * update shared_alb test * refactor: simplify environment checks and error handling in updateListenerRules * docs: clarify descriptions for CNAME inputs and update_listener_rules in action.yml * update readme * update .env.example * update .gitignore * mv main.blue_green test * Update dist file * update version --------- Co-authored-by: tmshkr <[email protected]>
1 parent 085e62b commit aa60a5e

36 files changed

+166500
-208086
lines changed

.env.example

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,19 +9,24 @@ INPUT_DEPLOY="true"
99
INPUT_DISABLE_TERMINATION_PROTECTION="false"
1010
INPUT_ENABLE_TERMINATION_PROTECTION="false"
1111
INPUT_GREEN_ENV="my-green-env"
12+
INPUT_MINIMUM_HEALTH_COLOR="Green"
1213
INPUT_OPTION_SETTINGS=
1314
INPUT_PLATFORM_BRANCH_NAME="Docker running on 64bit Amazon Linux 2023"
14-
INPUT_PRODUCTION_CNAME="my-production-cname"
15-
INPUT_PROMOTE="true"
16-
INPUT_SOURCE_BUNDLE=
15+
INPUT_PRODUCTION_CNAME="my-prod-cname"
16+
INPUT_SEND_COMMAND="echo 'it works!' >>test.txt"
17+
# INPUT_SINGLE_ENV_CNAME="single-env-cname"
18+
# INPUT_SINGLE_ENV="my-env"
19+
INPUT_SOURCE_BUNDLE="test/bundle.zip"
1720
INPUT_STAGING_CNAME="my-staging-cname"
21+
INPUT_SWAP_CNAMES="false"
1822
INPUT_TEMPLATE_NAME=
19-
INPUT_TERMINATE_UNHEALTHY_ENVIRONMENT="true"
23+
INPUT_TERMINATE_UNHEALTHY_ENVIRONMENT="false"
2024
INPUT_UPDATE_ENVIRONMENT="true"
2125
INPUT_UPDATE_LISTENER_RULES="false"
26+
INPUT_USE_DEFAULT_OPTION_SETTINGS="true"
2227
INPUT_VERSION_DESCRIPTION=
23-
INPUT_VERSION_LABEL=
28+
INPUT_VERSION_LABEL="test-version"
29+
INPUT_WAIT_FOR_COMMAND="true"
2430
INPUT_WAIT_FOR_DEPLOYMENT="true"
2531
INPUT_WAIT_FOR_ENVIRONMENT="true"
2632
INPUT_WAIT_FOR_TERMINATION="true"
27-
INPUT_USE_DEFAULT_OPTION_SETTINGS="true"

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,4 +136,5 @@ build
136136
!.elasticbeanstalk/*.global.yml
137137

138138
bundle*
139-
.DS_Store
139+
.DS_Store
140+
cdk.out

README.md

Lines changed: 73 additions & 18 deletions
Large diffs are not rendered by default.

action.yml

Lines changed: 28 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ inputs:
1414
description: "AWS session token for using temporary credentials. May instead be specified via the AWS_SESSION_TOKEN environment variable."
1515
blue_env:
1616
description: "Name of the blue environment."
17-
required: true
17+
needs: [green_env, production_cname, staging_cname]
1818
create_environment:
1919
description: "Whether to create a new environment during deployment if the target environment doesn't exist."
2020
default: "true"
@@ -29,7 +29,7 @@ inputs:
2929
default: "false"
3030
green_env:
3131
description: "Name of the green environment."
32-
required: true
32+
needs: [blue_env, production_cname, staging_cname]
3333
minimum_health_color:
3434
description: "Minimum health color (Green, Yellow, Red, or Grey) required for the target environment to be considered healthy."
3535
default: "Green"
@@ -38,26 +38,43 @@ inputs:
3838
platform_branch_name:
3939
description: "Name of the platform branch to use. When creating a new environment, it will be launched with the latest version of the specified platform branch. To see the list of available platform branches, run the `aws elasticbeanstalk list-platform-branches` command."
4040
production_cname:
41-
description: "CNAME prefix for the domain that serves production traffic."
42-
required: true
41+
description: "CNAME prefix for the domain that serves production traffic when performing a blue/green deployment."
42+
needs: [blue_env, green_env, staging_cname]
43+
send_command:
44+
description: "Command to send to the target environment after (optional) deployment. Specify a shell script or series of commands to run. Useful for running tasks related to deployment, such as swapping environment variables before promoting an environment to production."
45+
single_env:
46+
description: "Name of a single environment to deploy. If specified, the blue/green environments and production/staging CNAMEs must not be provided."
47+
needs: [single_env_cname]
48+
single_env_cname:
49+
description: "CNAME prefix to use for a single-environment deployment."
50+
needs: [single_env]
4351
source_bundle:
4452
description: "Path to the source bundle to deploy. If not specified, the sample application will be used."
4553
staging_cname:
46-
description: "CNAME prefix for the staging environment."
47-
required: true
54+
description: "CNAME prefix of the staging environment for a blue/green deployment."
55+
needs: [blue_env, green_env, production_cname]
4856
swap_cnames:
4957
description: "Whether to swap the CNAMEs of the blue and green environments."
5058
default: "false"
5159
template_name:
5260
description: "Name of an Elastic Beanstalk configuration template to use when creating a new environment."
5361
terminate_unhealthy_environment:
5462
description: "Whether to terminate an unhealthy target environment. If set to false, the action will fail if the target environment is unhealthy."
55-
default: "true"
63+
default: "false"
5664
update_environment:
5765
description: "Whether to update an existing environment during deployment."
5866
default: "true"
5967
update_listener_rules:
60-
description: "When set to true, the action will update any elbv2 listener rules on the environments' SharedLoadBalancer tagged with a `bluegreenbeanstalk:target_cname` key, whose value is equal to the staging or production CNAME prefix, so that it forwards to the corresponding target group. The action will also remove any target group from the listener before terminating the environment. The port of the process may be specified by another tag with the key `bluegreenbeanstalk:target_port` whose value is the port number. If no such tag is found, the default port of 80 will be used."
68+
description: |
69+
When set to true, the action will update any elbv2 listener rules on the environments' SharedLoadBalancer tagged with a `bluegreenbeanstalk:target_cname` key, whose value is equal to an environment's CNAME prefix, so that it forwards to the corresponding target group.
70+
71+
For example, you can tag a listener rule that matches the host `my-domain.com` with a tag containing `bluegreenbeanstalk:target_cname` as its key and `my-prod-cname` as its value, and the action will update the listener rule to point to the same target group as the environment with the CNAME `my-prod-cname`.
72+
73+
The listener rules are updated after the CNAMEs are swapped, so this keeps the listener rules in sync with the CNAMEs.
74+
75+
The port of the process may be specified by another tag with the key `bluegreenbeanstalk:target_port` whose value is the port number. If no such tag is found, the default port of 80 will be used.
76+
77+
If you'd only like to update the listener rules for a certain CNAME, you can set this input to the CNAME prefix you'd like to update.
6178
default: "false"
6279
use_default_option_settings:
6380
description: "Whether to use default option settings when creating a new environment."
@@ -66,6 +83,9 @@ inputs:
6683
description: "Description to use for the new application version."
6784
version_label:
6885
description: "Version label to use for the new application version."
86+
wait_for_command:
87+
description: "Whether to wait for the send_command execution to complete."
88+
default: "true"
6989
wait_for_deployment:
7090
description: "Whether to wait for the deployment to complete."
7191
default: "true"

0 commit comments

Comments
 (0)