Skip to content

feat(layers): add support for publishing v2 layer #1558

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

Merged
merged 36 commits into from
Oct 7, 2022
Merged
Show file tree
Hide file tree
Changes from 8 commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
741b87a
feat(layers): add initial support for publishing v2 beta layer
rubenfonseca Sep 29, 2022
b850cf1
chore(layer): rename workflow
rubenfonseca Sep 29, 2022
3294d88
chore(deps): moved extra dependencies into an extra poetry group
rubenfonseca Sep 30, 2022
57be7ee
feat(layers): add regular and arm64 flavours
rubenfonseca Sep 30, 2022
c141cdc
chore(deps): move fastjsonschema to optinal dependency group
rubenfonseca Sep 30, 2022
0ba4d38
feat(layers): use qmeu for arm64 builds
rubenfonseca Sep 30, 2022
55e7e2d
fix(layers): pinned github actions
rubenfonseca Sep 30, 2022
ec4f5e6
chore: create extra dependency groups per utility
rubenfonseca Oct 3, 2022
43bc98f
chore: apply suggestions from code review
rubenfonseca Oct 3, 2022
0d19a80
chore: use latest cdk layer construct
rubenfonseca Oct 3, 2022
04f44b9
chore: add jmespath and idempotency deps groups
rubenfonseca Oct 3, 2022
bef044e
chore: lock deps
rubenfonseca Oct 3, 2022
273be4c
chore: use new cdk construct name
rubenfonseca Oct 3, 2022
c5d2669
chore: update call to CDK architecture
rubenfonseca Oct 3, 2022
c5b1df8
chore: fix canary deployment
rubenfonseca Oct 4, 2022
2c3b64c
feat: use canary to test for presence of optional dependencies
rubenfonseca Oct 5, 2022
41f8d4e
chore: bump cdk to 2.44 so we can use direct mode
rubenfonseca Oct 5, 2022
db227e2
chore: typo
rubenfonseca Oct 5, 2022
1c7b4fe
feat: use CDK direct mode on e2e and remove unecessary deps
rubenfonseca Oct 5, 2022
84eb4b5
chore: remove badly escaped strings
rubenfonseca Oct 5, 2022
f0093a4
chore: apply suggestions from code review
rubenfonseca Oct 6, 2022
7a45c12
chore: apply suggestions from code review
rubenfonseca Oct 6, 2022
5dd961a
chore: lock dependencies
rubenfonseca Oct 6, 2022
4ad4b5e
chore: apply suggestions from code review
rubenfonseca Oct 6, 2022
2c057a4
chore: remove unecessary code
rubenfonseca Oct 6, 2022
36fff2f
feat: allow e2e tests to run on arm64
rubenfonseca Oct 6, 2022
4eef6bd
chore: add jmespath as an optional dependency
rubenfonseca Oct 6, 2022
c8ecdb4
chore: bumped layer construct version
rubenfonseca Oct 6, 2022
683784f
chore(dep): add boto as optional dep
heitorlessa Oct 7, 2022
b7c0780
chore(dep): add aws-sdk extras to ease local dev
heitorlessa Oct 7, 2022
f61f03a
chore(typing): remove unnecessary optional type
heitorlessa Oct 7, 2022
8b4447c
chore(typing): remove unnecessary optional type
heitorlessa Oct 7, 2022
978cba4
refactor: use more explicit name for intent
heitorlessa Oct 7, 2022
3286573
chore: use more explicit name
heitorlessa Oct 7, 2022
9be0000
chore: lock dependencies
rubenfonseca Oct 7, 2022
2c56344
chore: update cdk construct dependency
rubenfonseca Oct 7, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/publish_v2_layer.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ jobs:
echo RELEASE_TAG_VERSION="${RELEASE_TAG_VERSION:1}" >> "$GITHUB_ENV"
- name: Set up QEMU
uses: docker/setup-qemu-action@8b122486cedac8393e77aa9734c3528886e4a1a8 # v2.0.0
# NOTE: we need QEMU to build Layer against a different architecture (e.g., ARM)
- name: Set up Docker Buildx
id: builder
uses: docker/setup-buildx-action@dc7b9719a96d48369863986a06765841d7ea23f6 # v2.0.0
Expand Down
18 changes: 9 additions & 9 deletions layer/layer/canary/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,7 @@ def on_create(event):


def check_envs():
logger.info(
'Checking required envs ["POWERTOOLS_LAYER_ARN", "AWS_REGION", "STAGE"]'
)
logger.info('Checking required envs ["POWERTOOLS_LAYER_ARN", "AWS_REGION", "STAGE"]')
if not layer_arn:
raise ValueError("POWERTOOLS_LAYER_ARN is not set. Aborting...")
if not powertools_version:
Expand All @@ -93,20 +91,17 @@ def verify_powertools_version() -> None:
raise ValueError(
f'Expected Powertools version is "{powertools_version}", but layer contains version "{current_version}"'
)
logger.info(f"Current Powertools version is: {current_version}")
logger.info(f"Current Powertools version is: {current_version} [{_get_architecture()}]")


def send_notification():
"""
sends an event to version tracking event bridge
"""
if stage != "PROD":
logger.info(
"Not sending notification to event bus, because this is not the PROD stage"
)
logger.info("Not sending notification to event bus, because this is not the PROD stage")
return

architecture = platform.uname()[4]
event = {
"Time": datetime.datetime.now(),
"Source": "powertools.layer.canary",
Expand All @@ -117,7 +112,7 @@ def send_notification():
"version": powertools_version,
"region": os.environ["AWS_REGION"],
"layerArn": layer_arn,
"architecture": architecture,
"architecture": _get_architecture(),
}
),
}
Expand All @@ -130,3 +125,8 @@ def send_notification():
if resp["FailedEntryCount"] != 0:
logger.error(resp)
raise ValueError("Failed to send deployment notification to version tracking")


def _get_architecture() -> str:
"""Returns aarch64, x86_64"""
return platform.uname()[4]
32 changes: 16 additions & 16 deletions layer/poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading