iTranslated by AI

The content below is an AI-generated translation. This is an experimental feature, and may contain errors. View original article
🚢

eb deploy has a --nohang option

に公開

The eb deploy command available in the Elastic Beanstalk CLI has a --nohang option. For some reason, this option is currently not listed in the documentation, but it is documented in the help output.

$ eb --version
EB CLI 3.20.2 (Python 3.7.2)

$ eb deploy --help
usage: eb deploy <environment_name> [options ...]

Deploys your source code to the environment.

positional arguments:
  environment_name      environment name

optional arguments:
  -h, --help            show this help message and exit
  --debug               toggle debug output
  --quiet               suppress all output
  -v, --verbose         toggle verbose output
  --profile PROFILE     use a specific profile from your credential file
  -r REGION, --region REGION
                        use a specific region
  --no-verify-ssl       don't verify AWS SSL certificates
  --modules [MODULES [MODULES ...]]
                        modules to deploy
  -g ENV_GROUP_SUFFIX, --env-group-suffix ENV_GROUP_SUFFIX
                        group suffix
  --version VERSION     existing version label to deploy
  -l LABEL, --label LABEL
                        label name which version will be given
  -m MESSAGE, --message MESSAGE
                        description for version
  -nh, --nohang         return immediately, do not wait for deploy to be
                        completed
  --staged              deploy files staged in git rather than the HEAD commit
  --timeout TIMEOUT     timeout period in minutes
  --source SOURCE       source of code to deploy directly; example
                        source_location/repo/branch
  -p, --process         enable preprocessing of the application version

If you execute it without specifying the --nohang option, you will end up waiting until the deployment is complete or times out, unless you exit with Ctrl+C.

$ eb deploy environment_name -l label
WARNING: Deploying a previously deployed commit.
2022-01-25 08:54:10    INFO    Environment update is starting.
2022-01-25 08:54:16    INFO    Deploying new version to instance(s).
-- Events -- (safe to Ctrl+C) Use "eb abort" to cancel the command.

On the other hand, if you execute it with the --nohang option, it immediately returns to the command prompt. Although you will need to check separately whether the deployment was successful, it is useful for running deployments in CI/CD.

$ eb deploy environment_name -l label --nohang

Discussion