Skip to content

Add the versionFunctions provider flag that will reduce the default number of stack outputs - #3042

Merged
eahefnawy merged 2 commits into
serverless:masterfrom
ryansb:optionalVersioning
Jan 20, 2017
Merged

eahefnawy merged 2 commits into
serverless:masterfrom
ryansb:optionalVersioning

Conversation

@ryansb

@ryansb ryansb commented Jan 2, 2017 •

Copy link
Copy Markdown
Contributor

What did you implement:

Per #2853, having versions as resources/outputs can trigger some limits
related to CloudFormation stack outputs. This will (by default) reduce
the number of outputs by N, where N is the number of functions total.

How did you implement it:

Added an option --versionFunctions so that version resources aren't autocreated. This will also save code storage space as a side effect.

How can we verify it:

  1. Run serverless deploy --noDeploy on any project
  2. Look at the generated project-stack-update.json and note the AWS::Lambda::Version resources created
  3. Add versionFunctions: false to the AWS provider in serverless.yml
  4. Run serverless deploy --noDeploy on the same project
  5. Note lack of same ::Version objects.

Todos:

  • Write tests
  • Write documentation
  • Fix linting errors
  • Make sure code coverage hasn't dropped
  • Provide verification config/commands/resources
  • Enable "Allow edits from maintainers" for this PR
  • Change ready for review message below

Is this ready for review?: YES
Is it a breaking change?: NO

@pmuens pmuens left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@ryansb thanks for the PR! 👍

As discusses earlier it would be great if this property can live in the serverless.yml file.

Something like:

provider:
  versionFunctions: false

Here's a comment from @nicka about the config property...

When we do it the serverless.yml way (with the default option to true) we don’t have to worry about it being a breaking change. For me personally, I’ not being a big fan of it being enabled by default.

Suggestion: Within a newer version of serverless we could mention (in the cli logs) that the property will default to false within the next release.

Any additional thoughts @eahefnawy @nikgraf @mthenw

@nikgraf

nikgraf commented Jan 3, 2017

Copy link
Copy Markdown
Contributor

I agree with the provider setting and having it on by default for now to avoid a breaking change.

I'm not sure if it should be on or deactivated by default long term. I personally thought on by default makes the most sense and that's why we initially merged it. It provides more insights when investigating error logs.

@nicka why would you prefer it to be off by default?

@nicka

nicka commented Jan 3, 2017

Copy link
Copy Markdown
Contributor

@nikgraf for me they don't add that much value, they bring issues by taking up the global Lambda functions storage (which you need to manually clean up), they take up CloudFormation resources and make deployments slower.

@ryansb
ryansb force-pushed the optionalVersioning branch from 2b061b9 to 12477eb Compare January 5, 2017 16:20
@ryansb ryansb changed the title Add the --versionFunctions CLI flag that will reduce the default nu… Add the versionFunctions provider flag that will reduce the default nu… Jan 5, 2017
@ryansb

ryansb commented Jan 5, 2017 •

Copy link
Copy Markdown
Contributor Author

@nicka and @nikgraf I've updated it to retain the current default, and to be a provider option instead of a CLI flag.

… default number of stack outputs.

Per serverless#2853, having versions as resources/outputs can trigger some limits
related to CloudFormation stack outputs. This leaves the existing
default, but if turned to `false` will reduce the number of outputs by
N, where N is the number of functions total.
@ryansb
ryansb force-pushed the optionalVersioning branch from 12477eb to d4a1aaf Compare January 5, 2017 16:23
@nicka

nicka commented Jan 5, 2017

Copy link
Copy Markdown
Contributor

@ryansb Perfect!!!

@pmuens pmuens left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@ryansb thanks for the updates 👍

I just reviewed it and it works as expected! I pushed some minor cleanups on top of your commit.

GTM from my side!

@pmuens pmuens modified the milestone: 1.6 Jan 18, 2017

@eahefnawy eahefnawy left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks @ryansb 😊 ... Works!

@eahefnawy
eahefnawy merged commit 1f7ee35 into serverless:master Jan 20, 2017
@pmuens pmuens changed the title Add the versionFunctions provider flag that will reduce the default nu… Add the versionFunctions provider flag that will reduce the default number of stack outputs Jan 27, 2017
@flux627

flux627 commented Feb 2, 2017

Copy link
Copy Markdown

Any way to disable this per stage?

@ryansb

ryansb commented Feb 7, 2017

Copy link
Copy Markdown
Contributor Author

Yes, you'd set the value to an option like: ${custom:${opt:stage}EnableVersions} and then in custom do:

custom:
  devEnableVersions: false
  prodEnableVersions: true

@flux627

flux627 commented Feb 7, 2017

Copy link
Copy Markdown

Fantastic- thank you!

@ryansb
ryansb deleted the optionalVersioning branch February 9, 2017 14:38
@rjtlinux

rjtlinux commented Jul 5, 2023

Copy link
Copy Markdown

How to achieve this using cloudformation?

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.

7 participants