Skip to content
This repository was archived by the owner on Aug 30, 2023. It is now read-only.

Commit 76259cd

Browse files
committed
Cleanup
1 parent 1c3152d commit 76259cd

File tree

2 files changed

+33
-46
lines changed

2 files changed

+33
-46
lines changed

README.md

Lines changed: 18 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -7,24 +7,26 @@ This GitHub action will create a ZIP file containing:
77

88
## Prerequesites
99

10-
Befor you can use this action to bundle Lambda Layer and the Sentry Lambda extension together you need to prepare your Lambda Layer in a directory called `/dist-serverless` and upload with [actions/upload-artifact@v3](https://github.com/actions/upload-artifact)
10+
Befor you can use this action to bundle Lambda Layer and the Sentry Lambda extension together
11+
you need to prepare your Lambda Layer in a directory called `/dist-serverless`:
1112

12-
Example how to do this:
13+
A very basic example would be:
1314

1415
```yaml
1516
steps:
16-
- run: |
17-
echo "Create the Lambda in the dist-serverless directory"
18-
mkdir dist-serverless
19-
cp -r stuff/* dist-serverless/
20-
21-
- uses: actions/upload-artifact@v3
22-
with:
23-
name: ${{ github.sha }}
24-
path: |
25-
dist-serverless/*
17+
- run: |
18+
echo "Create the Lambda in the dist-serverless directory"
19+
mkdir dist-serverless
20+
cp -r stuff/* dist-serverless/
2621
```
2722
23+
You also have to make sure to include this directory in the build cache you need to set up
24+
using the [actions/cache@v3](https://github.com/actions/cache) Github action.
25+
26+
How this is done you can learn in the build workflow of the Javascript SDK:
27+
28+
https://github.com/getsentry/sentry-javascript/blob/master/.github/workflows/build.yml
29+
2830
## Usage
2931
3032
To bundle the above prepared Lambda layer with the latest Sentry Lambda Extension and save it in a file called `sentry-python-serverless.zip` you can the following to your GitHub workflow:
@@ -49,9 +51,10 @@ The following are all _required_.
4951

5052
| name | description |
5153
| ------------------- | ----------------------------------------------------------------------------- |
52-
| `artifact_name` | Name of the artifact containing the Lambda layer directory. |
53-
| `zip_file_name` | The name the generated .zip file should have. |
54-
| `preserve_symlinks` | Boolean when set to true the symblic links will be preserved in the zip file. |
54+
| `artifact_name` | Name of the prepared articact the Lambda Layer zip file should be uploaded to |
55+
| `zip_file_name` | Name of the zip file that will be created |
56+
| `build_cache_key` | Build cache key |
57+
| `build_cache_paths` | Paths of the build cache |
5558

5659
## Contributing
5760

action.yml

Lines changed: 15 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,64 +1,48 @@
1-
name: "Build AWS Lambda Extension"
2-
description: "Creates a packaged Lambda layer including the Sentry Lambda extension."
1+
name: "Build AWS Lambda Layer"
2+
description: "Creates a Lambda layer including the Sentry SDK and the Sentry Lambda extension."
33
inputs:
44
artifact_name:
5-
description: Name of the prepared articact to package into an Lambda extension
5+
description: Name of the prepared articact the Lambda Layer zip file should be uploaded to
66
required: true
77
zip_file_name:
88
description: Name of the zip file that will be created
99
required: true
10-
preserve_symlinks:
11-
description: Should symbolic links be preserved in the .zip file
12-
required: false
13-
default: false
14-
build_cache_path:
15-
description: Paths of the build cache
16-
required: true
1710
build_cache_key:
1811
description: Build cache key
1912
required: true
13+
build_cache_paths:
14+
description: Paths of the build cache
15+
required: true
2016
runs:
2117
using: "composite"
2218
steps:
2319
- name: Check build cache
2420
uses: actions/cache@v2
2521
id: cache_built_packages
2622
with:
27-
path: ${{ inputs.build_cache_path }}
23+
path: ${{ inputs.build_cache_paths }}
2824
key: ${{ inputs.build_cache_key }}
29-
# - uses: actions/download-artifact@v3
30-
# with:
31-
# name: ${{ inputs.artifact_name }}
32-
- name: Setup tmate session
33-
uses: mxschmitt/action-tmate@v3
34-
- name: Download and configure extension
25+
- name: Download and configure Sentry Lambda extension
3526
shell: bash
3627
run: |
37-
echo "Downloading extension..."
28+
echo "Downloading Sentry Lambda extension..."
3829
mkdir -p dist-serverless/extensions
3930
curl -0 --silent --output dist-serverless/extensions/sentry-lambda-extension `curl -s https://release-registry.services.sentry.io/apps/sentry-lambda-extension/latest | jq -r .files.\"sentry-lambda-extension\".url`
4031
chmod +x dist-serverless/extensions/sentry-lambda-extension
41-
- name: Check for symlink
42-
shell: bash
43-
run: |
44-
echo "--------------------"
45-
ls -laR packages/serverless/build/aws/dist-serverless/
46-
echo " XXX packages/serverless/build/aws/dist-serverless/nodejs/node_modules/@sentry/serverless/dist should be a symlink"
47-
echo "--------------------"
48-
- name: Zip directory
32+
echo "Done downloading Sentry Lambda extension..."
33+
- name: Create Lambda Layer zip
4934
shell: bash
5035
run: |
5136
echo "Creating ${{ inputs.zip_file_name }}..."
52-
echo "${{ inputs.preserve_symlinks }}"
53-
echo "${{ inputs.preserve_symlinks && '-y' }}"
5437
cd dist-serverless
55-
zip -r ${{ inputs.preserve_symlinks && '-y' }} ../${{ inputs.zip_file_name }} . --exclude \*__pycache__\* --exclude \*.yml
38+
# preserving symlinks with -y is important for Node based Layers!
39+
zip -r -y ../${{ inputs.zip_file_name }} . --exclude \*__pycache__\* --exclude \*.yml
5640
cd ..
5741
echo "Done creating ${{ inputs.zip_file_name }}."
5842
59-
echo "Contents of the created ZIP file:"
43+
echo "Contents of the created zip file:"
6044
unzip -Z ${{ inputs.zip_file_name }}
61-
- name: Upload zip
45+
- name: Upload zip (will be picked up by Craft for deployment)
6246
uses: actions/upload-artifact@v3
6347
with:
6448
name: ${{ inputs.artifact_name }}

0 commit comments

Comments
 (0)