Skip to content

Commit

Permalink
feat: ElasticLoadBalancingV2 TargetGroups, provisioned concurrency su…
Browse files Browse the repository at this point in the history
…pport (#26)

* Scoped package, version bump, publish job

* Add ELBV2 and existing target alias support

Co-authored-by: Matthew Elwell <[email protected]>
  • Loading branch information
khvn26 and matthewelwell authored Jan 8, 2024
1 parent a6bfb25 commit 6a4d75d
Show file tree
Hide file tree
Showing 13 changed files with 1,361 additions and 331 deletions.
32 changes: 32 additions & 0 deletions .github/workflows/publish-package.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: Publish Package to npmjs

on:
release:
types: [published]

jobs:
build:
runs-on: ubuntu-latest
name: Tests & Publish

steps:
- name: Cloning repo
uses: actions/checkout@v2

- name: Setup Node.js
id: setup-node
uses: actions/setup-node@v2
with:
node-version-file: .nvmrc
cache: npm

- name: Install dependencies
run: npm ci --ignore-scripts

- name: Run tests
run: npm run test

- name: Publish package
run: npm publish --access public
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
3 changes: 1 addition & 2 deletions .github/workflows/run-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,8 @@ jobs:
with:
node-version-file: .nvmrc
cache: npm

- name: Install dependencies
if: steps.setup-node.outputs.cache-hit != 'true'
run: npm ci --ignore-scripts

- name: Run tests
Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ Some values are only available as top-level configurations. They are:
The plugin relies on the [AWS Lambda traffic shifting feature](https://docs.aws.amazon.com/lambda/latest/dg/lambda-traffic-shifting-using-aliases.html) to balance traffic between versions and [AWS CodeDeploy](https://docs.aws.amazon.com/lambda/latest/dg/automating-updates-to-serverless-apps.html) to automatically update its weight. It modifies the `CloudFormation` template generated by [Serverless](https://github.com/serverless/serverless), so that:

1. It creates a Lambda function Alias for each function with deployment settings.
- For functions that already have a target alias due to provisioned concurrency or SnapStart configuration, the CodeDeploy-related settings are applied to it.
2. It creates a CodeDeploy Application and adds a [CodeDeploy DeploymentGroup](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-codedeploy-deploymentgroup.html) per Lambda function, according to the specified settings.
3. It modifies events that trigger Lambda functions, so that they invoke the newly created alias.

Expand All @@ -119,6 +120,7 @@ For now, the plugin only works with Lambda functions invoked by
* CloudWatch Logs
* IoT rules
* AppSync DataSources
* ElasticLoadBalancingV2 TargetGroups

[More events](https://serverless.com/framework/docs/providers/aws/events/) will be added soon.

Expand Down
Loading

0 comments on commit 6a4d75d

Please sign in to comment.