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

feat: Add multiple invalidations based on stages #19

Merged
merged 2 commits into from
Jan 18, 2021

Conversation

AllegraChen
Copy link
Contributor

@AllegraChen AllegraChen commented Oct 29, 2020

Before this PR, cloudfrontInvalidation was a single object under the custom section of serverless.yml file. There was no possible way to create invalidations for multiple CloudFront distributions. Therefore, the cloudfrontInvalidation object is turned into a list that can contain multiple distributions. The index.js file is modified to realize this feature. The function body in invalidate() is moved into ...cloudfrontInvalidation.forEach(). This feature is also mentioned in issue #8.

Besides, an option of create invalidations based on deployment stages was also not available. Hence, an optional stage property is added for each distribution element. An if statement that checks for stage property declaration and its matching with the provider's stage is added into invalidate() in index.js file.

The Setup example of cloudfrontInvalidation as a list and the Setup example of using the stage property of the elements of cloudfrontInvalidation is added to README.md file.

Allegra Chen added 2 commits October 29, 2020 14:31
Before this commit, `cloudfrontInvalidation` was a single object under the
`custom` section of serverless.yml file. There was no possible way to create
invalidations for multiple CloudFront distributions. Therefore, the
`cloudfrontInvalidation` object is turned into a list that can contain
multiple distributions. index.js file is modified to realize this feature.
The function body in `invalidate()` is moved into
`...cloudfrontInvalidation.forEach()`

Besides, an option of create invalidations based on deployment stages
was also not available. Hence, an optional `stage` property is added for
each distribution element. An if statement that checks for `stage` property
declaration and its matching with the provider's stage is added into
`invalidate()` in index.js file.

The Setup example of `cloudfrontInvalidation` as a list and the Setup
example of using the `stage` property of the elements of
`cloudfrontInvalidation` is added to README.md file.

Modified files:
    - index.js
    - README.md
@AllegraChen
Copy link
Contributor Author

Hi @aghadiry, could you take a look at this pull request?

@aghadiry aghadiry merged commit f573ba8 into aghadiry:master Jan 18, 2021
@coyoteecd
Copy link

@aghadiry @AllegraChen next time please mention this kind of changes as BREAKING (so release a major, not a minor). I updated from 1.5 to 1.8 and builds started to fail due to the plugin assuming the config is an array.

mihaerzen pushed a commit to mihaerzen/serverless-cloudfront-invalidate that referenced this pull request Aug 24, 2021
as it was broken with aghadiry#19
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