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

Resolve bucket name dynamicly #3

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open

Conversation

jettary
Copy link

@jettary jettary commented Dec 8, 2022

Request Serverless Deployment Bucket Name created during previous deploys. No needs to know exact deployment buckeet.

@jettary
Copy link
Author

jettary commented Dec 16, 2022

@coyoteecd or @f00f any feedback?

@f00f
Copy link
Contributor

f00f commented Dec 19, 2022

Hi @jettary

I'm flattered by your choosing me as reviewer ;-)
I had a quick look at the code - LGTM. But I'm not maintainer or otherwise affiliated with this plugin, esp. w/ regards to usefulness of this feature, whether it's considered a breaking change, etc.

@@ -45,6 +45,9 @@ custom:
# (optional) Buckets to remove before a stack is deployed.
bucketsToCleanOnDeploy:
- oldBucketName

# (optional) Get deployment bucket name from AWS. Works only for `sls s3remove` and `sls remove`
autoResolve: false
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The plugin is not meant to clean just the Serverless deployment buckets, think of stacks that create additional S3 buckets for other purposes, such as web apps. I think autoResolve in this context is a bit too open-ended, so I'd suggest a more targeted name. E.g. cleanDeploymentBucket, includeDeploymentBucket, or something similar?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@f00f sorry for mentioning ) just because you are appears in "maintainers"

@coyoteecd good point. For renaming option.

@@ -67,6 +68,10 @@ export default class ServerlessS3Cleaner implements Plugin {
const config = this.loadConfig();
let bucketsToEmpty = isDeploying ? config.bucketsToCleanOnDeploy : config.buckets;

if (!isDeploying && config.autoResolve) {
bucketsToEmpty.push(await this.provider.getServerlessDeploymentBucketName());
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this work properly with an explicit bucket name as well as a generated (default) bucket name?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In my mind logic is to delete deployment bucket only on remove operation according with the rest of listed buckets

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jettary in Serverless Framework you can either let the framework auto-generate the deployment bucket itself, or you can specify an externally managed bucket (see here). Does getServerlessDeploymentBucketName resolve properly in that case?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants