-
Notifications
You must be signed in to change notification settings - Fork 429
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
Changes from all 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 b850cf1
chore(layer): rename workflow
rubenfonseca 3294d88
chore(deps): moved extra dependencies into an extra poetry group
rubenfonseca 57be7ee
feat(layers): add regular and arm64 flavours
rubenfonseca c141cdc
chore(deps): move fastjsonschema to optinal dependency group
rubenfonseca 0ba4d38
feat(layers): use qmeu for arm64 builds
rubenfonseca 55e7e2d
fix(layers): pinned github actions
rubenfonseca ec4f5e6
chore: create extra dependency groups per utility
rubenfonseca 43bc98f
chore: apply suggestions from code review
rubenfonseca 0d19a80
chore: use latest cdk layer construct
rubenfonseca 04f44b9
chore: add jmespath and idempotency deps groups
rubenfonseca bef044e
chore: lock deps
rubenfonseca 273be4c
chore: use new cdk construct name
rubenfonseca c5d2669
chore: update call to CDK architecture
rubenfonseca c5b1df8
chore: fix canary deployment
rubenfonseca 2c3b64c
feat: use canary to test for presence of optional dependencies
rubenfonseca 41f8d4e
chore: bump cdk to 2.44 so we can use direct mode
rubenfonseca db227e2
chore: typo
rubenfonseca 1c7b4fe
feat: use CDK direct mode on e2e and remove unecessary deps
rubenfonseca 84eb4b5
chore: remove badly escaped strings
rubenfonseca f0093a4
chore: apply suggestions from code review
rubenfonseca 7a45c12
chore: apply suggestions from code review
rubenfonseca 5dd961a
chore: lock dependencies
rubenfonseca 4ad4b5e
chore: apply suggestions from code review
rubenfonseca 2c057a4
chore: remove unecessary code
rubenfonseca 36fff2f
feat: allow e2e tests to run on arm64
rubenfonseca 4eef6bd
chore: add jmespath as an optional dependency
rubenfonseca c8ecdb4
chore: bumped layer construct version
rubenfonseca 683784f
chore(dep): add boto as optional dep
heitorlessa b7c0780
chore(dep): add aws-sdk extras to ease local dev
heitorlessa f61f03a
chore(typing): remove unnecessary optional type
heitorlessa 8b4447c
chore(typing): remove unnecessary optional type
heitorlessa 978cba4
refactor: use more explicit name for intent
heitorlessa 3286573
chore: use more explicit name
heitorlessa 9be0000
chore: lock dependencies
rubenfonseca 2c56344
chore: update cdk construct dependency
rubenfonseca File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,92 @@ | ||
name: Deploy v2 layer to all regions | ||
|
||
permissions: | ||
id-token: write | ||
contents: read | ||
|
||
on: | ||
workflow_dispatch: | ||
inputs: | ||
latest_published_version: | ||
description: "Latest PyPi published version to rebuild latest docs for, e.g. v1.22.0" | ||
default: "v2.0.0" | ||
required: true | ||
# workflow_run: | ||
# workflows: ["Publish to PyPi"] | ||
# types: | ||
# - completed | ||
|
||
jobs: | ||
build-layer: | ||
runs-on: ubuntu-latest | ||
if: ${{ (github.event.workflow_run.conclusion == 'success') || (github.event_name == 'workflow_dispatch') }} | ||
defaults: | ||
run: | ||
working-directory: ./layer | ||
steps: | ||
- name: checkout | ||
uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 0 | ||
- name: Install poetry | ||
run: pipx install poetry | ||
- name: Setup Node.js | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: "16.12" | ||
- name: Setup python | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: "3.9" | ||
cache: "pip" | ||
- name: Resolve and install project dependencies | ||
# CDK spawns system python when compiling stack | ||
# therefore it ignores both activated virtual env and cached interpreter by GH | ||
run: | | ||
poetry export --format requirements.txt --output requirements.txt | ||
pip install -r requirements.txt | ||
- name: Set release notes tag | ||
run: | | ||
RELEASE_INPUT=${{ inputs.latest_published_version }} | ||
LATEST_TAG=$(git describe --tag --abbrev=0) | ||
RELEASE_TAG_VERSION=${RELEASE_INPUT:-$LATEST_TAG} | ||
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 | ||
- name: install cdk and deps | ||
run: | | ||
npm install -g aws-cdk@2.44.0 | ||
cdk --version | ||
- name: CDK build | ||
run: cdk synth --context version="$RELEASE_TAG_VERSION" -o cdk.out | ||
- name: zip output | ||
run: zip -r cdk.out.zip cdk.out | ||
- name: Archive CDK artifacts | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: cdk-layer-artefact | ||
path: layer/cdk.out.zip | ||
|
||
deploy-beta: | ||
needs: | ||
- build-layer | ||
uses: ./.github/workflows/reusable_deploy_v2_layer_stack.yml | ||
secrets: inherit | ||
with: | ||
stage: "BETA" | ||
artefact-name: "cdk-layer-artefact" | ||
environment: "layer-beta" | ||
|
||
# deploy-prod: | ||
rubenfonseca marked this conversation as resolved.
Show resolved
Hide resolved
|
||
# needs: | ||
# - deploy-beta | ||
# uses: ./.github/workflows/reusable_deploy_layer_stack.yml | ||
# secrets: inherit | ||
# with: | ||
# stage: "PROD" | ||
# artefact-name: "cdk-layer-artefact" | ||
# environment: "layer-prod" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,102 @@ | ||
name: Deploy CDK Layer v2 stack | ||
|
||
permissions: | ||
id-token: write | ||
contents: read | ||
|
||
rubenfonseca marked this conversation as resolved.
Show resolved
Hide resolved
|
||
env: | ||
CDK_VERSION: 2.44.0 | ||
|
||
on: | ||
workflow_call: | ||
inputs: | ||
stage: | ||
description: "Deployment stage (BETA, PROD)" | ||
required: true | ||
type: string | ||
artefact-name: | ||
description: "CDK Layer Artefact name to download" | ||
required: true | ||
type: string | ||
environment: | ||
description: "GitHub Environment to use for encrypted secrets" | ||
required: true | ||
type: string | ||
|
||
jobs: | ||
deploy-cdk-stack: | ||
runs-on: ubuntu-latest | ||
environment: ${{ inputs.environment }} | ||
defaults: | ||
run: | ||
working-directory: ./layer | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
region: | ||
rubenfonseca marked this conversation as resolved.
Show resolved
Hide resolved
|
||
[ | ||
"af-south-1", | ||
"eu-central-1", | ||
"us-east-1", | ||
"us-east-2", | ||
"us-west-1", | ||
"us-west-2", | ||
"ap-east-1", | ||
"ap-south-1", | ||
"ap-northeast-1", | ||
"ap-northeast-2", | ||
"ap-southeast-1", | ||
"ap-southeast-2", | ||
"ca-central-1", | ||
"eu-west-1", | ||
"eu-west-2", | ||
"eu-west-3", | ||
"eu-south-1", | ||
"eu-north-1", | ||
"sa-east-1", | ||
"ap-southeast-3", | ||
"ap-northeast-3", | ||
"me-south-1", | ||
] | ||
steps: | ||
- name: checkout | ||
uses: actions/checkout@v3 | ||
- name: Install poetry | ||
run: pipx install poetry | ||
- name: aws credentials | ||
uses: aws-actions/configure-aws-credentials@v1 | ||
with: | ||
aws-region: ${{ matrix.region }} | ||
role-to-assume: ${{ secrets.AWS_LAYERS_ROLE_ARN }} | ||
- name: Setup Node.js | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: "16.12" | ||
- name: Setup python | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: "3.9" | ||
cache: "pip" | ||
- name: Resolve and install project dependencies | ||
# CDK spawns system python when compiling stack | ||
# therefore it ignores both activated virtual env and cached interpreter by GH | ||
run: | | ||
poetry export --format requirements.txt --output requirements.txt | ||
pip install -r requirements.txt | ||
- name: install cdk and deps | ||
run: | | ||
npm install -g "aws-cdk@$CDK_VERSION" | ||
cdk --version | ||
- name: install deps | ||
run: poetry install | ||
- name: Download artifact | ||
uses: actions/download-artifact@v3 | ||
with: | ||
name: ${{ inputs.artefact-name }} | ||
path: layer | ||
- name: unzip artefact | ||
run: unzip cdk.out.zip | ||
- name: CDK Deploy Layer | ||
run: cdk deploy --app cdk.out --context region=${{ matrix.region }} 'LayerStack' --require-approval never --verbose | ||
- name: CDK Deploy Canary | ||
run: cdk deploy --app cdk.out --context region=${{ matrix.region}} --parameters DeployStage="${{ inputs.stage }}" 'CanaryStack' --require-approval never --verbose |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.