Skip to content

Conversation

72636c
Copy link
Contributor

@72636c 72636c commented Jan 24, 2021

Proposed changes

BeforeAllowTrafficHooks and AfterAllowTrafficHooks require access to report their status back to CodeDeploy. It's tedious and brittle to manually add these to iamRoleStatements as they rely on CloudFormation logical IDs generated by the plugin itself.

This detects which functions have a hook defined and appends permissions to report on their corresponding deployment groups.

Resolves #93.

Types of changes

What types of changes does your code introduce to the plugin?

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)

Checklist

  • Lint and unit tests pass locally with my changes
  • I have added tests that prove my fix is effective or that my feature works
  • I have added necessary documentation (if appropriate)

`BeforeAllowTrafficHook`s and `AfterAllowTrafficHook`s require access to
report their status back to CodeDeploy. It's tedious and brittle to
manually add these to `iamRoleStatements` as they rely on CloudFormation
logical IDs generated by the plugin itself.

This detects which functions have a hook defined and appends permissions
to report on their corresponding deployment groups.

Resolves davidgf#93.
@72636c
Copy link
Contributor Author

72636c commented Jan 31, 2021

Hiya @davidgf, reckon you'll have a moment to look this over?

@davidgf
Copy link
Owner

davidgf commented Feb 5, 2021

Hey @72636c, first of all, I'm very sorry for the late reply, unfortunately for professional reasons I cannot pay all the attention I'd like to to this project. Also, thank you very much for your contribution. It looks pretty good in general, but there's something I'd like you to change if you could. Basically, all the functions under lib/CfTemplateGenerators/ don't have any side effect by design, but simply generate a piece of a CloudFormation template and return it. The service's CF template is only explicitly modified in the Object.assign() statement on the addCanaryDeploymentResources function. However, in your PR, the CF generator takes the full CF template as a parameter and directly modifies it within the scope of that function. Could you modify it so it aligns with the aforementioned approach? Thanks!

@72636c
Copy link
Contributor Author

72636c commented Feb 6, 2021

@davidgf no stress, thanks for the review!

Good call, I was tiptoeing around that since we're extending a fairly chunky Serverless-generated resource. I've gone with a dirty _.cloneDeep in ed78f3b; let me know if you have any better ideas.

@davidgf davidgf merged commit e22ab1c into davidgf:master Feb 6, 2021
@davidgf
Copy link
Owner

davidgf commented Feb 6, 2021

It looks good to me, thanks a lot for your contribution!

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.

Hook functions don't have permission to set deployment status
2 participants