Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support other env vars in CLI version #100

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,14 @@ The program is available as an [NPM Package](https://www.npmjs.com/package/beans
```npm install -g beanstalk-deploy``` and then you'll have the ```beanstalk-deploy``` command (without .js) available
everywhere.

Some additional environment variables are available to use functionality available in the GitHub Actions version:

```.bash
export INPUT_EXISTING_BUCKET_NAME=elasticbeanstalk-us-east-1-xxxxxxxxxxxx
export INPUT_WAIT_FOR_DEPLOYMENT=false
export INPUT_WAIT_FOR_ENVIRONMENT_RECOVERY=20 # Wait for 30 seconds for environment recovery
```

## Caveats

1. The S3 upload is a simple PUT request, we don't handle chunked upload. It has worked fine for files that are a
Expand Down
23 changes: 12 additions & 11 deletions beanstalk-deploy.js
Original file line number Diff line number Diff line change
Expand Up @@ -258,6 +258,18 @@ function main() {
waitForRecoverySeconds = 30,
waitUntilDeploymentIsFinished = true; //Whether or not to wait for the deployment to complete...

if (process.env.INPUT_EXISTING_BUCKET_NAME) {
existingBucketName = strip(process.env.INPUT_EXISTING_BUCKET_NAME);
}

if ((process.env.INPUT_WAIT_FOR_DEPLOYMENT || '').toLowerCase() == 'false') {
waitUntilDeploymentIsFinished = false;
}

if (process.env.INPUT_WAIT_FOR_ENVIRONMENT_RECOVERY) {
waitForRecoverySeconds = parseInt(process.env.INPUT_WAIT_FOR_ENVIRONMENT_RECOVERY);
}

if (IS_GITHUB_ACTION) { //Running in GitHub Actions
application = strip(process.env.INPUT_APPLICATION_NAME);
environmentName = strip(process.env.INPUT_ENVIRONMENT_NAME);
Expand All @@ -271,17 +283,6 @@ function main() {
awsApiRequest.sessionToken = strip(process.env.INPUT_AWS_SESSION_TOKEN);
awsApiRequest.region = strip(process.env.INPUT_REGION);

if (process.env.INPUT_EXISTING_BUCKET_NAME) {
existingBucketName = strip(process.env.INPUT_EXISTING_BUCKET_NAME);
}

if ((process.env.INPUT_WAIT_FOR_DEPLOYMENT || '').toLowerCase() == 'false') {
waitUntilDeploymentIsFinished = false;
}

if (process.env.INPUT_WAIT_FOR_ENVIRONMENT_RECOVERY) {
waitForRecoverySeconds = parseInt(process.env.INPUT_WAIT_FOR_ENVIRONMENT_RECOVERY);
}
useExistingVersionIfAvailable = process.env.INPUT_USE_EXISTING_VERSION_IF_AVAILABLE == 'true' || process.env.INPUT_USE_EXISTING_VERSION_IF_AVAILABLE == 'True';

} else { //Running as command line script
Expand Down