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

Skip service role when all deploy prefs with no role are disabled #2187

Closed
wants to merge 1 commit into from
Closed

Skip service role when all deploy prefs with no role are disabled #2187

wants to merge 1 commit into from

Conversation

hawflau
Copy link
Contributor

@hawflau hawflau commented Oct 19, 2021

Issue #, if available:
#1496

Description of changes:
This PR modifies the translated templates output by sam-translator in order to make sure that no unnecessary CodeDeployServiceRole is created. If there is a deployment preference which has no role (but that's okay because it's disabled), then the role will not be created.

I went for the easiest win, which was changing the logic in can_skip_service_role. Do we feel like that is the best place? Alternatively, I think we could modify self._resource_preferences.values() so that disabled DeploymentPreferences are not present.

There are some broken unit tests on this branch but it looks like those are broken on develop too right now, so I don't believe that was introduced by this change.

Description of how you validated changes:
By running bin/translate-sam.py by hand, and by adding unit tests.

Checklist:

  • Add/update tests using:
  • make pr passes
  • Update documentation
  • Verify transformed template deploys and application functions as expected

Examples?

Please reach out in the comments, if you want to add an example. Examples will be
added to sam init through https://github.com/awslabs/aws-sam-cli-app-templates/

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@codecov-commenter
Copy link

codecov-commenter commented Oct 19, 2021

Codecov Report

Merging #2187 (996c307) into develop (cb8e179) will increase coverage by 0.29%.
The diff coverage is n/a.

Impacted file tree graph

@@             Coverage Diff             @@
##           develop    #2187      +/-   ##
===========================================
+ Coverage    94.08%   94.38%   +0.29%     
===========================================
  Files           86       95       +9     
  Lines         5413     6534    +1121     
  Branches      1082     1317     +235     
===========================================
+ Hits          5093     6167    +1074     
- Misses         148      170      +22     
- Partials       172      197      +25     
Impacted Files Coverage Δ
...el/preferences/deployment_preference_collection.py 93.20% <ø> (+1.84%) ⬆️
samtranslator/region_configuration.py 77.77% <0.00%> (-22.23%) ⬇️
samtranslator/sdk/resource.py 90.00% <0.00%> (-10.00%) ⬇️
samtranslator/validator/validator.py 90.56% <0.00%> (-5.09%) ⬇️
samtranslator/plugins/api/implicit_api_plugin.py 94.08% <0.00%> (-4.17%) ⬇️
samtranslator/model/s3_utils/uri_parser.py 69.23% <0.00%> (-2.20%) ⬇️
samtranslator/translator/translator.py 97.26% <0.00%> (-1.17%) ⬇️
samtranslator/model/sam_resources.py 92.35% <0.00%> (-1.01%) ⬇️
...lator/plugins/application/serverless_app_plugin.py 82.73% <0.00%> (-0.82%) ⬇️
samtranslator/model/__init__.py 97.64% <0.00%> (-0.51%) ⬇️
... and 42 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update cb8e179...996c307. Read the comment docs.

AutoPublishAlias: live
DeploymentPreference:
Enabled: false
Role:
Copy link
Contributor

Choose a reason for hiding this comment

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

Based on the description and code change, we're trying to handle the case where Enabled is false and no role is specified -- is this correct? If so, should we omit role from the test case?

@hawflau
Copy link
Contributor Author

hawflau commented Oct 29, 2021

Closing this one in favor of #2197

@hawflau hawflau closed this Oct 29, 2021
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.

None yet

5 participants