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(layers): add support for publishing v2 layer #1558

Merged
merged 36 commits into from
Oct 7, 2022
Merged

Conversation

rubenfonseca
Copy link
Contributor

@rubenfonseca rubenfonseca commented Sep 30, 2022

Issue number: #1379

Summary

This PR adds support for publishing the v2 layer of Lambda Powertools for Python

Changes

Please provide a summary of what's being changed

  • Created separate workflows for v2 (so we can keep v1 running)
  • Moved all additional dependencies to a new "all" group
  • Marked boto3 as dev dependency
  • Changed Layer CDK code to produce and canary test 2 layers (regular + arm64)
  • Configured github actions to be able to produce arm64 (via qemu emulation)

User experience

Please share what the user experience looks like before and after this change

After merging this we should be able to start testing the v2 layer on the beta branch.

In order for it to work, we need a new major release of the CDK Layer Construct

Checklist

If your change doesn't seem to apply, please leave them unchecked.

Is this a breaking change?

RFC issue number:

Checklist:

  • Migration process documented
  • Implement warnings (if it can live side by side)

Acknowledgment

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

Disclaimer: We value your time and bandwidth. As such, any pull requests created on non-triaged issues might not be successful.

@boring-cyborg boring-cyborg bot added dependencies Pull requests that update a dependency file github-actions Pull requests that update Github_actions code internal Maintenance changes labels Sep 30, 2022
@pull-request-size pull-request-size bot added the size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. label Sep 30, 2022
@github-actions github-actions bot added the feature New feature or functionality label Sep 30, 2022
@rubenfonseca rubenfonseca marked this pull request as ready for review September 30, 2022 10:40
@rubenfonseca rubenfonseca requested a review from a team as a code owner September 30, 2022 10:40
@rubenfonseca rubenfonseca requested review from heitorlessa and removed request for a team September 30, 2022 10:40
pyproject.toml Outdated Show resolved Hide resolved
Copy link
Contributor

@heitorlessa heitorlessa left a comment

Choose a reason for hiding this comment

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

as per peer review session

.github/workflows/publish_v2_layer.yml Show resolved Hide resolved
.github/workflows/publish_v2_layer.yml Outdated Show resolved Hide resolved
.github/workflows/reusable_deploy_v2_layer_stack.yml Outdated Show resolved Hide resolved
layer/layer/layer_stack.py Outdated Show resolved Hide resolved
layer/app.py Outdated Show resolved Hide resolved
pyproject.toml Outdated Show resolved Hide resolved
pyproject.toml Show resolved Hide resolved
pyproject.toml Show resolved Hide resolved
@heitorlessa heitorlessa linked an issue Oct 3, 2022 that may be closed by this pull request
2 tasks
@codecov-commenter
Copy link

codecov-commenter commented Oct 3, 2022

Codecov Report

Base: 99.42% // Head: 99.42% // No change to project coverage 👍

Coverage data is based on head (9be0000) compared to base (4099d42).
Patch has no changes to coverable lines.

Additional details and impacted files
@@           Coverage Diff           @@
##               v2    #1558   +/-   ##
=======================================
  Coverage   99.42%   99.42%           
=======================================
  Files         125      125           
  Lines        5726     5726           
  Branches      357      357           
=======================================
  Hits         5693     5693           
  Misses         18       18           
  Partials       15       15           

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

@boring-cyborg boring-cyborg bot added the tests label Oct 5, 2022
Copy link
Contributor

@heitorlessa heitorlessa left a comment

Choose a reason for hiding this comment

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

Some quick suggestions, praises (my god, amazing work), and two issues spotted: 1/ Pip is bringing a wheel for X86 despite building for ARM (works but slower), 2/ Sin from the past on how we mistakenly accepted a PR with email-validator where we're downloading all available versions before choosing one.

.github/workflows/publish_v2_layer.yml Outdated Show resolved Hide resolved
.github/workflows/publish_v2_layer.yml Show resolved Hide resolved
layer/layer/canary/app.py Show resolved Hide resolved
layer/layer/canary/app.py Show resolved Hide resolved
tests/e2e/utils/lambda_layer/powertools_layer.py Outdated Show resolved Hide resolved
pyproject.toml Outdated Show resolved Hide resolved
pyproject.toml Outdated Show resolved Hide resolved
pyproject.toml Outdated Show resolved Hide resolved
)

execution_role.add_to_policy(
PolicyStatement(effect=Effect.ALLOW, actions=["lambda:GetFunction"], resources=["*"])
PolicyStatement(
effect=Effect.ALLOW, actions=["lambda:GetFunction"], resources=["*"]
Copy link
Contributor

Choose a reason for hiding this comment

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

@am29d please remind me again why do we need this permission in the Lambda itself? leftover?

Looking at the new canary I don't see an API call that would require this permission.

@heitorlessa
Copy link
Contributor

Disregard my comment on JMESPath - we need to cater for PyPi customers too!

We just need to define the JMESPath as an optional dependency for extra to work

@rubenfonseca
Copy link
Contributor Author

@heitorlessa ready to go again, incorporated your feedback, and added an code path to run our e2e tests using arm64 (no CLI flag was created yet)

Copy link
Contributor

@heitorlessa heitorlessa left a comment

Choose a reason for hiding this comment

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

last changes and it's good to go! (pinky promise)

pyproject.toml Outdated Show resolved Hide resolved
pyproject.toml Outdated Show resolved Hide resolved
tests/e2e/utils/infrastructure.py Outdated Show resolved Hide resolved
tests/e2e/utils/infrastructure.py Outdated Show resolved Hide resolved
tests/e2e/utils/lambda_layer/powertools_layer.py Outdated Show resolved Hide resolved
tests/e2e/utils/lambda_layer/powertools_layer.py Outdated Show resolved Hide resolved
This will help customers prototyping locally without SAM CLI
This is due to jmespath and boto in general not being available locally, if a customer doesn't depend on boto3 as a dep (uses runtime)
@rubenfonseca rubenfonseca merged commit 2e5d0cb into v2 Oct 7, 2022
@rubenfonseca rubenfonseca deleted the feat/layer-v2 branch October 7, 2022 12:47
heitorlessa added a commit to heitorlessa/aws-lambda-powertools-python that referenced this pull request Oct 7, 2022
rubenfonseca added a commit that referenced this pull request Oct 14, 2022
Co-authored-by: Heitor Lessa <lessa@amazon.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dependencies Pull requests that update a dependency file feature New feature or functionality github-actions Pull requests that update Github_actions code internal Maintenance changes size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. tests
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Maintenance: Shrink size of Powertools Layer
3 participants